Free written solutionLength of Longest Fibonacci Subsequence (LeetCode 873): Solution and Explanation
Given a strictly increasing array of positive integers, find the longest subsequence where every term from the third on is the sum of the two before it. Return its length, or 0 if no such subsequence has at least 3 terms.
Read the intuition, approach, code and complexity →