How to find the missing positive number in a given array
Answers
Answered by
0
Explanation:
In the given unsorted array find the smallest missing positive integer. Positive integer doesn`t include 0. We can modify the original array ..
Answered by
2
Explanation:
Here, I am first sorting the array, and then traversing the array once. Before traversing the array, I have initialized a variable named "min" as 1. Now, while traversing the array, when we get an integer that is equal to min, we simply increment the value of min. This ensures that the min variable hold the latest least positive integer that has not occurred yet. Can you think of any better approach? Thanks in advance
Similar questions