Google | Phone | LCS with consecutive elements
Anonymous User
2023

Step Intern Interview
An array of numbers is given. Tell the length of longest subarray which contains consecutive elements.
For example:
1 4 5 3 2 7 8 12 14 13
Ans: 5 ( index 0 to 4 )
example 2
1 4 7 6 5 9 2
ans: 4 (index 1 to 4)
Can anyone tell the approach to solve this?

Comments (12)