Leetcode 378. Kth Smallest Element in a Sorted Matrix [Java]

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

КОМЕНТАРІ • 25

  • @farukhmahammad9374
    @farukhmahammad9374 2 роки тому

    great!!! what's the TC of the last approach?

  • @lakshyaKumar12
    @lakshyaKumar12 Рік тому

    watched a lot of videos on repeat but your video made it crystal clear in one go... THANK YOU keep it up loved it

  • @mohammadyahya78
    @mohammadyahya78 2 роки тому

    Thank you. Can you make a list of mediums you had please? Also do you have a list of mid-hard questions you would recommend preparing for interview please?

    • @ifelsestatement7803
      @ifelsestatement7803  2 роки тому

      I will add it to my to-do list to make these playlists. In a meantime, definitely check out:
      1) 322. Coin Change
      2) 518. Coin Change 2
      3) 647. Palindromic Substrings
      4) 475. Heaters
      5) 542. 01 Matrix
      6) 46. Permutations

  • @heyjoe5920
    @heyjoe5920 11 місяців тому

    Great explanation, thank you so much.

  • @shreysharma2056
    @shreysharma2056 2 роки тому

    in the countLessOrEqual function, why is the starting point in the right most column?
    Thank you for this video by the way, greatly appreciated!

  • @VasheshJ
    @VasheshJ 2 роки тому

    Thank you so much. This video was really helpful to understand how the binary search solution worked.

    • @ifelsestatement7803
      @ifelsestatement7803  2 роки тому +1

      I am very happy that I was able to help you! Thanks for watching!

    • @VasheshJ
      @VasheshJ 2 роки тому

      @@ifelsestatement7803 Hey, I am still not sure abt time complexity. The binary search actually depend on the value of the smallest and largest element of the matrix so time complexity will actually depend on the values?

  • @CSRookie22
    @CSRookie22 2 роки тому

    Appreciate your explanation, very clear.

  • @chilly2171
    @chilly2171 2 роки тому

    isn't the middle element (min + max)/2?

    • @apoorvgupta1211
      @apoorvgupta1211 Рік тому +2

      The middle is calculated in this way so as to avoid Integer Overflow. Adding 2 integers may produce a value which exceeds the acceptable integer limits. Hence we calculate the mid in this manner.

  • @YogendraRajA
    @YogendraRajA 2 роки тому

    Nice solution!

  • @lalitkashyap1203
    @lalitkashyap1203 2 роки тому

    thanks

  • @perasperaadastra777
    @perasperaadastra777 3 роки тому +1

    gj!!

  • @soltomoon3620
    @soltomoon3620 9 місяців тому

    you look like luka doncic

  • @numerobis3949
    @numerobis3949 2 роки тому

    min + (max - min)/2 == (min + max)/2

    • @pratishbarthwal465
      @pratishbarthwal465 2 роки тому +5

      conceptually it is true. But when implemented as (min+max)/2, the result may overflow as we have a permissible range for any datatype. For example, (2147483600+2147483647)/2 would overflow, while 2147483600+(2147483647-2147483600)/2 won't. Mathematically, both are equivalent.

    • @numerobis3949
      @numerobis3949 2 роки тому

      @@pratishbarthwal465 good point