In an array 1-100 numbers are stored, one number is missing how do you find it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

In an array 1-100 numbers are stored, one number is missing how do you find it?

tell me fast....come on

1st May 2017, 5:55 PM
"$uraj @nbhule "
"$uraj @nbhule " - avatar
2 Answers
+ 16
MagicWordMissingException at this.Question:5.
1st May 2017, 6:07 PM
Tashi N
Tashi N - avatar
+ 3
Use a function and pass the array as the parameter... Then apply indexOf method to find the missing number. Take a look at this to understand what I'm trying to say: x = [1,2,3...100]; function missingNumber(x){ for(var i=1; i<=x.length; i++){ if(x.indexOf(i) == - 1){ return i } That's what you need ( one of the thousands way to achieve it) Good luck dude.
1st May 2017, 7:24 PM
Julio Rodriguez
Julio Rodriguez - avatar