Triangle Flags from Adjacent Elements
Updated
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.
More Luma AI Online Assessment questions
- 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
- Minimum Euclidean Distance Between PointsOA · Seen Jun 2026
- Numerically Stable SoftmaxOA · Seen Jun 2026
- Rotate a Rectangular Image ClockwiseOA · Seen Jun 2026
Similar questions at other companies
- Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
- Count Valid Square PairsAuxoAI · OA
- Picked Player Who LostSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Server InvestmentRippling · OARippling interview questions
- Basic Item DiscountsPalantir · OAPalantir interview questions
- Next Pascal Row CoefficientIntuit · OAIntuit interview questions
- Unique Integers That Sum to ZeroNVIDIA · OANVIDIA interview questions
- Count Multiples of Three with Two SevensHudson River Trading · OAHudson River Trading interview questions
- Diagonal Bounce TraversalAutodesk · OAAutodesk interview questions
- Maximum Student-Teacher DistanceChubb · OAChubb interview questions