I was asked a variation of this question: https://leetcode.com/problems/flatten-nested-list-iterator/
There will be a NestedList
{1, {2,3}, 4, {5, 6, 7}}
Implement flatten(depth) such that
If called as flatten(1) on the above list, it should return:
1, {2,3}, 4, {5, 6, 7}
if called as flatten(2) it should return:
1,2,3,4,5,6,7
The interviewer gave a blank coderpad link.
The interview expected me to write input parsing, flattening, printing output in 45 mins.
I was able to write main to create input and flatten it but ended up printing hardcoded output for 1 level.
Either the interviewer was underprepared or he wanted me to look for an efficient way to design this entire system