6/8
Real example from yesterday - K Closest Points to Origin (LeetCode 973): π
I was stuck on the Quickselect optimal solution.
I started with: "can you help me understand the optimal solution"
Then: "explain quick select in this context" asked for a walk-through with a concrete example.
Next: "show me with the code that is annotated with easy to understand variable names"
I kept drilling in on the confusing parts:
- "I dont understand moving the pivot to the end"
- "what does this mean" (the write_position loop)
- "but why do we move to the end of the array the random start point"
- "can you do the example with numbers not points" (to simplify)
Then I wrote my own code, it failed on edge cases, and I asked "intuitively why" it broke "what's the intuition with the left and right?"
Took about 8-10 back-and-forths, but I actually understood Quickselect instead of just memorizing it.