FastPrepFastPrep
Problem Brief

Find Max Number of Pairs

INTERNOA
See Roblox online assessment and hiring insights

Given an array, find the numbers with the same number of digits that can form the largest number of different pairs. For example, given the array {1, 9, 23, 30, 54, 103}, the possible pairs are {1, 9}, {23, 30}, {23, 54}, {30, 54}, and the output should be 4.

1Example 1

Input
nums = [1, 9, 23, 30, 54, 103]
Output
4
Explanation
The possible pairs with the same number of digits are:
  • {1, 9}
  • {23, 30}
  • {23, 54}
  • There are a total of 4 different pairs, so the output is 4.

    Constraints

    Limits and guarantees your solution can rely on.

    🐌🧡🦖
    public int findMaxNumberOfPairs(int[] nums) {
      // write your code here
    }
    
    Input

    nums

    [1, 9, 23, 30, 54, 103]

    Output

    4

    Sign in to submit your solution.