def triangleNumber(self, nums):
    '\n        :type nums: List[int]\n        :rtype: int\n        '
    result = 0
    nums.sort()
    for i in reversed(xrange(2, len(nums))):
        (left, right) = (0, (i - 1))
        while (left < right):
            if ((nums[left] + nums[right]) > nums[i]):
                result += (right - left)
                right -= 1
            else:
                left += 1
    return result
:type nums: List[int]
:rtype: int
def triangleNumber(self, nums):
    '\n        :type nums: List[int]\n        :rtype: int\n        '
    result = 0
    nums.sort()
    for i in reversed(xrange(2, len(nums))):
        (left, right) = (0, (i - 1))
        while (left < right):
            if ((nums[left] + nums[right]) > nums[i]):
                result += (right - left)
                right -= 1
            else:
                left += 1
    return result