Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 396. Rotate Function
Given an array, maximize the rotation function F(k) = sum_{i=0}^{n-1} i * arr_k[i] over all k (rotating the array by k positions), with n up to 1e5. The core challenge is to avoid O(n^2) recomputation by using a mathematical recurrence to update F for each rotation in O(1), achieving an overall O(n) solution.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.