Search in Rotated Sorted Array - Leetcode 33 - Binary Search (Python)

Поделиться
HTML-код
  • Опубликовано: 1 фев 2025

Комментарии • 11

  • @GregHogg
    @GregHogg  6 месяцев назад +1

    Master Data Structures & Algorithms For FREE at AlgoMap.io!

  • @christianjt7018
    @christianjt7018 6 месяцев назад +1

    this was a very tricky problem for me, but your explanation is incredibly clear, thanks!

  • @KurtSchwind
    @KurtSchwind 11 месяцев назад +8

    Isn't the 3rd case m,n-1 identical to edge case where m is position 0 ? 0,n-1 ? So why is 0,n-1 an edge case?

  • @Chathur732
    @Chathur732 4 месяца назад +1

    first = 0
    last = len(nums) - 1
    while first

  • @saurabhbhagat4528
    @saurabhbhagat4528 4 месяца назад

    To avoid all the extra conditions, you can also set left = min_index and right = min_index + nums.length, ofcourse while accessing those indices will be out of bounds of the array, so while accessing real item indices you can just do "nums[] mod nums.length" and when its time to update the left or right bounds, use the "fake" indices.

  • @mohammedyousufbaba3038
    @mohammedyousufbaba3038 11 месяцев назад

    Hi greg,
    I am your new subscriber from India. Love your content.
    I need a suggestion, Is DSA mandatory to learn if we want to get into data science field?

    • @GregHogg
      @GregHogg  7 месяцев назад

      Sorry for the extremely slow reply!! Yes, generally it is

  • @bishwut9209
    @bishwut9209 Месяц назад +2

    this one got me fucked up

    • @bishwut9209
      @bishwut9209 Месяц назад

      how would I come up with this one my own during interview ??

    • @npyeshaswi
      @npyeshaswi 18 дней назад

      @@bishwut9209 ikr i really wonder how everyone else learn this shit

  • @EchoesOfSurrealism
    @EchoesOfSurrealism 11 месяцев назад +1

    you should create a separate playlist for all your leetcode videos