Demo entry 6738649

LIS-20180505

   

Submitted by anonymous on May 05, 2018 at 05:05
Language: Python. Code size: 359 Bytes.

def Find(arr):
	counter = 1
	recordArr = [1] * len(arr)
	for i in range(len(arr) - 1):
		if arr[i] + 1 == arr[i + 1]:
			recordArr[i] += counter
			counter += 1
		else:
			counter = 1
			longest = 1
	for record in recordArr:
		if record > longest:
			longest = record
	return longest

arr = [4, 1, 2, 3, 4, 3, 2, 4, 1, 2, 3, 4]
print Find(arr)

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).