#3708
Longest Fibonacci Subarray
pupil · 580 · lc medium +29 · 69.5% accepted · 53 likes · top 77%
Description
Given an array of positive integers nums, return the length of the longest subarray that follows the Fibonacci rule (every element from index 2 onward equals the sum of the two preceding it); subarrays of length 1 or 2 always qualify.
Code
1
2
3