#Nox's path to getting gud at LC.

661 messages · Page 1 of 1 (latest)

polar plinth
#

Moving onto https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/ going to bookmark this for now. Didn't even know where to start so I peeked at the breakdown of the answer but not the code itself. Going to draw this one out. Only 8 more questions to go until i've done everything on the easy list. I'll have to cycle through again but i'm hoping I can solve 2-3 a night to make sure the patterns stick and then do random easys to see if I can apply them in the wild.

#

Maybe more if I hit a good streak but I don't want to re-enforce remembering code but instead remembering patterns.

#

Spend a few weeks doing wild easys not on the list to see where i'm weak then move onto mediums and start the grind all over again but with mediums.

#

Rinse and repeat until I can do mediums reliably in about 45 minutes which is my goal.

tropic knot
#

Doing your old problems two weeks later is really valuable.

#

You forget the code but can still remember the concept.

#

Sounds like you're doing it right though.

polar plinth
#

Know the approach for the bookmarked question. Need to leverage binary tree properties. If both target values are to the left of the given root node then we navigate to the left of the tree. If both values are to the right of a node we navigate to the right. If the two target values are split and one goes left and one goes right then the current rood node is our LCA.

#

However I didn't get to do any coding on this I had to spend some time on work and do some revisions for https://leetcode.com/problems/average-of-levels-in-binary-tree/ wrote down the pattern for this. Also feel like i'm forgetting patterns associated with binary search. Going to go over notes and try to get 3 net new problems done tomorrow.

#

Total 9 (missed a problem on my sheet) problems left until done with initial pass of list. Trying to get finished up by friday so I can spend the weekend trawling through and revising based off patterns. It's been multiple weeks so I shouldn't have any memory of the code.

polar plinth
#

Guess this means i'm good enough for google

polar plinth
#

Worked on 3 problems today:Lowest Common Ancestor of a Binary Search Tree, Subtree of Another Tree, then Invert Binary Tree. LCA I kind of cheated at because I knew the solution by looking at it's description so i'm not counting that. Subtree of another tree I had to look at the solution for help but inverting the tree I got on my first time.

#

I'm realizing I need to warm up a little bit it feels like because I misread the second question and that caused me a ton of issues. Going to make a note to try and read the problem out and draw out a basic example until my brain can not go into self doubt as soon as I see a problem i'm not 100% familar with.

sharp swift
polar plinth
#

Thanks @sharp swift i'll read this and try and see if the concepts help me out. Didn't do LC today. I ended up passing out on my couch for a nap after work. I'll pick this back up tomorrow and see if I can solve a few this weekend.

polar plinth
#

Nothing much to report. The weekend and today were pretty busy and I couldn't bring myself to work on this. Going to get back onto the grind on Tuesday.

polar plinth
#

Finally finished all the easy questions. Don't know why i'm so bad at estimating how long it will take. Honestly that's pretty frustrating. Now the trick is to go back through all of them to see if the patterns have sunk in at all. My guess is i'll have mixed results. If this goes badly i'll reevaluate my strategy because I can't be wasting months on a method that gives no results.

#

Ideally my goal is after "phase 0" of going through all these once I shouldn't have anymore "timeouts". Meaning in the initial 15 minutes of a problem there should be much fewer problems where I can't think of any solution at all and I I have to look at the solution on LC in order to move forward. That can't be 100%. I'm not going to set myself up for failure but i'd like to remember at least 75-80% of the patterns. I feel like that's fair.

#

Meaning that if there are 32 easy problems with patterns for me to learn. I should be able to get about 27-29 of them right or mostly right without timing out.

#

If that works i'll study the ones i'm weak at. Get those patterns into my bones. Then i'll begin the process of trying to do "wild" easy problems not on my list and try to apply the same thought processes.

#

Going to spend an hour or so on this now and then take a break. As always i'd like to do 2-3 hour study blocks a night.

tropic knot
#

I think you will find that you will learn more by exposing yourself to similar patterns.

#

With different questions.

#

Notice on LC.com there's a folder marked "related questions."

#

Maybe do a related question for all those questions.

polar plinth
#

Ok yeah i'll try that. @tropic knot do you think it would make sense to do the original problem to see if the pattern hit then try a few of the related or just jump right into the relateds?

tropic knot
#

What's most important is to figure out what works for you.

#

The internet has a mountain of advice, everything 5 different ways.

#

Some people have a timer and a cycle where they do two new problems, 1 old problem, big excel spreadsheets.

#

And they repeat old problems on a two week gap.

polar plinth
#

I guess that's sort of what i'm doing now. It's been at least several weeks since i've seen the beginning of the list.

#

But I can't tell if i'm remembering the pattern or a solution.

tropic knot
#

Try Pramp.

#

Explaining problems to people on Pramp and not getting tongue tied was a great experience.

#

The standard is very relaxed so you'll do fine.

#

Try whatever works, as long as you are doing a mix of old and new problems you'll be good.

polar plinth
#

What's Pramp?

tropic knot
#

It's like #mock interviews but more casual

polar plinth
#

Oh man maybe i'll wait until I see how I do on these old/new problems first.

#

I'm really not in the mood to spiral out if I can't preform at all.

tropic knot
#

IMO I think it's important to try it and see if it works well.

#

You're cleverer than the average LCer I wouldn't want you to underestimate yourself and go too slow.

#

Seeing the general population on Pramp you'll realise this discord is another world kinda. Lotta people on there I see will never make it to a big tech company in a million years, it gave me a ton of confidence. ||Just like me if I don't start applying||

#

You'll figure it out regardless, you're on track super well Nox.

polar plinth
#

Started doing random easy questions from the related questions. I'm trying to keep it bound to easys for now. Running into a weird issue where some of the problem categories seem super easy? Was it the acceptance rate that indicates how often people solve these? In any case my pattern is as follows:

#

Do a problem from my original list to see if the pattern has stuck. Some of these I haven't done in a long time so I feel that's OK. Then if I can solve it I go down the path of doing others in a similar category. Arrays, Backtracting, DFS/BFS problems etc.

#

And I try to stick to a specific group or topic that week.

#

Then I try to piece out patterns and tricks from wording to help figure out how to solve other problems.

#

Usually with notes to record thoughts organized by the type of problem.

polar plinth
#

Time for bed, knocked out two wild leetcode problems doing bitwise operations. Still kind of shaky on this so i'll focus in on it. I'll know how to solve a problem but then the application messes me up.

#

Two is kind of low, so i'd like to bump it up. I'll see how I feel about it in the morning.

sharp swift
#

2 > 0, keep it up man 👍

polar plinth
#

Not too much progress here. Stuck on a problem https://leetcode.com/problems/find-the-duplicate-number/ it seems like a bit manipulation question and I know the fact that the the array contains n+1 ints and is in the range of 1-n matters. Going to get some rest and try again in the morning.

#

Xor operations help me find singles in a an array of duplicates. I wonder if the inverse can help me find a duplicate in an array of singles?

#

I'll play around with it in the morning. This feels like it belongs in the cracked category. Im either going to solve it by playing around on paper with it or be stuck on it for over my 15 minute timeout period in which case i'll look at the answer

polar plinth
#

Ended up giving up on the above spent like an hour and had nothing. The bitmask solution turned out to have been something I would have never had gotten gun to my head. Neat thing is that you can reduce this to a linked list problem and use the same method that's used to detect which node a linked list cycle starts.

#

Problem has like 6 solutions and only two of the provided ones actually conform to the requirements of linear time, constant space and not modifying the array.

tropic knot
#

Bitwise questions are kinda optional

#

Depends on if you want a C role.

polar plinth
# tropic knot Bitwise questions are kinda optional

Yeah i'm not going to stress too much about it. I ended up doing some wild easy problems not on the list. I keep forgetting how useful graph theory is and how you can apply the same ideas to arrays. I had way more success with the easy problems so that's progress I used to struggle a lot more with them but i'm solving most of them within my time limits now.

tropic knot
#

It's kinda important long term

#

Knowing bitwise stuff is v. v. useful for proper embedded work if that is your jam.

polar plinth
#

Not really. I dont want to do embedded work. That being said I also don't want to screw up an interview at Google or Microsoft if they ask me a question that requires an understanding of bitwise operations.

polar plinth
#

Nothing to report for friday. Took the night off to go out. Going to try and do a few more bitwise operations from leetcode (easy level)just to round out the week. Then i'm going to do some more wild easys's (randoms from the top interview question list off Leetcode) and then start off on the mediums.

#

Going to go out again though so i'm going to squeeze in an hour or two of study before I start pregaming and getting dressed to go dancing. Not expecting too much but I want to keep the habit going to engrain it.

polar plinth
#

Nothing to report got stuck on easys again

tropic knot
#

Which easies?

#

It's good to focus on core problems, there's a lot of shit LC problems.

#

Maybe move onto graph traversal or min heaps, core problems, rather than lingering on say bitwise

polar plinth
#

Yeah I guess I got fixated. I started just doing random easys. There's a god awful amount of LC problems with garbage like/dislike ratios. I have no idea why they don't get pruned or re-written once they hit a certain ratio for a certain period of time.

#

I was doing the 2nd and 3rd layer of https://leetcode.com/explore/learn/card/the-leetcode-beginners-guide/679/sql-syntax/4358/ but I started doing an easy and I got stuck on https://leetcode.com/problems/find-the-middle-index-in-array/ and I coudln't figure it out and I got bummed.

