4 ms·
> The next interview asked me to implement Towers of Hanoi non-recursively. What? Obviously this isn't a great interview question, but this seems massively poi
by hawkice 10y ago
> The next interview asked me to implement Towers of Hanoi non-recursively.
What? Obviously this isn't a great interview question, but this seems massively pointless. I don't think there is an obvious way of doing this that doesn't just turn the call stack into an explicit stack (which, again, is pointless). And the recursive code is the only code that could possibly be understood by someone whose whole world isn't dominated by understanding those ~12 lines.
EDIT: also, ya know. Who cares. I have not even heard of a software engineering legend where solving anything remotely similar to towers of hanoi was necessary.