Skip to content

Commit 9220f3e

Browse files
committed
add comments
1 parent 62536d2 commit 9220f3e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

data_structures/array/number_of_1_in_sorted_array.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# The array is sorted in decreasing order
1+
"""
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+
"""
26

37
def count(arr):
48
start = 0

0 commit comments

Comments
 (0)