Given a list of lists A
with at most one layer of nesting, and an element to search for…
A = [1,2,3,[4,5,6,7],8,9,10]
to_find = 5
What is the fastest way to check whether an element with value 5 exists in A
or not? List won't be sorted, and the index of element is of no concern.
I can iterate through A
and check if element is a list and then check in there recursively.
Is there any better and faster way to do it?