Just wanted to mention that there's almost a zero % chance you will get asked a question this difficult by almost any company. The reason I picked such a hard one is because I wanted to find one I wouldn't be able to solve. The purpose of this video is to show you my live problem solving skills, which is something I don't normally show in my videos. Hopefully it's helpful for you in some way to improve your own problem solving skills.
This is very useful to know how you approach questions. Is it a good idea to add this part in your neetcode videos? Like explaining why you would think of "dp,sliding window,graph" from "the pattern you see in the question". Or sth like "If you see there is an array, and you need to find subarrays, you probably need sliding window" "if points or nodes are traversable, maybe try graph".
Never say never. Tech interview have been getting harder and harder over the last decade. There might be companies who'd think this is a good question to ask in the near future.
There are definitely problems I consider "politely get up, say good bye and leave the interview" problems, like this one! Thanks for including me in your video!
i don't think you should quit before it's over even with this type of problen. At the interview of my first programming job there was a question I didn't knew at all and one I only solved partially. But I still gave my best shot to solve and explain everything, and the interviewer stated that I had talent for programming and they accepted me.
@@Leonhart_93 well, for me it is because I recognize immediately how difficult this problem is, and for an interviewer to give this as a problem is probably a bit of a red flag in a few ways.
@Algorithmist Don't count on such things, you should always give your best shot. Some interviewers might test tenacity or something. If you don't like their character you can reserve the right to change your mind later. Just do your best in the present, there is no reason not to try some more since your are already there. Even if it is out of principle.
@@Leonhart_93 Sir, I have 20+ years of experience in tech, I do not have trouble with interviews, and I do not appreciate interviewers wasting my time. This is my principle.
Tons of respect to neetcode for posting this. This just reminds us that you can’t get better without failing first. You can’t avoid failure on the long road to improvement. And no one can avoid this. The people who are ranked top 5 on leetcode are cracked out though lol they solved that last problem in half the time the guy who is ranked 88 did. Interestingly though, he solved the first 3 problems as fast or faster than them.
@15:40 "back in my days, there weren't a bunch of helpful videos" --- You are so right. Before you, I cannot consistently find good video solutions. They were just spending like 40 minutes to explain some algorithm but no reference to the actual implementation. Or, they just shared their coding process, no explanation of why. You transformed the field!
its like in college and the professor is like "I spent the last 19 years researching this topic and finding an elegant solution to this problem, you have 60 minutes and your time starts now"
i did come up with a solution in about 30 mins and optimized it a bit in next 10-20 mins but it wasn't kinda slow and couldn't pass the last few test cases. Here it is var minReverseOperations = function (n, p, banned, k) { const vis = new Array(n).fill(false); const ans = new Array(n).fill(-1); const bannedSet = new Set(banned); const queue = [p, null]; let moves = 0; while (queue.length > 1) { const curP = queue.shift(); if (curP === null) { moves++; queue.push(null); continue; } else if (vis[curP]) continue; vis[curP] = true; ans[curP] = moves; let pivot = Math.max(curP - k + 1, 0); while (n - pivot >= k && pivot
Hey neetcode. Another good video. Really like the points you made. Something that I've noticed is that a lot of the topics you cover and discuss are really difficult things to explain to other people. Like how do you explain how you "know" something? You kind of just do. Your brain naturally and subconsciously internalized a bunch of solutions and a bunch of "mini-skills" that you can use to solve problems. Some of these skills are like sliding window, DFS and BFS, but another example of a skill that is even more subconscious was at 16:44 where you say "that math wise in my head makes sense because I've done it a bunch of times". Being innately good at something does go a long way. But as you said near the end of the video. Practice is key in becoming even better. People like scott wu seemed to have a natural ability for math and competitive programming, but at the same time they also had a lot of practice and time spent on it. Spending time doesn't entirely mean that people will get better. It's also how well the time is spent. People can learn better when they come up with the solution themselves. But they also want to "cut their losses" so they can get more experience by solving more leetcode problems. But there's no better practice than going on the website neetcode.io to prepare for your coding interviews. Thank you and have a good day.
I got really stuck at hard problems. Some GOD programmer said to me that I have to solve it until I really quit, even some days of thinking. It makes me think like looking at the solution is a shame. As soon as I do like what they said, Instead of I can handle the hard problems, I got so demotivated by thinking some hours but going to the wrong track. I do leetcode like there is no tomorrow before interview, so if one day I can not solve even 1 problem, I got so demotivated. That's more painful than other benefit of "do not look at the solution" method. Thank you, Neetcode. You are the best guider
Excellent video! And great advice by Scott Wu. I'm one who struggles through a problem for hours before what I felt before was "caving". But after Scott Wu's quote, I am going to take a new tactic and look for help as soon as I get stuck.
These are my opinions. * My first thought on this is. If you can sort without moving those in the banned position. Though that was wrong. 1.) The importance of simplifying or making a problem understandable. I bet most people spend 30 mins or more just figuring out the problem statement. 1.2) The importance of naming things. Like maybe banned is actually called banned_index or k should be called differently. 2.) Good examples are a must. I don't know if this is hard because of bad examples or bad because of too few good examples. 3.) Companies should understand not everyone wants to be a competitive programmer or want to be a leetcode solver. It's fine if you want it. But don't make it a priority for qualification. DS and Algo should be priotize more. 4.) The benefit for the problem. If you give this type of problem to your applicants. Is there a benefit if someone solves this problem? Or are you just giving hard problem for the sake of it? If your company always or most of the times encounter this problem go for it. But if not, it is just a waste of time for you and your applicants.
There was a validate xml sort of question on Leetcode. It has a very complex description and my patience was wore off when reading it. So I scrolled to the "discussion" section. There the comment that got 200+ likes is "They don't want to hire you. You want to work for them" :-) That's exactly what I thought if I see myself in an interview being posed a problem like that. Some interviewers say they almost already declined the candidate at heart but decided to offer the candidate a last chance by throwing a hard problem. If the candidate can solve it, the interviewers say they will revert their previous judgement and give a pass to the candidate. I cannot comment on that, but I don't feel good about it.
If I get stuck on what the question is asking me to do I just move on to the next question immediately and come back later and often times I find my understanding through doing more leetcode problems, better. For things I do understand and pass almost all test cases on the first go I like to spend my time figuring it out myself. But for questions I understand but don’t know how to code the solution I would just go look for solutions or hints or TH-cam videos right away.
love you man and your work. It's something I definitely learned about why comparison is not a good thing at all, in all levels of prodigies. I'm just a starter at leet code. And you've been helping me man. Thanks a lot.
My way of viewing problems in general, and in this in particular, is trying simple examples until I get some intuition and then make them harder and harder until I have the full solutions. For example, here you should take an array without any banned places and see what happens as a function of n,k,p. First, we can immediately see a different behavior whether k is even or odd. When k is even, then p is even\odd means its neighbors are odd\even. If k is odd, then you keep the parity. Second, if k is small and you track the nodes that you visited, you will more or less see a segment which keeps increasing. On the other hand, if k is large (say 0.9n) and p is near the edges of the array, then you will get two increasing segments for even and odd distances. Adding back the banned positions, you actually get the same behavior only these positions can stop the growth of these segments. So now, the solution needs only to track the sizes of the segments as they increase, and mark the distance from p using the reversal window.
11 years as a software engineer and failing 3 faang interviews 😅 .. I can say that this is absolutely genuine advice to newbies in programming and leetcode.
Embrace struggle, ty for uploading this kind of content i thought a genius like u can do every leetcode but even the strongest struggle sometimes, keep it up
I managed to get this with some effort. Like others have said, just understanding the problem took half the time. The big insight for me was realizing that reversing the subarray is kind of a red herring. Since your input array is all zeros except for at p, reversing is really just swapping, which you can conceptually reduce to hops of size k - 1. Position i is abs(i - p) elements from p, so you can check if i is reachable simply by checking if abs(i - p) % (k - 1) and i not in banned. If reachable return num steps which is just abs(i - p) // (k - 1). I realized searching for i in banned makes this O(n^2), but this is easily fixable by converting banned to a set.
Started again, and I'm pretty sure I solved it, because it passes 694/711 tests, but runs out of time on 695, which has n = 100000 😆 This time I stuck with my initial insight that we're basically moving the 1 around, but added the idea that sometimes you're not moving from one end of subarray to other After drawing the movements out, it became pretty apparent this was a graph problem. Since it was undirected, unweighted, I used a basic BFS. That left the tricky part building the graph. I just wrote out a bunch of graphs by hand (not worrying about banned elements) and looked for a pattern. I ended up noticing that there are two variables that determine where you can jump: where the subarray starts and where the source element is in the subarray. Without getting into two many details, I found simple formulas for finding the end points of an edge based on these two values. This part is really quick and completes the graph super fast. The BFS is the slow part. Since I don't think you can do better than BFS, I think there is either a fundamentally different solution, or I just need to use a faster language, maybe I'll try rewriting it in C.
Even though I doubt anyone's reading this, for completeness, I'll follow up on what I tried. I did try writing in C, the first time, I got to the same test case, but this time ran out of memory. I changed the data structures for some of the graph stuff, and then ran out of time again 😩. At this point, I decided to give up. Fun challenge though!
hint: there are 3 hints below 1 Can we use a breadth-first search to find the minimum number of operations? 2 Find the beginning and end indices of the subarray of size k that can be reversed to bring 1 to a particular position. 3 Can we visit every index or do we need to consider the parity of k?
You can use just integers as your sets because python has big ints, banned is simply a mask for what bits not to set, and k determines how you smear your bits along the "n" integer
to realize that everyone is the same, just keep solving, keep revising, keep grasping the concepts and patterns and HOPE that interviews you get something you can break through or remember its pattern. I solved about 600 leetcode problems, and now I am doing a resolving to most of them and doing the problem plans. trust me i get stuck on problems i know how to solve. it's okay, it really is, just keep going, keep exploring all patterns that exist and keep trying to practice them. and most of all, try getting better at identifying the pattern of the problem.
OP, you can still try to solve it or at least think of what's happening. After you done your best and still won't work . Then I guess that's the time to give up or look at solutions. But Don't be too dependent or too comparing to another.
I love Larry, he's a great dude. Also, Neetcode, have you considered doing the weekly contests and uploading the videos for that? I'm not sure, maybe you feel like it would be too much work but it could be interesting too.
Hey @NeetCode, just a thought in my head. Could we have the daily problem videos based on the same template as this, where you would not come up with a solution and explain why it works, rather, just record yourself going through the problem, how could you approach a problem, if you thought this could be solved using XYZ algo then why that's the case. It would definitely help us, as most of us don't just come up here to see the solution, but to understand the intuition/approach and that big WHY? and how you could think of this approach. Secondly, it would obviously be fresh content for your channel, coz, as much as I love Neetcode videos, they have been the same for last 3 years. So, guess its time we update the template/format of daily LC problems. With the face cam on, and all those hand gestures, I am never going to forget any of the stuff you explain 😅
The problem is, is that the problem is very lengthy and complicated, it should provide images, alternate explanations, so you can fully understand the problem, spitting everything out without organising it is just timewasting behaviour. I guess this is an excersise site so its your job to do it
Neetcode i completely agree with you. Codeforfces is more about creative thinking and it is very hard to force creative thinking unless you manage to come up with a solution within the first five minutes - 10 miuntes. If you don't come up with an idae within the first 5 to 10 minutes you might as well give up cuz its codeforces not leetcode.
This problem is crazy as hell. I'd probably be able to solve it (was comfortable with the scope just before solution was shown), but only because ive spent near 60 hours in the last 3 weeks trying ti make a custom suffiz array algorithm. Its 3am but this made me want to go back to my desk and browse LOL
i ve seen you solve some leetcode easy and normals and was thinking hiw can one come up with such optimisation, then saw this problem and almost had the solution (minus the parity bypass in case k is odd).Like what, barely felt it hard, then cant do easy sometimes
Who wrote the problem description, they literally could have a single easy line that would not waster anyone's time and just start understanding faster. What was that language 💀 Edit: They made the description easier, nice leetcode
If you get this and you think the company you are applying for don't need this. In my opinion, just walk away from that company. Just find another one.
I promise you no one has gotten this question in their interview. Unless you're trying to be a competitive programmer, the most intelligent decision you can make is to ignore this problem.
Just wanted to mention that there's almost a zero % chance you will get asked a question this difficult by almost any company.
The reason I picked such a hard one is because I wanted to find one I wouldn't be able to solve. The purpose of this video is to show you my live problem solving skills, which is something I don't normally show in my videos. Hopefully it's helpful for you in some way to improve your own problem solving skills.
This is very useful to know how you approach questions.
Is it a good idea to add this part in your neetcode videos?
Like explaining why you would think of "dp,sliding window,graph" from "the pattern you see in the question".
Or sth like "If you see there is an array, and you need to find subarrays, you probably need sliding window"
"if points or nodes are traversable, maybe try graph".
Never say never. Tech interview have been getting harder and harder over the last decade. There might be companies who'd think this is a good question to ask in the near future.
@@bigbigdog they will also dump the question after 100/100 candidates failed it.
There are definitely problems I consider "politely get up, say good bye and leave the interview" problems, like this one! Thanks for including me in your video!
Thanks for explaining all those contest problems, I don't know of anyone with as many videos on them as you!
i don't think you should quit before it's over even with this type of problen. At the interview of my first programming job there was a question I didn't knew at all and one I only solved partially. But I still gave my best shot to solve and explain everything, and the interviewer stated that I had talent for programming and they accepted me.
@@Leonhart_93 well, for me it is because I recognize immediately how difficult this problem is, and for an interviewer to give this as a problem is probably a bit of a red flag in a few ways.
@Algorithmist Don't count on such things, you should always give your best shot. Some interviewers might test tenacity or something. If you don't like their character you can reserve the right to change your mind later. Just do your best in the present, there is no reason not to try some more since your are already there. Even if it is out of principle.
@@Leonhart_93 Sir, I have 20+ years of experience in tech, I do not have trouble with interviews, and I do not appreciate interviewers wasting my time. This is my principle.
I'd need 45 mins just to understand the problem statement!
Real
I usually ignore those types of questions. It makes no sense to put a 15 minute timer on a question that will take 45-60 mins to decode.
fr bro. wtf is this
It's been 2 hours and I still didn't understand the question 😅😅😅
ye this shit is way too weirdly worded. Idk what sort of leetcode knowledge you need to decipher this shit
Tons of respect to neetcode for posting this. This just reminds us that you can’t get better without failing first. You can’t avoid failure on the long road to improvement. And no one can avoid this.
The people who are ranked top 5 on leetcode are cracked out though lol they solved that last problem in half the time the guy who is ranked 88 did. Interestingly though, he solved the first 3 problems as fast or faster than them.
@15:40 "back in my days, there weren't a bunch of helpful videos" --- You are so right. Before you, I cannot consistently find good video solutions. They were just spending like 40 minutes to explain some algorithm but no reference to the actual implementation. Or, they just shared their coding process, no explanation of why. You transformed the field!
Did not know how to approach any problem on leetcode, so glad I found your channel and now I am already pretty good at interviews
its like in college and the professor is like "I spent the last 19 years researching this topic and finding an elegant solution to this problem, you have 60 minutes and your time starts now"
or a more honest statement: " Only after 19 years, i found someone on the internet who had a better solution"
No
Also, you have to solve 2 of that and another easier problem in 90 minutes. Also, all classes exam will be like that.
i did come up with a solution in about 30 mins and optimized it a bit in next 10-20 mins but it wasn't kinda slow and couldn't pass the last few test cases. Here it is
var minReverseOperations = function (n, p, banned, k) {
const vis = new Array(n).fill(false);
const ans = new Array(n).fill(-1);
const bannedSet = new Set(banned);
const queue = [p, null];
let moves = 0;
while (queue.length > 1) {
const curP = queue.shift();
if (curP === null) {
moves++;
queue.push(null);
continue;
} else if (vis[curP]) continue;
vis[curP] = true;
ans[curP] = moves;
let pivot = Math.max(curP - k + 1, 0);
while (n - pivot >= k && pivot
Hey neetcode. Another good video. Really like the points you made. Something that I've noticed is that a lot of the topics you cover and discuss are really difficult things to explain to other people.
Like how do you explain how you "know" something? You kind of just do. Your brain naturally and subconsciously internalized a bunch of solutions and a bunch of "mini-skills" that you can use to solve problems.
Some of these skills are like sliding window, DFS and BFS, but another example of a skill that is even more subconscious was at 16:44 where you say "that math wise in my head makes sense because I've done it a bunch of times".
Being innately good at something does go a long way. But as you said near the end of the video. Practice is key in becoming even better. People like scott wu seemed to have a natural ability for math and competitive programming, but at the same time they also had a lot of practice and time spent on it.
Spending time doesn't entirely mean that people will get better. It's also how well the time is spent.
People can learn better when they come up with the solution themselves. But they also want to "cut their losses" so they can get more experience by solving more leetcode problems.
But there's no better practice than going on the website neetcode.io to prepare for your coding interviews. Thank you and have a good day.
I got really stuck at hard problems. Some GOD programmer said to me that I have to solve it until I really quit, even some days of thinking. It makes me think like looking at the solution is a shame.
As soon as I do like what they said, Instead of I can handle the hard problems, I got so demotivated by thinking some hours but going to the wrong track.
I do leetcode like there is no tomorrow before interview, so if one day I can not solve even 1 problem, I got so demotivated. That's more painful than other benefit of "do not look at the solution" method.
Thank you, Neetcode. You are the best guider
Excellent video! And great advice by Scott Wu. I'm one who struggles through a problem for hours before what I felt before was "caving". But after Scott Wu's quote, I am going to take a new tactic and look for help as soon as I get stuck.
These are my opinions.
* My first thought on this is. If you can sort without moving those in the banned position. Though that was wrong.
1.) The importance of simplifying or making a problem understandable.
I bet most people spend 30 mins or more just figuring out the problem statement.
1.2) The importance of naming things.
Like maybe banned is actually called banned_index or k should be called differently.
2.) Good examples are a must. I don't know if this is hard because of bad examples or bad because of too few good examples.
3.) Companies should understand not everyone wants to be a competitive programmer or want to be a leetcode solver.
It's fine if you want it. But don't make it a priority for qualification.
DS and Algo should be priotize more.
4.) The benefit for the problem. If you give this type of problem to your applicants. Is there a benefit if someone solves this problem?
Or are you just giving hard problem for the sake of it? If your company always or most of the times encounter this problem go for it.
But if not, it is just a waste of time for you and your applicants.
Great video! Just a tip: Will be easy for us if you also put the leetcode problem link in the description.
There was a validate xml sort of question on Leetcode. It has a very complex description and my patience was wore off when reading it. So I scrolled to the "discussion" section. There the comment that got 200+ likes is "They don't want to hire you. You want to work for them" :-) That's exactly what I thought if I see myself in an interview being posed a problem like that.
Some interviewers say they almost already declined the candidate at heart but decided to offer the candidate a last chance by throwing a hard problem. If the candidate can solve it, the interviewers say they will revert their previous judgement and give a pass to the candidate. I cannot comment on that, but I don't feel good about it.
If I get stuck on what the question is asking me to do I just move on to the next question immediately and come back later and often times I find my understanding through doing more leetcode problems, better. For things I do understand and pass almost all test cases on the first go I like to spend my time figuring it out myself. But for questions I understand but don’t know how to code the solution I would just go look for solutions or hints or TH-cam videos right away.
Thanks neet i needed this 😭. I was always doubting myself why can't i solve some problems.
dude you are such a big inspiration, my biggest appreciations
love you man and your work. It's something I definitely learned about why comparison is not a good thing at all, in all levels of prodigies. I'm just a starter at leet code. And you've been helping me man. Thanks a lot.
cool problem. it's just bfs, but since the number of edges is O(N^2) in the worst case you have to remove each visited node as you traverse the graph.
My way of viewing problems in general, and in this in particular, is trying simple examples until I get some intuition and then make them harder and harder until I have the full solutions.
For example, here you should take an array without any banned places and see what happens as a function of n,k,p.
First, we can immediately see a different behavior whether k is even or odd. When k is even, then p is even\odd means its neighbors are odd\even. If k is odd, then you keep the parity.
Second, if k is small and you track the nodes that you visited, you will more or less see a segment which keeps increasing. On the other hand, if k is large (say 0.9n) and p is near the edges of the array, then you will get two increasing segments for even and odd distances.
Adding back the banned positions, you actually get the same behavior only these positions can stop the growth of these segments.
So now, the solution needs only to track the sizes of the segments as they increase, and mark the distance from p using the reversal window.
11 years as a software engineer and failing 3 faang interviews 😅 .. I can say that this is absolutely genuine advice to newbies in programming and leetcode.
Embrace struggle, ty for uploading this kind of content i thought a genius like u can do every leetcode but even the strongest struggle sometimes, keep it up
Getting this during interview 😢
I managed to get this with some effort. Like others have said, just understanding the problem took half the time. The big insight for me was realizing that reversing the subarray is kind of a red herring. Since your input array is all zeros except for at p, reversing is really just swapping, which you can conceptually reduce to hops of size k - 1. Position i is abs(i - p) elements from p, so you can check if i is reachable simply by checking if abs(i - p) % (k - 1) and i not in banned. If reachable return num steps which is just abs(i - p) // (k - 1). I realized searching for i in banned makes this O(n^2), but this is easily fixable by converting banned to a set.
Just realized I missed the fact banned indices can never be 1. I’ll have to rework a bit.
Okay, missed a couple things, for example swapping when 1 not at ends of subarray.
Started again, and I'm pretty sure I solved it, because it passes 694/711 tests, but runs out of time on 695, which has n = 100000 😆
This time I stuck with my initial insight that we're basically moving the 1 around, but added the idea that sometimes you're not moving from one end of subarray to other After drawing the movements out, it became pretty apparent this was a graph problem. Since it was undirected, unweighted, I used a basic BFS. That left the tricky part building the graph. I just wrote out a bunch of graphs by hand (not worrying about banned elements) and looked for a pattern. I ended up noticing that there are two variables that determine where you can jump: where the subarray starts and where the source element is in the subarray. Without getting into two many details, I found simple formulas for finding the end points of an edge based on these two values. This part is really quick and completes the graph super fast. The BFS is the slow part. Since I don't think you can do better than BFS, I think there is either a fundamentally different solution, or I just need to use a faster language, maybe I'll try rewriting it in C.
Even though I doubt anyone's reading this, for completeness, I'll follow up on what I tried. I did try writing in C, the first time, I got to the same test case, but this time ran out of memory. I changed the data structures for some of the graph stuff, and then ran out of time again 😩. At this point, I decided to give up. Fun challenge though!
@@atrus3823 Good try man, were you able to solve it now after 6months 😄
hint:
there are 3 hints below
1 Can we use a breadth-first search to find the minimum number of operations?
2 Find the beginning and end indices of the subarray of size k that can be reversed to bring 1 to a particular position.
3 Can we visit every index or do we need to consider the parity of k?
The medical profession used to have (maybe still) a mantra: See one, do one, teach one. Sometimes you just need to see it first.
You can use just integers as your sets because python has big ints, banned is simply a mask for what bits not to set, and k determines how you smear your bits along the "n" integer
1. I enjoy it, 2. its good for interviews, and 3. I enjoy it lol love it and thanks for the videos
If you can't solve it, then what hope do the rest of us have?
The hope is that he's not a super genius that is at an unreachable level.
Have some confidence man we haven't spent (i haven't had) 1500 hours on this, so of course we can't.
😂😂
to realize that everyone is the same, just keep solving, keep revising, keep grasping the concepts and patterns and HOPE that interviews you get something you can break through or remember its pattern.
I solved about 600 leetcode problems, and now I am doing a resolving to most of them and doing the problem plans. trust me i get stuck on problems i know how to solve.
it's okay, it really is, just keep going, keep exploring all patterns that exist and keep trying to practice them. and most of all, try getting better at identifying the pattern of the problem.
OP, you can still try to solve it or at least think of what's happening.
After you done your best and still won't work . Then I guess that's the time to give up or look at solutions.
But
Don't be too dependent or too comparing to another.
I love Larry, he's a great dude. Also, Neetcode, have you considered doing the weekly contests and uploading the videos for that? I'm not sure, maybe you feel like it would be too much work but it could be interesting too.
Great video and thanks about the honesty!
Thanks for putting this video out there, much needed perspective for understanding various challenges involved👍✌.
Hey @NeetCode, just a thought in my head. Could we have the daily problem videos based on the same template as this, where you would not come up with a solution and explain why it works, rather, just record yourself going through the problem, how could you approach a problem, if you thought this could be solved using XYZ algo then why that's the case.
It would definitely help us, as most of us don't just come up here to see the solution, but to understand the intuition/approach and that big WHY? and how you could think of this approach.
Secondly, it would obviously be fresh content for your channel, coz, as much as I love Neetcode videos, they have been the same for last 3 years. So, guess its time we update the template/format of daily LC problems. With the face cam on, and all those hand gestures, I am never going to forget any of the stuff you explain 😅
Thank You So Much for this wonderful video.......🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
Larry is so underrated
This isn't programming, this is figuring out math formulas.
Heh thats half of Leetcode lol
This video is very important, to make, I value this one
This was huge, thank you for sharing
props for keeping it real neet
The problem is, is that the problem is very lengthy and complicated, it should provide images, alternate explanations, so you can fully understand the problem, spitting everything out without organising it is just timewasting behaviour. I guess this is an excersise site so its your job to do it
The guy nc mentioned in last minute
www.youtube.com/@Algorithmist
Among his 3600 videos, only 18 are not from leetcode (but from Advent of Code 2023).
I thought I had more, but it's not very common!
Yesterday I was so proud of myself, solving a hard question (median of 2 merged sorted array) but this question is a total wtf. waaaaaay too hard
I even don't know what is leetcode and fuck i watching it🤣🤣
leetcode is a website with programming questions
This is similar to a codeforces problem that was c problem from a to f we can do k swap and we have to tell minimum swaps to sort array
I don't know much about code forces but I feel like this prob would easily be 2200+
@@NeetCodeIO actually it would be 1800 or at maximum 1900
Do you suggest reviewing Cormen's book? It's been a while for me since I had my algorithms course. What are your thoughts?
This is a goated video not gonna lie
Scott Wu is now reaching Linus levels of dominon
I stopped the video to understand the problem. Never played it again.
Pleas give credits to The Larry's channel: Algorithmist
Done
I didn't understand anything, but hey at least you're a mere mortal like the rest of us! :P
Thankyou for the video
Neetcode i completely agree with you. Codeforfces is more about creative thinking and it is very hard to force creative thinking unless you manage to come up with a solution within the first five minutes - 10 miuntes. If you don't come up with an idae within the first 5 to 10 minutes you might as well give up cuz its codeforces not leetcode.
This problem in fact seems as Div.2D or even harder from Codeforces, I believe
@Donquixote-Rosinante 1800-2000, I believe. It can be considered as an easy Div.2D problem in my opinion
16% acceptance; not touching it with a 10foot pole for now., i sort questions in descending order.
This problem is crazy as hell.
I'd probably be able to solve it (was comfortable with the scope just before solution was shown), but only because ive spent near 60 hours in the last 3 weeks trying ti make a custom suffiz array algorithm.
Its 3am but this made me want to go back to my desk and browse LOL
Where can I watch your streams bro !?
i ve seen you solve some leetcode easy and normals and was thinking hiw can one come up with such optimisation, then saw this problem and almost had the solution (minus the parity bypass in case k is odd).Like what, barely felt it hard, then cant do easy sometimes
A similar thing happened to me, I stopped the video before he explained the solution and actually solved it
What is he using to draw on the screen?
Classic paint. He took a screenshot and use paint
funny enough, the guy who put up the solution for that problem is a codeforces international master which is like almost red on cf
Who wrote the problem description, they literally could have a single easy line that would not waster anyone's time and just start understanding faster. What was that language 💀
Edit: They made the description easier, nice leetcode
already lost just having to decipher the 1st paragraph, it's written so poorly
Are these really in interviews for tech companies? How does the interviewer knows what questions to throw at candidates?
do you solve advent of code?
is this video a clip from a livestream?
Why don’t you look at the hints?
Hi Neato!
Why leetcode problem are so hard to understand
The question itself is not worded correctly
imagine getting that in an interview
If you get this and you think the company you are applying for don't need this.
In my opinion, just walk away from that company. Just find another one.
@@asagiai4965 for real
Yes you could never solve this one
Wtf is this solution 😂 absolutely insane
Quite depressing. If even Neetcode stumbles....what hope there is for me?
I promise you no one has gotten this question in their interview. Unless you're trying to be a competitive programmer, the most intelligent decision you can make is to ignore this problem.
You completely missed the point of the video.
@@NeetCodeIONext year it will be standard junior question :P !
1:54
Larry!
tourist: Hold my Google jam medals
Leetcode is just pure penalism.
nice nvidia eye tracking fakery we can all see the chatgpt on ur other monitor