You are given an array arr of N integers including 0. The task is to find the smallest positive number missing from the array.
Note: Expected solution in O(n) time using constant extra space.
First line consists of T test cases. First line of every test case consists of N, denoting the number of elements in array. Second line of every test case consists of elements in array.
Single line output, print the smallest positive number missing.
The task is to complete the function missingNumber() which returns the smallest positive missing number in the array.
1 <= T <= 100
1 <= N <= 106
-106 <= arr[i] <= 106
1 2 3 4 5
0 -10 1 3 -20
Testcase 1: Smallest positive missing number is 6.
Testcase 2: Smallest positive missing number is 2.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.