Skip to content

Practice Maximum Number of Pairs in Array

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

Easy#2341
LeetCode Problem

Maximum Number of Pairs in Array

Problem Statement

Repeatedly remove two equal integers from nums to form a pair. Make as many pairs as possible and return [pairsFormed, integersLeftOver].

Source: Maximum Number of Pairs in Array on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

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

# Example 2

Input
nums = [1,1]
Output
[1,0]

# Example 3

Input
nums = [0]
Output
[0,1]

Constraints

1 <= nums.length <= 100
0 <= nums[i] <= 100

Related LeetCode Problems

Practice more problems similar to Maximum Number of Pairs in Array.

Review your practice with PhantomCodeAI

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