+ 1

How to find missing numbers in array?

Need some logics to find this

11th Nov 2022, 6:42 PM
Zubair Rajpoot
Zubair Rajpoot - avatar
7 Answers
+ 1
One solution could be to have two arrays and loop over the expected numbers. a = [1,2,3,4,5] b = [1,2,5] missing = [] foreach number in a { if number not in array b { add to missing array; } } console.log(missing); This is not full javascript but I hope it helps :)
11th Nov 2022, 7:32 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 1
Thank you so much
11th Nov 2022, 7:33 PM
Zubair Rajpoot
Zubair Rajpoot - avatar
0
Could you give us more informations? The tags are a good place to write the language you use! Link us your attemps fron the code playgtound so we can help you out. Do you have example input and expected output?
11th Nov 2022, 7:13 PM
Apollo-Roboto
Apollo-Roboto - avatar
0
I have mentioned language please check
11th Nov 2022, 7:14 PM
Zubair Rajpoot
Zubair Rajpoot - avatar
0
nice, do you have more information? what do you mean by finding missing numbers? do you have an example?
11th Nov 2022, 7:18 PM
Apollo-Roboto
Apollo-Roboto - avatar
0
Like suppose that arr [101, 102, 103 , 108, 110] find missing number between 101 to 110 in JavaScript?
11th Nov 2022, 7:20 PM
Zubair Rajpoot
Zubair Rajpoot - avatar
- 1
ć”ć”ć°±çĄè§‰
13th Nov 2022, 3:46 AM
y l