Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Flatten Nested JSON Object Arrays

MediumPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Flatten Nested JSON Object Arrays. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Flatten a deeply nested array whose elements are either JSON objects (dict) or more arrays. Return all objects in left-to-right order without using recursion.

Constraints

  • 0 <= total elements across nesting <= 10^5
  • Each element is either a dict or a list
  • Nesting depth can be very large
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output