19 ms·
A guide to learning algorithms through LeetCode
- Hackbraten 6y agoWhy is the title censored? As a European citizen, I absolutely don’t get it. Why can’t we say fuck on the internet?
- VitalyAnkh 6y agoJust personal preference. I made this title by myself other than censorship. Anyway, “fuck” sounds a little rude.
- tmpmov 6y agoThanks for the write up and git book. Related question: I’m curious if any has game-ified algorithm learning, sort of like those old educational math games targeting certain grade levels. Might be cool to make a point and click adventure centered around dynamic programming or greedy algorithms.
- ghj 6y agoThere are plenty of competitive programming sites where you can grind rating just like you would for MMR rating in video games. For example CodeForces, AtCoder, TopCoder, and even LeetCode have rated contests
- tmpmov 6y agoThanks ghj. I was aware of top coder/leet code, though hadn't heard of code forces/at coder. For me the adventure game give a bit more concept linkage. Take Monkey Island, I can remember how to reply to many of the sword fighting insults, or what was needed to get pieces of eight via the cannon at the circus. There's something to be said for linking problems via a memorable story, giving examples and meaning from multiple angles helps retain the content over the dryness of problem prompt/quick solve.
- shahbaby 6y agoUsually when you try to combine education with gaming, the result is something that's not very educational and not very fun.
- barry-cotter 6y agoIt can be done, see Dragonbox Elements or Dragonbox Algebra.
- zodiac 6y agoFor me, codeforces is fun the same way chess is fun. Yeah, the mechanics look dry on the surface, but lots of variation under the surface, and lots of chances to link concepts by having an aha moment during the contest or afterwards in analysis.
- agustif 6y agohttps://codecombat.com/ https://codecombat.com/
- person_of_color 6y agoIs this evidence of the 996 culture?
- mjburgess 6y ago996 is a universal culture. People who wish to master a skill on their own time are simply pursuing an intrinsic (/identity-based) goal: here, excellence in computer science.
- flak48 6y agoEvidence of Leetcode culture more than anything
- throwaway_pdp09 6y agoFYI https://en.wikipedia.org/wiki/996_working_hour_system https://en.wikipedia.org/wiki/996_working_hour_system "The 996 working hour system is a work schedule commonly practiced by some companies in the People's Republic of China. It derives its name from its requirement that employees work from 9:00 am to 9:00 pm, 6 days per week"
- cheez 6y agoLooks more like tech interview culture.
- nickx720 6y agoThis is really sweet. Thank you kind sir.
- TACIXAT 6y agoThis is really cool. What order are the chapters in? Seems intense to lead with dynamic programming.
- OnionBlender 6y agoI got really good at dynamic programming problems but then none of the companies I interviewed with asked me a dynamic programming problem. These were large tech companies and well funded startups. Perhaps it was just luck.
- bradlys 6y agoPartially luck and maybe you never solved it with a DP solution. There are problems for which DP will give an answer but it isn’t a hard requirement for you to come up with it. I’ve received quite a few DP problems in my time interviewing. Then again, I feel like saying I’m unusual. I’ve received a lot of very difficult problems. Almost like the people are trying to set me up for failing. ;)
- jorblumesea 6y agoDP solutions were really in vogue for awhile, and seem to be asked less now. I heard a completely unsubstantiated rumor that FB found them to cause high false negatives because they're such a tricky and specific problem type. Also, once you know the "one trick" to solving them they don't help illuminate candidate thinking.
- lewapkon 6y agoQuestions with DP solutions are usually not particularly great for interviews. They usually don't have any solutions in-between brute force and DP. If somebody doesn't come up with a DP solution you, as an interviewer, just learned that they don't know DP, but it doesn't give you too much useful signal on the candidate's skills. DP is just kind of a trick that you can learn to solve this specific type of problems, but knowing the trick is not something that FAANG companies want to test for.
- ummonk 6y agoI tell interviewees to practice some dynamic programming problems because dynamic programming questions are the least intuitive, and it's good to be prepared in case that's what you get asked. For the same reason though, I think they make for terrible interview questions - very much dependent on knowing a specific "trick" that doesn't actually come up often in day to day coding.
- paulcarroty 6y agoFound in my bookmarks: https://leetfree.com/ https://leetfree.com/ Not sure if all quizzes are original, but some of them looks interesting.
- fizixer 6y agoCan anyone explain/interpret what leetfree.com is saying here? > ... don't try to solve it with online judge ... > ... Try to learn from the solutions we provided as quickly as possible ... > ... Interviewers only care about your WhiteBoard communication skills ... Are they implying that rote memorization (memorize all problems and their solutions) is the best/easiest way to do the interviews? If yes, wouldn't that trip you up the moment you're asked something new/original? If no, what are they saying? Is the best leetcode stuff paywalled and they're providing a free version? what's the latest on step-by-step most effective way to get ready for standard coding interviews? Context: I'm trying to get back into this after many years. I've used leetcode in the past but don't remember anything about online judge.
- hackermailman 6y agoOnline judge is competitive programming like https://open.kattis.com/ https://open.kattis.com/ or CodeWars or CodeForces meaning a server that takes your source, compiles and runs it, tests if you satisfied all the req of the challenge. There's books for this https://cpbook.net/#CP4content https://cpbook.net/#CP4content and despite leetfree claims of being 'useless because no online judge in interview' there is actually 2-3 judges sitting there in the interview performing the same function, telling you if your code does not satisfy the problem requirements
- OnionBlender 6y agoFirefox says, "Warning: Potential Security Risk Ahead" for that website.
- drenvuk 6y agoNice how browsers have trained people to be scared if there's not a lock. It's just an expired cert, not revoked, and you're not entering payment information.
- bohemian99 6y agoI haven't seen gitbook before, is this a common tool for documentation?
- mettamage 6y agoOccasionally you see a gitbook on HN. It is mostly for well... books and educational content.
- deleted 6y ago[deleted]
- deleted 6y ago[deleted]
- doc_gunthrop 6y agoAll the items are taken from Leetcode problems, but for the vast majority of them the author (labuladong) does not give attribution. There should at least be a link to the related Leetcode problem for each section.
- pcestrada 6y agoCan you imagine having to learn all this just to make a connection to a database, process some data, and then persist it somewhere?
- tourist_on_road 6y agoBut it might come handy when implementing - route optimization problems - Building database query optimization engine You can argue that not everyone is implementing these from scratch every day. But it could be argued that given an opportunity, an engineer should have the skills and ability to build these systems.
- jkachmar 6y agoBullshit. It has been my personal experience, and the experience of many people I’ve spoken with, that this kind of trivia is learned in order to get a job and then forgotten immediately afterwards because it’s useless. Anecdotal example: a former colleague is an incredibly talented systems programmer and has had to study leetcode garbage for the last few months in order to feel qualified to interview for a position with a team that he had previously been on at an older employer. As another commenter said elsewhere, these types of questions are used because they’re legal proxies for “IQ tests”, and because they filter for people who are willing to sacrifice much of their personal time for the sake of the company.
- biztos 6y agoI don't think the knowledge is useless as much as it's properly abstracted away into core libraries for 99.999% of the real-world use-cases. Maybe the questions started as "IQ tests" (or a proxy for "fresh out of a Stanford-like CS Program?") but my impression is that now it's a mild (or not) proxy for hazing. "I suffered through this crap and by God you are going to suffer through it to, or you can't join my little club, and by the way I just make a hundred dollars telling you that." Edit: clarity & speling
- jkachmar 6y ago
- digianarchist 6y agoIt's becoming obvious to me that my time is better spent learning to solve these riddles rather than actually becoming a better developer. I have a job search coming up at the end of the year and whilst I've managed to largely avoid companies that ask this type of question, I believe it's seriously constraining my career. I can't speak for everyone but the whiteboard interview has prevented me from leaving jobs earlier, moving jobs more frequently and left me avoiding certain companies altogether.
- grumple 6y agoI wonder if that isn’t the point, to increase developer retention and reduce competition for devs.
- rightbyte 6y agoIt would be a "tragedy of the commons"-like effect for companies that don't adhere. I would guess that is just an unintended effect and that there is no master plan behind making recruiting expensive, slow and inaccurate.
- jdietrich 6y agoOr it's part of an organised cartel between the major SV employers to reduce salary competition and employee turnover. https://en.wikipedia.org/wiki/High-Tech_Employee_Antitrust_Litigation https://en.wikipedia.org/wiki/High-Tech_Employee_Antitrust_L...
- rightbyte 6y agoI am not ruling out the possibility that there is a "recruiting should be hell" cartel but I believe there is no general bad bureaucracy HR bloat cartel and that it is an unintended effect, hazing, esprit de corps, HR self interest etc. The conspiracies are probably more simple like "no poaching" or wage cartels?
- an_opabinia 6y ago
- OnionBlender 6y agoA good free algorithms book is http://algorithms.wtf http://algorithms.wtf (by Jeff Erickson)
- unemphysbro 6y agoI took his class way back in 2010. Challenging but fun.
- bradlys 6y agoGosh, I don’t enjoy that there is so much competition in this space. I can’t compete against people who essentially seem to have no life or other interests than getting job at Big N (or enjoy competitive programming). It feels like this culture has ramped up in the last 5-10 years. When I started interviewing, the questions were easier. It feels like they’ve gotten more difficult - or at least the answer the interviewer wants is less attainable. And I feel like I know why - go look at the leetcode discussion forums. There’s almost always some post at the top saying, “I did 1000 problems and won’t stop. I got accepted/rejected and learned so much. Believe.” From the outside and inside, it looks like a cult. I feel like these folks are just making it worse for everyone. Maybe I am just bitter because I’ve passed every mock interview I’ve done but I can’t get an offer from Big N still. Startups are the worst as a non-founder/non-executive.
- deleted 6y ago[deleted]
- PragmaticPulp 6y ago> I can’t compete against people who essentially seem to have no life or other interests than getting job at Big N (or enjoy competitive programming). Interview prep doesn't need to be a grind. One of the nice things about Leetcode is that the problems are bite-sized. You can do one or two per day on your lunch break and make a lot of progress in a matter of months, or even weeks. Don't approach it like a cram session before your interviews. That doesn't work unless maybe you're a new college grad with no other obligations. > go look at the leetcode discussion forums. There’s almost always some post at the top saying, “I did 1000 problems and won’t stop. Obviously the Leetcode forums are going to be a hotbed of discussion about Leetcode. You have to keep in mind that many of those people are entry-level developers treating this as an extension of their education. For them, it's basically a miracle that a mostly-free website lets them practice for interviews for $200K-300K+ career paths from the comfort of their web browser. Compare that to just about any other high-paying industry, where getting the right education, credentials, certifications, and test results will take years of your life and potentially hundreds of thousands of dollars of post-secondary education. We really have the easy end of this deal. Don't let the total number of Leetcode questions overwhelm or discourage you. It shouldn't be approached as a cram session before the interview. It should be approached as a consistent habit or practice over a longer period of time. If you just don't want to do any Leetcode or whiteboard interviews, that's fine too! There are plenty of jobs out there that won't require any of that. However, you can't have it both ways: Big N salaries come with a high barrier to entry. All things considered, spending 50-100 hours of your free time solving problems on a free website at your leisure is really a small price to pay.
- agentultra 6y agoI find this little sub-industry building up around, “the coding interview,” to be highly strange. Where are the papers that correlate this niche, specialized skill to general job performance and productivity? I get that at certain problem domains the asymptotic complexity becomes a baseline for performance so I’m not against testing people’s knowledge where it’s appropriate. But is it really the dominating skill? Reading some of the comments of people who went through the pipeline of this cottage industry, it sounds like it’s not even useful after you get hired. In fact optimizing for it to get through the interview sounds like a bad idea! Imagine landing the job and having no other skills. I’m curious how these algo expert/monster/crushing the interview businesses survive and perpetuate this highly competitive environment.
- PragmaticPulp 6y ago> Where are the papers that correlate this niche, specialized skill to general job performance and productivity? I would love to read this research if it existed in the public domain. However, much of this comes down to trade secrets and business practices. It's also not very amenable to controlled studies. Practically speaking, these companies have a lot at stake in their hiring process. It's strange that so many people are convinced that the Big N companies are shooting themselves in the foot or otherwise making poor decisions with these interview processes. Leetcode-style interviews might not have supporting research in the public domain, but absence of evidence is not evidence of absence. That is, just because the research doesn't exist doesn't mean that the Leetcode interviews are bad or worse than the alternatives. Even if companies did eliminate Leetcode-style interviews, they have to replace it with some other alternative. Most of these criticisms fail to suggest actual replacement interview processes.
- thewarrior 6y agoAnonymous google employees have claimed in HN comments that google has data showing that these interviews do “work” whatever that means. Can any of you post more info here ?
- masterphilo 6y agoOn your last point, the best alternative I've seen is take-home projects where it would take less than a week to complete. The interviewer is free to frame a problem in a way that allows the engineer to apply their real-world experience and show their fit for the job. It removes all the variables around interview stress/anxiety and as a result is a better (but not perfect) indication of their performance.
- Gummaluri 6y agoTemporary comment for following and future retrieval of this post.
- Stratoscope 6y agoImagine what would happen if everyone did that! Some practical advice: HN has two ways for you to do this without cluttering the discussion. You can simply upvote the post, or you can favorite it. Both of these lists are available at the bottom of your profile page: https://news.ycombinator.com/user?id=Gummaluri https://news.ycombinator.com/user?id=Gummaluri Be aware that favorites are public, while your list of upvoted posts or comments is private. (View your profile page in an incognito window to see what the public sees.)
- deleted 6y ago[deleted]
- deleted 6y ago[deleted]
- didip 6y agoIs there a list of companies that purposely not use Leetcode in their hiring? Someone should make one.
- digianarchist 6y agohttps://github.com/poteto/hiring-without-whiteboards https://github.com/poteto/hiring-without-whiteboards
- ammanley 6y agorepo name is on point
- deleted 6y ago[deleted]
- wisecoder 6y ago16+ years of experience and won several awards and designed multiple highly scalable systems in retail. Still cannot get into faang. These coding interviews gate keeping me..
- dkarbayev 6y ago9 years of experience, used LeetCode for preparation for two months (solved around 200 mostly medium problems) and got an offer from FAANG. Coding challenges at FB and G are not that hard nowadays.
- bobblywobbles 6y agoThank you for your guide. I do apologize in advance, but this tutorial, like others, simply goes into the _what_ to do and doesn't explain the _why_. Forever math will be about memorizing these "tricks" and not understanding it intuitively - can someone please help offer some suggestions to me?
- meow_mix 6y ago"fucking algorithms" such a good repo name tbh.
- Unklejoe 6y agoEdited to remove
- pheug 6y agoSorry for stating the obvious, but money is a pretty big reason to continue doing leetcode style interviews. Most high paying employers ask them. Out of curiosity, how much does your no-leetcode job pay? Is it at least $200k? > If it comes down to it, maybe I’ll move into hardware design. Hardware jobs generally pay less than SWE, you'll lose even further on the monetary aspect.
- deleted 6y ago[deleted]
- croh 6y agoI am a self taught programmer (python). I learned things because they required to solve some problem. You face problem and then you find solution. I used to solve puzzles in childhood for competative exams. But now as adult, it is very difficult to connect with imaginary problems which you never deal in day to day life. It makes me feel empty - learning something to just get a job. Recently I picked up interest in OS because I started to notice my limit with application programming. I learn to write comments and importance of git, after working in startup where you keep wearning thousdands of hats daily and forgot what code last week. And I feel this is very organic approach to learn. Being on both sides of table, whenever I conduct interview I just ask simple programs to do (mostly fizbuz) and try to gauge candidate passion by understanding projects s/he worked and problems faced. If candidate passes fizbuz, I believe s/he has basic understanding of logic. Other things can be thought easily if candidate has passion. I have friends in university who only talks about algos but can't write single line of code (I am not blaming them, it is just their field doesn't require intense coding. What i am trying to say here is, writing good code is like craft. You need to write actual code to excel in craft. Solving leetcode problem successfully doesn't imply you can write good code automatically). Last time when I switched jobs, I studied couple of algos and now I forgot them. I am again switching and thinking to start with leetcode. The biggest problem in industry is hype. These days even small stupid IT shops are asking for hackerrank test with full stack developer. Lot of focus is still on memorization and hype.
- throw1234651234 6y agoWhat language should you grind leetcode in for FAANG? Or does it honestly not matter. Like C# or Javascript, for example?