Hi all I completed around 450 problems in Leetcode. Among 450 around 200 are medium problems. But still in the Leetcode contests I am unable to crack the medium questions. Can you please give me pointers on how to approach medium and hard problems. #leetcode #leetcodehard
following cus same issue. i can do the problems ive done before if im not rusty 90% of the time without issue, but mediums/hards i havent seen before are always tough :(
Although I haven't had a good luck myself 100% of the time but my contest performance improved with below line of thought for questions - Think dictionary first, can it be applied. A good number of times I found this to be the case. - Array: two pointers, sort, can any of these work - See if the problem can be converted into a graph dfs/bfs - String: like array but may require DP. If there are multiple string involved, it might as well need trie or a combination of dict, queue, set etc. - matrix: most likely would need memoization. - Does it look like a recursive approach, in that case think stack. - If recursive gave TLE, then use stack for traversal. At some point, give up the idea of recursion altogether and everytime recursion comes to mind, use stack. - At last queue (a normal queue or a priority queue) - Hints in the questions (a sorted array, a tree of n elements with values 1-n)
@kuuD23 Thanks 👍🏻
Skill transference between multiple subjects is next to impossible. And that’s what lc feels like at times. If you’re not high iq u just gonna memorize patterns. If u have bad memory, ur just fucked.
Sometimes I can't remember what the 2 problems I worked on the previous day were. What does that say about my memory?
Not much, unless you commonly have problems with memory in general.
Then it means you have practice but not a wiz.
If you solved hundreds of problems you should be familiar with main algorithms (bfs, dfs, how to solve do etc). IQ matters. Someone with IQ of 140 will find it easier to learn and grasp the concepts (almost feels intuitive) then someone with IQ of 120 or 110. Work isn't an IQ test (unless this is some hard research) Someone who puts more timer and persistent will achieve more than someone smarter but who is slacking off. Try this in order top to bottom: 1. If problem requires specific algorithm and you don't know it don't beat yourself down. Some smart dude have come up with it long ago after doing a lot of research and thinking. 2. If you know the algorithm but couldn't dissect the problem when you see it, try to develop an intuition, try to feel it. 3. If you don't feel it, don't have natural intuition try to read books like Cormen. Maybe if you have deep understanding it will be easier to develop intuition. 4. If above 3 steps failed there is hope for you. Try to memorize and understand main algo patterns and apply to correct problem. 5. If you have bad memory ... you're screwed.
Solved around 500 lc and can generally solve 3 of the 4 problems (though there are exceptions. Some times I can't solve the easy or medium problem and sometimes I can solve the hard problem). I'd identify what leetcode problems types your are struggling with and go from there. Also if you have not already, I would recommend resolving problems as well. I find the leetcode mock interview section is good for this.
Are you planning to interview now?
Have a few interviews scheduled am actively interviewing
Over how many months?
6 months