Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Flatten Nested Integer List

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

Your question is Flatten Nested Integer List. 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 nested list containing integers and sublists into a single list of integers in left-to-right order. The nesting can be arbitrarily deep, and empty lists may appear anywhere.

Constraints

  • Input length can be up to 10^4
  • Each element is either an integer or another nested list
  • Preserve left-to-right order
  • Nesting depth may be greater than 1
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output