General Coding (DSA)
AI/ML roles at most companies still include a general software engineering coding round — this isn't optional prep even if your target role is ML-focused.
Core Patterns to Drill
- Arrays & strings: two pointers, sliding window — the majority of "easy/medium" problems reduce to one of these patterns.
- Hash maps: turning an brute-force lookup into — see Algorithms & Data Structures for why this works, made concrete below:
- Trees & graphs: BFS/DFS traversal, and recognizing when a problem is secretly a graph problem (it often is, even when not stated explicitly).
- Dynamic programming: identifying overlapping subproblems and optimal substructure — usually the hardest pattern to get comfortable with, and worth the most practice time relative to how often it comes up.
Want worked problems for these patterns, not just the strategy? See Practice Problems — real problems in each pattern above, with an in-browser sandbox graded against real test cases and a reference-solution reveal.
How to Practice Effectively
- Time yourself. A pattern you can solve untimed but not in 20-30 minutes isn't actually interview-ready yet.
- Explain your approach out loud before coding. Interviewers are evaluating your reasoning process, not just whether the final code compiles.
- Revisit problems you've already solved a week or two later, cold — recognizing a pattern quickly under pressure is the actual skill being tested, not having memorized one specific problem.
Why This Still Matters for ML Roles
Even in an LLM/agent-heavy job, you'll still write real code: data pipelines, evaluation harnesses, serving infrastructure. Interviewers use DSA rounds as a proxy for general coding fluency and problem-solving under pressure — not because you'll literally implement a graph traversal at work every day.
Next: ML Coding — the ML-specific coding round, testing whether you can implement the algorithms you know the theory of.