← All problemsSign in

2656. Maximum Sum With Exactly K Elements

LeetCodeArrayGreedyOpen on judge ↗

You are given a 0-indexed integer array nums and an integer k. Your task is to perform the following operation exactly k times in order to maximize your score: - Select an element m from nums. - Remove the selected element m from the array. - Add a new element with a value of m + 1 to the array. - Increase your score by m. Return the maximum score you can achieve after performing the operatio

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start