Given an array of integers, find the first missing positive integer in linear time and constant space. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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 3.

24th Jan 2019, 1:38 PM
DODDABASAPPA
DODDABASAPPA - avatar
2 Answers
+ 3
Where is your try?
24th Jan 2019, 1:45 PM
KrOW
KrOW - avatar
0
I need only logic of this concept.
28th Jan 2019, 6:52 PM
DODDABASAPPA
DODDABASAPPA - avatar