DEV Community

swkidd
swkidd

Posted on

Challenge: Find the least positive missing number

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.

Top comments (0)