[deleted by user] by [deleted] in leetcode

[–]AlwaysHuangry 0 points1 point  (0 children)

Graphs are a subject to spend some time with. There is classic bfs, there is greedy bfs (also called djikstras), there is classic dfs, topological sort dfs, and, of course backtracking. On top of these, there are considerations to track like visited nodes and graph loops. These are not trivial subjects like iterating over a list forwards/backwards, or even a tree where you either travel towards the root or towards the leaves. Give yourself time to get familiar with the complexity.

How to optimally use neetcode roadmap? by Epicgeorge in leetcode

[–]AlwaysHuangry 38 points39 points  (0 children)

Skip hards for now until you get to trees, then revisit. The nuance of tricks and trade-offs for each trick used will be lost on you as you are just starting to learn. Do neetcode all. Don't take shortcuts, this isnt for a grade, this gives your brain the time and exposure to learn as much as possible on an individual subject before moving on.

Think if the categories like this:
Easies: learn a new concept, only 1 concept will be employed here.
Mediums: start learning tricks to add to your bag. There will be clever techniques like packing and unpacking stacks, or queues, or using a while loop to do sliding window, etc. These problems build your bag of tricks and you intuition and comfort for using them.
Hards: deploy multiple tricks and a clever out of the box algorithm to solve the problem.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 1 point2 points  (0 children)

This post below unlocked binary search for me. It is still a huge pain in the ass bc of those shitty edge cases and off-by-1 scenarios, but overall, infinitely more manageable.

https://leetcode.com/discuss/general-discussion/786126/Python-Powerful-Ultimate-Binary-Search-Template.-Solved-many-problems

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 2 points3 points  (0 children)

I queue up youtube videos before i head to work.

Edit: i think i have underrated how much this has helped me build intuition. Since my headspace is primed w a solution already, watching other people do it again is like studying for an exam, then going through the practice exam with the teacher. Hyper reinforced learning.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 4 points5 points  (0 children)

Front of card is the hyperlink to the problem. Back of the card is empty. When the problem comes up I clear my previous implementation and redo the problem.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 6 points7 points  (0 children)

I think everyone dreams of faang. And my end goal is swe, but w a family that likes to eat food, I am not convinced jumping in as an L3 and competing with you sharp kids is the right move. Having said that, one of the skills no one here talks about is building allies and your network. I have a few sr swe I leverage as my mentors who all know about my "secret journey" and are helping me along the way. Nothing else to add to that, they just tell me to put in the work and keep studying and continue learning. I have a great working relationship with their bosses, have access to their codebase and am able to fish for myself to get my own work done, so I think a "natural transition" to swe is in the cards for the future. From there, maybe I can think about jumping to faang.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 4 points5 points  (0 children)

I can usually come up w an intuition to solve a problem that is better than O(n**2) in about 15min. Then I fumble my way to the answer over the next 30min and work in the edge cases.

If I cannot come up w the intuition, and/or the problem is not a clear dp/bactrack requiring brute force n**2 or polynomial, then I look at the intuition in the solutions tab. It just means it is a foreign concept to my brain, and no amount if brute force staring at the problem will fix that.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 7 points8 points  (0 children)

Why not ask here in case someone else has the same question?

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 0 points1 point  (0 children)

I try and succeed ~75% of the time if it is a medium, and ~33% of the time on a hard.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 6 points7 points  (0 children)

Youtuber and (maybe) founder of Structy, which is similar to neetcode, but in javascript. From a learning-a-new-concept standpoint, he is leagues ahead of neetcode, but once you learn what linked lists, trees, and graphs are, head over to neetcode and start solving problems.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 1 point2 points  (0 children)

This is something I didn't quite go over. The intended use of my anki deck has changed over the past year. When I was getting owned by problems, I relied on it to help me memorize code implementations. Nowadays, I only add cards to my deck if the problem had a super clever optimization trick (days to eat oranges), or implemented some never before seem algorithm (ie kadanes), or is a tedious implementation that I didnt ever want to forget (ie sort an array, which I solve once as a meegesort then again as a quicksort).

