Cody

# Problem 23. Finding Perfect Squares

Solution 532867

Submitted on 22 Nov 2014 by Simon
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))

a_m = 2 3 4 2 3 4 2 3 4 sq_m = 4 4 4 9 9 9 16 16 16

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

a_m = 20 21 22 23 24 25 26 27 28 29 30 20 21 22 23 24 25 26 27 28 29 30 20 21 22 23 24 25 26 27 28 29 30 20 21 22 23 24 25 26 27 28 29 30 20 21 22 23 24 25 26 27 28 29 30 20 21 22 23 24 25 26 27 28 29 30 20 21 22 23 24 25 26 27 28 29 30 20 21 22 23 24 25 26 27 28 29 30 20 21 22 23 24 25 26 27 28 29 30 20 21 22 23 24 25 26 27 28 29 30 20 21 22 23 24 25 26 27 28 29 30 sq_m = 400 400 400 400 400 400 400 400 400 400 400 441 441 441 441 441 441 441 441 441 441 441 484 484 484 484 484 484 484 484 484 484 484 529 529 529 529 529 529 529 529 529 529 529 576 576 576 576 576 576 576 576 576 576 576 625 625 625 625 625 625 625 625 625 625 625 676 676 676 676 676 676 676 676 676 676 676 729 729 729 729 729 729 729 729 729 729 729 784 784 784 784 784 784 784 784 784 784 784 841 841 841 841 841 841 841 841 841 841 841 900 900 900 900 900 900 900 900 900 900 900

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

a_m = 1 sq_m = 1

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

a_m = 6 10 12 14 36 101 6 10 12 14 36 101 6 10 12 14 36 101 6 10 12 14 36 101 6 10 12 14 36 101 6 10 12 14 36 101 sq_m = 36 36 36 36 36 36 100 100 100 100 100 100 144 144 144 144 144 144 196 196 196 196 196 196 1296 1296 1296 1296 1296 1296 10201 10201 10201 10201 10201 10201

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

a_m = 6 10 12 14 101 6 10 12 14 101 6 10 12 14 101 6 10 12 14 101 6 10 12 14 101 sq_m = 36 36 36 36 36 100 100 100 100 100 144 144 144 144 144 196 196 196 196 196 10201 10201 10201 10201 10201

### Community Treasure Hunt

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

Start Hunting!