+ 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.

16th Mar 2020, 8:54 PM
Sudhakara Bathala
7 odpowiedzi
+ 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))
16th Mar 2020, 11:41 PM
rodwynnejones
rodwynnejones - avatar
+ 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.
16th Mar 2020, 9:04 PM
Sudhakara Bathala
0
rodwynnejones thanks for your intelligent answers
17th Mar 2020, 8:30 PM
Sudhakara Bathala
0
~ swim ~ thanks for your multiple solutions, all are great.
17th Mar 2020, 8:31 PM
Sudhakara Bathala