Skip to content
CampusEduX

Find the Missing Number

Easyjavapythonccppjavascript

An array contains N-1 distinct numbers taken from 1 to N, with exactly one number missing. Find the missing number.

Input Format

The first line contains an integer N. The second line contains N-1 space-separated distinct integers, each between 1 and N.

Output Format

Print the missing number.

Related Problems

  • Find the Largest Element
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • Find the Smallest Element
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • Find the Second Largest Element
    Easy · java, python, c, cpp, javascript
    Solve Problem

Input (stdin)

Output

Run your code to see output here...