Grokking the Coding Interview: Patterns for Coding Questions
Vote

0% completed

​

Solution: Problem Challenge 2: Find the Smallest Missing Positive Number

.....

.....

.....

Like the course? Get enrolled and start learning!
A

Anonymous

· 3 years ago

class Solution: def findNumber(self, nums): smallest = 1 for num in nums: if smallest == num: smallest += 1 return smallest
Show 1 reply
A

Anonymous

· 4 years ago

There is a slight typo in here. Take line 3 inside the function for java.

"if (nums[i] > 0 && nums[i]

A

Anonymous

· 5 years ago

Don't understand why it returns nums.length + 1 at the end? For which input would this line be needed?

Show 2 replies
A

Anonymous

· 5 years ago

Some of these cyclic sort algorithms don't work on the corresponding LeetCode problems...

Show 1 reply

Reading Progress

0%


Vote for new content