Bad Triangle
From Codeforces. Triangle inequality. Solve the geometry problem "Bad Triangle".
Examples
Input: [1,2,3]
Output: 0
Input: [2,3,4]
Output: 0
Hints
The triangle inequality fails when the sum of the two smallest sides is less than or equal to the largest side. Given a sorted array, the easiest bad triangle to find is `(i, i+1, n-1)` — take the two smallest elements and the largest element.
If `nums[0] + nums[1] > nums[n-1]`, then every triple satisfies the triangle inequality and no bad triangle exists (return -1). Otherwise, indices `(0, 1, n-1)` form a bad triangle.
The problem asks for any 1-based indices `(i, j, k)` with `i < j < k`. You do not need to find the longest or most degenerate bad triangle — the first one you find is sufficient.
Bad Triangle
**From Codeforces.** Triangle inequality. Solve the geometry problem "Bad Triangle".