Skip to content

Practice Maximum Number of Operations With the Same Score I

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#3038
LeetCode Problem

Maximum Number of Operations With the Same Score I

Problem Statement

Given nums, repeatedly remove its first two elements and record their sum as the operation score. An operation requires at least two remaining elements. All performed operations must have the same score. Return the maximum possible number of operations.

Source: Maximum Number of Operations With the Same Score I on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [3,2,1,4,5]
Output
2

# Example 2

Input
nums = [1,5,3,3,4,1,3,2,2,3]
Output
2

# Example 3

Input
nums = [5,3]
Output
1

Constraints

2 <= nums.length <= 100
1 <= nums[i] <= 1000

Related LeetCode Problems

Practice more problems similar to Maximum Number of Operations With the Same Score I.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.