Problem 2035. Check if it is a square or cube of consecutive numbers
Check whether the element of given row vector is a square or cube of consecutive numbers.
For example
Input x=[4 27 16 25 36 343]
Output y=true
Hence all elements are the square/cube values of number 2 3 4 5 6 7.
But if x=[36 49 121 81] then y=false. Because square/cube value for 8 is missing.
Solution Stats
Problem Comments
-
1 Comment
Dyuman Joshi
on 15 Sep 2022
Test suite update with an additional case.
Solution Comments
Show commentsProblem Recent Solvers18
Suggested Problems
-
Sum all integers from 1 to 2^n
17304 Solvers
-
Number of 1s in a binary string
10891 Solvers
-
Compute a dot product of two vectors x and y
1043 Solvers
-
Getting the row and column location from a matrix
297 Solvers
-
152 Solvers
More from this Author3
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!