3281. Maximize Score of Numbers in Ranges | Weekly Contest 414 | Leetcode

Поділитися
Вставка
  • Опубліковано 7 лис 2024

КОМЕНТАРІ • 18

  • @rugvedshinde5418
    @rugvedshinde5418 Місяць тому

    great explanation . thankyou

    • @U-DAY
      @U-DAY  Місяць тому

      Thank you ❤

  • @raveendragachchinamath7565
    @raveendragachchinamath7565 Місяць тому

    Great solution, we could reduce the search space from 10**10 to max(arr) + d for the high

    • @U-DAY
      @U-DAY  Місяць тому

      @@raveendragachchinamath7565 yes that's right you can do that

  • @andlisasa3
    @andlisasa3 Місяць тому

    you're a legend bro 🙏

    • @U-DAY
      @U-DAY  Місяць тому

      Thank you bro.. ❤

  • @jk-sm6qr
    @jk-sm6qr 2 місяці тому

    Thanks man, Great explaination

    • @U-DAY
      @U-DAY  2 місяці тому +1

      Thank you ❤

  • @keerthanaaduri
    @keerthanaaduri 2 місяці тому

    Nice explanation found got the intuition

    • @U-DAY
      @U-DAY  2 місяці тому

      Thank you ❤

  • @gokulsubramani7760
    @gokulsubramani7760 2 місяці тому

    How did you choose high?

    • @U-DAY
      @U-DAY  2 місяці тому +3

      start[i] range is from ( 0 to 10^9 )
      d range is from ( 0 to 10 ^ 9 )
      The min value you can get is 0 .
      The max value you can get is ( Max(start[i]) + Max(d) == 10^9 + 10^9 == 2*10^9 )
      The max absolute diff is 2*10^9
      So that's why i have taken high as 10^10

  • @mayankshakya9200
    @mayankshakya9200 2 місяці тому

    Hey wanna ask like how can i reach expert from where to practice so that can come up with div2 C have been struggling a lot plz help

    • @U-DAY
      @U-DAY  2 місяці тому +1

      Just try to observe the difficulty rating of C problem and make sure that you practice roughly around 30 or above problems in that difficulty rating from practice section and learn the concepts and try to observe the patterns . It can help you eventually

  • @amitjain3216
    @amitjain3216 Місяць тому

    Can you explain the part where are mid + p[0] < p[1], still we accept it and went further with p[1]?? What if elements are like [1,5,9] and d=2, so p = 1 is not possible still according to our mathod it's true, why?? I know we need to look for bigger elements than this, but how can we apply binary search on such inconsistent data.

    • @U-DAY
      @U-DAY  Місяць тому

      what is p here ?

    • @amitjain3216
      @amitjain3216 Місяць тому

      @@U-DAY sorry, p[0] I am referring here was array elements, and the another p in the example is our mid, for which we are checking whether it is acceptable min diff or not

    • @amitjain3216
      @amitjain3216 Місяць тому

      @@U-DAY bro, have you understood my question??