Cody

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

Solution 3926233

Submitted on 30 Nov 2020
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))

y = 1

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

y = 4.6416

Assertion failed.

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

y = 2.5198 + 0.0000i 2.0801 + 0.0000i 1.0000 + 1.7321i 1.0000 + 0.0000i 0.0000 + 0.0000i 1.0000 + 0.0000i 1.5874 + 0.0000i 3.0000 + 0.0000i

Assertion failed.

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

y = 0 0

Assertion failed.

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

y = 1.5874 3.0000 2.5198 2.9240 3.3019 7.0000

Assertion failed.

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

y = 1.5874 + 0.0000i 3.0000 + 0.0000i 2.5198 + 0.0000i 1.4620 + 2.5323i 3.3019 + 0.0000i 7.0000 + 0.0000i 0.0000 + 0.0000i 1.9129 + 0.0000i 0.0000 + 0.0000i

Assertion failed.

### Community Treasure Hunt

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

Start Hunting!