Note The intuition is that as long as nums[i] + nums[j] > nums[k], and the nums array is sorted, then you have a triangle References https://leetcode.com/problems/largest-perimeter-triangle/