Cody

# Problem 199. hanoi towers II

Solution 1898800

Submitted on 13 Aug 2019 by Adam
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
n = 1; y_correct = [2]; assert(isequal(unHanoingProblem(n),y_correct))

x = 1 seq = [] seq = 2 3 1 mytry = 2

2   Pass
n = 3; y_correct = [1 3 3 7]; assert(isequal(unHanoingProblem(3),[2 3 1 2 3 1 2]))

x = 7 seq = [] seq = 2 3 1 seq = 2 3 1 2 3 1 seq = 2 3 1 2 3 1 2 3 1 seq = 2 3 1 2 3 1 2 3 1 2 3 1 seq = 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 seq = 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 seq = 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 mytry = 2 3 1 2 3 1 2

3   Pass
n = 6; y_correct = [2 3 1 2 3 1 2]; assert(isequal(unHanoingProblem(n),[3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1]))

x = 63 seq = [] seq = 3 2 1 seq = 3 2 1 3 2 1 seq = 3 2 1 3 2 1 3 2 1 seq = 3 2 1 3 2 1 3 2 1 3 2 1 seq = 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 33 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 36 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 39 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 42 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 45 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 48 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 51 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 54 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 57 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 60 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 60 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 61 through 63 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 60 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 61 through 66 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 60 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 61 through 69 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 60 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 61 through 72 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 60 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 61 through 75 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 60 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 61 through 78 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 60 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 61 through 81 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 60 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 61 through 84 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 60 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 61 through 87 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = Columns 1 through 30 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 31 through 60 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 Columns 61 through 90 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 seq = ...

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!