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
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
Social Sciences,
5 months ago
Physics,
5 months ago
Computer Science,
10 months ago
English,
10 months ago
Math,
1 year ago