Computer Science, asked by melvinsam2575, 10 months ago

Given an input array of size unknown with all 1s in the beginning and 0s in the end. Find the index in the array from where 0s start. Consider there are millions of 1s and 0s in the array

Answers

Answered by Anonymous
0

Find the index of first 1 in an infinite sorted array of 0s and 1s

Given an infinite sorted array consisting 0s and 1s. The problem is to find the index of first ‘1’ in that array. As the array is infinite, therefore it is guaranteed that number ‘1’ will be present in the array.

Examples:

Input : arr[] = {0, 0, 1, 1, 1, 1}

Output : 2

Input : arr[] = {1, 1, 1, 1,, 1, 1}

Output : 0

PLEASE MAKE ME AS A BRAINLIST ANSWER

Similar questions