This question evaluates proficiency in parsing nested data structures, string processing, hierarchical representation construction, and analysis of algorithmic time and space complexity within the Coding & Algorithms domain.
Given a string that encodes a nested list (ArrayList-like notation), parse it into an in-memory nested list structure.
[
and
]
to denote lists
,
as separators
"[1,2,[3,-4],5]"
"[]"
"[10,[20,[30]],40]"
Return a nested list data structure where each element is either:
(You may describe the structure as a NestedElement type with two variants: Integer(value) or List(children).)