LeetCode perceived difficulty

CategoryConcern
Array/StringLow
Two pointersHigh
Sliding windowLow
Prefix sumLow
Hash mapVery low
Stack???
QueueLow
Linked listLow
Binary tree (DFS)Medium
Binary tree (BFS)???
Graphs (BFS)???
Graphs (DFS)???
Heap / PQ???
Binary search???
Backtracking???
DP (1-D)Low
DP (N-D)High
Bit manipulation???
Prefix tree???
Intervals???
Monotonic stack???
”Misc”???

2024-06-13

  • Once I sense that I’m starting to get too tired, really just stop. It’s not productive to keep grinding at these things once I’m not thinking straight.
  • There is a huge diversity of problems in the “two-pointers” category. This type of problem hasn’t come up much in my career, so I haven’t gotten much practice with them. I need to keep grinding on these.
  • For now, move on to something else and come back to two-pointer in awhile

2024-06-11

Linked lists

today the LinkedList problems were coming very easy lol

Dynamic programming

Just keep working with the stock problem series:

  1. 121. Best Time to Buy and Sell Stock
  2. 122. Best Time to Buy and Sell Stock II
  3. 123. Best Time to Buy and Sell Stock III
  4. 188. Best Time to Buy and Sell Stock IV
  5. 309. Best Time to Buy and Sell Stock with Cooldown
  6. 714. Best Time to Buy and Sell Stock with Transaction Fee

2024-06-10

  • Seriously, do all the LinkedList problems. Red alert. I got so jammed up!
  • Also, DP problems. Need to set up a recurrence relation before attempting to solve.
  • Once I got the hang of what they were after with 1-D DP, it became pretty easy.
  • Multi-dimensional DP is rough. Do some more of these.
  • Tomorrow, start with trees.

2024-06-07

  • Also bad at linked lists. (It’s been awhile and nobody cares IRL.)

2024-06-06

  • I was very slow at a two-pointer problem involving swaps, but lightning-fast at one involving analyzing a string. Speaks to the kind of work I’ve done! Practice the former.
  • To convert a tail-recursive function to a loop, you basically just surround the body with while True.
  • One trick with two-pointer problems is to leave a mess and then clean it up

2024-05-27

From “How did you crack Google?” discussion thread

  • Goal is to get used to all the patterns
    • So solve 100% of the “easy” problems and as many “medium” as you have time for
  • Don’t look at answers, ever
  • Don’t try “Hard” questions
  • One-hour timer
    • No solution? Skip it and come back to it
  • It follows from this that LC premium is probably not worth it

David’s thoughts on this