Skip to content
Proyectos

charlie763/technical-interview-practice

Ver en GitHub

Acerca de

A collection of Software Engineer practice problems with test suites, designed to be generated and extended by an AI coding agent (Claude Code or similar).

Herramientas de desarrollo

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

Technical Interview Practice

A collection of Software Engineer practice problems with test suites, designed to be generated and extended by an AI coding agent (Claude Code or similar).


Design Principles

  • It should be easy to get AI to add new practice problems that can (1) be tested under the existing framework and (2) be searcheable by opening index.html
  • It should be easy to find relevant practice problems to work on
  • SWEs practice should be able to run tests against their practice problem answer files without having to update any code besides the code in their answer file
  • Tests should isolated and not bleed data
  • Practice problem logic should be cumalitive; later stage logic should utilize earlier stage logic where possible
  • Practice problems should be strive to realistic represent practice problems an SWE might encounter in a real technical interview
  • This repo is meant to be used locally

Repo structure

More directories may be added over time as problems in different languages are added, but the overall structure should stay the same.

index.html                    # Searchable problem browser — open in any browser locally
data.js                       # Problems array holding meta-data about all practice problems
python/
  practice_problems/          # Problem stubs — read these, don't edit them
  practice_problem_answers/   # Your implementations go here
  tests/                      # pytest suites (one per problem)
  conftest.py                 # pytest config & --answer flag
react/
  practice_problems/          # React/JSX/TSX starter files
  src/App.jsx                 # Active problem (overwrite to work; restore with git)
  src/main.jsx                # Vite entry point (do not modify)
  tests/                      # Playwright e2e specs (one per problem)
  package.json                # Vite + Playwright deps
  playwright.config.js        # Playwright config (auto-starts Vite)
  vite.config.js
typescript/
  practice_problems/          # .ts class stubs (read-only during practice)
  practice_problem_answers/   # Your implementations go here
  tests/                      # Jest suites (one per problem)
  package.json                # Jest + ts-jest deps
  jest.config.js              # Answer-redirect plugin
golang/
  practice_problems/          # problem_NN_<name>/ dirs, each with problem.go + problem_test.go
  practice_problem_answers/   # cw_answer_NN_<name>.go files
  go.mod
ruby/
  practice_problems/          # problem_NN_<name>.rb class stubs (read-only during practice)
  practice_problem_answers/   # Your implementations go here
  tests/                      # RSpec suites (one per problem) + spec_helper.rb
  Gemfile                     # rspec dependency
run_tests.sh                  # Unified test runner for all languages (see below)
CLAUDE.md                     # Guidelines for the AI agent

Prerequisites

Python (one-time setup)

# From the repo root
python3.11 -m venv .venv
.venv/bin/pip install pytest

run_tests.sh activates .venv automatically, so you don't need to do it manually before running tests.

React (one-time setup)

cd react
npm install
npx playwright install chromium   # download the test browser (~95 MB)

TypeScript (one-time setup)

cd typescript
npm install

Go (one-time setup)

Go 1.22 or newer must be installed. Check with:

go version

No additional dependencies — all Go problems use only the standard library.

Ruby (one-time setup)

Ruby 3.2+ must be installed. Check with:

ruby --version

Then install the rspec gem:

cd ruby/
bundle install

Browsing problems

Open index.html in any browser (double-click it in Finder, or run open index.html).

The index lets you filter by language and industry, search by keyword, and click tags to narrow results. Each card has an Open in VS Code link that deep-links directly into your local clone — no path configuration needed.


Practicing a problem

1. Find a problem

Browse index.html to pick something, then click Open in VS Code to open the stub.


Python problems

2. Copy the stub to your answers directory

cp python/practice_problems/problem_03_permission_manager.py \
   python/practice_problem_answers/my_answer_03_permission_manager.py

The prefix (my_answer_, cw_answer_, etc.) can be anything — the filename must keep the NN_<name> segment (e.g. 03_permission_manager) so the runner can map it to the right test suite.

3. Implement it

