```
def threeSumSmaller(self, nums, target):
nums.sort()
ans = 0
size = len(nums)
for i in xrange(size-2):
start = i + 1
end = size - 1
now = nums[i]
while start < end:
if now + nums[start] + nums[end] < target:
ans += (end - start)
start += 1
else:
end -= 1
return ans
```