Free written solution

Transformed Array (LeetCode 3379): Solution and Explanation

Treat the array as a ring. For each index, hop nums[i] steps (right if positive, left if negative) and record the value you land on.

Read the intuition, approach, code and complexity →