[Solved] Arraylist index calculation java [closed]


Without actual code:

  1. iterate thorough the array
  2. count the 1s you found
  3. if you found a 0 then start over the count
  4. check after increasing the counter: if the counter reaches 3 then return with true
  5. if you reached the end of the array and no more elements then return with false

Something like this, I hope I could help.

solved Arraylist index calculation java [closed]