We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 62536d2 commit 9220f3eCopy full SHA for 9220f3e
1 file changed
data_structures/array/number_of_1_in_sorted_array.py
@@ -1,4 +1,8 @@
1
-# The array is sorted in decreasing order
+"""
2
+Count the number of 1s in a sorted array
3
+Instead of linearly searching the array to find the first occurence,
4
+do a binary search to find the first 0
5
6
7
def count(arr):
8
start = 0
0 commit comments