Practice Rotate Function
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
For k from 0 through nums.length - 1, let arr_k be nums rotated k positions clockwise. Define F(k) as the sum of i * arr_k[i] over all zero-based indices i. Return the largest F(k). The result fits a signed 32-bit integer.
Source: Rotate Function on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [4,3,2,6]
Output
26
# Example 2
Input
nums = [100]
Output
0
Constraints
n == nums.length
1 <= n <= 10^5
-100 <= nums[i] <= 100
Related LeetCode Problems
Practice more problems similar to Rotate Function.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.