Ezvor

2964. Number of Divisible Triplet Sums

MediumArray Preparing judge… LeetCode
ArrayHash Table

Hints

Hint 1
Fix index L to be the leftmost element of a triplet.
Hint 2
Starting from L, go forward and add the remainder of each element to a map.
Hint 3
Now when you are at index R, consider nums[L] + nums[R] and calculate what the remainder of the third element should be.
Hint 4
Then use the map to find the number of valid third elements between L and R.