Skip to content

Commit 5c8f908

Browse files
committed
improve docstring
1 parent d985aa3 commit 5c8f908

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

bit/find_missing_number.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
def find_missing_number(nums):
2-
"""Returns the missing number from a sorted list of unique
3-
integers in range [0..n] in O(n) time and space. The difference
4-
between consecutive integers cannot be more than 1.
2+
"""Returns the missing number from a sequence of unique integers
3+
in range [0..n] in O(n) time and space. The difference between
4+
consecutive integers cannot be more than 1. If the sequence is
5+
already complete, the next integer in the sequence will be returned.
56
6-
>>> find_missing_number([i for i in range(0, 10000) if i != 1234])
7+
>>> find_missing_number(i for i in range(0, 10000) if i != 1234)
78
1234
9+
>>> find_missing_number([4, 1, 3, 0, 6, 5, 2])
10+
7
811
"""
912

1013
missing = 0

0 commit comments

Comments
 (0)