Leetcode Rotate Array Problem Math