Cody

Problem 23. Finding Perfect Squares

Solution 2013121

Submitted on 11 Nov 2019 by Nicholas Begg
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))

b = 3 d = 2 e = 4 f = 3 b = logical 1

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

b = 11 d = 20 e = 400 f = 1×0 empty double row vector b = logical 0 d = 21 e = 441 f = 1×0 empty double row vector b = logical 0 d = 22 e = 484 f = 1×0 empty double row vector b = logical 0 d = 23 e = 529 f = 1×0 empty double row vector b = logical 0 d = 24 e = 576 f = 1×0 empty double row vector b = logical 0 d = 25 e = 625 f = 1×0 empty double row vector b = logical 0 d = 26 e = 676 f = 1×0 empty double row vector b = logical 0 d = 27 e = 729 f = 1×0 empty double row vector b = logical 0 d = 28 e = 784 f = 1×0 empty double row vector b = logical 0 d = 29 e = 841 f = 1×0 empty double row vector b = logical 0 d = 30 e = 900 f = 1×0 empty double row vector b = logical 0

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

b = 1 d = 1 e = 1 f = 1 b = logical 1

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

b = 6 d = 6 e = 36 f = 5 b = logical 1

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

b = 5 d = 6 e = 36 f = 1×0 empty double row vector b = logical 0 d = 10 e = 100 f = 1×0 empty double row vector b = logical 0 d = 12 e = 144 f = 1×0 empty double row vector b = logical 0 d = 14 e = 196 f = 1×0 empty double row vector b = logical 0 d = 101 e = 10201 f = 1×0 empty double row vector b = logical 0