Missing Coin (Arrays & Lists)

Read n, then n − 1 distinct numbers from 1 to n. Print the one that is missing.

Input: n, then n − 1 integers.

Output: The missing number.

Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • The sum of 1..n is n(n+1)/2.

More Arrays & Lists practice