Embed Notice
HTML Code
Corresponding Notice
- Embed this noticeSort of, also with sorting algorithms and sich.
It's called Tower of Hanoi.
Imagine you have 3 poles (A, B, C) and N disks. The discs can only be in ascending order of size so a larger disk can never go on top of a smaller disk.
The goal is to move the stack from the left-most column to the right-most column. You can only move one disk at a time and only in a LIFO fashion. Now the trick is writing a program which can solve for it, to be honest I get the joke but... it doesn't seem that hard.
I'm supposing it might be a leetcode question or a common problem given in CS classes hence the PTSD. It's actually the perfect kind of problem to be broken down into sub-problems -- aka ideal for recursive functions.