Hey Neetcode, can you please make a video about transitioning from mediums to hard? The biggest focal point in transitioning from easy to mediums was algorithm understanding. But I'm having issues with solving hard problems even though I understand those same algorithms(algorithms: sliding window, dp, etc.) that got me from solving easy to solving mediums. I know you can make an argument that if I can't solve hards, then I clearly don't understand the algorithms I'm working with. But I feel the answer is more nuanced and you'd be able to give valuable insights / strategies.
@satviksrinivas8764Күн бұрын
Hi, I know this question was asked to NeetCode but I just wanted to share that in my experience the key to solving hards is recognizing those little aha moments. In my opinion what makes hard problems hard is that you need to know all the algorithms as you alluded to but each problem has a little aha moment where you need to think outside the box. For example, in this problem the aha moment would be the modular arithmetic part. In other problems it's recognizing that the XOR operator has a certain special property or realizing that you need to use two heaps instead of one, etc... But if you do a lot of these hards and make note of these aha moments I think they start to feel more tangible.
@vitruvius1202Күн бұрын
@@satviksrinivas8764 Thanks for chiming in. Seems like the actual answer is the most obvious one, which is "Do more hards, and the patterns become more graspable."
@Pippiwazza17 сағат бұрын
This becomes conceptionally a bit easier to think through, if you preprocess the grid by adding 1 to the cells that can only be reached 1 second after the time value they contain. Then you dont need to bother at all anymore about the parity thing.
@nilfm99Күн бұрын
For intuition on the explanation at the end, picture the grid as a chess board alternating white and black squares. It is clear then that each color has a corresponding parity.
@user-my6yf1st8z16 сағат бұрын
thanks boss, tried to solve this problem implementing the yesterday's solution, but catched WA in tests. Didn't even catch that it's possible to go back and forth.
@fahimimtiaz2153Күн бұрын
bro is the face of consistency
@omdandade824519 сағат бұрын
In both yesterday's and today's problem, while implementing the Dijaktras algorithm, you won't update and re-push a node if there exists a shorter way to reach it (you just ingore it 'cause its visited). yesterday I got TLE in Java if I don't do it .
@AnuragKumar-mw6esКүн бұрын
You are really awesome. Love your content. Cannot image a world without Neetcode.
@BlunderArmourКүн бұрын
Yeah, no way I was going to come up with that logic of finding the time it takes to visit the next cell. Justified hard.
@b1gfreakn67816 сағат бұрын
Off topic to this video, but I’d love to see you solve some Advent of Code puzzles starting in a couple days!
@lian123820 сағат бұрын
i wrote 100 lines of code for 2 hours and got a max time exceeded error. thank you neetcode for simultaneously aspiring and making me feel dumb. mostly aspiring :)
@hossammenem7396Күн бұрын
Thank you Mr. Max Tennyson for this informative video
@MP-ny3epКүн бұрын
Very beautifully explained!
@AnivMazumder-c1uКүн бұрын
Amazing, especially the last insight!!
@floriankubiak7313Күн бұрын
I believe this was in a contest this month. I really have to start learning graph algorithms :)
@kane-m9oКүн бұрын
and i should too!!
@PurpleDaemon_Күн бұрын
I knew the solution would be related with Greedy, but how do you decide what to pick as the Priority Key (the first element of the heap arrays)? I've tried using is_back_path and is_back_direction, to prefer movement toward the target, but how did you come up to the min_reach_cost solution? Is there a hint, or do you just have to know that such an option exists? BTW not sure if this really helps, but in the final solution I iverted x and y in the heap to again prefer path closer to the target.
@ronbuchanan54322 сағат бұрын
what if the upper-left cell isn't 0? Let's say it was 100. Is it a valid configuration of the grid?
@Zero-ui4epКүн бұрын
Awesome as always!
@ap2s2000Күн бұрын
Happy Thanksgiving Neet!
@mukherjee.pКүн бұрын
We love some hard problems!
@devmahad22 сағат бұрын
thanks :)
@kingheisenberg674Күн бұрын
is it even possible to solve it within time constraints of an interview or an OA?
@PurpleDaemon_Күн бұрын
In conclusion, this is a regular greedy algorithm that can be written in couple minutes. The whole point is to select the right Priority Key. But unfortunately, I don't see an algorithm to determine it. So IMHO this problem can be solved in minutes (if you know the right PK) or not solved at all.
@EverAfterBreak2Күн бұрын
I highly doubt you will see this in an OA
@g2gsoldchannelКүн бұрын
When I see you with the red shirt on the thumbnail, that's when I know I'm cooked for today
@viswes825823 сағат бұрын
I just noticed bro uses green shirt for easy, light green for medium and red for hard with same flowers design! 😭😂
@mrf92Күн бұрын
why to use viseted with dijkstra? first you say that you are doing a variation of dijkstra and then said it is common to use visited set in BFS.Apparently, these two algorithms are not same. please clarify why do you use visited with dijkstra.