Sum all elements in the array and subtract it from the summation of the first N natural numbers using the formula N * (N + 1) / 2 to find the missing number.

Check out the code implementation to find out the missing number!

Utilize the XOR property. Calculate a1 ^ a2 ^ ... ^ an = A1, a1 ^ a2 ^ ... ^ an-1 = A2. Then calculate A1 ^ A2 to find the missing number.

Check out the code implementation to find out the missing number!

Sort the array & then perform a binary search to find the missing number efficiently. Adjust the search space based on comparing middle element with its index.

Check out the code implementation to find out the missing number!

Create a hash set and store all array elements. Iterate through N natural numbers, checking if each exists in the hash set. The missing number is the one not found.

Check out the code implementation to find out the missing number!

Use a mathematical deduction. Calculate the expected sum and subtract the actual sum of the array to find the missing number.

Check out the code implementation to find out the missing number!

Improve your Interviewing Skills with Scaler!