--- license: cc-by-4.0 language: - en task_categories: - text-generation tags: - code - algorithms - interview - python pretty_name: Coding interview problems with test cases size_categories: - n<1K configs: - config_name: default data_files: problems.jsonl --- # Coding interview problems with test cases I put these 39 algorithm problems together for people preparing for the coding round of a software engineering or quant developer interview, and I've kept them close to what you'll actually be asked. Fourteen of them are graph problems and twelve are dynamic programming, while the other thirteen come from sliding window, binary search and a few smaller patterns like a stack or a heap. I'd call 11 of them easy, 24 medium and 4 hard, though you may well disagree once you've tried a couple. Each row has the problem statement in plain text with its worked examples and constraints, a Python starter, and the test cases I use to mark answers on the site, which come to 574 across the whole set. I've checked every problem's solutions against a separate reference solution on those same tests, so if you want a small code-generation benchmark you can call a candidate function on each test's `args` and compare whatever comes back with its `out`. I haven't included the solutions, because the point is that you write them yourself. Every row has a `url` for its problem page, and there you can write your answer in Python, C++, Java, JavaScript, Rust or Haskell and run it against the same tests, with hints on the page if you get stuck halfway. ## What a row looks like ```json {"slug": "count-islands", "title": "...", "pattern": "graphs", "difficulty": "Easy", "statement": "...", "examples": [{"input": "...", "output": "..."}], "constraints": ["..."], "python_function": "...", "python_starter": "...", "tests": [{"args": [...], "out": ...}], "url": "https://geodesicpartners.co.uk/coding-count-islands"} ``` You'll get each graph as a grid, an edge list or an adjacency list depending on the problem, and the statement tells you which one to expect. None of the outputs is a floating point number, so a plain equality check is all you need when you score a run. If you'd like the lessons that go with these, the whole course is sorted by pattern at https://geodesicpartners.co.uk/coding-interview-course