Find First and Last Position of Element in Sorted Array Leetcode 34 Solution | Searching and Sorting

Sdílet
Vložit
  • čas přidán 14. 05. 2021
  • Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
    NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. Question Statement:
    1. Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.
    2. If target is not found in the array, return [-1, -1].
    3. You must write an algorithm with O(log n) runtime complexity.
    Topic: #BinarySearch #SearchingAndSorting
    Used #DataStructure: #Array
    #TimeComplexity: O(log n)
    #SpaceComplexity: O(1)
    ---------------------------------------------------------------
    For detailed information and other exercises, VISIT: www.pepcoding.com
    Have a look at our result: www.pepcoding.com/placements​
    Follow us on our FB page: / pepcoding​
    Follow us on Instagram: / pepcoding​
    Follow us on LinkedIn: / pepcoding-education
    ----------------------------------------------------------------
    #BinarySearch #Leetcode34 #SearchingAndSorting

Komentáře • 38

  • @shekhar4319
    @shekhar4319 Před rokem +1

    Best video on you tube

  • @it4773
    @it4773 Před 2 lety +11

    I watched almost 5 6 video of the same question but belive me this was something that is easy understandable
    Thanks

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Glad you liked it!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @vanshikabajaj4323
    @vanshikabajaj4323 Před rokem +2

    best explaination literally! I have watched several videos then i stopped here

  • @abhishekthakur7578
    @abhishekthakur7578 Před rokem

    she is the best teacher of pepcoding

  • @vansh9857
    @vansh9857 Před rokem +1

    Such an easy explanation thank you so much

  • @anamikaahmed4887
    @anamikaahmed4887 Před 2 lety +2

    The only tutorial on this problem I understood. Thanks!

  • @avtarchandra2407
    @avtarchandra2407 Před rokem +1

    you have best way to explain....lit best

  • @abhisheksinghchauhan6583
    @abhisheksinghchauhan6583 Před 2 lety +1

    Best explanation, I came across.

  • @pragatiagrawal201
    @pragatiagrawal201 Před rokem +1

    Loved the explanation!! One of the best on CZcams!!

  • @prashanthrao8649
    @prashanthrao8649 Před 2 lety +2

    THANK YOU

  • @KaisarAnvar
    @KaisarAnvar Před rokem

    I don't understand Indian but your code explained everything to me. Very classic approach and super optimal. Thanks!

  • @DipakKumar-ey9ix
    @DipakKumar-ey9ix Před 2 lety +1

    Awesome explaination....thank u ma'am !!!

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd Před rokem +1

    This is the best ever explanation. Thanks a lot for such a great explanation.

  • @ShrutiAgrahari0803
    @ShrutiAgrahari0803 Před 2 lety +2

    easy explanation ma'am thanku

  • @parthanuj8611
    @parthanuj8611 Před rokem

    exceeding the time limit at leetcode

  • @mickyman753
    @mickyman753 Před 2 lety +1

    boht hi mast samjahya maam apne ,super clear ho gya binary search

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Do check out more such content on nados.pepcoding.com

  • @thiestmayank
    @thiestmayank Před 2 lety +1

    You just did a Magic in one minute. Great.

  • @rosonerri-faithful
    @rosonerri-faithful Před 2 lety +1

    Very clear explanation ,Manisha Mam🙏

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Thanks a lot 😊 and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms

  • @nischayrawat6216
    @nischayrawat6216 Před 3 lety +7

    mam great explanation btw congo for 45k

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thanks a lot 😊 keep motivating, keep learning and keep loving Pepcoding😊

  • @saileshramesh8113
    @saileshramesh8113 Před 2 lety +2

    The best explanation for this question, very very simple solution with minor changes, thanks for making understand the concept so clearly. Liked and subscribed pepcoding for this.

  • @parthanuj8611
    @parthanuj8611 Před rokem

    time limit is also exceeding at gfg

  • @ManishYadav-es3gz
    @ManishYadav-es3gz Před 2 lety +1

    Thank you for taking so much of initiative 👍👍👍🤗🤗

  • @jayeshbhanushali1745
    @jayeshbhanushali1745 Před 2 lety +1

    Nice explanation!!

    • @Pepcoding
      @Pepcoding  Před 2 lety +1

      For more content like this use nados.pepcoding.com

  • @thepardhu100
    @thepardhu100 Před 2 lety +1

    Crazy solution, very simple :) (y)

  • @anandamar6775
    @anandamar6775 Před 2 lety +1

    WOW

  • @bharanisrianbalagan1924

    nice approach:)

    • @Pepcoding
      @Pepcoding  Před 2 lety +1

      Glad you liked it!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @ShrutiAgrahari0803
    @ShrutiAgrahari0803 Před 2 lety

  • @ialgorithms
    @ialgorithms Před rokem

    Python code:
    class Solution:
    def searchRange(self, nums: List[int], target: int) -> List[int]:
    ans = [-1, -1]
    lo = 0; hi = len(nums)-1
    while lo

  • @abhishekthakur7578
    @abhishekthakur7578 Před rokem

    whai if array is not shorted

  • @imshivendra
    @imshivendra Před 2 lety

    3:54 par aapne last index ko 2 se update kiya hai wahan par 6 se karna hai update