Triangle Flags from Adjacent Elements
Problem statement
For every three consecutive positive integers in arr, return 1 if they can be the side lengths of a triangle and 0 otherwise.
The result has length arr.length - 2.
Function
adjacentTriangleFlags(arr: int[]) → int[]Examples
Example 1
arr = [1,2,2,4]return = [1,0]The triple 1,2,2 is valid, while 2+2 is not greater than 4.
Constraints
3 <= arr.length <= 100000.1 <= arr[i] <= 10^9.