Medium20 min
Rotate an Array
Rotate value to the right by extra positions and return the resulting array.
Your function
Implement solve(value, extra) in JavaScript. Return the answer; printing alone does not count as a result.
Examples
Input:
[[1,2,3,4],1]Output:
[4,1,2,3]Input:
[[1,2,3],4]Output:
[3,1,2]Constraints
Input contains at most 1,000 values or characters. Numbers are finite integers. Inputs follow the structure shown in the examples.