I miss simple things when solving LC questions

Intuit / Eng
sugmaqock

Go to company page Intuit Eng

sugmaqock
Feb 12 4 Comments

When solving LC questions I consistently miss very simple things that get me stuck. They tend to be attributes that are innate to this problem or data set, that once realized make the answer almost second nature. I get so tunnel vision with the first crappy idea that pops in my head and it becomes so hard for me to look at these problems at a high level and conceptualize an answer.

What am I missing?! Please share any tips.

#leetcode
#interview
#swe

comments

Want to comment? LOG IN or SIGN UP
TOP 4 Comments
  • How long have you been practicing? Don't be discouraged early on. It unfortunately is a grind and after a while you start to see patterns
    Feb 13 0
  • Amazon
    vMLq63

    Go to company page Amazon

    vMLq63
    You speak very abstractly, so I also think you think very abstractly. Try viewing your problems more concretely. Use real examples and solve the problems manually before converting the solution into pseudocode

    It’s not magic you’re just not focusing on finding a solution to the problem. They’re mostly straight forward applications of recurring patterns. It seems you think they all have gotchas
    Feb 13 2
    • Intuit / Eng
      sugmaqock

      Go to company page Intuit Eng

      sugmaqock
      OP
      Could you give an example about the thinking abstractly thing? What would you say is a way to look at problems concretely?
      Feb 13
    • Amazon
      vMLq63

      Go to company page Amazon

      vMLq63
      You’re looking for some gotcha in the problem. In the case of 2sum, you should just write down the sorted array on the board and see what happens if you increment the left pointer, your sum of the values of the 2 pointers will increase because the array is sorted (and there are no duplicates). If you decrement the right pointer the sum will decrease. This allows you to fixate on your target sum for the problem. This is a recurring pattern of using 2 pointers and a sorted array.

      Find the recurring patterns by solving concrete examples. Understand why they work well together (incrementing/decrementing 2 pointers in a sorted list) and then realize the subset of problems that can be solved with the pattern in some way.

      Most problems outside of DP don’t have “gotchas” they just have patterns you’re not familiar with so you think they’re “gotchas”
      Feb 13