DSA for Interviews
Back to Mock Interview Practice

Mock 6 — Full 90-Min Interview (90 min)

Run a 90-minute interview simulation in the downloadable Jupyter notebook. Attempt all three problems, add tests, explain complexity, complete the retro, and submit the notebook.

90 minutesProject submission
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.

Assignment Instructions

Download and complete the starter notebook

Use the Download starter notebook button on this lesson. Open the .ipynb in JupyterLab, Jupyter Notebook, or another compatible Python 3 environment. Work in a saved copy, complete the TODOs and reflection cells, run the public checks, add the requested tests, then upload that completed .ipynb to this lesson. Do not submit a blank starter. The notebook intentionally contains no answer key or private reviewer rubric.

Instructions

This is a 90-minute simulation with three problems. Narrate your approach, state complexity, test examples and edge cases, and manage time so each problem gets an honest attempt. Use Python 3 in the downloaded notebook, and complete its code, tests, and interview retro cells.

Problem 1 — Valid Parentheses (Easy, about 10 minutes)

Implement is_valid(s). s contains only the six bracket characters ()[]{}. Return whether brackets are correctly matched and nested. Empty input is valid.

Examples: "()" → True; "()[]{}" → True; "(]" → False; "([)]" → False.

Problem 2 — Top K Frequent Elements (Medium, about 25 minutes)

Implement top_k_frequent(nums, k) for a nonempty integer array. 1 <= k <= U, where U is the number of distinct values. Return the k values with greatest frequency. If values tie at the cutoff, any selection among tied values is accepted; output order is unrestricted.

Example: [1,1,1,2,2,3], k=2 → [1,2].

Problem 3 — Trapping Rain Water (Hard, about 40 minutes)

Implement trap(height) for nonnegative integer bar heights. Return the total trapped water. Empty and singleton inputs return 0. The input is not mutated.

Example: [0,1,0,2,1,0,1,3,2,1,2,1] → 6.

Submit the completed notebook

  • Download this lesson's starter Jupyter notebook, complete the requested functions, and upload the saved .ipynb file here.
  • Keep your implementation, added tests, complexity reasoning, and interview reflection in the notebook. No separate source file or NOTES.md is required.
  • Do not upload the untouched starter. Public checks are examples, not a complete test suite; add the edge cases requested in the notebook.
  • The downloadable notebook contains no reference solutions or reviewer rubric. Notebook outputs are not used as proof of correctness; the reviewer checks your submitted source and written reasoning.

Download your practice notebook

Complete the TODOs and reflection cells in the Jupyter notebook, save it, and upload that `.ipynb` file below. The notebook contains no answer key or reviewer rubric.

Sign in to download your mock practice notebook

Free, takes a second. Your progress is saved to your account.

Checking your access…