tropic knot
#

Hmm?

#

What kind of a role are you going for?

#

I think you've gotten way off track

#

vs what you kinda want which is to go trees/hashmaps/graph into dynamic programming

polar plinth
#

Honestly my goal is to work for google. I've been reached out to by people from there and even with the hiring freeze they seemed ok with me defferring until next year.

#

I know i've said amazon before but I was just trying to level set. If I could wave a magic wand and just get into any high tier company that asks LC a lot i'd do that.

#

I just wana be good at LC to take the stress of finding a new job and shave it down a little.

#

So it goes back to the old. "Be able to solve any given LC medium question within 45 minutes" is what i'd like to see.

tropic knot
#

Week 6.

#

Just follow the guide. In fact, I'd suggest to stop doing this guide out of order, and just do every single problem one after the other.

#

Don't start revising until you hit the hard tagged questions. Just plough through.

sharp swift
polar plinth
#

Ok i'll follow this. After so long I feel like i'm well past the sunk cost fallaciy and into straight up denial that it's not working out so great.

#

@tropic knot just to be clear are you saying that i'd be around week six or that I should just start from the beginning? I think i'm already pretty much really familar withe very intro topic listed save for graphs.

tropic knot
#

Just do first question from week 6.

#

Then go from there in order.

polar plinth
#

Implement Queue using Stacks - week 6 - Done, took some time to remember the trick from college but it works. Moving on..

polar plinth
#

First bad version - week 6 - failed. Knew it was a binary search but couldn't figure out how to alter the algo to work with an array of functionally true false values. Spent over an hour on it. Calling it. Marking it for eventual revisions.

polar plinth
#

Ransom Note - week 6 - done simple. Add every char from magazine and subtract it from that map when you build the random note. Took 5 mins to knock out.

#

Going to just update on where I started and where i'm at at the end of my night. Don't want to spam the goals channel..

polar plinth
#

Summary for week 6 techinterviewhandbook.org started on Implement Queue using Stacks ended on Climbing stairs. Number correct 3/4. Missed First Bad version which is an obvious binary search. Need to mark flavors of binary search for revision.

#

Climbing stairs. Felt like I just remembered the answer. This problem screams recursion and after you hit the runtime limit you remember to memoize.

tropic knot
#

They're good questions aren't they?

#

You feel like you're doing the good stuff.

polar plinth
#

I think these cover the original blind 75 core patterns questions. Stacks, binary search, dynamic programming, hash maps.

#

At least these last four.

ruby mica
#

Bruh I just saw this after like 2 months and I'm legit impressed

polar plinth
#

A small victory I managed to get https://leetcode.com/problems/reverse-linked-list/ on the first try. I really struggled with this a few weeks back and haven't seen it since but I managed to brain it out by working out the pointer logic myself. I'm very pleased with that.

polar plinth
#

Summary for today https://www.techinterviewhandbook.org/coding-interview-study-plan/ week 6. Did Longest Palindrome, Reverse Linked List. Majority element. I'd say 2.5/3. I did implement my own code to solve longest palindrome but I needed a hint. I missed the fact that we don't have to use all odd numbered letters. We can pick the biggest odd numbered letter and subtract 1 from the rest and add it to the even pairs to get a palindrome. The logic is messy but the solution works.

Study topics and practice questions based on time left to prepare for Software Engineer coding interviews

#

Majority Element. Got this with a hash map. felt the fastest and more readable. There's a math algo to do this in liner time and constant space but there's zero chance you could brain this out on your own on the fly in an interview. Not going to stress too much over it.

#

That leaves 5 more problems for week 6 then onto the mediums in week 7.

#

Nervious about those because i'm more familar with the patterns that come up in these easy solutions. I've been doing pretty well but i'm concerned i'm about to hit a streak of big fat L's where I get 0/3 for multiple days.

polar plinth
#

Well I had two beers on an empty stomach so there goes my brain for the future. I'll log today as a break day and finish up my last 5 on Saturday and Sunday. Then monday i'll do the mediums.

tropic knot
#

You'd be surprised how productive it is

#

to study on a bad day and not finish the problem.

#

The most I've learnt is from spending three futile hours flailing away at a problem.

#

Because what I learn will probably be relevant to a different problem

polar plinth
#

Got stuck on adding binary numbers. I figure out an edge case and then another thing comes up. Remembered the basics from college where the addition is a XOR and the carry over bit calculation is an AND but other than that i'm slipping. I'll deal with it in the morning.

polar plinth
#

Actually I just stayed up and simulated it on paper and got it. The problem was in my carryOver bit logic. I never added an edge cause clause where if my two bits end up being 0 AND my carryOver bit is 1 then the carryOver bit needs to be set to zero because I just spent it in the bitwise addition round I did one line up.

#

So now it works and it passed.

#

But I did take 30-45 minutes to do an easy which is also no good considering this thing says it should have been 15. So it's a rounded off w not really a full win imo.

polar plinth
#

Summary for tonight: 1/1, diameter-of-binary-tree. Had to fiddle with the recursion logic on paper again but I Got it just within my time limit (I think?) I'm really going over the durations listed in https://www.techinterviewhandbook.org/coding-interview-study-plan/. This said it should take me 15 minutes, took me about 30+ minutes? Don't know how worried I should be or how I can correct for that. 3 more until I hit mediums.

Study topics and practice questions based on time left to prepare for Software Engineer coding interviews

tropic knot
#

Ignore it

#

Speed increases exponentially

#

More you do the crazier you get

polar plinth
#

Pretty good tonight 3/3. Solved the last three in about 20 minutes total. Remembered the patterns for linked list middle finding, the recursion patterns I picked up last night for Max Depth of Binary Tree, and contains duplicate is easy if you know what a hash map is. Moving on to Mediums on the 24th. Might attempt one or two tonight but im fine calling this one a win.

tropic knot
polar plinth
#

Not too much to report today. Spent some time studying data structure. Realized some items i've gotten a bit rusty at. Searching matrix's and max stacks are going to cause me some headache. Figured it'd be good to read up.

polar plinth
#

Nothing for today. Parents are visiting in the morning so I spent today cleaning up my place and making my apartment look like a grown man with his shit together lives there.

tropic knot
#

Might be good to find time in the morning before parents arrive. Consistency is extremely helpful.

polar plinth
#

Yeah, if I can get up early enough I might spend an hour or two on this.

polar plinth
#

Getting a bit late. Tentatively 0/1 for now. Stuck on some syntax for min stack. The approach is to just treat it like a stack of individual nodes that contain a min and a val where min is the current global min. This allows you to retrieve the min value in O(1) time.

#

Current implementation passed 27/34 test cases but there's a specific test case that tests for Integer.MAX_VALUE which is what i'm setting my globalMin variable in the class.

#

And it's screwing up the logic.

#

Need to think if there's another value I can set a globalMinVal to in order to keep track of the smallest number seen so far. Might be approaching it from the wrong angle. Maybe I can use the getMin function to compare?

tropic knot
#

Can't you just set it to None?

#

"If None, Val defaults to first value etc"

polar plinth
#

You can't in java.

#

I think the actual problem is that my globalMin isn't being properly updated once the node containing it is popped.

#

So what i'll do is on every pop call i'll update the globalMin.

#

It's like 2am here so I got to settle in. I'll try getting off work early and doing this so I can jump onto the other mediums.

#

Was a nice break though.

polar plinth
#

Got minstack done. I was just being dumb about how I store my min values.

#

Protip just check the top of the stack because that's going to be your smallest value seen so far.

polar plinth
#

Exhausted today. Another 0/1, stuck on https://leetcode.com/problems/insert-interval/ for now. I have some ideas about this i'll try tomorrow.

#

Little behind on this week's mediums. Need to try and do a few more to make my quota for the week.

#

Need to have a few nights where I do at least 2.

tropic knot
#

Getting stuck then doing them the next day means you're learning a bunch.

#

Seems fine.

polar plinth
#

Took a solid L 0/1 ended up looking at the solution for https://leetcode.com/problems/insert-interval/solution/ because I had nothing for 2 days and multiple hours of fooling around with a pen and paper. Absolutely nothing like my ideas. Moving on.

#

I'll study the solution and move onto the next question on my list.

#

Have absolutely no idea how anyone could be expected to brain the solution out on the fly.

polar plinth
#

1/1 https://leetcode.com/problems/01-matrix/ straight forward just do a BFS on the 2d array and count how many layers deep you are. You can just do the DFS on every cell to determine the closest 0 value cell.

#

https://leetcode.com/problems/k-closest-points-to-origin/ will do this next. Think it's just a priority queue? You figure out the distance to the origin point for each coordinate then based on that distance you add them to a priority queue? Think all you should need for this is knowhow on how to override the comparator.

#

Maybe use a hash map or a pair data type?

#

I think there's also a DP solution to matrix where you add up the values of the neighbor cells to get a distance which is a much faster solution. That's just something I remember but didn't actually implement.

polar plinth
#

As an aside before bed are these estimated times to answer questions even accurate? Should I be solving them in the time shown? If so i'm real behind because it takes me a few hours to solve one medium a night.

#

Dunno if i'm having a bit of silent failure there. I guess some speed is better than no speed but that doesn't really matter in an interview when I have 45 mins at most to answer a question.

