2593. Find Score of an Array After Marking All Elements
You are given an array nums consisting of positive integers. Starting with score = 0, apply the following algorithm: - Choose the smallest integer of the array that is not marked. If there is a tie, choose the one with the smallest index. - Add the value of the chosen integer to score. - Mark the chosen element and its two adjacent elements if they exist. - Repeat until all the array elements
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.
Sign in to chat with the tutor and save your progress.
Sign in to start