Given a sorted array, arr[] containing only 0s and 1s, find the transition point, i.e., the first index where 1 was observed, and before that, only 0 was observed. If arr does not have any 1, return -1. If array does not have any 0, return 0.
Topics
Companies
Articles
Examples:
Expected Time Complexity: O(log n)
Expected Auxiliary Space: O(1)
Constraints:
1 <= arr.size() <= 10^5
0 <= arr[i] <= 1
Companies:
AmazonPaypal
Topics:
ArraySearching Algorithms
Please log in to access the Submissions tab, where you can review your progress and explore code submissions from other participants.
Please log in to access the Solution tab and view detailed answers and explanations.
Please log in to access the Discussion tab and join conversations with other participants.
Access Restricted: Please Login to access the code editor and test cases.