#

I think I asked that before but as I hit these mediums it's coming back up as a concern.

tropic knot
#

They are fairly accurate for people who can solve them 100% of the time.

#

150-200 questions makes a much bigger difference than you'd think

polar plinth
#

Little stalled out right now. Doing some revisions on some of the medium problems because I feel like I just looked at the solution and typed it out without really grokking the pattern. No progress to report. Tonight's just kind of being spent on note taking for items i've already done.

#

Wish there were a few more easy's that covered these patterns but I think part of the issue is you don't see these patterns in these configurations at all until you hit mediums. So i'm facing a significant skill requirement bump. Worried about loosing what I know about easys right now since it's taking me so long. I never quite hit that stage where I could confidently do most reasonably upvoted easys on LC.

tropic knot
#

I think you are focusing on easy's vs mediums

#

Instead focus on identifying patterns and algorithms.

#

These can include "pointers and off by 1 errors" as seen in "reverse a linked list" and merge intervals.

#

Or sliding windows.

#

Or BFS with deque, preorder, inorder, postorder DFS.

#

You need to embed these concepts in your head by distinctly drawing, note taking, and labelling those concepts.

#

Yes, LC should be 80% of your time.

#

I don't think you are thinking in terms of patterns, clearly, right now.

polar plinth
#

Oh yeah I just means easys end to have patterns in a more obvious way but in truth i've only seen that sometimes.

#

Like best time to buy and sell stock is a good use of a greedy algorithm in the form of kadane's algorithm but the related problems that are mediums have it setup in a not so obvious or straightforward application of the same pattern.

#

But if i've just straight up never seen it used that way before my odds of figuring it out on the fly are very low imo.

tropic knot
#

Sure.

#

But what's your list of patterns look like?

#

If you are not making lists and turning them into discrete chunked, named concepts, it won't go super well.

polar plinth
#

Maybe I should go back and do more note taking because usually all the notes I have are the things I type out here to summarize them. That being said that level of note taking isn't really mentioned in the guide unless they mean that by "revise" but honestly that's kind of a reach.

#

For easy's it's not as big a deal because i've been suck in easys for the past six months but it might be absolutely necessary that I take deep notes with drawings and labeled code for every medium for some time.

#

Which will absolutely suck because it's going to slow me down a lot but if it's what I have to do I don't really have a choice. Kind of the price you pay for being kind of obtuse.

tropic knot
#

Idk about deep. Like 1 page plus some drawings? But yes, something.

#

Basic college study skills.

polar plinth
#

I'll do that for the mediums and i'll do that again for easys I miss in revisions I guess.

#

I don't have it in me to reset back to easys right now.

#

I got all of monday off so I can catch up and take my time. Had nothing planned anyway.

tropic knot
#

I don't think you should reset to easy either.

#

You want to keep the challenge moderately steep without getting discouraged.

Looking back, honestly you learn the most per hour when you're working under as stressful conditions as possible.

#

Just, keep in mind that using exact terminology, building really exact ideas of patterns, having formal notes and drawing pictures is an important part of the process.

#

If I were you I'd want to be thinking "I am bad at xxx questions, working on those." Which shows you understand that that is a distinct topic to think about.

#

And how it's seperate and similar to other topics.

polar plinth
#

Goodness that took forever. Kth closest points to origin took a long time to optimize. Need to remember custom comparators and priorityqueues

#

Kth problems are going to show up a lot and are the most obvious Pattern to apply

#

Time for bed.

polar plinth
#

Note to self for morning: Do a write up on the formula used to calculate the distance, also make special note of custom comparators for PQueues, and Lists.

polar plinth
#

Progress from 9/7: Did my writeup on K Closest Points to Origin. Did Longest Substring Without Repeating Characters. Skipped 3Sum for today. Trying to finish up Binary Tree Order Traversal before bedtime.

polar plinth
#

Woo woo got it. Knew it was a double queue problem.

#

That leaves, 3sum, clone graph, and then evaluate reverse polish notation for week 7. Going to finish those up by Friday. Not going out this weekend so I should be able to get started on Week 8 to make up time.

polar plinth
#

Nothing to report tonight. Going to bed early to try and switch things up and do some studying in the morning. https://leetcode.com/problems/clone-graph/

#

Think I remember the pattern for this. It's a two pass solution I think?

#

HashMap where the key is all the original nodes and the value is the new node initied with the value of the original node.

#

Then iterate through all nodes in the map and tie the neighbors together via iterating through the neighbor list. You do the initial iteration over the graph via DFS or BFS it's dealers choice.

#

Going to shoot for finishing clone graph and Polish Notation then do 3Sum last. Then I can move onto week 8.

#

Also got a call from Amazon Prime video out of the blue. Asked the interviewer to hold off because i'm still studying my Mediums.

polar plinth
#

Struggling with the clone graph problem. I think I have the logic right for the first pass shallow clone but when I do my second pass to add all the neighbors it breaks down. Going to take a break and clock into work. Got prod issue to diagnose ugh. eww

polar plinth
#

And I missed my stand up because I thought it was Wednesday

polar plinth
#

Got deep clone graph. I was screwing up my second pass logic by calling the shallow clone neighbors which broke it. Fixed now. Moving onto polish notation.

#

Note for later: Work on remembering how to init the different Java data types. You keep looking up how to create Deques and Queues and junk and you can't do that in an interview, dummy.

#

Java's just garbage with staying consistent with how to create stuff.

#

Just do a little cheat sheet in your digital notes to look at. You cant keep going to geeksforgeeks

tropic knot
#

Java is a very clever virtual machine

#

With someone's college homework balanced on top

#

And people call it a good programming language

polar plinth
#

Yeah but it's also all i've known for 6 years. You'd think after more than half a decade of professional experience i'd know it in my gut but hey google is better than remembering.

#

Except when interviewing.

polar plinth
#

https://leetcode.com/problems/evaluate-reverse-polish-notation/ going to leave off on this one. Think I have a solution already. Looks like a stack? Simply push the numbers onto the stack until you hit a mathematical operation. Pop the two numbers off the stack, do the math operation, push the result back on the stack.

tropic knot
polar plinth
#

Simple stack problem. Thing to watch out for though. The ordering in which numbers are popped off the stack. if you record your items as val1 and val2 make sure that the correct item goes where because it's the difference between 13/5 or 5/13

#

Need to do 3sum and that's the end of week 7 and onto week 8.

#

Glad I at least remember the obvious pattern of "mathematical operations almost always means a stack problem." Same for parsing things like open and closed ( )

tropic knot
#

LC isn't hard..

#

I feel like the most effective advice about leetcode isn't data structures and algorithm advice.

#

It's basic study skills advice and pushing through advice.

#

I feel like most people who are academic high achievers figure out that if you just throw hard effort at it you get pretty far.

#

It's just that the best people realise it's hard effort AND you need to really grok the fundamental algorithms in a mathematical manner.

polar plinth
#

Yeah. Agreed, hope to catch up and get week 8 started. I feel like the most i'm doing right now is about 1 problem which isn't the worst thing in the world but it's one problem i'll sit and chew on all day.

#

Going to push myself to be a little bit faster.

#

Then immediately break that promise because it's 1:30am and i'm sleepy.

#

https://leetcode.com/problems/3sum/ - prospective solution. Add all items to a hash map. Sort then do a two pointer solution?

#

That sort of reduces it down to a 2sum problem with extra steps.

polar plinth
# tropic knot LC isn't hard..

Also when I think about it. I'll agree that the studying and incremental steps to improve aren't the worst but overall the A->B is hard. You make it easier by breaking it down into the baby steps.

#

But you're still looking at 6+ months of effort with the 2 months being sustained.

tropic knot
#

Maybe I am underestimating it.

polar plinth
#

In my case at least.

tropic knot
#

You are absolutely probably right.

#

The thing is...

#

You are actually also

#

A pretty good programmer shall we say.

#

Like you have years of effort behind you

#

and tons and tons of Java projects when you started no?

polar plinth
#

Yeah but all the professional experience really just means I can do with bureaucracy and negotiation and office politics better.

#

Overall i'm not that good I don't think.

#

I'm good enough to consistently not be fired but rarely promoted unless I get on my manager's ass about it for months.

#

I'm so garbage at leetcode it may as well not matter though because I have to just get lucky after 6 months of interviews. Which is why i'm going through all this soul ache to stop it from happening and get a job I actually want.

#

Vs a job I luck out into.

#

Overall LC is hard I think. If it's easy for some people that's great for them but that isn't me.

tropic knot
#

ik that feeling.

#

Dev life in a non tech company thing. You build "engineering skills," aka meeting kung fu and Jira board kung fu and sending email kung fu. Not invaluable, ...but.

#

Not actual coding skills.

polar plinth
#

Even in a tech company kinda. I work for a major software org with a department that defines itself as an engineering org.

#

Still just an API monkey.

#

I take JSON, convert it to an object and move it over there.

#

Done, 140k salary.

tropic knot
#

Ah. Hmm, true.

polar plinth
#

Maybe a startup would use LC type skills more often? Idk I honestly can't imagine a situation where that would be the case. If I still ran in academic circles I could see it happening.

#

But god's honest truth is I can't remember a single situation where LC skills actually came in handy at a job. I'm sure it must happen somewhere but after almost 6 years? Not once for me. System design and API design skills I studied for interviews were immediately useful and applicable though so it's not all a waste of time.

