7 kyu

Lost number in number sequence

372 of 10,586evgv

Description:

An ordered sequence of numbers from 1 to N is given. One number might have deleted from it, then the remaining numbers were mixed. Find the number that was deleted.

Example:

  • The starting array sequence is [1,2,3,4,5,6,7,8,9]
  • The mixed array with one deleted number is [3,2,4,6,7,8,1,9]
  • Your function should return the int 5.

If no number was deleted from the starting array, your function should return the int 0.

Note: N may be 1 or less (in the latter case, the first array will be []).

Arrays
Algorithms

Stats:

CreatedJul 3, 2017
PublishedJul 3, 2017
Warriors Trained15382
Total Skips576
Total Code Submissions37984
Total Times Completed10586
PHP Completions372
Python Completions2982
JavaScript Completions3911
Java Completions1125
Ruby Completions342
C++ Completions813
C# Completions355
Swift Completions835
C Completions178
Rust Completions116
Total Stars122
% of votes with a positive feedback rating92% of 1712
Total "Very Satisfied" Votes1463
Total "Somewhat Satisfied" Votes214
Total "Not Satisfied" Votes35
Total Rank Assessments20
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • evgv Avatar
  • Chrono79 Avatar
  • imjasonmiller Avatar
  • JohanWiltink Avatar
  • Voile Avatar
  • Souzooka Avatar
  • RShields Avatar
  • gKamelo Avatar
  • clcraig Avatar
  • user9644768 Avatar
  • hobovsky Avatar
  • ejini战神 Avatar
Ad