# 2593. Find Score of an Array After Marking All Elements ###### tags: `Leetcode` `Medium` `Simulation` Link: https://leetcode.com/problems/find-score-of-an-array-after-marking-all-elements/description/ ## Code ```python= class Solution: def findScore(self, nums: List[int]) -> int: seen = [False]*len(nums) res = 0 for a, i in sorted([a, i] for i, a in enumerate(nums)): if seen[i]: continue res += a seen[i] = True if i-1>=0: seen[i-1] = True if i+1<len(nums): seen[i+1] = True return res ```