Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Length of Sequences in an array.

Options
  • 14-04-2008 8:09pm
    #1
    Registered Users Posts: 3,018 ✭✭✭


    .


Comments

  • Registered Users Posts: 83,307 ✭✭✭✭Overheal


    you would need an integer counter to keep track of your instances of 1 for a start. When a 1 is encountered you ++counter; else reset the counter to 0 and store the counter's value in a seperate int max. If the counter later, is > max, then max = counter.

    edit: hey nothing to be ashamed about I've pulled out more hair forgetting to add the second '=' in my if statements. But dont go deleting your posts.


  • Registered Users Posts: 3,018 ✭✭✭iseegirls


    .


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Do not delete your posts. What if someone else had the same issue?


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    What hobbes said. Me thinks its time for me to start applying the rules around here.


  • Registered Users Posts: 1,119 ✭✭✭Donald-Duck


    Overheal wrote: »

    edit: hey nothing to be ashamed about I've pulled out more hair forgetting to add the second '=' in my if statements. But dont go deleting your posts.


    The amount of times I've done that :( thank god eclipse points it out for me


  • Advertisement
Advertisement