loading...

Challenge: Find the least positive missing number

swkidd profile image swkidd ・1 min read

Find the least positive number missing from a list in linear time with constant extra space

ex:

[1,2,3,4] -> 5

[-1,0,1] -> 2

[-20,3,10,1] -> 2

One solution uses linear time and linear extra space. Then there's an extra spicy solution that uses linear time and constant space.

Discussion

markdown guide