Test 2 in the test suite is wrong!
25 is clearly a perfect square.
the problem is to see if a number is the square of another number in the vector. Although 25 is a perfect square, 5 is not included in the vector
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
a = [2 3 4];
assert(isequal(isItSquared(a),true))
|
2 | Fail |
a = [20:30];
assert(isequal(isItSquared(a),false))
|
3 | Pass |
a = [1];
assert(isequal(isItSquared(a),true))
|
4 | Pass |
a = [6 10 12 14 36 101];
assert(isequal(isItSquared(a),true))
|
5 | Pass |
a = [6 10 12 14 101];
assert(isequal(isItSquared(a),false))
|
2474 Solvers
265 Solvers
223 Solvers
Sum of odd numbers in a matrix
232 Solvers
Add damping to a mass spring system
262 Solvers