Practice Find Score of an Array After Marking All Elements
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Find Score of an Array After Marking All Elements
Problem Statement
Start with every nums entry unmarked and score 0. Choose the smallest unmarked value, breaking ties by smallest original index, add it to the score, and mark it and its immediate existing neighbors. Repeat until all are marked and return the score. Marking does not remove entries or change adjacency.
Source: Find Score of an Array After Marking All Elements on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [2,1,3,4,5,2]
7
# Example 2
nums = [2,3,5,1,3,2]
5
Constraints
Related LeetCode Problems
Practice more problems similar to Find Score of an Array After Marking All Elements.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.