Tap here to switch tabs
Problem
Submissions

Problem: Max Sum of a Pair With Equal Sum of Digits

med
30 min
Try to solve the Max Sum of a Pair With Equal Sum of Digits problem.

Statement

Given an integer array nums, choose two distinct indices i and j such that the sum of digits of nums[i] is equal to the sum of digits of nums[j]. Among all such valid pairs, return the maximum possible value of nums[i] + nums[j]. If no valid pair exists, return -1.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Max Sum of a Pair With Equal Sum of Digits

med
30 min
Try to solve the Max Sum of a Pair With Equal Sum of Digits problem.

Statement

Given an integer array nums, choose two distinct indices i and j such that the sum of digits of nums[i] is equal to the sum of digits of nums[j]. Among all such valid pairs, return the maximum possible value of nums[i] + nums[j]. If no valid pair exists, return -1.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9