Spiral Matrix III - Leetcode 885 - Python

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

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

  • @ArunRampure
    @ArunRampure Месяц назад +8

    Always struggled with matrix traversing. Your explanation makes it looks simple and easier. Thanks for adding this one.

  • @rahulsbhatt
    @rahulsbhatt Месяц назад +8

    You write these codes so elegantly and efficiently!
    I love how you implement things like e.g. the part where you used the loop and then increased the steps counter, making us realize how to creatively use loops .
    Thanks for putting out a video for daily leetcode, because of you I'm able understand and implement and making small and consistent efforts to do DSA daily.

  • @lavanyam3224
    @lavanyam3224 Месяц назад +3

    Thanks for mentioning the pattern at 2:40 so that we could try it ourselves!

  • @666pss
    @666pss Месяц назад +1

    I usually get the logic for most leetcode problems, but your solutions are far more elegant than mine. Your code looks like an artwork, while mine look like a 3 year old's drawing

  • @user-dp9gi1vg8r
    @user-dp9gi1vg8r Месяц назад +2

    Kinda diff one today. Yesterday 'hard' problem was much more easier. Thanks for explanation, NeetCode, love u!

  • @MehmetDemir-xi3yy
    @MehmetDemir-xi3yy Месяц назад

    I solved this problem the way like you solved Sprial Matrix (the first one). I defined top, bottom, left and right boundaries and traversed right bottom left and top until I hit boundaries. While traversing if current row and col is in between 0 and len(row or col) I added it to result.

  • @lifeofaproblemsolver479
    @lifeofaproblemsolver479 Месяц назад +1

    I was sooo confused on this problem, mainly because I thought the arrow was showing me where it stops but I took that too deep lol. Thank you for explaining this to me :)

  • @bob-the-constructors9912
    @bob-the-constructors9912 Месяц назад +1

    Unrelated to this question, just wanna say thank you neetcode for your videos on LC and general topics, you are amazing and a great inspiration 🙏🙏

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

    Solved it by counting steps out load, 1,1,2,2,3,3 etc made me figure it out. :)

  • @user-lj7dr1vs2o
    @user-lj7dr1vs2o Месяц назад

    Everyday I watch your videos and learn something. Thank you very much.

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

    Best approach 🙌

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

    ur awesome dude

  • @shibambiswas
    @shibambiswas Месяц назад +1

    Junji ito mentioned 🗣️

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

    I took the approach that each of these directions move out diagonally. So incremented them diagonally

  • @s.kamesh3839
    @s.kamesh3839 Месяц назад

    ❤ awesome

  • @MP-ny3ep
    @MP-ny3ep Месяц назад

    Great explanation as always. Thank you

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

    Wow....Nice Approach

  • @rajshah9129
    @rajshah9129 21 день назад

    I didn't get y u r doing y in range(steps) ?? N how u r covering at a certain distance from the origin coordinate??
    Or r you doing it through steps only ??

  • @yang5843
    @yang5843 Месяц назад +1

    The intern writers are definitely paid a competitive wage to write this.

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

    Today I feel accoplished because my code is an exact match for NeetCode's.
    res = [[rStart, cStart]]
    deltas = [(0, 1), (1, 0), (0, -1), (-1, 0)]
    d, incDist = 0, 1

    while len(res) < rows * cols:
    for _ in range(2):
    for _ in range(incDist):
    rDelta, cDelta = deltas[d]
    rStart, cStart = rStart + rDelta , cStart + cDelta
    if 0

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

    7:07 math impresed

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

    Does amyone else love diving into ASM ,C and C++ before going back up to Java,C# ,Python or............. Java... JavaScript?

  • @EduarteBDO
    @EduarteBDO Месяц назад +1

    I made a 100 lines solution then I came here

  • @user-gz9il9gt5q
    @user-gz9il9gt5q Месяц назад

    sir please provide c++ code also 🙏🙏🙏🙏

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

    i got brain damage yesterday for this problem

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

    spiral matrix 4 is gonna be the end of my sanity fs

  • @ROHANMANNA-il7nt
    @ROHANMANNA-il7nt Месяц назад +17

    Who woke up early to solve the daily question on leetcode everyday 😌??

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

    Too early!

  • @akash-kumar737
    @akash-kumar737 Месяц назад +5

    Fairly Easy but I hate such questions.

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

    Im gonna skip this ...

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

      lock in and do it