3320. Maximum Number of Operations With the Same Score I
My accepted Python solution to LeetCode problem 3320, Maximum Number of Operations With the Same Score I, running in 0ms.
- Difficulty: Easy
- Python
- Runtime 0ms
- Memory 17.3MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 0ms, memory 17.3MB, accepted 2026-01-02.
class Solution:
def maxOperations(self, nums: List[int]) -> int:
if len(nums) < 2:
return 0
target = nums[0] + nums[1]
count = 0
i = 0
while i + 1 < len(nums):
if nums[i] + nums[i+1] == target:
count += 1
i += 2
else:
break
return count