We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello. I need help to find longest repetitive sequence of numbers in array and put that sequence in new array.For example, I have array[10]={0,1,1,1,1,0,0,0,1,1} so the longest sequence will be 1,1,1,1 and this numer must be in new array. array1[4]={1,1,1,1}.Thanks for your help!
The first problem is that that code is buggy as heck. For starters, it has too many magic numbers, and way too few buffer index range checks.
But the biggest problem is that your whole algorithm is wrong. You say you want the longest sequence of repeated numbers, but you actually only count sequences of zeroes.
And to top it all off, none of this has anything to do with Keil tools, so you're also asking this in the wrong place.