I Solved 1583 Leetcode Questions Here's What I Learned
2023 ж. 17 Қар.
477 196 Рет қаралды
Recorded live on twitch, GET IN
/ theprimeagen
Reviewed video: • I solved 1583 Leetcode...
By: Ashish Pratap Singh | / @ashishps_1
MY MAIN YT CHANNEL: Has well edited engineering videos
/ theprimeagen
Discord
/ discord
Have something for me to read or react to?: / theprimeagenreact
Kinesis Advantage 360: bit.ly/Prime-Kinesis
Hey I am sponsored by Turso, an edge database. I think they are pretty neet. Give them a try for free and if you want you can get a decent amount off (the free tier is the best (better than planetscale or any other))
turso.tech/deeznuts
The biggest problem with pen and paper or whiteboards is that I need to actually remember the legacy skill of handwriting.
My handwriting looks like that of a child's. A contemporary "Eww, pencil? I use tablets for everything." child. XD
@@spankyjeffro5320I had the same issue, but you can get yourself a nice pen. The pilot G-2 0.7 ones are pretty good. I had the same issue but had to get used to it for my math lectures. Didn't have money for a tablet :/
Always have a permanent marker, that way they know you’ve been there.
I struggle to write my signature
Handwriting was deprecated in life v.2008
I feel it's a shame that people now think, I need to get better at programming, and they don't write some cool programs to become better but they will do leetcode problems for countless hours.
It's a shame that people don't use quotation marks anymore.
Sometimes it feels like the projects I do are too straightforward for me to actually learn as much as I want to. And the projects that look like they can teach me are often too high-level for me to even know where to start from. It's so confusing.
It is a slippery slope even for senior software engineers that simply are not used in the new shit, they really second guess themselves until they talk to someone they know (me) and shittalk them out of it, like... WWWWWWTTTTFFF you know what you can do etc, no you dont know everything, newsflash that's why we google things :p
Yes, that's why I never applied at FAANG companies. Right from the get-go, I hated the Leetcode-esque interviews.
@@datboi1861 I believe that's a pretty normal experience at first, but solving this by programming solutions will learn you a lot in the end, even with some projects that might appear simple at first.
Wow, start with easy problems and then increase difficulty. This is really next level advice. Life changing
0:22: 💡 Practicing interviews at companies you don't care about can help improve your skills and discover new interests. 3:02: 🔑 Having a basic understanding of fundamental data structures and algorithms, such as binary search, is crucial before attempting coding problems. 6:22: 💡 The video discusses resources and strategies for preparing for coding interviews. 9:17: ✏ Drawing and thinking is a helpful approach to problem-solving, and using a whiteboard can simulate an interview scenario. 12:16: 🔑 Staying organized and learning from others' solutions are key to success on LeetCode. 15:23: 📝 The video discusses the benefits and drawbacks of using Obsidian and Notion for tracking progress and organization. 18:25: 👍 The video provides valuable advice for coding interviews and emphasizes the importance of timed practice and stress-inducing environments. those are some good advices
@@hanhthien2948c'mon dude, really? lol
@@hanhthien2948 which AI did you use to extract these video notes? if not, then it's impressive.
You've no idea how many things I like to start at with the hardest difficulty, just because I didn't want to do anything less. Like Halo Combat Evolved.
@@sunxsky5569 even if im 12 days late, he used HarpAI most likely
I would like to see prime doing a leetcode contest. it will be interesting to see how he approaches problems.
Bla bla bla
💀
He would likely fail at most of them. I would and I'm a senior... Most of these problems don't even help in real problems lol
@@nullx2368 trick is that you have to train to solve them for while. They are very similar to competitive programming and test your familiarity with this class of problems. Not something you can learn being a good software developer. So i suspect those trying to create sunken cost fallacy to give HR leverage.
leetcode is a skill in itself, i doubt he would be good at it
I use leetcode for de-dusting my skills on a language. If I haven't used a given language for over 3-4 years, a dozen problems on all difficulties is more than enough to refresh for interviews.
This is actually a great idea
what do you think of codewars?
Most of coding don't really need any complicated algorithm problems.. In my experience, it was way, way more important to know OS, networking, compiler, PL well. And people who knows these well can always pickup required algorithm and data structure knowledge when needed.
What's PL?
@@kkounal974 "Programming Languages", I guess
You are a blessing! I don't know you but thank you for this one, I have been searching this exact statement for ages to find out where I have the knots tied still.
@@aniketsabud6705I just want to add that “knowing” these are not quite enough, implementing relevant projects (like RAFT, Multi version Concurrency Control) are probably more valuable. System design& implementation >>>>anything else
@@alexzhang3870 Thanks for the add. Would you please care to elevate me towards it's source somehow?
One really nice thing about leetcode problems is that you can jump into one and finish it with very little warmup. On the flipside, if I'm working on a project, I need more time to get into a flow state in order to be productive. I can just crank out leetcodes because they are self-contained problems.
I think in companies, it is more about understanding frameworks, storage solutions, networking. the maximum what I had was if I understand the complexity O-Notation of a given problem.
The secret handshake of getting in the door is to solve DSA problems. The system is flawed, but wouldn't you rather just do it if it helps you get the job?
you deal with the given cards @@Stasisdrone4827
I stopped leetcode and started focusing 100% on building projects. Leetcode is good but I think starting out building things is completely diff
Doing projects is a different way of thinking than solving a problem/question. I'd say doing projects teaches you the proper way of thinking when it comes to programming, while problems are just short brain exercises.
i have done many project and now i am back to leetcode lmao in the end grinding leetcode is required for coding interview prep sadly, most decent jobs got a white boarding session
You need both but I think coders focus on nerd stuff to me. @@SealedKiller
To learn French you need to read, write, listen and speak to get proficient. To become a boxer you need to do sparring, drills, running and weight lifting. And to become an excellent programmer, depending on your domain, you might need to build projects, solve Leetcode problems and study mathematics. You always need a variety of stimulus to become proficient at something.
Yes, we need both but I think starting out focused mostly on Leetcode and codewars is a mistake. @@tapwater424 NOW that I have started building things I can do codewars better now.
As a junior/mid I'm on stackoverflow all the time. It usually points me in a good direction towards solving the problem I have at that moment... but I've never experienced situation where I was able to copy/paste some portion of the code that would just work. I suppose it's funny as a meme but I don't find it as a realistic situation.
trust me, no senior has to do that in real life either, the interview process is outdated asf
@@and_I_am_Life_the_fixer_of_all it actually has a completely different purpose. People who invest themselves enough to get good enough at leetcode and then go through their extremely lengthy process to work for them are more likely to stick with them for longer, and happy about working for these companies. The entire situation where a lot of people look at these companies as their career goal is created and maintained by this ecosystem where there are learning platforms, contests, courses, youtube channels and whatnot. Another thing they really try hard is pushing for not needing college or masters education for roles. The more people they can add to an industry that has way more role gaps than engineers, the lower the salaries and benefits get...
To be honest. I mostly experienced the opposite. In many cases the stack overflow solution isn't even a good direction to go in. Now I mostly look at source code because documentation is often outdated or incomplete and I test a bit around external functions to look if they actually work as expected or have some hidden bug. Especially apis are a bit crazy how many errors you can encounter that just aren't or false documented. Of course documentation is my first goto but if I can't figure it out with the documentation source code is the way to go. Edit: This might be a problem with the javascript ecosystem.
There is a reason why he is very much into Leetcode, coz in India interview process is fucked up like anything, College Gard has to go through 4-6 rounds on interview in order to get internship at good product based company, hence he was compelled to do that much of programming, I don't blame him, on top that the job market is way more competitive in India.
Lmao don't bother about these folks, most of them would struggle to clear OAs and Rounds in Indian settings. Better to stick to what gets one a good job.
@@pratikwankhede6218 lmao, thing is dsa is not even useful in most jobs unless you're in database company or something lol. He's not wrong, the indian system is fucked up.
Indian interview changes once you aquired some industry experience. Then you will mostly be asked about the tech stacks and take home project is also very popular.
im with the same employer for years, however i at least go to an interview 1-2 a year. its also good to get in touch with reality sometimes :)
I use stackoverflow not just as a quick reference but because it helps check if there's a new way of doing something.
I will say it's not easy solving algos .. with experience and taking the time to learn the underlying concepts of the different algos you'll see. Solving algos becomes second nature because it intuitively makes sense to you what you're trying to do.
Solving leetcode or algoexpert problems is fun and challenging and will make you a better PROGRAMMER for sure, but does nothing for your DEVELOPER career imho. Being a good, professional developer is so much more than being able to sort a list or create a linked list or whatever. It's design patterns, using frameworks, working in a team, using GIT or some other source control system, etc. etc.
Prime explaining his notes brought back my interest in discrete maths lmao thanks
"Apply to companies you don't care about." may not always be a good approach because not all companies have the same interview process. I have never in my life had a whiteboard interview so no matter how many interviews in smaller companies I did, I would never get anything near passing the big tech interview.
I have solved one leetcode problem so far. I want to solve about 10-20 but only because I want to see if I can do that in BASIC since I don't think anyone else does it. I kind of like many of the problems, in the same way I like solving crossword puzzles on the beach. Anyway, I think Rosetta code is more interesting though not quite equivalent.
Bro I really liked your idea about applying and practice. The greatest advices ever for gaining confidence, thanks sooo much
Loved your course on frontend masters, it helped me a lot .
The important thing is: you need to be doing it regularly. In the past I also cracked several medium, hard problems, but then, as I never looked to them again, I just forgot about them. So if you are not doing it on a regular basis, your mind will erase it. Unless you are gifted by the universe with a freaking good memory (not my case at all).
As a senior, I can guarantee you even you understand DSA fundamentals very well, you would easily fail at LeetCode questions, you just have to come back to LeetCode again and again. The problem is LeetCode skills don't stick.
I think I'm gonna start telling non-coders to tell me the hardest math they've ever done. Then I'm going to give them a time-limit and constantly pester them to tell me to explain their process. Then I'll judge them entirely on those 30 minutes, ignoring their work history and ability to explain their career beforehand. But first I'll make sure that my potential hires have autism to some degree, by ensuring it's a job with technical skills. Then instead of being sued for ADA violations, I'll become the standard, and force other companies to follow. Then I'll get youtubers like this guy to be so into it, he calls people who can't do it "dumb", regardless of how much code they've written and how clean it was. John Carmack's Quake code, for example, was OOP based, so clean a beginner could read it, and came out before leetcode... but that makes him dumb, obviously, because it didn't have this interview to prove himself, and likely would have failed. Q-bert was written by a 13 yr old. He too would've failed. Linux was written by some college kid.
The irony is no one is stopping the unemployed programmer from creating the next Quake, the next Linux blah blah... also John Carmack, Linus and the kid would've crushed leetcode, if that was their thing.
this is simply untrue. this just shows you are not a good problem solver at all. good competitive programmers never need to keep revising or memorizing shit , especially most lc problems are easy and not even close to implementation heavy
its because it short, like it doesnt stick at all, and it also contains alot of math stuff, like its not just coding
@@_Cfocus where is the math stuff? I've done over 400 problems
Bro where os your 9hr long algo course link i am not able to find it.
A flaw to the advice of applying at companies you dont care about to practice coding interviews is you assume we can even get an interview in the first place
Dude but doing coding puzzles is honestly so much fun. You have to warp your brain half way to Tuesday to solve some of these problems. And it's so so so satisfying to solve them. It would be fun to have a job where you just make problems.
Bro writing errors and enjoying it it's work
lol yeah but it gets boring, huge projects are much much rewarding
today I learned that I am a loser.
Aren't we all
Today means everyday for me everytime I read someone else's code
You are not alone 😢
Stack overflow is for finding out what the universe of solutions might look like.
After 20 years, I can count how many times I've had to write a red-black tree in real life on 0 hands. If you have to implement this stuff yourself then you're doing something wrong.
I could maybe see it if you're working on some super-resource-constrained embedded project, and can hyper-optimize for your exact use case... Otherwise? Yeah, just use a library.
I agree very much, but I have no clue how I'd find anyone who I'm confident can actually write maintainable, reliable, testable code. It makes sense to give several Easy LC problems to verify they aren't faking being a programmer, rather than giving LC Hard problems to try to find a "10X" super-genius-super-special impossible-to-work-with engineer.
@@SolarShadoi work in embedded and honestly, there is very little usage of fancy algorithms, other than numerical domain-specific ones (FFT, signal processing algos, etc). I mainly write C in environments where dynamic memory allocation is prohibited, which makes 99% of cool data structures impossible or not worth it. I don’t think leetcode is very useful for embedded or systems programming, but maybe there are some good collections of problems for those domains im not aware of.
@@SolarShadoBut 99% don't and that's the point. The whole problem with leet code is that only pertains to people that already would know these things. Interviews that rely on leet code type of questions to determine a candidate's abilities are flawed from the get-go.
Same. Nearly 25 years here. Day to day, I always wind up having to handle strings up in the guts. Ideal? Hell no, reality? Yup.
It's very rare to see a software engineer KZheadr like you... Keep it up🙌👏
How do you know other software engineer KZheadrs have a hard time keeping it up?
Cuz they NEVER do the hard problems
They cant hack it as real devs and become youtubers.
I wish I could get that many interviews like he mentions in the beginning, I don't even get that many so that adds extra stress to the few that I do get, which have been very very few so far.
Random indian guy: i solved 9999 leet code questions but i gonna shitcode in production. enjoy
Look whatever he said fits in indian scenario. I hope is just casual roast. To crack big MNC in india you need to be an expert/cm on codeforces specially in current market scenario as a fresh college grad
Ngl the interviewers in india for amazon google and meta asked me real hard questions for dsa almost like they wanted me to fail. I joined meta in london and the interview was much easier especially the dsa bit, also interviewers were more friendly and actually felt like they wanted me to join. I donno if this is universal or just something I felt.
if there are 1m people for your position, you better be 1 in 1m to get the position. once you get there its hard to lose your job but people get bored because they are 1 in 1m.
How did you even make it to Amazon london from india?
its cuz of the competition. Most of these interview rounds act as a filter, especially in places like India, where there are far more applicants for a role.
@@career800 oh yeah meta in 2021 mid was hiring like crazy I applied for a role in Dublin but it was an sre/dev role but mid way they told me a role in london was more suitable. I just applied randomly. Similarly had got offers from intercom and another unicorn during the time they were sponsoring visas for folks with around 4 years of xp
@@and_I_am_Life_the_fixer_of_allNope, for companies you are just a cog, especially in India, which is why the salaries are low as there is always someone to fill in
If you have five interviews and two of them are coding, you might spend some time on other topics besides leetcode - design, project management, leadership, quality assurance, etc.
So I'm fairly new to all of this. Still working through a webdev bootcamp. I'm dabbling with Python as well, and plan on going back to College for some Computer Science courses. Any recommendations for a newbie?
Thank you so much bro for your advice!
I find your videos funny like everybody else however you got me nervous about knowing stuff that I had no idea about until now.
I've done all of the problems on leetcode. I just find it a fun thing to do when I'm watching a movie or waiting for something. Look, it's either sudoku or leetcode.
The only time I've copy pasted from SO directly and it just worked was for this problem: the percentage of overlap between rectangle A and B, given that rectangle A is always bigger, and all we have is their bounding box coordinates. Someone happened to have the same exact question and there was a super elegant function that accepted two objects as arguments with the same name for keys. It felt like cheating and it has never happened again lol
In our undergraduate studies in France, we have whiteboard sessions when a teacher asked us to solve stuff and roast us when we fail. Then grade us on the perf. You hear stuff like "why are you even here", "in one semester you are out for sure", "this is high school level math, and you still got it wrong". We were going in this hour of joy in group of 3 students and while you were solving your problem in one whiteboard in the corner of the room, you mate was being roosted by the professor. My favorite time was when my friend was done with the theory question and explain everything to the professor and the latter replied: "good, now you are going to demonstrate to me why what you just said is wrong". Don't miss it but if coding interviews are like that as well, the trick is to take it with a smile and don't pressure yourself too much, show confidence even if you are not sure how to solve and always try something
sounds a bit toxic, interviewers are super supportive
@@roshatron you must not have interviewed at Facebook then.
Lol, I had a professor just like that at my uni in Ukraine. Maybe a little less toxic though 😂
I like how you have to implement binary search tree algorithm on an interview for a job for which you’ll do crud apps. Awesome idea :)
While i like stuff like leetcode and codinggame and etc, i feel like most times it ends up pushing people into "small domain" mindsets. Which is fine for "find the shortest path from x to y". But at some point I'll need you to "extend large domain x with new feature z. x is already a s**tshow of a system, how would you go about implementing z without making x even more of a s**show?". Now i might need an answer that totally runs counter to "best at the small domain" but is "best at the larger domain". Can the person do that shift if he has focused too tightly on the "small domain" issues? Can he understand that many times, there are tradeoffs? Has he become so familiar with the optimal solution that now he can't see he's trying to fit a square peg into a round hole?
How are any of those leetcode exercises help with web stuff, front end, backend, queries, github, app architecture, mobile and so on?
Absolutely 😃
14:00 I find more and more I end up more confused leaving stack overflow than when I went in. A lot of people either marked it solved with "I solved it myself" with no solution, the classic "Duplicate of" and the duplicate doesn't solve the issue, or one question with 20 different solutions which are so different from each other that attempting all of them would waste my time.
I found leetcode recently and it's a fun place that will throw out some puzzles. But it hasn't helped me build anything. I can make this one system REALLY efficient and consider how it could be optimized but... That's what you pull out after you've figured out how to build the whole system.
CS graded uni in 1990 learnt binary search. Retiring next year, never once implemented my own b search. I did see just 6:38 once “a deadly embrace” with db table locks.
agreed, and thank you
9:27 "get the whiteboard out", did he just suggest.. bringing your own scrum mainer to an interview? CHROOT
If it's hard to get to the interview stage (i.e the job market sucks) there are discord communities and online resources for mock interviews!
My biggest problem with leetcode is that I can never understand the problem! Whoever writes the descriptions for the problems doesn't write them nearly stupid enough for me to understand. It's a skill issue; if I knew what the answer was, I'd understand the question, but I'm still going to complain about it.
Same.
I had an interviewer paste a huge screenplay in the zoom chat of the happy number problem. I never have done LeetCode and have been a dev for 12 years. I have never got a LeetCode question in an interview until 2 months ago. I could not understand the problem at all. I said I dont understand the problem. With things like this I need time to myself to let the problem sink in. So he said ok lets do it as a take home and you finish it in your own time and email me back with the solution. So I did. I did some research and understood it and had a solution. He asked follow up questions and then I get rejected. I will from now on reject companies that do LeetCode questions OR if they do Codility/TestDome/HackerRank. Nope.
Good day, I cant find the link to the algorithm course you mentioned.
Your DSA course is on fire holy moly!
Where can i find it?
i solved 1476 problems on leetcode (Rank 2,270). But there's still type of problem patterns which i find hard to tackle, such as problem 432.
i programmed on whiteboards - i think its much more common to code on programming apps where I care about variable names etc. On a whiteboard short names matter -- on a whiteboard often youll run out of space and have arrows going all over, it turns into a nightmare to follow really quick if you dont plan your writing space well. I feel whiteboarding is not common now post covid with interviews being online - although i guess copy paste AI answers is going to be a potential problem.
Learn as I go is my approach here, reading a book about algorithms before even starting LeetCode is a good way to become demotivated
I use stackoverflow monthly. 50% of the time its to answer the question "How do I search the text of all stored procedures in the database" because im trying to figure out everywhere we are referencing a specific column
Where can I find the link to the free algorithm course mentioned in 6.32? Thank you in advance
I have never ever ever had to do a binary search in my life!!
Doesn't mean some else didn't have to
@@gandalfthegrey2777 Yes, true. That was not my point though. I do not think its a must to know in real life. You would know if you need it, I guess.
Yeah but data structure like binary tree are cool to learn but never implemented in my life
@@eunesshshahithakuri7047 never implemented but you use it all the time using a language api
I've implemented it once. I pulled in data from a crypto website and each coin/token started it's data on a different day. So I just picked the first day the company existed to check and then used binary search to find that first day where the data started flowing, for each token. So far the only time I've implemented it.
this guy is hilarious lmao first funny programmer channel i've seen
Who has the link for the 9.5 hour algo course? I don't see it in the description
the IRONY, my guy talking about DSA and then reprints everything from the start @4:30
Where’s the link to the dsa course?
I'd add to use a language that has a lot of shorthand built in so you can code faster. Like Python and their list comprehension. Nice to be able to transpose a matrix in one line of code.
Hey man where's the algo free course link?
For simple questions, I suppose it’s better to ask ai than searching anywhere else like stackoverflow. In 99 of 100 cases it perfectly gives you a simple example and brief explanation that’s enough to proceed further on your own. Another option is to look at docs, but sometimes it just takes a bit more time to find what you need than ask ai.
You also don't have to deal with some egomaniac being like "Simply... blah blah." and treating you like a dumbfuck for not finding a necro thread from 5 years ago on the same topic.
@@ezpk-true. Sometimes it really annoys to get extremely stupid “assumptions” about the problem on stackoverflow.
Being an Indian I can see where this rat race is coming from, here we are nurtured as bookworms and for all sorts of tests. So most of em fall into this trap instead of finding their own path, which in turn is the much easier option!
Y'all need to chill and reproduce less my niggah, you can't live a good life with so much competition. Africa's next => the competition there will be 10x India and Salary will be 10 times less than India.
BASED
Does anyone actually implement dynamic programming, binary search, or advanced concepts at their work?
Where is the link for algorithm course he is talking about?
where is the link to the free algorithms course??
Wait, isn't knowing FizzBuzz enough?!
I wonder how these people have so much time and how companies consider this a good approach. Do you guys work or do you login to work and then do a new endpoint edit to add a new field to table A on Monday, proceed to ignore the backlog, and open leetcode and do that for the rest of the sprint?
What is the link to the free algorithms course mentioned 6:34 ?
I have finally written a linked list in Rust. I have a clone, and a map, and as ref... so not clean. But I am far from sure how clean it could even be. I'm going to redo the DS and Algo first 13 chapters (through red black tree), now in Rust instead of python... (which that was cheating). Oof will be hard, but I will learn a lot
Where is the link to the free 9 hours algorithm course?
you're good and crazy bruhh!
People should read introduction to algorithms, its a great book and gives you the mathematical foundation for how they work
The only problem with doing interviews at places you don’t want to work at just for practice is that you will waste time of other people. Hopefully they will also train together with you to conduct them even better next time so maybe not complete waste, but they won’t get anything else they are hoping for unless you discover that it’s actually a decent place 😕
"finite automaton of Leetcode problems" really caught me off guard lol!
Where and how do you regularly study algorithms?
Where was this channel before it's literally a gold mine for programmers to find your channel ThePrimeTime.
app architechture/infrastructure is way more important than algorithms in most situations
Yeah in my opinion it’s good to know dsa from the theoretical side but in real life it’s better to learn some cloud services or design patterns
where is the link he mentioned will be included in the description the @ mark 6:33! Would love to study it! Thanks in advance.
Is this the guy that works at that Netflix startup™?
Love the content. The Dr.Disrespect of programming world xD
No link in the description :[
where is the link WHERE IS THE LINK???? the free course is on frontendmasters i think
never seen prime so upset when someone mentioned copy-pasting from stackoverflow
Signed up for the Frontend Masters Bootcamp, but don't see any free algorithms course. Please share it, ya know - between diaper changes :P
Yo where is link to that course??
where the course ? i am trying to learn algos cause its about time before i just keep doing projects. since i am too young to get hired i do projects since its fun and entertaining and in the short term programming is a hobby not a job for me.
is this a re-upload? i was searching for this yesterday and I didn't find it WTH??
He did not put it in the description, no one is suprised.
end the sentence with deeznuts or he'll never read it
Frontend Masters "The last algorithm you will ever need" .
Its on frontend master
It is similar to working in higher level languages making you better at programming in lower level languages. Knowing about leet techniques can make your normal code better.
Where's the free algorithms course link?
Anyone know the link for the free algorithms course?
How can i fix the me problem? Its not fixable its impossible to remeber all the APIs
where's that 9 and half hrs algorithm course link?
no way I remember a single search algo and ive been coding for 30 yrs :).. wow them leetcode ones are difficult to be honest.
New here. So The Primeagen is the Dr. Disrespect of programming. Instant subscribe.
Thank god for subtitles.
Good advice dude