Cody

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

Solution 365241

Submitted on 5 Dec 2013 by Vivek
• Size: 13
• This is the leading solution.
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))

ans = 1

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

ans = 1

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

ans = 1

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

ans = 0

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

ans = 1

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

ans = 0

### Community Treasure Hunt

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

Start Hunting!