6 kyu

Number Zoo Patrol

2,695 of 6,217shawkinsl

Description:

Background:

You're working in a number zoo, and it seems that one of the numbers has gone missing!

Zoo workers have no idea what number is missing, and are too incompetent to figure it out, so they're hiring you to do it for them.

In case the zoo loses another number, they want your program to work regardless of how many numbers there are in total.


Task:

Write a function that takes a shuffled list of unique numbers from 1 to n with one element missing (which can be any number including n). Return this missing number.

Note: huge lists will be tested.

Examples:

[1, 3, 4]  =>  2
[1, 2, 3]  =>  4
[4, 2, 3]  =>  1
Algorithms
Performance
Mathematics

Stats:

CreatedNov 3, 2013
PublishedNov 3, 2013
Warriors Trained11746
Total Skips681
Total Code Submissions40663
Total Times Completed6217
JavaScript Completions2695
C# Completions557
PHP Completions336
Java Completions617
Python Completions1858
Ruby Completions123
C Completions200
CoffeeScript Completions9
OCaml Completions4
Haskell Completions5
Total Stars210
% of votes with a positive feedback rating92% of 852
Total "Very Satisfied" Votes733
Total "Somewhat Satisfied" Votes100
Total "Not Satisfied" Votes19
Total Rank Assessments11
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • shawkinsl Avatar
  • jhoffner Avatar
  • anter69 Avatar
  • donaldsebleung Avatar
  • aweleshetu Avatar
  • Voile Avatar
  • Souzooka Avatar
  • FArekkusu Avatar
  • markus.benko Avatar
  • hobovsky Avatar
  • cliffstamp Avatar
  • dmercertaylor Avatar
  • ejini战神 Avatar
  • ajmeese7 Avatar
  • tobeannouncd Avatar
  • Just4FunCoder Avatar
  • KayleighWasTaken Avatar
Ad