• + 1 comment

    If they had included a test case in which they appended 1 character 10^6 times (which falls within the problem constraints), you would have had to store around 10^12 bytes (1TB) in memory, far larger than is allowed on here. Apparently they didn't push the test cases to the limit.

    That being said, I think your solution is pretty cool, and I would say that it absolutely does use the stack concept.