Cody

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

Solution 2106390

Submitted on 26 Jan 2020 by Asif Newaz
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))

a = 1 b = 1

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

a = 10 b = 4.6416

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

a = 4.0000 3.0000 2.8284 1.0000 0 1.0000 2.0000 5.1962 b = 2.5198 2.0801 2.0000 1.0000 0 1.0000 1.5874 3.0000 c = 1 c = 0.1716 d = 1 c = 1 c = 1 c = 1 c = 1 c = 3.1962 d = 1

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

a = 0 0 b = 0 0 c = 0 d = 0

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

a = 2.0000 5.1962 4.0000 5.0000 6.0000 18.5203 b = 1.5874 3.0000 2.5198 2.9240 3.3019 7.0000 c = 3.1962 d = 1 c = 1 c = 1 c = 1 c = 12.5203 d = 1.0000

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

a = 2.0000 5.1962 4.0000 5.0000 6.0000 18.5203 0 2.6458 0 b = 1.5874 3.0000 2.5198 2.9240 3.3019 7.0000 0 1.9129 0 c = 3.1962 d = 1 c = 1 c = 1 c = 1 c = 12.5203 d = 1.0000 c = 7.0000 d = 7.0000