Given an infinite sorted binary array (containing only 0s and 1s), find the index of the first occurrence of 1.
{ "arr": [ 0, 0, 0, 0, 0, 1, 1, 1, 1 ] }
5
{ "arr": [ 1, 1, 1, 1, 1, 1 ] }
0
{ "arr": [ 0, 0, 0, 0, 0, 0 ] }
-1
Sign in to Run Code and Submit