tropic knot
#

I think there are just a ton of jobs like yours

polar plinth
#

I'm pessimistic overall and i'm most likely not really considering stuff that I would find obvious but could be learned via LC. If anyone finds this in the future please don't judge the comments too harshly. I'm overall a negative person and I recognize that. I'm trying to work on it.

tropic knot
#

Where the company genuinely just wants an API monkey.

#

rarely promoted unless I get on my manager's ass about it for months

#

This is every company.

#

Bit bleak.

#

Employees and workers are slaves.

#

Only 10% of jobs in society I feel are "career track jobs."

#

Where the company offers a path of promotion to management, CEO etc.

polar plinth
#

Well hopefully with more studying i'll be on track to start thinking about job applications by early to mid october.

tropic knot
#

90% are "you are literally a serf. We want you to sit in that chair and work until you are 45 where we fire you for someone 20 years younger."

polar plinth
#

And I can land a job where I actually apply this stuff.

tropic knot
#

Ye

#

Anyway, it makes sense. Sorry if what I say is depressing, it just reminds me of my current workplace.

polar plinth
#

I'm cool making 140k but my parents aren't getting any younger and their retirement plans aren't getting any rosier.

tropic knot
#

Yeah. Well you want more money, and to be on the career track.

#

And like, becoming a great actual software engineer.

polar plinth
#

Tbh i'd also like to try living in a new even larger city like NYC or Seattle too. New job would help make that happen. I want to live it up in one more city before I start thinking about living in Texas again.

#

For a myriad of reasons that would be weird to talk about on the chat.

tropic knot
#

Why lol?

polar plinth
#

Dating stuff, general unease with staying in one place for this long. Wanting to see more things before I get too old to really be able to do it without it being a big pain.

#

Overall weird idiosyncratic junk.

tropic knot
#

Hmm. Moving cities isn't such a weird thing to chat about. Don't sweat.

#

Anyway, I get your situation yeah.

#

I used to say everything in programming is a lot easier than multivariable calculus. Maybe I need to revise that, jamming all of data structures and algorithms properly is probably a 2-3 month endeavour.

#

You seem to be on track to knock it off in 2 months at medium intensity though.

polar plinth
#

We'll see. With any luck you're right and then I can stan that study guide all the time when people ask me how I did it.

tropic knot
#

Just stick at it.

#

Just keep in mind that...

#

I think your goal then is more than just LC.

#

It's

#

#1 Get Good at Leetcode.
#2 Get a job that isn't API monkey, an actual, intensive and demanding software engineering job.
#3 Move cities and improve life situation for xxx good reasons.

#

A very good goal.

#

Just keep that in mind.

#

Part of that is really improving your studying, scheduling and time management skills.

#

LC grind often has more to do with study skills and time management skills than programming.

#

Allg tho.

polar plinth
#

Ended up looking at the solution for https://leetcode.com/problems/3sum/, doing a writeup on it. Looks like i'm kind of crummy at anything that isn't the 2sum problem. Kinda salty about it. Making a note to practice variations after getting the solution better understood.

#

Moving on into more L's I know for a fact that I don't remember how to do https://leetcode.com/problems/course-schedule/ this is a weird class of problems because it requires that you remember graph theory which I don't and I couldn't brain it out. Going to add topological sort as another weakness.

#

Full of cheese and sleep meds so i'm going to call it a night before I start seeing weird stuff

#

Kinda looking forward to graph problems. I like that solution space a lot for some reason. The algos are a pain in the ass to remember though.

steep pilot
#

@polar plinth Have you looked at many of the matrix / grid traversal problems? I think they're something you'd like

polar plinth
#

Nah honestly I've been spiraling out. Been a bad week for study.

#

Hanging out at my towns oktoberfest

polar plinth
#

Spinning my wheels for a bit on the graph problem. Had some issues implementing Kahns and looked at the discussion for LC on it.

#

Had a bad mental health week but i'm back on the horse. Going to get back to our regularly scheduled grind tomorrow and start moving along again.

#

Going to shoot for 2-3 a day (most likely two this week) we'll see if I can handle the upped pace.

#

I keep saying that but I figure if I lie to myself enough eventually it's the truth so we'll see how that goes.

polar plinth
#

Pausing on https://leetcode.com/problems/coin-change/ for the night. Having a little difficulty figuring out how to apply BFS (peeked at the related topics)

polar plinth
#

Have to break for tonight on https://leetcode.com/problems/implement-trie-prefix-tree/ never implemented a trie before so I did some learning on the DS. Slowed me down. 0/1 for tonight.

#

Having an issue where my implementation is getting tripped up on searches when the next search is a partial match. "apple" vs "app". If I only insert the word "apple" then I should return false on "app" but there are situations where that isn't happening.

#

I have a boolean to mark individual leaf nodes as being leafs or the end of words. Something screwy is going on there. Wish LC did a diff for expected input vs output. When you get something like :

#

["Trie","insert","insert","insert","insert","insert","insert","search","search","search","search","search","search","search","search","search","startsWith","startsWith","startsWith","startsWith","startsWith","startsWith","startsWith","startsWith","startsWith"]
[[],["app"],["apple"],["beer"],["add"],["jam"],["rental"],["apps"],["app"],["ad"],["applepie"],["rest"],["jan"],["rent"],["beer"],["jam"],["apps"],["app"],["ad"],["applepie"],["rest"],["jan"],["rent"],["beer"],["jam"]]

#

As your input and the output diff is just two long strings of:

#

[null,null,null,null,null,null,null,false,false,false,false,false,false,false,true,true,false,true,true,false,false,false,true,true,true]
and [null,null,null,null,null,null,null,false,true,false,false,false,false,false,true,true,false,true,true,false,false,false,true,true,true]
it's hard to see where the beef is sometimes.

tropic knot
#

TDD helps I find.

#

Forget LC just define the test cases manually and do it properly in the IDE.

polar plinth
#

Yeah. I'm sure there must be a firefox addon that provides a unit test style diff where it just highlights the diff in output values as well.

#

I have a 9am meeting and it's currently 2.44am so i'll figure it out later I need to sleep at least a little.

tropic knot
#

You've got the concept for coding the stops, that's what's important.

#

It'll just be Boolean logic for how you deal with the stops tmmrw. Allg.

polar plinth
#

Trick was to make sure you set your isLeaf boolean to false in the init of the object. Nothing too crazy there.

#

Haven't had to touch static classes in some time. Trick to remember.

polar plinth
#

Toying with the solution for https://leetcode.com/problems/coin-change/ I have this recursive function that's generating all possible permutations of the given input and then recording the number of calls made when I hit an amount that == 0 and then I do a Math.min to assign the global output value but I don't know if that's really a BFS solution to the problem or me just going crazy and throwing a brute force solution against this.

polar plinth
#

I give up https://leetcode.com/problems/coin-change/ sucked away another day of study. Going to study the solution and move on.

tropic knot
#

Make sure to, like, make notes. Understand the concepts and the algorithms.

#

DP for me is extremely difficult with dictionaries and recursion.

#

I find you HAVE to use an array of n dimensions and access it via index.

#

It's almost impossible otherwise.

polar plinth
#

Yeah I will.

ruby mica
#

I'm not sure if you're still on the coin change thing, but I've posted someone's reddit comment (now deleted 😦 unfortunately) that really helped me.

#

The problem most people have with a topic like DP is that they jump directly to the optimal solution without understanding the process of deriving the optimal solution from brute force recursion. The idea behind any dynamic programming problem is as follows:

  1. Write down a recursive brute force solution
  2. Figure out how to translate that recurrence into DP.
    If you are struggling at (1), you need to get better at formulating recurrences. I recommend doing the following:
  • Watch a 15-20 minute youtube video on mathematical induction and on strong induction (many good videos on induction, but good videos on strong induction videos are far fewer)
  • Spend some time trying to understand the intuition behind induction and why it works. It is a waste of time solving math problems that require induction proofs however it is crucial you understand why induction works.
  • Once you do this, solve some classic recursion problems such as factorial (non dp version), quick/mergesort, tree problems, tower of hanoi etc and every time you solve them try to correlate this with induction.
    If you are struggling at (2) and you can get a brute force solution, I recommend doing the following:

Read through the following posts I made (some posts are from an alt account I deleted):

polar plinth
#

I knocked out the basic framework for a recursive solution where I treat the problem as a tree and each coin is just a node on the tree.

#

So if I have a requirement to get the number 11 from three coins (1,2,5) I start from 11 and the three coin choices represent nodes on a tree.

#

But the memoize step is killing me. For trivial example problems it's fine but for something like [1,2,5] 100 you easily go over the time limit because the time complexity is on the order of O(M*N) where M is the number of coins and N is the value you are trying to get to.

tropic knot
#

That's where the induction comes in.

#

It's just bloody hard to figure out.

#

I strongly suspect you just have to use math.

#

Either math, or the "make a recursive solution, add LRU cache" setup.

polar plinth
#

What I tried to do is have a hashmap and simply say if i'm at X value and my map contains that key AND the return value has a smaller number of coins just return that value and skip the work.

#

Because if i'm at the number 10 (target 11) with 10 coins but already have a number 10 with 3 coins then I shoudln't even bother to pursue this branch of the tree any further as I already have a previously saved solution that works better.

#

