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.
Examples
01 · Example 1
nums = [1, 9, 23, 30, 54, 103] return = 4
The possible pairs with the same number of digits are:
There are a total of 4 different pairs, so the output is 4.
{1, 9}{23, 30}{23, 54}Constraints
🐌🧡🦖More Roblox problems
- Candy Crush Grid Matching and GravityPHONE SCREEN · Seen Jun 2026
- Closest Binary Search Tree Value VariantPHONE SCREEN · Seen Jun 2026
- Design Search Autocomplete SystemPHONE SCREEN · Seen Jun 2026
- Find the Closest PalindromePHONE SCREEN · Seen Jun 2026
- Grid Pathfinding with Obstacles (DFS)PHONE SCREEN · Seen Jun 2026
- Maximize Distance to Closest PersonPHONE SCREEN · Seen Jun 2026
- Maximum Number of Balls in a BoxPHONE SCREEN · Seen Jun 2026
- Meeting Rooms IIPHONE SCREEN · Seen Jun 2026
public int findMaxNumberOfPairs(int[] nums) {
// write your code here
}
nums[1, 9, 23, 30, 54, 103]
expected4
sign in to submit