You are viewing a single comment's thread. Return to all comments →
You could reduce the iterations by start indexing at 2 and initialize the result with 1 (the first or last jump, depending on your view).
C#
int n=c.Length-1, jump=1; for (var i=2; i<n; jump++, i+=2) if (c[i]==1) i--; return jump;
Seems like cookies are disabled on this browser, please enable them to open this website
Jumping on the Clouds
You are viewing a single comment's thread. Return to all comments →
You could reduce the iterations by start indexing at 2 and initialize the result with 1 (the first or last jump, depending on your view).
C#