Fibonacci Like Subsequence Length

Given an integer array arr, return the length of the longest Fibonacci-like subsequence. A subsequence is Fibonacci-like if it has at least 3 elements and satisfies the condition that arr[i] + arr[i+1] == arr[i+2].

Examples
Input: [1,2,3,4,5,6,7,8]
Output: 5
Hints

Fibonacci Like Subsequence Length

Given an integer array `arr`, return the length of the longest Fibonacci-like subsequence. A subsequence is Fibonacci-like if it has at least 3 elements and satisfies the condition that arr[i] + arr[i+1] == arr[i+2].