Grokking Tree Coding Patterns for Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
For C++, can solve with one small change from the none reverse version:

Shlomi Fisher

Feb 14, 2024

instead of:

result.push_back(currentLevel);

use:

result.insert(result.begin(), currentLevel);

It's a simple change that works. it might incur more moves in the container though.

0

0

Comments
Comments