No offense but this problem seriously needs some more explanation and grammar check. I want to add a few clarification as follows so it saves you some time:
- the add() method adds a NestedInteger object to the caller. e.g.:
outer = NestedInteger() # 
nested = NestedInteger(5)
outer2 = nested
outer.add(nested) # outer is now 
outer2.add(outer) # outer2 is now [5, ]
"Set this NestedInteger to hold a nested list and adds a nested integer elem to it." cannot be more vague.
'-' means negative. It's not a delimiter.
For test cases like "324" you need to return something like NestedInteger(324) not "".
A list cannot have multiple consecutive integers. e.g. "321, 231" is invalid. I guess it's for difficulty purposes.
@zchen39 great issues raised! the question is definitely in need of more example cases.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.