Tap here to switch tabs
Problem
Submissions

Problem: Maximum Number of Pairs in Array

med
30 min
Try to solve the Maximum Number of Pairs in Array problem.

Statement

You are given an integer array nums. In one operation, you may pick two equal integers from nums and remove them from the array.

Repeat this operation until no further pairs of equal integers can be formed.

Return an integer array of size 22 where the first element is the total number of pairs removed and the second element is the number of leftover integers remaining in nums.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 0≤0 \leq nums[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Number of Pairs in Array

med
30 min
Try to solve the Maximum Number of Pairs in Array problem.

Statement

You are given an integer array nums. In one operation, you may pick two equal integers from nums and remove them from the array.

Repeat this operation until no further pairs of equal integers can be formed.

Return an integer array of size 22 where the first element is the total number of pairs removed and the second element is the number of leftover integers remaining in nums.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 0≤0 \leq nums[i] ≤100\leq 100