Skip to content

Practice Maximal Score After Applying K Operations

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2530
LeetCode Problem

Maximal Score After Applying K Operations

Problem Statement

Begin with score 0. In each of exactly k operations, choose a nums entry, add its current value to the score, and replace it with that value divided by 3 rounded upward. Return the greatest achievable score.

Source: Maximal Score After Applying K Operations on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [10,10,10,10,10], k = 5
Output
50

# Example 2

Input
nums = [1,10,3,3,3], k = 3
Output
17

Constraints

1 <= nums.length, k <= 10^5
1 <= nums[i] <= 10^9

Related LeetCode Problems

Practice more problems similar to Maximal Score After Applying K Operations.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.