Suppose we have the list:
mylist = [
[
"Hello",
[
"Hi"
]
]
]
How do I check that list containing "Hello" and "Hi" exists in mylist, in specifically this structure without flattening it?
All the solutions are flattening the list, but I need to check for specific structure, like this
Array
|_
—-|_ “Hello”
———|_ “Hi”
——. . .
HelloandHibe at any level of nesting, or do you just need to check at the levels in your example?mylist[0]satisfies your criteria? Alternatively, is what you need as a result more likemylist[0][0]+mylist[0][1][0]?