Count triplets that can form a triangle's sides. Sort first, then fix the largest side
k from the end inward. For a fixed largest side, if
nums[left] + nums[right] > nums[k], then every value between them also
works with right — count all of them at once and move right in.