Practice Apply Operations to Maximize Score
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Apply Operations to Maximize Score
Problem Statement
Begin with score 1. In each of at most k operations, choose a nonempty nums subarray whose index interval has not been chosen before. Within it, select the value having the most distinct prime factors, breaking ties by earliest index, and multiply the score by that value. Return the greatest attainable score modulo 10^9 + 7.
Source: Apply Operations to Maximize Score on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [8,3,9,3,8], k = 2
81
# Example 2
nums = [19,12,14,6,10,18], k = 3
4788
Constraints
Related LeetCode Problems
Practice more problems similar to Apply Operations to Maximize Score.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.