In the first example, shouldn't it be 4? (1-3-4-5)
1 and 3 are not consecutive. You may be thinking of the longest increasing path, which is not what the question asks for.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.