Samsung Coding Interview Question - Find Transition Point in a Sorted Array - Binary Search

Опубликовано: 17 Октябрь 2024
на канале: PrepBytes
97,343
362

Samsung Coding Interview Question - Find Transition Point in a Sorted Array - Binary Search - O(logn) time complexity.

Crack your next coding interview: http://bit.ly/2vip0MO
Problem Statement: mycode.prepbytes.com

You are given a sorted binary array consisting of 0's and 1's. You have to find out the transition point i.e the point from where 1 starts in the array.

How do we solve this?

First, we try and solve using brute force but that gives TLE. Hence we try and optimise using modified binary search.

Prerequisites: Binary Search