Welcome to another coding interview question challenge! Today we are really turning up the heat. Do you have what it takes? Lets find out!
Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well.
For example, the input
[3, 4, -1, 1]should give
2. The input
[1, 2, 0]should give
You can modify the input array in-place.
Post a link to a pastebin of your answer in the comments below. Share this challenge with your friends and lets see if they can solve it!