FastPrepTriangle Flags from Adjacent Elements
Problems/Triangle Flags from Adjacent Elements

Triangle Flags from Adjacent Elements

Luma AI logoLuma AI● EasyFULLTIMEOA
QuestionFunctionExamplesConstraints

Problem statement

Source note: A first-hand Luma AI assessment provides the complete adjacent-triangle flag contract and examples. The practice task matches the report at about 99%.

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.

More Luma AI problems

  • Build a Gaussian Blur KernelOA · Seen Jun 2026
  • Center Crop a Grayscale ImageOA · Seen Jun 2026
  • Impute Missing Values and Normalize ColumnsOA · Seen Jun 2026
All Luma AI interview questionsSee Luma AI hiring insights
Saved
class Solution {
    public int[] adjacentTriangleFlags(int[] arr) {
        // Return one flag for every adjacent triple.
    }
}
Checking account…