Have an array we have to find longest subarray with consecutive numbers

Have an array we have to find longest subarray with consecutive numbers

ex [4,5,34,33,32,11,10,31]

answer is [31,32,33,34]

[92 26 30 28 27]
answer is [27, 28]
NOT [26, 27, 28]
because 26, 27, and 28 are not in a contiguous subarray
原文地址:https://www.cnblogs.com/yayagamer/p/2876926.html