I'm spending an obscene amount of time on the problem but i'd rather just solve it vs looking at a solution.

tropic knot
#

I'd highly recommend the opposite.

#

when you learn something for the first time you do worked problems.

#

Like 4-5 of them usually.

#

For DP you probably need to do like 10.

polar plinth
#

I was getting real cocky with the max subarray but the copy array idea has flaws because you also have to keep track of the fact that if your last number was negative it's possible for the current number to be negative and the result to be higher overall.

#

I'm sure the underlying idea is solid tho

#

Maybe a Boolean flag or something to account for it. If the last number was negative and the current number is negative do the multiplication and store the result if it's bigger than the current index of the input array.

polar plinth
#
    int finalOutput = Integer.MAX_VALUE;
    public int coinChange(int[] coins, int amount) {
        if(amount<1){
            return 0;
        }
        return coinChangeHelper(coins, amount, 0, new HashMap<Integer, Integer>());
        
    }
    
    public int coinChangeHelper(int[] coins, int amount, int numCoins, Map<Integer, Integer> memo){
        if(amount == 0){
            return 0;
        }if(amount < 0){
            return -1;
        }if(memo.containsKey(amount-1) && memo.get(amount-1) != 0){
            return memo.get(amount-1);
        }
        
        int min = Integer.MAX_VALUE;
        for(int coin : coins){
            int res = coinChangeHelper(coins, amount-coin, numCoins, memo);
            if(res >= 0 && res<min){
                min = 1+res;
            }
        }
        memo.put(amount-1, min == Integer.MAX_VALUE?-1:min);
        return memo.get(amount-1);
    }
}```
#

Solved but with help from the actual leetcode solution page. I just replaced the array they used with the memo array.

#

Only god and his little baby jesus know why the amount-1 means anything at all.

#

Shit's a mystery.

#

Top down DP solution that only works with memo data structure.

#

Oh I get it.

#

The amount-1 is because I adapted this straight from a memo DS that was just an array.

#

(which is dumb, use hashmaps over arrays always. It's a more universal solution that's easy to remember)

#

But the fact that it's amount-1 is because originally the memo DS is an array that's of size amount.

#

So in order to use the 0 index for your memo logic you need to always subtract 1.

#

also 0 index'd have this problem where now you need to introduce the magic number of -1 vs using the actual amount.

#

stupid stupid, forgot the basic rule for recursive DS solutions. Your base case is always ALWAYS 0, you are tossing out a line from the top of the problem until you hit your positive base case. The other base cases are for when you go over the limit or when you can save time using your memo DS to recall work.

#

Going to work on https://leetcode.com/problems/product-of-array-except-self/ but will most likely pause as it's 2am. I remember this problem though. It has an infuriating mathematical solution that no reasonable person could be expected to work out on a 30 minute time budget.

polar plinth
#

This is so it's on the record the change problem is especially embarrassing as I pretty much spent the better part of a work week on it only to realize i've actually seen a half dozen DP problems like this and the solution should have been trivial to code. The last few days have been an absolute waste of time if I had just remembered the basic thing about the topic I spent the better part of 3 weeks studying two months ago

#

I event hinted at it because I mentioned the base case thing twice. Fucking hell man. What a joke.

polar plinth
#

Sort of got https://leetcode.com/problems/product-of-array-except-self/ ? I used a prefix sum built from left to right and then a separate one from right to left. And then used L[i-1] * R[i+1] = output[i]

#

I'll count it as 0.5/1 because I used a part of the description from the solution to get it. I'd fully hear the argument to count it as 0/1 though. This one is kind of mathy.

#

Need to remember prefix sums because Amazon like this one a lot apparently. The followup is a double F you if you suck at math.

#

For people getting mad at it I think really all you need is an understanding of the prefix approach and some knowhow from bitwise math.

#

Wherein two multiplies can give you the result of a division in some cases.

polar plinth
#

Need to get some sleep. Going to call it .5/2 for now. For the BST problem I was way off course and I was doing a recursive solution where each node is a perfect subproblem.

#

But that's not the case for validating a BST. The wording kind of tricks you. The only thing that matters is every node to the right of the root is larger than the root node.

#

I had a whole rant typed up about the study times and how long this guide thinks it will take you to go from zero to hero based on you finishing and being able to recall the patterns.

#

But I got embarrassed at myself for winging. Ultimately i'd like to know how the original author got his time estimates because I feel they are overall much much too aggressive.

#

I think future people who look at this list need to realistically budget 6 months.

#

Going to experiment with new approach. If I cant solve the problem in 1.5-2x the posted duration I go to the discussion section implement the solution from ideas there and move on.

#

And make Sunday a revision day for the week. Try to solve random problems of equal difficulty that apply the same concept.

#

Right now my time usage is really bad. I dont feel like taking 3 days to solve problem yields benefit worth the investment.

#

Probrably won't be ready until November or December at the earliest because of the poor time management. Story of my life.

short ravine
#

What do you feel like is taking up most of ur time when studying?

polar plinth
#

@short ravine trying to solve problems for multiple days straight. @tropic knot has been real supportive throughout all this and when I was wingeing he kind of backed me up on giving up faster on some problems. I should be doing 2-3 a night from my list.

#

https://leetcode.com/problems/rotting-oranges/ - got this right with some tinkering. Kind of cheated I needed to use a debugger to help me step through and figure out how to calculate the rounds but I got the core logic.

#

https://leetcode.com/problems/number-of-islands/ - got this right with no help. The top two are just BFS and the oranges one just has a twist of knowing how to insert a flag into the queue to mark the end of a round.

#

@short ravine new approach is to give myself 1.5-2x the time listed on the duration of the problem list found here. (That's where i'm getting my practice questions) https://www.techinterviewhandbook.org/coding-interview-study-plan/ and if I can't do it I look the solution description and try to implement it and then write down the code + notes on the pattern.

Study topics and practice questions based on time left to prepare for Software Engineer coding interviews

#

Tomarrow is https://leetcode.com/problems/search-in-rotated-sorted-array/ and then I want to do a review of the problems of week 8 because i'm already getting fuzzy on the pattern for course schedule even though I did notes.

#

Topographical sort always kind of gave me problems.

#

Then get started on week 9 on Friday then do some reviews of week 8 and part of week 9 on Sunday.

tropic knot
#

@polar plinth

#

Do you think.

#

The times on those problems.

#

Are actually not minimums and we've both misunderstood.

#

What if they are maximums.

polar plinth
tropic knot
#

I think so

#

Like, that is how long I think someone who is practiced would take, maximum.

#

In those questions.

#

I think that is the time they are referring to.

#

Then if you have truoble, you do similar questions.

polar plinth
#

Man I dunno some of these durations are like 20 minutes. I mean I guess but I think that still means that putting a hard limit on the time it takes to solve before giving up, reading the description, and then making notes on approach and pattern still makes sense.

tropic knot
#

That sounds fine?

polar plinth
#

Speaking of stress.

#

https://leetcode.com/problems/search-in-rotated-sorted-array - couldn't figure it out. Knew I had to do a binary search but didn't realize I have to search for a pivot point first. I spent ages on a solution where if I hit an edge of the array i'd make my high and low pointer snap to the opposite end of the array. Add it to the pile of questions that need write ups even if I know the pattern fairly well.

#

That makes all the problem for week 9. Going to spend tomorrow afternoon and saturday doing writeups on what I missed and practicing concepts on Sunday then monday hit week 10.

polar plinth
#

One criticism I feel like Leetcode needs to address is solutions that have magic numbers.

#

Like, ok fine your solution has a return value of output+1 why? Maybe spend a line describing that.

#

And obviously i'm sure it's not always possible to get rid of those numbers without increasing the complexity which defeats the purpose. I understand that. But maybe pump the breaks on it wherever possible.

tropic knot
#

LC Solutions are not optimal.

#

@polar plinth always remember.

#

In this field 99.9% of people are not perfect.

#

Peter Nordvig is perfect, everyone else screws up majorely constantly.

polar plinth
#

Yeah but they gotta know the solution tab is going to be the first point of contact for the solution. I know people say go to the discussion tab but they also check the solution tab.

tropic knot
#

The key I find with LC answers is:

#

Scan them. Find the GOOD PARTS.

#

Forget the BAD PARTS.

#

Your objective is to steal as many tips, tricks, useful things from all the answers and solutions.

tropic knot
#

Are not paid $500k a year.

#

They are very, very fallible.

#

The upside of the LC solutions tab is it always provides the best algorithm.

#

To solve the problem.

#

That part is well done.

#

The code itself is... if they could code.

#

They would be working at G.

#

The code is never great.

sharp swift
#

I've found a combination of the leetcode question discussions tab and youtube/neetcode are on average an improvement over the LC solutions tab

tropic knot
#

Neetcode's solution to median of 2 sorted arrays is dramatically better than any other on the internet yeah.

polar plinth
#

Yeah being said magic numbers is my little beef with that solutions tab. Especially the solution tabs that are behind the paywall.

#

Like, c'mon fellas.

#

I learned that when I was getting paid jack + shit first year out of college.

#

I know it's not supposed to be optimal but maybe these guys are getting paid by the word or whatever but it seems counterproductive.

tropic knot
#

M8 you get what you are paying for.

#

And 100 bucks a year from 20k people is not a lot of money to run a business.

#

When anyone with a shred of talent is off doing much cooler stuff than writing for LC.

polar plinth
#

No studying today. Got stuck on late meetings. Going to look into backtracking so I don't flounder around with the first question of week 9 which is https://leetcode.com/problems/combination-sum/

#

Been a little while.

polar plinth
#

Struggle bussing on this one too. Going to sleep and try to reasses what i'm doing wrong here to be struggling this bad. Maybe I need to do some easy versions of this first if they exist. Don't want to look at the pattern yet because I feel like I haven't tried hard enough.

tropic knot
#

y u no give up and look at answer?

polar plinth
#

Because I only watched a YouTube tutorial just like an hour ago and i'm still getting all my notes down. I got cocky and thought I could track a crack at it while the info on the pattern was fresh.

polar plinth
polar plinth
#

There I actually did get it. The leetcode discussion one really helped. Just the tips to use void functions and use the copy constructor pushed me over the edge to getting it.

faint matrix
polar plinth
#

@faint matrix I feel like this site's really gotta qualify what the duration on this actually means because I feel like this is interpretation number 3.

#

Like study time to study the concept and then do the problem?

faint matrix
#

If u read the page.. he says study this long this topic in week 1. And so on

polar plinth
#

Also 2x problems in 35 minutes what? It's usually 45 mins and one problem, no?

faint matrix
#

You have to learn all the topics anyway so I don't think it matters how long u spend tbh. Lol

faint matrix
#

Funny thing is lot of people do 1 and think they did good 😹

polar plinth
#

Well shit on me, good to know I guess but kind of discouraging.

faint matrix
#

I'm slower than that too

#

I'm using a timer app to improve speed

polar plinth
#

Yeah but i'm like on month 5 or 6 now of this studying.

#

Going to die of old age at this rate.

faint matrix
#

I'm also using anki

#

As long as you're studying you'll make it. *As long as you're smart enough

polar plinth
#

Oof yeah I started this thread on 6/17 and i'm on 10/6 now.

#

Ouch did not need to see that. Should not have done that.

faint matrix
#

Are u working same time

#

Kinda limits study time so I wouldn't get worried about time span so much

#

All we can do is max study time after work

polar plinth
#

Kinda. It's impossible to do the same study schedule. I try to get 2 hours a night in but sometimes i'll be busy with work or i'll have a bad mental health break and I break off to pull out of my spirals.

faint matrix
#

Yea, gotta hard close the work laptop at 5

polar plinth
#

How are you using anki for this? I saw those little card remembering apps but I never figured out a way to integrate it into Lc studying.

faint matrix
#

So this is my second attempt. Now I really get how it works

polar plinth
#

I think our profile pic guys might have the same hair cut too just noticed that

faint matrix
#

I put the LC number and question title as question. I do the question. If I for a solution I put as answer. Submit

#

Then the app will come back in x weeks and tell you to do the question again

#

The ideal scenario is that if it's hard, you forget how to do it.

polar plinth
#

So are you smushing the entire answer into the index card? Also wont that mean you remember the solution vs the pattern?

faint matrix
#

When u do it after forgetting, the memories becomes stronger

faint matrix
#

It's the timed repetition that I use for

polar plinth
#

Just because obviously doing one type of problem for a pattern isn't actually practice for applying it to anything other than the exact same type of problem.

faint matrix
#

Yea... Re hitting old problems is something I felt was important

polar plinth
#

Backtracking has like 6 or 7 different patterns alone.

#

Dynamic programming questions are just a big mess.

faint matrix
#

BT requires u to know BFS DFS imo

#

Then u can use template

polar plinth
#

It's just a DFS with constraints

faint matrix
#

Dyn prog in my opinion, can be skipped depending on your intentions

polar plinth
#

I'm trying to interview with google next year.

faint matrix
#

In a non big tech scenario I never see dp

#

Ok. Google you need it

polar plinth
#

I mean i'm going for faang style jobs so I assume a big fuck you is coming in terms of what you touch.

#

So it's gotta be everything.

faint matrix
#

I think it should be last item on list for general interviewing

#

But yes Google loves it

polar plinth
#

Welp almost 2am here. Going to bookmark https://leetcode.com/problems/permutations/. I give myself a .5/1. Not a big fat L but maybe a lowercase l.

faint matrix
#

YouTube search for backtracking template

polar plinth
#

I seriously need to make my schedule not as stupid because i'm sitting down to study at almost 11pm every night.

#

And I get off work at 6 and all I do is go to the gym and study so it's not like I got a ton of junk going on.

#

No drinking or screwing around until new years I guess I want to be in actually good shape for interviews come January.

#

Like, any given two problems from easy to medium good in 35 mins I guess

tropic knot
#

Ankidroid's good

polar plinth
#

So one method that I feel like i'm getting some value of is for groups of patterns where i'm having problems like backtracking what i've done is i'm just moving down the list https://leetcode.com/problems/permutations/discuss/18239/A-general-approach-to-backtracking-questions-in-Java-(Subsets-Permutations-Combination-Sum-Palindrome-Partioning) and trying to solve them after studying the first one to get the pattern.

#

So doing multiples of different variations of the same problem which seems obvious but rarely do I get a handy dandy list built like that.

#

And then all the code gets heavily commented to describe why we do each thing

#

PLUS notes in my book about the commonality between the solutions to establish the pattern framework.

#

Also I just hit the gym at lunch and start studying at 6 or 7.

#

So I have way way more time.

polar plinth
#

Lol in doing my practices I inadvertently did my problem https://leetcode.com/problems/permutations/ Got it with no help and just studying the pattern. Very pleased.

#

Going to continue practicing the different patterns but going to put a pin in that and try my hand at https://leetcode.com/problems/merge-intervals/ so I can get the 2 question quota per day that i've been trying to keep up with.

static bane
#

I can totally relate to taking forever and being frustrated at the process, personally i've been doing terrible with studying because i've only been casually doing a problem here and there for the past year and not doing flashcards 😅 i feel people underestimate times. We're not all superstars

polar plinth
#

No movement. Stuck again on a problem.

#

Logic for Merge Intervals is messing me up because doing the merge merging across multiple indexes is messing me up vs straight merges between adjacent neighbors.

#

Giving it another 15 to get an approach and if not i'm just reading the answer.

polar plinth
#

Moving onto https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/ i've seen this problem before and I think I remember the pattern that made the original solution but i'm having trouble remembering how to implement it. Going to think on it but again time limit of 30 mins for some kind of approach otherwise I need to look at the answer and move on. An extra big fat L if I mess this up since i've actively studied and implemented the solution in the past.

#

Pattern should be something like a depth first search from a root node on the left and right children and if you find the values inside the left and right children then the current node is the LCA of the tree. If the current node is one of the target nodes then you do a search down the left and right children and if you find the unaccounted for node then that node is the LCA.

polar plinth
#

Ugh actually i'm mixing this up. Note to self the above pattern is for a binary SEARCH tree where you can simply use the property of the search tree.

#

But a binary tree doesn't follow the same rules. IE larger values existing on the right sub tree and smaller values on the left.

#

Think you can still adapt this but you have to do an extra step to do the search.

#

Maybe helper functions that denote the searched for nodes living in the left or right subtree?

tropic knot
#

Maybe try the #programming-challenges channel.

#

I think doing this stuff with other people will help you notice a lot of things you can do better at this stage.

#

You've invested a ton of hours at this point, for what seems like not the most progress in the world for your time. Although it's valuable knowledge.

#

Maybe also a guided course.

polar plinth
#

I mean idk what a guided course will do that the study guides aren't going to give you as part of the process.

#

Also I did do guided courses two years prior as part of getting my current job that didn't really work out.

#

Same exact problem. Inevitably whatever schedule is set I fall behind on.

#

Going to start restricting the post to finished problems and maybe tone down the commentary i'm sure it's painful watching a guy struggle for six months. I'll figure out something else.

tropic knot
#

na na, let us know.

#

It's better to share 110%.

polar plinth
#

Could also just start from zero on the study plan. I did jump in at the mediums.

tropic knot
#

I think you're not in a terrible place, you need to incorporate a bunch of things you aren't doing.

#

Not drop the things you are doing.

#

If that makes sense.

polar plinth
#

Yeah but IDk what i'm missing here. I'm trying to do problems on a timer. I make notes on approaches. If I don't get the problem I write notes down and try to figure out the pattern and how to implement it.

#

Literally the only thing I can think of at this point is practicing problems that use the same pattern to re-enforce.

tropic knot
#

Just have a chat to other people. They'll be able to guess it.

polar plinth
#

Based on this and the difficulty i'm having on the timing I think I need to take some time to step back and go over my fundamentals again.

#

Because obviously something's wrong here. I'm easily at 30+ questions. I don't really expect to just suddenly be able to do all the problems below the durations but I should see some kind of downtrend.

#

When obviously we're not seeing that based on the painful results of the last 3 weeks.

#

I don't just have access to lots of people who can analyze my thing. I also forgot that the actual subreddit is garbo there's way too many smug fresh grads in there for a lot of their stuff to hit home for me.

#

So i'm going to pause things for a bit while I look over the fundamentals to see where i'm weak.

polar plinth
#

@steep pilot that's encouraging. Taking a step back to re-do my basics and see what i'm missing. Think I might be able to use Anki to help take notes on all the patterns. What they are and where they're applicable and then hopefully with practice I can associate the code with the patterns and identify them more easily.

#

I'd like to actually be able to say what pattern I want to use based on what i'm seeing in the prompts.

polar plinth
#

Well one benefit to the patterns is some solutions feel painfully obvious vs before. https://leetcode.com/problems/product-of-array-except-self feels like it doesn't deserve to be a medium because it all hinges on you knowing a prefix and suffix sum approach.

#

But having that in your pocket makes problems like this and I guess all the questions tagged as a prefix or suffix problem easier if not trivial.

rich void
#

thats really good plan. how long did it take?

steep pilot
polar plinth
#

Going to try to structure the study time a little more strictly. 8-11. Spend time working on the patterns and trying to get real formal with it. My trouble before is my study time kind of just shifts but obviously that's not helping out a lot.

#

Trying to do it every night at the same time to keep the consistency going. Take Friday nights off so I can still go out but go easy on the drinks because the hangovers kill any study time or productivity on Saturdays.

polar plinth
#

Mediums mostly.

#

Having some difficulty with this part of the pattern though. I think in the template it describes this as the part where you make the window valid or invalid again but the logic for it is escaping me.

#

I think what's supposed to happen is we're trying to make the window valid again by finding the first letter in the map that has been seen only once and once we do that and escape the second while loop we can get a valid length of the current longest subarray even if the index values of start and end aren't on the indexes of the actual substring.

polar plinth
#

Was also consuming questions from the list he recommended. Don't really think it's for me.

tropic knot
#

The excel sheet seemed important kinda.

polar plinth
#

Yeah I had them separated out by difficulty and I followed the same color coding.

#

Only difference was the blues which were skipped because I didn't feel like dealing with the implementation at the time.

#

Feels like after month two or three I wasn't really seeing any improvement but I don't know if I agree with this guy. Maybe there's some unspoken understanding that you're already familiar with all the patterns to some extent?

#

But just following his video guidance raw you throw yourself at problems without really understanding that you need to base it in the basic patterns.

#

And that method must work for some people otherwise why would this guy get so much good feedback but it doesn't work for me overall.

tropic knot
#

well I mean the entire point is learning the patterns I guess.

polar plinth
#

Yeah but my point is I didn't know that going in. he does make a reference to patterns at about 4 minutes in but if you don't know any better that advice gets you nowhere.

#

Because there's no extra line of "Most leetcode questions fall into specific pattern groups to help narrow down how to answer a question. Here are where you can find patterns to get started."

#

Again, obviously, this works for some people it just isn't for me.

#

Had a whole mini novel complaining about the time durations in https://www.techinterviewhandbook.org/coding-interview-study-plan/ because (PIC 1) makes no earthly sense when just the Arrays section has problems that should take you way longer. I truly wish I could ask the author where he's getting these numbers because they feel like the result of a dart throw. I've said it a million times but I can't get over it and I don't see how a student would have some magic knowledge that I don't given that a student would be even less equipped to know this information given a 15 credit hour course load.

Study topics and practice questions based on time left to prepare for Software Engineer coding interviews

#

Screw it. This is bothering me so much I just sent an email to the website to see if they actually answer, lol. Maybe i'll get lucky and they'll explain how they get these numbers.

#

It bugs the shit out of me and I think about it almost everyday because I gotta look at this everyday.

#

Like, the wording mentions 11 hours a week is what you'd need to get through the material in 3 months and I guess all these times equal up to 11 hours but what kind of superman flying across the world backwards time dilation power do you have where 2 hours is enough to get you through any of this lol.

sharp swift
#

I had similar issues with the study guide. The lack of proper preparation and explanation for the patterns themselves, the unrealistic timeframes. The problem sets feeling a little fractured. I almost completely pivoted to algomonster for that reason and I've found a lot more success using that combined with neetcodes videos and other articles than just using the guide. They consistently update it as well. It is a paid service with a bit of a steep price tag for lifetime but I'd say it was worth it for me. Let me know if you want to take 15 minutes at some point and I can screen share the site with you and click around the premium sections and you can see if it is worth it. No referral or benefit for me, I just empathize with a lot of the frustrations you had and wanted to share something that worked for me

polar plinth
#

Honestly i'm just happy somebody else is seeing the problem with the timeframe. It feels like you're taking crazy pills.

#

I just think it's a marketing thing. "Get good at LC in 3 months" but then the big fat asterisk is that only if you can keep to a time schedule that's unrealistic for actual learning. Maybe you can do it in 3 months but not with just 11 hours a week you're not.

sharp swift
#

I consider myself a decently smart dude. But yeah, if you tell me in 3 hours I'll fully comprehend and be able to handle a majority of hash table related problems something is wrong

polar plinth
#

Otherwise I think it's OK considering it's free @sharp swift maybe i'll hit you up for your offer to look at algomonster when hours are a little more decent. It's almost 1:30am for me. I've also been looking at https://www.educative.io/courses/grokking-the-coding-interview but if i'm being honest I feel like ther material I get off techinterviewhandbook is still superior in some respects.

#

And i've already used that website and didn't really feel like it was worth the cash. If you give me a list a patterns and describe them thoroughly even if I bitch daily about unrealistic time frames it's still overall not bad. I just think that one specific aspect of the site needs to come clean.

sharp swift
polar plinth
#

I like the metric where if you're not seeing some kind of downtrend in the time it takes to answer a question then you need to go back and re-review basics. I like there to be a clear failure state and where to go from there. With a lot of those sites it feels like you don't get it.

#

Nothing feels worse than paying for a 200+ dollar course, getting stuck and realizing there's really no explicit provision for what to do when you get stuck other than go back and study which seems obvious but somehow for 200 dollars you kind of wanted more somehow.

polar plinth
#

Fun little progress thing to start the night off. I haven't done https://leetcode.com/problems/maximum-subarray/ problem in over four months. Totally forgot about it but looking at it I immediately came up with a viable quick solution.

#

Idk if you wana chalk it up to just remembering but i've also looked enough at problems where the answer is a subsection and I just happen to know that greedy algorithms work well there.

#

But for whatever reason Kadane's algorithm just happens to live rent free in my head.

polar plinth
#

On the flip side https://leetcode.com/problems/maximum-product-subarray/ is the exact same concept but multiplication and that throws a big enough wrench into things that the execution feels sort of related but different enough to screw you up, lol.

#

I wana chalk this one up to the intent being that you just figure out the two pointer solution that's O(n^2) because the alternative is you hit head first into a DP style question on like question 5 of chapter one of this guide which feels like an insane difficulty curb spike.

#

Same for https://leetcode.com/problems/search-in-rotated-sorted-array/ even though the problem set asks you to figure it out on O(log n) time but at this point in the guide all you have are some very specific tools for arrays. You don't hit search algorithms until subsection 5 of the Arrays section.

polar plinth
#

Still chugging away at some basic patterns. On fire tonight with the substrings after finally getting the pattern. Suddenly I can do the medium difficulty substring problems in less than 5 mins.

polar plinth
#

Fucking yes I got my challenge problem done and the intuition from the pattern I practiced was the correct take and suggested in the solutions

polar plinth
#

Getting a little stuck on a problem though. The problem I just finished was https://leetcode.com/problems/permutation-in-string/ and from there I moved onto https://leetcode.com/problems/find-all-anagrams-in-a-string/ functionally they're the same exact question. An anagram is just a permutation of a string. So in theory you can copy paste the submission from the first question, make a few tweaks and and then hit submit.

#

Problem is though that the inputs on anagrams in a string question are so long that i'm getting time limit exceeded errors.

#

So I gotta figure out if there's a faster way to do this or use a different data structure instead of a hashmap.

polar plinth
#

Oh ok, looking at the discussion from the 1st question there's an optimization I missed to make things much faster. I had it right in the initial try but there's a much faster way to use the HashMap in this context.

polar plinth
#

YES got it. Turns out the optimization from the discussion was too slow and I came up with my own from what I remembered from other problems.

polar plinth
polar plinth
#

They don't kid around with the hards. was really tricky. Wouldn't have thought to use the solution outlined in my guide.

polar plinth
#

Turns out I solved my two problems last night in a unique way that wasn't covered by the guide and is slightly slower but still fast enough to not get a timeout error. On it's own it'd be fine and i'd pass an interview that asked me it but the guide itself have a solution that extends more easily to the hards i'm dealing with so I gotta backtrack a little and take some notes.

polar plinth
#

Doing BFS/DFS stuff. Also keeping a little list of the problems plus challenges and if I mess them up my thing is to come back to them after a day to see if I can solve them plus notes. When I finish up sliding window and two pointer I'm going to take a crack at the array problems in LC for more studying.

short ravine
#

@polar plinth sounds like we getting better?

polar plinth
#

@short ravine better than before. Been doing some mediums and hards for the patterns i've tackled. Not so great that I can just do any problem under the pattern set though. Sometimes I get confused on the constraints but I hope exposure to more will fix that.

polar plinth
#

Hit a slight delay. Went back to review sliding window and I wasn't really remembering the patterns as well as i'd liked. Moved onto my Matrix traversal but the challenge problems are pretty hard. So i'm going to call it a night and try to clear them out soon. Wont spend more than a day though since odds are they'll end up as red marks to be reviewed on my google spreadsheet in a few days anyway.

limber flint
#

amazing progress!!!!!!

#

you got this!

polar plinth
#

Took some time to go back and do reviews. So far i've gone through Sliding Window, Matrix Traversal, and Two pointer patterns. That's 3 out of the 16 in this guide. Going to pause and try to drill in the patterns with practice. Having some problems figuring out the logic on how to apply patterns to different questions.

#

I know that studying 3 problems and doing 3 pre-made challenge problems isn't going to do it in terms of burning the pattern in. So today and tomorrow are review. Going to find a list of problems under the patterns and try to apply the knowhow.

#

Biggest issue is the logic. Yeah you know the pattern is a sliding window or whatever but then actually applying it to different constraints. Find K closest elements, max sum with two non-overlapping subarrays etc.

limber fossil
#

damn, I didn't know about this discord feature, it helps a lot, good look bra!!!

polar plinth
#

Still chugging along doing my patterns. Got a lot of mediums under the belt now much much better than before when I struggled with easys but leetcode is weird about how it structures some problems.

#

Dead slow though. Going to start on the two pointer patterns again. Then do more reviews on matrix traversal.

#

Hards are a little hit or miss. I think a lot of problems exist on a spectrum where the border between easy/mediums and mediums/hard are fuzzy and I can get most of the problems on those borders but if they are firmly in the hard category it's a no go.

#

Some of the easy/medium ones are weird too. Wording gets a little weird or they ask something you've never been asked before so you can't immediately map patterns.

#

The latter is the killer. They impose a constraint you've never hit so you can't really map experience onto it to figure it out.

#

Lot of mediums and some easys will do that and it screws you up royal.

tropic knot
#

It's funny how LC was really horrible when I couldn't do any easy questions.

#

When I could finish my first medium, suddenly it's the most enjoyable thing in the world.

polar plinth
#

Little slower today. Went out to vote and played some Deep Rock Galactic so I didn't get as much studying in.

#

Back on full force on Wed. Getting better at filtering out distractions so I can work.

#

Going to be doing two pointer stuff all week. Practicing problems and doing challenges to get the pattern in. Much much harder for me for some reason same issue with the logic.

#

Yeah you know you need two pointers (sometimes 3) to solve the problem but then draw the rest of the owl. It isn't easy.

#

Ideally what i'd like to get out of this is if I get good at these patterns it opens up almost all the array problems in Leetcode to me.

#

Sucks to spend two or three weeks getting mediocre at one category though.

limber fossil
#

keep pushing!

polar plinth
#

Slow again. Stuck on the two pointer pattern because it's so broad and doesn't have as universal a pattern as sliding window or matrix traversal. Been trying to get an intuition for the problems but it's rough.

#

Most of the problems are "here's two pointers" and then a lot of extra logic. Knowing the pattern isn't enough to actually get anywhere useful.

#

Don't know how anyone can be expected to figure out the 3 sum closest problem https://leetcode.com/problems/3sum-closest/ off the cuff.

#

As an aside going to the doc soon. Talked about some problems I had with studying and other stuff and someone mentioned they had similar problems and ended up getting diagnosed with ADHD. Would be weird to find out I have it so late in life but stranger things have happened.

sharp swift
#

Neetcodes video on 3sum helps a lot. Also doing 2sum 2

polar plinth
#

I got so spoiled on most videos having java as their main way of showing code examples.

#

@sharp swift thanks though looking at that right now.

polar plinth
#

Got tangled up in two pointer patterns. Decided to take a break and move onto fast & slow pointers. Going to revisit two pointers in a week and some change after I cool down from it.

polar plinth
#

https://leetcode.com/problems/linked-list-cycle-ii/description/ don't feel too guilty about not getting the best answer here. I got O(n) time and space complexity by using one pointer and a hash set to determine where a cycle begins.

#

But then to get the constant space and time answer you'd have to know Floyd's Tortoise and Hare algorithm which consists of a two phase approach where first you detect the cycle, then do a phase two where you set two new pointers. One at the start, one at the point at which you detected the cycle, then advance both pointers by 1 until they match and that's the entrance point to the cycle.

#

I could be forgiven for not being able to brain that out in the 10 minutes I allot myself to a solution before I look at the description.

#

But this is just going to have to be one of the solutions that sticks in my memory but at least I know how to calculate the if a cycle exists, how large it is, and where the entrance points are so hopefully that lets me answer more complex problems.

polar plinth
#

You may assume the two numbers do not contain any leading zero, except the number 0 itself.

#

-_-

polar plinth
#

Like to the point where this is better because you can easily get better discussions on patterns and approaches by googling or going to leetcode.

#

And i'll be using this going forward.

polar plinth
#

Doing linked list stuff before I re-do fast and slow pointers. The chapters in this book are weird. Chapter 8 has patterns that you need to solve stuff in Chapter 5.

#

Pointer logic is hard.

polar plinth
#

Cool thing if you have an Android tablet. If you use Microsoft one notes you can make really detailed note. Use the computer to type in or copypaste pictures or large paragraphs of text with details, sync it and then access the notes on your tablet. An added trick is you can write your own clarifying details in the "margins" to help with retention with the little pen.

#

Why use a while loop inside a specific implementation of a solution. What wording offers clues to use which data structure as a helper, etc.

#

Notes on space/time complexities and why they're calculated as such.

polar plinth
#

Doing revisions on old patterns. Breezing through sliding window. We're about to hit a couple of hards for challenge problems but I feel really good about retention so far. Going back and revamping my notes to have lots of details and stuff in the margins helps keep me focused.

#

Knowledge feels sufficiently baked in for some of the more straight forward questions and remembering how to tackle the problem doesn't feel like a conscious action so much as it is just knowing how to answer the question and make adjustments for the specific constraint as you read the problem.

#

I can see where I think I had problems last time and where my notes aren't as good so this second pass will help lock in some of the stuff that didn't work for me in the past. More issues where there's seemingly jumps in logic or the solution uses a method or logic I didn't quite get.

polar plinth
#

Been pretty poopy about getting multiple questions done but i'm still working through my patterns. Using Anki to do a little spaced repetition for problems where I can't get the solution straight off. Just a little warmup period but even a 30 minute warmup sucks up more time than you'd think.

#

So slow but better than before. Hoping I can keep this up as I enter new patterns because sliding window seems to be my jam because of how consistent the problems are across the category.

tropic knot
#

How have you been with the concepts?

#

It's really just about learning the concept and getting the pattern in your head.

#

Just like how you learnt sliding window, next you'll learn tons of smaller patterns like index hashing, all the various others.

polar plinth
#

@tropic knot I think going back and doing second passes at my pace helps. There's stuff from sliding window that I distinctly remember not understanding the underlying concept but on the second go around it makes much more sense.

#

There are still some aspects of the book i'm using that i've been bugging the a authors about. But it's mostly complaints about how some chapters should come before others because they have concepts that earlier chapters assumed you knew.

#

I guess I got "lucky" because all these FAANG's are deep into hiring freeze so it takes some pressure off on me to stick to the schedules I had setup.

#

My goal is is to work through the entire easy list of https://seanprashad.com/leetcode-patterns/ by the 24th.

Next i'll try cycling through them to make sure the lessons are sticking then i'll try to apply the pattern to random easys. By July 15th i'd like to compare where I am with easy's now vs then. Will do weekly check-ins on Saturday with progress and what problems I've had problems with and completed.

tropic knot
polar plinth
#

Did a little work but was kind of slow. I'm still looking at the linkedlist pointer. Disappointed in progress but getting back on the horse and trying to do at least 2 hours per day minimum.

tropic knot
#

Remember 30 minutes every day is better than 2h every 2 days.

#

Linked List pointers took a surprisingly long time I'll be honest.

ruby mica
polar plinth
#

Keeping on with it. Moved on from linked list stuff awhile go. god damn i'm slow at this now that I see that i've essentially just been hovering on linked list for almost a month because of my laziness jesus. What a guilt generator this has been

polar plinth
#

Moving onto Binary Trees, got some good notes on patterns for binary search. Doing Ok so far since on easy most of the problems are basic recursion and if you can remember how to capture the base cases and save values you're pretty good here.

#

Ran into a snag with "Average Levels in a Binary tree" I think this is a hint that the mediums that use BFS/DFS are going to be a little trickier because your base cases and logic before you move onto the next node is a little harder to capture.

polar plinth
#

Trying to focus on patterns and what differences in those patterns get you and why we do them if I get a problem I can't solve. My little notepad is coming in handy there since I can write it all out.

polar plinth
#

Had problems with https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/ and https://leetcode.com/problems/merge-two-binary-trees/submissions/ the base cases aren't as obvious so I eventually struggled with them and gave up and looked at the solutions after about 15 minutes of wheel spinning. Wrote both functions out on my notebook and highlighted what's doing what to try and make it easier if I get similar problems in the future.

#

Going to spend tomorrow reviewing the DFS's I've hit so far before I move onto the last 3 DFS on the easy before I move onto my next topic. After that it's just Two Pointer problems, a Trie, sorting, and an Arrays problem and i'm done with easys and then it's just going through them to make sure I remember the patterns.

#

Then i'll move onto my mediums. Really hoping I don't hit a brick wall on those I could really use an early W. Either that or i'll do random easy's an and try to apply the patterns I got and then move onto mediums when I can reliably solve easy's.

tropic knot
#

Did you draw the tree

#

With pen and paper

#

pen and paper drawing is like the only cheat code in LC

polar plinth