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.
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
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.
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 :)
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 ??
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
Always struggled with matrix traversing. Your explanation makes it looks simple and easier. Thanks for adding this one.
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.
Thanks for mentioning the pattern at 2:40 so that we could try it ourselves!
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
Kinda diff one today. Yesterday 'hard' problem was much more easier. Thanks for explanation, NeetCode, love u!
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.
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 :)
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 🙏🙏
Solved it by counting steps out load, 1,1,2,2,3,3 etc made me figure it out. :)
Everyday I watch your videos and learn something. Thank you very much.
Best approach 🙌
ur awesome dude
Junji ito mentioned 🗣️
I took the approach that each of these directions move out diagonally. So incremented them diagonally
❤ awesome
Great explanation as always. Thank you
Wow....Nice Approach
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 ??
The intern writers are definitely paid a competitive wage to write this.
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
7:07 math impresed
Does amyone else love diving into ASM ,C and C++ before going back up to Java,C# ,Python or............. Java... JavaScript?
I made a 100 lines solution then I came here
sir please provide c++ code also 🙏🙏🙏🙏
i got brain damage yesterday for this problem
spiral matrix 4 is gonna be the end of my sanity fs
Who woke up early to solve the daily question on leetcode everyday 😌??
Not me
Me
Not people with jobs.
I get to it when I get to it
Too early!
Fairly Easy but I hate such questions.
Im gonna skip this ...
lock in and do it