def long_continuous_seq(A):
ls = {}
result = (0,0)
for x in A:
if not x in ls:
left = ls[x - 1] if (x - 1) in ls else 0
right = ls[x + 1] if (x + 1) in ls else 0
if left + right + 1 result[1] - result[0]:
result = (x - left,
Find the longest
subarray which consists of numbers that can be arranged in a continuous
sequence.
For ex- {4,5,1,5,7,6,8,4,1}
output-{5,7,6,8,4}.Find the longest.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on