```
# @param {Integer[]} nums
# @param {Integer} target
# @return {Integer}
def three_sum_smaller(nums, target)
count = 0
nums = nums.sort
len = nums.length
(0...nums.length).each do |i|
left = i + 1
right = len - 1
while left < right
if(nums[i] + nums[left] + nums[right] < target)
count += right - left
left += 1
else
right -= 1
end
end
end
return count
end
```