Hello,

I’m relatively new when it comes to working with arrays. For my current project, I’m having trouble finding a solution to the problem below.

Take an array [1, 1, 1, 0, 0 ,0, 0, 0, 1, 1] - Call this ARRAY

*I want to find how the large the gap of 0’s are within this example array or put another way, how many positions is the last occurring 1 to the next 1 that occurs after a 0.*

*My initial thoughts were*

*for (i = 0; i < 10; i++)*

*{*

_ if (ARRAY *== 1) //The idea to look at 1’s and position the last 1 to occur as iMIN*_

** { //Since the continue function wont work unless another 1 occurs**

** continue; //When it continues after a gap of 0’s in theory (I think)**

** } // the next i (position value), will be a higher number than iMIN**

** iMIN = i; // Simply take the difference and that is the range**

*//Some more code to assign the iMAX*

*}*

*The trouble I’m having currently is assigning an iMAX without reassigning the iMIN.*

*Anything helpful advice would be appreciated.*