Jaguar & NeonCipher
NeonCipher NeonCipher
Hey, heard you've got a new race up your sleeve—mind if I throw a code obstacle in the mix? Let's see whose limits we can push first.
Jaguar Jaguar
Sure thing, throw it at me. I’ve never been beaten by a little code before. Bring the hardest thing you’ve got, I’ll run it faster than you can debug.
NeonCipher NeonCipher
Alright, here’s a quick one—no fancy libraries, just pure logic. You’re given a string of numbers: 3, 1, 4, 1, 5, 9, 2, 6. Write a program that takes that sequence, finds the longest increasing contiguous subsequence, then outputs the sum of that subsequence. The twist: you must do it in less than 20 lines of code. Think you can beat the clock?
Jaguar Jaguar
seq=[3,1,4,1,5,9,2,6] max_len=0 max_sum=0 i=0 while i<len(seq): j=i s=seq[i] while j+1<len(seq) and seq[j+1]>seq[j]: j+=1 s+=seq[j] if j-i+1>max_len: max_len=j-i+1 max_sum=s i=j+1 print(max_sum)