Day 32 of 133
ML coding consolidation + design pattern review
Re-implement one classifier with a clean OO API. Reflect on SOLID violations.
DSA · NeetCode Two Pointers
- Trapping Rain WaterDSA · Two Pointers
Interview questions to prep
- Compare DP (precompute left-max, right-max) vs two-pointer O(1) space — walk through the two-pointer invariant.
- What if rainwater can flow off the sides — how does that change anything?
ML · Coding from scratch
Interview questions to prep
- Implement k-NN from scratch and explain its time/space complexity.
- How would you speed up k-NN inference on millions of points without changing the prediction?
Interview questions to prep
- Implement k-means with k-means++ initialization.
- Why does k-means++ initialization matter, and what does it cost vs random init?
Interview questions to prep
- Implement logistic regression with mini-batch SGD and L2 regularization.
- What numerical-stability pitfalls do you watch out for when implementing the sigmoid + log-loss?
Interview questions to prep
- Implement linear regression training with vectorized gradients and a learning-rate parameter.
- How do you verify your from-scratch implementation against sklearn or a closed-form OLS solution?
SWE · Design patterns
Interview questions to prep
- When is a singleton an anti-pattern in tests?
- Compare factory vs abstract factory vs builder.
Interview questions to prep
- When would you reach for an adapter vs a facade?
- Where does the decorator pattern show up cleanly in an ML inference pipeline?
Interview questions to prep
- Show how the strategy pattern lets you swap ML models without touching call sites.
- When does observer cause subtle bugs in a high-throughput system?
References & further reading
- alirezadir — Machine Learning Interviews ↗GitHub
- Refactoring.guru — design patterns ↗Refactoring.guru