NeetCode #828LC-2818HardGreedy
← Back to All Problems#828 · #2818 · Apply Operations to Maximize Score(操作使得分最大)
📌 Problem Statement & Constraints
You are given an array
nums and an integer k. The prime score of a number is its count of distinct prime factors. In one operation, pick an index i you have not used, multiply your score (initially 1) by nums[i], and mark i used. Choose indices to maximise the score after exactly k operations, and return it modulo 10^9 + 7. When several indices tie on prime score, the smaller index wins. Constraints: 1 <= nums.length <= 10^4, 1 <= nums[i] <= 10^5, 1 <= k <= 10^9.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!