@compton_scatter

have someone think about traverse the array from 0 to n-1?

this solution is i from n-1 to 0, just judge a[low]+a[high] > a[i]. When I first thought is from i from 0 to n-1, low = i+1 ,high = n-1; judge [high] -[low] < [i] ,we get combination

C(2,low-high+1),but when [high] -[low] > [i] ,i cannot think clearly high-1 or low +1 . [high-1]-[low] and [high]-[low+1] , both are possible less than [i], so i think it become more complex.

Valid Triangle Number