Tap here to switch tabs
Problem
Submissions

Problem: Rotate Function

med
30 min
Try to solve the Rotate Function problem.

Statement

Given an integer array nums, define the rotation function F(k) as the sum of i * nums[(i + k) % n] for each index i, where n is the length of nums.

Return the maximum value of F(k) over all possible rotations k.

Constraints:

  • n == nums.length

  • 1 <= n <= 10^5

  • -100 <= nums[i] <= 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Rotate Function

med
30 min
Try to solve the Rotate Function problem.

Statement

Given an integer array nums, define the rotation function F(k) as the sum of i * nums[(i + k) % n] for each index i, where n is the length of nums.

Return the maximum value of F(k) over all possible rotations k.

Constraints:

  • n == nums.length

  • 1 <= n <= 10^5

  • -100 <= nums[i] <= 100