LEETCODE 34: Find First and Last Position of Element in Sorted Array

  Рет қаралды 939

Nikash Kumar

4 жыл бұрын

Hi Everyone
This is one of common questions asked in #GOOGLE #MICROSOFT #INTERVIEW.
This video contains the explanation and code for the problem "Find First and Last Position of Element in Sorted Array".
Please do let me know if you have any inputs/concerns for the solution.
Try solving this problem here: leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/
Find all my Leetcode solutions here: kzbin.info/aero/PLod2hJhyen5fBGkRZelDtg5YBVgd8aSvx
Subscribe at kzbin.info
Follow me here: nikash_nikx
Also do like, share and Subscribe :) Keep Learning Everyday :)
Thank you

Пікірлер: 6
@vershaverma1409
@vershaverma1409 3 жыл бұрын
Good video ! but why have you used two different formulas to calculate mid in the two while loops? if I could get some explanation it would be great
@NikashKumar
@NikashKumar 3 жыл бұрын
Hi Varsha, Thank you for the comment. Here is the explanation : First we do binary search for low, mid = lo + (high-lo)/2, this will keep the mid to left/lo always. Then we do binary search for high, mid = lo + (high-lo+1)/2, this will keep the mid to the high/right always. Do let me know if you have any more questions. Also do like and follow facebook.com/TechieThugs/
@vershaverma1409
@vershaverma1409 3 жыл бұрын
@@NikashKumar got it !! thankyou :)
@codeWithPatience
@codeWithPatience 2 жыл бұрын
Sir null pointer error a Raha hai kiya karu
@NikashKumar
@NikashKumar 2 жыл бұрын
Share your code and i can take a look at it,
@codeWithPatience
@codeWithPatience 2 жыл бұрын
Thank you sir for your response ♥️♥️♥️♥️ But I done it with another method
ДЕНЬ УЧИТЕЛЯ В ШКОЛЕ
01:00
SIDELNIKOVVV
Рет қаралды 4 МЛН
Smart Sigma Kid #funny #sigma
00:14
CRAZY GREAPA
Рет қаралды 8 МЛН
Я сделала самое маленькое в мире мороженое!
00:43
Кушать Хочу
Рет қаралды 4,4 МЛН
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 1,1 МЛН
ДЕНЬ УЧИТЕЛЯ В ШКОЛЕ
01:00
SIDELNIKOVVV
Рет қаралды 4 МЛН