Algorithm · Airbnb · Medium
You are given a Python list values whose elements are either integers or nested lists, where nesting can be arbitrarily deep. Traverse the structure depth-first from left to right and return every integer as a flat Python list[int]. Implement the following function: Example 1: Explanation: The integers appear in depth-first left-to-right order: 3, then 8, then 2, then 9, then 10. Example 2: Explanation: Each nested list is visited immediately, so the original left-to-right…
Checking your access…