Fill in the raise NotImplementedError stubs. Keep the function/class signatures identical to the stub.

4. Run tests against your answer

# Full test suite
./run_tests.sh \
  -f python/practice_problem_answers/my_answer_03_permission_manager.py \
  -c pytest python/tests/test_problem_03_permission_manager.py -v

# Single test class
./run_tests.sh \
  -f python/practice_problem_answers/my_answer_03_permission_manager.py \
  -c pytest python/tests/test_problem_03_permission_manager.py::TestCreateRole

# Single test method
./run_tests.sh \
  -f python/practice_problem_answers/my_answer_03_permission_manager.py \
  -c pytest python/tests/test_problem_03_permission_manager.py::TestCreateRole::test_empty_permissions_by_default

# Stop on first failure
./run_tests.sh \
  -f python/practice_problem_answers/my_answer_03_permission_manager.py \
  -c pytest python/tests/test_problem_03_permission_manager.py -x

--answer is injected automatically — you never need to edit the test files.


React problems

2. Create your answer directory and copy the stub into it

mkdir -p react/practice_problem_answers/cw_answer_02_incident_dashboard
cp react/practice_problems/problem_02_incident_dashboard.jsx \
   react/practice_problem_answers/cw_answer_02_incident_dashboard/App.jsx

react/src/App.jsx is a permanent placeholder — never edit it. Your answer lives in its own isolated directory.

3. Implement it in a browser

cd react
PRACTICE_ANSWER=practice_problem_answers/cw_answer_02_incident_dashboard npm run dev

Opens http://localhost:5173 and hot-reloads your App.jsx on every save. You can add helper files (components, hooks, etc.) inside your answer directory and import them normally.

4. Run Playwright tests against your answer

Use run_tests.sh the same way as Python — pass the answer directory (or App.jsx inside it):

# Run the Playwright suite for problem 02
./run_tests.sh \
  -f react/practice_problem_answers/cw_answer_02_incident_dashboard \
  -c npm run test:02

# Open Playwright's interactive UI (step through each test visually)
./run_tests.sh \
  -f react/practice_problem_answers/cw_answer_02_incident_dashboard \
  -c npm run test:ui

Or run directly from the react/ directory:

cd react
PRACTICE_ANSWER=practice_problem_answers/cw_answer_02_incident_dashboard npm run test:02
PRACTICE_ANSWER=practice_problem_answers/cw_answer_02_incident_dashboard npm run test:ui

Stop any running npm run dev session before running tests — when PRACTICE_ANSWER is set, Playwright always spawns a fresh dev server to ensure it uses the right answer.

5. No cleanup needed

react/src/App.jsx is never modified, so there's nothing to restore.


TypeScript problems

2. Copy the stub to your answers directory

cp typescript/practice_problems/problem_01_donation_processor.ts \
   typescript/practice_problem_answers/my_answer_01_donation_processor.ts

The prefix (my_answer_, cw_answer_, etc.) can be anything — the filename must keep the NN_<name> segment.

3. Implement it

Fill in the throw new Error('Not implemented') stubs. Keep the class and method signatures identical to the stub.

4. Run tests against your answer

# Via run_tests.sh (from repo root)
./run_tests.sh \
  -f typescript/practice_problem_answers/my_answer_01_donation_processor.ts \
  -c npm run test:01

# Or directly from typescript/ with the env var
cd typescript
PRACTICE_ANSWER=my_answer_01_donation_processor npm run test:01

# Watch mode (re-runs on every save)
PRACTICE_ANSWER=my_answer_01_donation_processor npm run test:watch

The PRACTICE_ANSWER env var tells Jest to redirect imports of the stub to your answer file — you never need to edit the test files.


Go problems

2. Copy the stub to your answers directory

cp golang/practice_problems/problem_01_geofence_alert_engine/problem.go \
   golang/practice_problem_answers/my_answer_01_geofence_alert_engine.go

The prefix can be anything; the NN_<name> segment must match the problem directory name.

3. Implement it

