Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Leetcode 2818. Apply Operations to Maximize Score
Given nums and k, each operation picks an unused subarray and multiplies the score by the element in that subarray with the largest number of distinct prime factors (ties broken by smaller index); maximize the final product mod 1e9+7 after at most k operations. The algorithmic core is computing for each element how many subarrays would select it as the prime-score winner (with tie-break), typically via a monotonic-stack range-count, then greedily using those counts to pick the largest values up to k multiplications.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.