nums.count to store the number of triplets found.i from 0 to n - 3.
a. For each i, initialize left to i + 1 and right to n - 1.
b. While left < right, check if nums[i] + nums[left] + nums[right] < target.
i. If true, increment count by right - left (all elements between left and right will form valid triplets with nums[i]), and move left to the right.
ii. If false, move right to the left.count of valid triplets.