+ 2
What is the optimal way to find the missing element in array b from below arrays?
Ex: Array a =[1,2,3,4,5,6,7,8,910] Array b =[3,2,10,9,7,6,8,1,5] Here element 4 exists in array a but missing in array b.
4 Answers
+ 2
Is your array "a" correct [......910] or should it be [......9, 10]?
If it's [...9, 10] then..for python...just do:-
a =[1,2,3,4,5,6,7,8,9,10]
b =[3,2,10,9,7,6,8,1,5]
print(sum(a) - sum(b))
+ 1
Mirielleđœ thank you for your quick response, we need to print or identify the missing element in array b which is there in array a, but you are printed only True or false instead of missing element.
0
rodwynnejones thanks for your intelligent answers
0
~ swim ~ thanks for your multiple solutions, all are great.