Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions challenge_7/python/py2k5/findMissingNumber.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

def main():
numbers = [ 0,1,3,4,2,5,7 ]
tot = len(numbers)
if 0 not in numbers:
print 0
else:
for num in numbers:
if num +1 < tot and num+1 not in numbers:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'num + 1 not in numbers is O(n), and you put it in the for loop, together it's O(n square) complexity?

print num + 1
break

if __name__ == '__main__':
main()