Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Implement a program to find the missing number in an array of size n containing numbers from 1 to n+1.

Hard

Problem Statement

Implement a program to find the missing number in an array of size n containing numbers from 1 to n+1.

Sample Input

arr = {2, 3, 1, 5}

Sample Output

Missing Number = 4

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
#include <stdio.h> int main() { int arr[] = {2, 3, 1, 5}; int size = sizeof(arr) / sizeof(arr[0]); // Logic to find the missing number return 0; }
Log in or sign up to run or submit your code.Log inSign up
Input
arr = {2, 3, 1, 5}
Expected Output
Missing Number = 4