Cody

# Problem 23. Finding Perfect Squares

Solution 1119891

Submitted on 10 Feb 2017 by Miklós Csécsi
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
a = [2 3 4]; assert(isequal(isItSquared(a),true))

ans = 2 b = logical 0 tomb = 0 0 ans = 3 b = logical 0 tomb = 0 0 0 ans = 4 b = logical 1 tomb = 0 0 0 1 ans = 2 b = logical 0 tomb = 0 0 0 1 0 ans = 3 b = logical 0 tomb = 0 0 0 1 0 0 ans = 4 b = logical 0 tomb = 0 0 0 1 0 0 0 ans = 2 b = logical 0 tomb = 0 0 0 1 0 0 0 0 ans = 3 b = logical 0 tomb = 0 0 0 1 0 0 0 0 0 ans = 4 b = logical 0 tomb = 0 0 0 1 0 0 0 0 0 0 b = logical 1

2   Pass
a = [20:30]; assert(isequal(isItSquared(a),false))

ans = 20 b = logical 0 tomb = 0 0 ans = 21 b = logical 0 tomb = 0 0 0 ans = 22 b = logical 0 tomb = 0 0 0 0 ans = 23 b = logical 0 tomb = 0 0 0 0 0 ans = 24 b = logical 0 tomb = 0 0 0 0 0 0 ans = 25 b = logical 0 tomb = 0 0 0 0 0 0 0 ans = 26 b = logical 0 tomb = 0 0 0 0 0 0 0 0 ans = 27 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 ans = 28 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 ans = 29 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 0 ans = 30 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 0 0 ans = 20 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 21 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 22 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 23 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 24 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Column 17 0 ans = 25 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 18 0 0 ans = 26 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 19 0 0 0 ans = 27 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 20 0 0 0 0 ans = 28 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 21 0 0 0 0 0 ans = 29 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 22 0 0 0 0 0 0 ans = 30 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 23 0 0 0 0 0 0 0 ans = 20 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 24 0 0 0 0 0 0 0 0 ans = 21 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 25 0 0 0 0 0 0 0 0 0 ans = 22 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 ans = 23 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 27 0 0 0 0 0 0 0 0 0 0 0 ans = 24 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 28 0 0 0 0 0 0 0 0 0 0 0 0 ans = 25 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 26 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 27 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 28 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 29 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Column 33 0 ans = 30 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 34 0 0 ans = 20 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 35 0 0 0 ans = 21 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 36 0 0 0 0 ans = 22 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 37 0 0 0 0 0 ans = 23 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 38 0 0 0 0 0 0 ans = 24 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 39 0 0 0 0 0 0 0 ans = 25 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 40 0 0 0 0 0 0 0 0 ans = 26 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 41 0 0 0 0 0 0 0 0 0 ans = 27 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 42 0 0 0 0 0 0 0 0 0 0 ans = 28 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 43 0 0 0 0 0 0 0 0 0 0 0 ans = 29 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 44 0 0 0 0 0 0 0 0 0 0 0 0 ans = 30 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 throug...

3   Pass
a = [1]; assert(isequal(isItSquared(a),true))

ans = 1 b = logical 1 tomb = 0 1 b = logical 1

4   Pass
a = [6 10 12 14 36 101]; assert(isequal(isItSquared(a),true))

ans = 6 b = logical 0 tomb = 0 0 ans = 10 b = logical 0 tomb = 0 0 0 ans = 12 b = logical 0 tomb = 0 0 0 0 ans = 14 b = logical 0 tomb = 0 0 0 0 0 ans = 36 b = logical 1 tomb = 0 0 0 0 0 1 ans = 101 b = logical 0 tomb = 0 0 0 0 0 1 0 ans = 6 b = logical 0 tomb = 0 0 0 0 0 1 0 0 ans = 10 b = logical 0 tomb = 0 0 0 0 0 1 0 0 0 ans = 12 b = logical 0 tomb = 0 0 0 0 0 1 0 0 0 0 ans = 14 b = logical 0 tomb = 0 0 0 0 0 1 0 0 0 0 0 ans = 36 b = logical 0 tomb = 0 0 0 0 0 1 0 0 0 0 0 0 ans = 101 b = logical 0 tomb = 0 0 0 0 0 1 0 0 0 0 0 0 0 ans = 6 b = logical 0 tomb = 0 0 0 0 0 1 0 0 0 0 0 0 0 0 ans = 10 b = logical 0 tomb = 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 ans = 12 b = logical 0 tomb = 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 ans = 14 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Column 17 0 ans = 36 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 18 0 0 ans = 101 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 19 0 0 0 ans = 6 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 20 0 0 0 0 ans = 10 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 21 0 0 0 0 0 ans = 12 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 22 0 0 0 0 0 0 ans = 14 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 23 0 0 0 0 0 0 0 ans = 36 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 24 0 0 0 0 0 0 0 0 ans = 101 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 25 0 0 0 0 0 0 0 0 0 ans = 6 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 ans = 10 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 27 0 0 0 0 0 0 0 0 0 0 0 ans = 12 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 28 0 0 0 0 0 0 0 0 0 0 0 0 ans = 14 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 36 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 101 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 6 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 10 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Column 33 0 ans = 12 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 34 0 0 ans = 14 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 35 0 0 0 ans = 36 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 36 0 0 0 0 ans = 101 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 37 0 0 0 0 0 b = logical 1

5   Pass
a = [6 10 12 14 101]; assert(isequal(isItSquared(a),false))

ans = 6 b = logical 0 tomb = 0 0 ans = 10 b = logical 0 tomb = 0 0 0 ans = 12 b = logical 0 tomb = 0 0 0 0 ans = 14 b = logical 0 tomb = 0 0 0 0 0 ans = 101 b = logical 0 tomb = 0 0 0 0 0 0 ans = 6 b = logical 0 tomb = 0 0 0 0 0 0 0 ans = 10 b = logical 0 tomb = 0 0 0 0 0 0 0 0 ans = 12 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 ans = 14 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 ans = 101 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 0 ans = 6 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 0 0 ans = 10 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 12 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 14 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 101 b = logical 0 tomb = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 6 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Column 17 0 ans = 10 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 18 0 0 ans = 12 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 19 0 0 0 ans = 14 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 20 0 0 0 0 ans = 101 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 21 0 0 0 0 0 ans = 6 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 22 0 0 0 0 0 0 ans = 10 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 23 0 0 0 0 0 0 0 ans = 12 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 24 0 0 0 0 0 0 0 0 ans = 14 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 25 0 0 0 0 0 0 0 0 0 ans = 101 b = logical 0 tomb = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 26 0 0 0 0 0 0 0 0 0 0 b = logical 0