Replace every panic("not implemented") with a real implementation. Your answer file must:

  • Declare the same package name as the problem (shown at the top of problem.go, e.g. package geofence)
  • Only import standard-library packages
  • Include the type definitions copied from problem.go (keep them as-is)

4. Run tests against your answer

# Full test suite
./run_tests.sh \
  -f golang/practice_problem_answers/my_answer_01_geofence_alert_engine.go \
  -c go test -v .

# Single test group
./run_tests.sh \
  -f golang/practice_problem_answers/my_answer_01_geofence_alert_engine.go \
  -c go test -v -run TestIsInZone .

run_tests.sh automatically pairs your answer file with the right problem_test.go, compiles them together in a temporary directory, and runs the tests — no go.mod setup required.


Ruby problems

2. Copy the stub to your answers directory

cp ruby/practice_problems/problem_01_geofence_alert_engine.rb \
   ruby/practice_problem_answers/my_answer_01_geofence_alert_engine.rb

The prefix (my_answer_, cw_answer_, etc.) can be anything — the filename must keep the NN_<name> segment so the runner can map it to the right spec file.

3. Implement it

Fill in the raise NotImplementedError stubs. Keep the class and method signatures identical to the stub.

4. Run tests against your answer

# Via run_tests.sh (from repo root)
./run_tests.sh \
  -f ruby/practice_problem_answers/my_answer_01_geofence_alert_engine.rb \
  -c rspec tests/problem_01_geofence_alert_engine_spec.rb

# Or directly from ruby/ with the env var
cd ruby
PRACTICE_ANSWER=my_answer_01_geofence_alert_engine \
  rspec tests/problem_01_geofence_alert_engine_spec.rb

tests/spec_helper.rb's load_problem helper reads PRACTICE_ANSWER and loads your answer file in place of the stub — you never need to edit the spec files. Running rspec from ruby/ with no PRACTICE_ANSWER set runs every spec against the stubs, which should all fail with NotImplementedError — that's the expected baseline.


Adding new problems with an AI agent

⚠️ WARNING - PLEASE READ: If contributing, please do not add any problems verbatim from actual technical interviews. We don't want to get each other in trouble or cause issues for people actively interviewing. The CLAUDE.md file has instructions to scrub actual company names from problems, but please double check the code for that before submitting a PR.

This repo is designed to be extended by prompting an AI coding agent. Open Claude Code (or your preferred agent) in this repo and describe what you want. The agent will read CLAUDE.md for conventions automatically.

A good prompt specifies: the language, the industry/domain, the core data structure or algorithm pattern, the number of parts, and any constraints on problem style. Example:

Generate a new Senior SWE interview problem for the python/ directory.

- Domain: dev-tools / CI-CD infrastructure
- Core concept: a class-based job scheduler that manages a queue of build jobs
  with priorities, dependencies between jobs, and cancellation
- 3 progressive parts: Part 1 basic enqueue/dequeue, Part 2 job dependencies
  (a job can't start until its dependencies complete), Part 3 priority ordering
  within the ready queue
- Style: class-based, candidate chooses internal data structures
- Follow all conventions in CLAUDE.md (fixtures, no class-level state,
  self-contained parts, composing methods, concrete usage example in docstring)
- [optional] - please checkout this JD/company website, do some research on the company
   to see if the company asks a specific style of interview questions and base the practice 
   problem(s) off of that.

After creating the problem and test files, add an entry to the PROBLEMS array
in data.js following the format in CLAUDE.md.

The agent will create:

  • python/practice_problems/problem_NN_<name>.py — the stub
  • python/tests/test_problem_NN_<name>.py — the test suite
  • An entry in index.html

DO NOT ask it to improve existing problems or test suites, unless you don't plan to merge your branch into main as that will likely break other peoples' answers. Instead, if you would like to improve upon an existing problem/test just copy and paste it into a new problem/test file with something like v.x appended to the file name, and then try to improve the problem and/or test suite.

Explorar proyectos relacionados

Cargando…