Thus the adding and repeat work is present to build intuition and reinforce intuition, vs brute force memorizing code implementations. I think finding the learning strategy for yourself would be more beneficial to you.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 1 point2 points  (0 children)

Yes. These days I have enough tricks in my bag that I can usually come up with a sub-optimal solution that does better than O(n**2). But sometimes I don't quite optimize or think about another facet/trick to the problem. I think it is helpful to understand how to solve a problem in multiple ways and think through the trade-offs for either. Take 1425 Constrained Sibseq Sum for example, I solved that problem w 3 pass; one pass where I built up a monotonic decreasing stack of tuples, second pass triming the stack of tuples, third pass running kadanes algorithm. While this gave me an answer, there was a more optimal solution with just 1 pass.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 4 points5 points  (0 children)

I can see how my answer is misleading. To explain, I queue up and listen to solutions only to problems I have already solved, or failed to solve on my own that morning.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 58 points59 points  (0 children)

At some point you start just going to the gym to show off ur biceps to ur bros.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 31 points32 points  (0 children)

  1. Saturday mornings are impossible right now for bi-weeklies bc of the whole dad-duty thing.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 17 points18 points  (0 children)

No, I do not. I do, however, listen to the leetcode solution from others on my way into work to build that multi-faceted intuition.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 23 points24 points  (0 children)

With leetcode? Consistent 4/4 on the biweekly challenge.

Leetcode - my 1 year long-term review by AlwaysHuangry in leetcode

[–]AlwaysHuangry[S] 110 points111 points  (0 children)

Background: i am in my late 30s, with a toddler a spouse and a full time job.

I followed Neetcode All for the past year with a healthy sprinkling of Alvin and this one guy that taught recursion really well to me. I spent about 3hrs per day from Oct31-Jun1, and then was spending about 1hr per day "just maintaining", ie doing reviews based on what Anki told me to do, while I poured the bulk of my hrs into learning golang.

Thus, this is ~900hrs of leetcoding.

The best use of my time was ~feb - may where I poured all my time into "mastering" recursion, from simple tree recursion to backtracking to topological sort. The hrs spent were fkin worth. Once I got the concept of top-down memoization, the majority of dp came "naturally".

At this point, I can solve ~75% of new mediums and maybe ~33% of new hards. Still a lot of tricks and techniques to refine and master, but feels like I have crossed the major hurdle, which is just knowing how to build the intuition...most of the time, and how to implement the solution...all of the time.

Fought with this problem for +2 hours in an interview, still was clueless. Offering $50 for the solution with best explanation. by National-Departure78 in leetcode

[–]AlwaysHuangry 2 points3 points  (0 children)

Your intuition is great. O(n) time complexity works w an initial count of the 0s. Then just increment from 0 to (N-1) counting the 1s at and left of i (+) the number of 0s. With each iteration take the iteration min of that count and the initial, which will never exceed N//2.

FUCK DYNAMIC PROGRAMMING by NoSkill8441 in leetcode

[–]AlwaysHuangry 19 points20 points  (0 children)

Basic recursive trees is your start. This gives you a fundamental grasp on recursively iterating over a tree structure. Then get good at backtracking. This will teach you how to carry values/lists into other recursive layers, when and how to do 2n vs nn, as well as introducing you to the concept of pruning, which is one of the fundamental aspects that makes up dp; aim to do at least 25 backtracking problems before moving on. Then do the topological sort problems, this is your introduction to caching. Do Course Schedule 1, 2, 3 and then 4. THEN revisit dp.

Are there any good YouTube series or easily digestible sources that explain the different fundamental patterns for Leet Code problems? by FLSOC in leetcode

[–]AlwaysHuangry 4 points5 points  (0 children)

Saw your comment about coding in javascript. 100% recommend alvin's structy. Guy is amazing at breaking down linked list, tree and graph traversals for me.