Largest Submatrix With Rearrangements - Leetcode 1727 - Python

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

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

  • @Moch117
    @Moch117 Год назад +17

    Did you solve this without hints ? Seems like a super tough problem and none of the solution was intuitive

  • @gmh14
    @gmh14 Год назад +10

    Just to get this intuition from the code would have been hard, let alone explaining it. Thank god you're back lol

  • @shoooozzzz
    @shoooozzzz Год назад +12

    hardest medium on LC

    • @Moch117
      @Moch117 Год назад +6

      Man im glad i'm not the only one who felt this way. I was on a streak of 7 days but then came upon this problem which felt hard af

    • @julianelmasry9556
      @julianelmasry9556 Год назад

      literally same exact position. 7 day streak and this one killed my confidence.@@Moch117

  • @TheFast900
    @TheFast900 Год назад

    The matrix intuition threw me for a loop so far the only one to explain the bxh res calculation, thanks!

  • @mindhealer6163
    @mindhealer6163 Год назад +7

    Its definitely not a medium level question

  • @arihantbedagkar7678
    @arihantbedagkar7678 Год назад +1

    Without sorting:
    Time: O(n*m), Space: O(m)
    n, m = len(matrix), len(matrix[0])
    result = 0
    towers = list(map(lambda x: (x, 0), range(m)))
    for i in range(n):
    new_towers = []
    zeros = []
    for j, height in towers:
    if matrix[i][j]:
    new_towers.append((j, height + 1))
    else:
    zeros.append((j, 0))
    towers = new_towers + zeros
    for j in range(m):
    result = max(result, (j + 1) * towers[j][1])
    return result

  • @swastikgorai2332
    @swastikgorai2332 Год назад

    Can we do it without sorting ?

  • @CS_n00b
    @CS_n00b Год назад

    I needed something like this for my quant internship

    • @hamirmahal
      @hamirmahal Год назад +2

      Do you mean it came up in the interview, or you actually had to do this for a real-world problem?

  • @sadekjn
    @sadekjn Год назад +2

    "medium"

  • @broccoli322
    @broccoli322 Год назад

    Nice

  • @user-j5ja95
    @user-j5ja95 Год назад +3

    what does Neetcode think of copycat youtubers who copy your video thumbnail style for clickbait :')
    happens so often, I look forward to Neetcode videos, click on it and I start hearing someone else's voice

    • @NeetCodeIO
      @NeetCodeIO  Год назад +3

      Yeah I've noticed a lot of those lately

  • @ronbuchanan5432
    @ronbuchanan5432 8 месяцев назад

    I thought I'll like this question but I'm not

  • @yang5843
    @yang5843 Год назад

    Knight Dialer pls

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

    The code is good but the explanation has lots of gaps and mistakes

  • @VIJAY-hg7ei
    @VIJAY-hg7ei Год назад +1

    Within One Year i will make a huge salary hike in my career dsa will be one of my areas on focus

    • @JohnSnow-gi7iv
      @JohnSnow-gi7iv Год назад +1

      And topics like HLD and LLD are also important