Tower of Hanoi — Asked in Apple, De Shaw and Facebook Interviews

Problem Statement :

3
1

Explanation of given Test Cases :

One of the correct matrices is { { 1, 2 }, { 1, 3 }, { 2, 3 }, { 1, 2 }, { 3, 1 }, { 3, 2 }, { 1, 2 } }.

Approach :

Recursive Approach

Code :

Thanks for Reading

Upskilling students for tech placements!