Cody

# Problem 2035. Check if it is a square or cube of consecutive numbers

Solution 507851

Submitted on 3 Oct 2014 by rifat
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
%% x = 1; y_correct = true; assert(isequal(Sqube(x),y_correct))

m = 1 1 -1

2   Pass
%% x = 100; y_correct = true; assert(isequal(Sqube(x),y_correct))

m = 10.0000 4.6416 -10.0000

3   Pass
%% x = [16 9 -8 1 0 1 4 27]; y_correct = true; assert(isequal(Sqube(x),y_correct))

m = 4.0000 3.0000 NaN 1.0000 0 1.0000 2.0000 5.1962 2.5198 2.0801 -2.0000 1.0000 0 1.0000 1.5874 3.0000 -4.0000 -3.0000 NaN -1.0000 0 -1.0000 -2.0000 -5.1962

4   Pass
%% x = [0 0]; y_correct = false; assert(isequal(Sqube(x),y_correct))

m = 0 0 0 0 0 0

5   Pass
%% x = [4 27 16 25 36 343]; y_correct = true; assert(isequal(Sqube(x),y_correct))

m = 2.0000 5.1962 4.0000 5.0000 6.0000 18.5203 1.5874 3.0000 2.5198 2.9240 3.3019 7.0000 -2.0000 -5.1962 -4.0000 -5.0000 -6.0000 -18.5203

6   Pass
%% x = [4 27 16 -25 36 343 0 7 0]; y_correct = false; assert(isequal(Sqube(x),y_correct))

m = 2.0000 5.1962 4.0000 NaN 6.0000 18.5203 0 2.6458 0 1.5874 3.0000 2.5198 -2.9240 3.3019 7.0000 0 1.9129 0 -2.0000 -5.1962 -4.0000 NaN -6.0000 -18.5203 0 -2.6458 0