In vector x of length n we define (n+1) position as going back to the first position (so called wrap-around effect). Can you return the value of x at a given position, taking into account the above rule?
Example: x = [1 2 3] -> x(1) yields 1, x(5) should yield 2; and so on.
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers54
Suggested Problems
-
Given an unsigned integer x, find the largest y by rearranging the bits in x
2078 Solvers
-
Project Euler: Problem 6, Natural numbers, squares and sums.
2590 Solvers
-
Test if two numbers have the same digits
267 Solvers
-
Sum the elements in either diagonal of a square matrix
223 Solvers
-
323 Solvers
More from this Author9
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
This problem has been updated to have more than one test case in the test suite.