Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Fix index <code>L</code> to be the leftmost element of a triplet.
Starting from <code>L</code>, go forward and add the remainder of each element to a map.
Now when you are at index <code>R</code>, consider <code>nums[L] + nums[R]</code> and calculate what the remainder of the third element should be.
Then use the map to find the number of valid third elements between <code>L</code> and <code>R</code>.