Find Missing Number - MATLAB Cody - MATLAB Central

Problem 42586. Find Missing Number

Difficulty:Rate

A little problem (inspired by CodeChef) for the coffee break.

A friend give you an array of size n-1 integers and these integers are in the range of 1 to n. There are no duplicates in array, but one of the integers is missing. Write efficient code to find the missing integer.

  • The first argument contains an integer n denoting the size of array
  • The second argument contains n integers A1, A2, ..., AN denoting the elements of array.

Solution Stats

54.42% Correct | 45.58% Incorrect
Last Solution submitted on May 10, 2025

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8

Problem Recent Solvers66

Suggested Problems

More from this Author43

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!