Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1].
Solved using our favorite Exotic Binary Search !
return new int[] {ebs(nums, target), ebs(nums, target + 1) - 1} ;
// ebs = Exotic Binary Search
Leetcode 34 : https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/
#binarysearch #interviewdose
Download
0 formats
No download links available.
Leetcode 34. First and Last element in a sorted array Using The Exotic Binary Search | NatokHD