Previous Next
0 / 5
Module DEMO-32-107DEMO-C-32

Find Missing Number

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a function findMissing that accepts an array of n-1 numbers in range 1 to n, and returns the missing number.

Constraints

n <= 100

Input Format

n, n-1 array elements

Output Format

Missing number

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
5
1 2 4 5
3
Sample #2
Public sample
2
1
2
Sample #3
Public sample
3
2 3
1
Sample #4
Public sample
6
1 2 3 5 6
4

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings