Diagnostic Assessment
Overview
Before building a study plan, we needed to figure out where the gaps were. This diagnostic session covered eight classic interview problems across heaps, graphs, dynamic programming, sliding windows, and data structure design. For each problem, I gave a recognition assessment, DS/algorithm choice, and implementation confidence level.
The results: strong first-principles reasoning but weak pattern recognition. I could often frame the problem correctly but didn’t know the standard algorithms or data structures to solve it efficiently.
Problems
Kth Largest Element
Problem: Given an array nums and integer k, return the kth largest element. Do better than O(n log n).
My response: Maintain a sorted top-k collection, scan the array once. Claimed O(n) time.
Assessment: Reached for the heap approach (O(n log k)) but miscounted the complexity as O(n). Did not know Quickselect — the true O(n) average-case answer. Also couldn’t implement quicksort’s partition scheme.
- Recognition: Partial
- DS/Algo: Heap yes, Quickselect no
- Confidence: Medium
Meeting Rooms II
Problem: Given meeting intervals [[start, end], ...], find the minimum number of rooms needed.
My response: Sort by start time, iterate earliest to latest, greedily assign meetings to free rooms. Recognized this as the same class as my failed interview question (interval coloring).
Assessment: Correct greedy strategy but did not name the min-heap as the data structure for efficiently finding the earliest-ending room.
- Recognition: Yes
- DS/Algo: Greedy yes, min-heap no
- Confidence: Low-Medium
Longest Substring Without Repeating Characters
Problem: Given string s, find the length of the longest substring without repeating characters.
My response: Sliding window with a hashset. Correctly refined from hashtable to hashset since values aren’t needed. (A placeholder in the UI partially spoiled this one.)
Assessment: Right answer, but partially spoiled. Self-rated 5/10 on implementing the window shrink logic.
- Recognition: Yes (with assist)
- DS/Algo: Yes
- Confidence: Medium
Climbing Stairs
Problem: n steps, can climb 1 or 2 at a time. Count the distinct ways to reach the top.
My response: Combinatorial approach — sum of ways to arrange k twos among the steps. Valid math but impractical to implement.
Assessment: Completely missed the DP / Fibonacci recurrence: ways(n) = ways(n-1) + ways(n-2).
- Recognition: No
- DS/Algo: No
- Confidence: Low
Binary Tree Level-Order Traversal
Problem: Given a binary tree, return its values in level order (left to right, level by level).
My response: Mentioned the array representation of a binary tree (parent index = floor(child/2)), said level order would be the array order.
Assessment: That works for complete binary trees (heap storage) but not arbitrary trees. Did not know the BFS + queue approach for general trees.
- Recognition: Partial
- DS/Algo: No
- Confidence: Low
Course Schedule
Problem: Given n courses and directed prerequisite edges, return a valid completion order or indicate impossible.
My response: Correctly identified that “impossible” means a cycle exists and that disconnected subgraphs can go in any order. Mentioned Dijkstra’s algorithm (wrong — that’s for shortest paths). Said he doesn’t know how to find disconnected subgraphs.
Assessment: Good graph intuition but did not know topological sort or Kahn’s algorithm. Confused Dijkstra’s purpose.
- Recognition: No
- DS/Algo: No
- Confidence: Low
Number of Islands
Problem: Given an m x n grid of 0s and 1s, count the number of connected components of 1s (islands).
My response: Correctly framed as counting disconnected components in a graph where adjacent 1s share edges. Did not know the algorithm to count them.
Assessment: Did not know DFS flood fill on grids. Also did not mention Union-Find as an alternative.
- Recognition: Partial
- DS/Algo: No
- Confidence: Low
Insert/Delete/GetRandom O(1)
Problem: Design a data structure supporting insert, remove, and getRandom, all in O(1) average time.
My response: Two structures — an array and a value-to-index map. Insert appends and records the index. Remove uses the map to find the index. getRandom picks a random array index.
Assessment: Very close to the correct solution. Missed the key trick: swap the target element with the last element before popping, so array deletion is O(1). Strong reasoning from first principles.
- Recognition: No (but reasoned toward it)
- DS/Algo: Partial
- Confidence: Medium
Identified Gaps
Priority-ordered list of what to study, based on diagnostic results:
- Heaps — knows the concept, can’t implement or apply. Unlocks problems 1 & 2. Start here because it builds on existing knowledge.
- BFS/DFS on graphs and grids — doesn’t know flood fill, BFS traversal, or general graph search. Unlocks problems 5, 6, 7.
- DP pattern recognition — didn’t see the recurrence in the simplest DP problem. Biggest gap for interview coverage.
- Sliding window mechanics — knows the pattern name but shaky on implementation (self-rated 5/10). Quick win to solidify.
- Quickselect / partitioning — doesn’t know quicksort partition either. Useful but lower priority.
| # | Problem | Pattern | Recognized? | DS/Algo? | Confidence |
|---|---|---|---|---|---|
| 1 | Kth largest | Quickselect / Heap | Partial | Heap yes, Quickselect no | Med |
| 2 | Meeting rooms | Greedy + min-heap | Yes | Greedy yes, heap no | Low-Med |
| 3 | Longest substring | Sliding window | Yes (spoiled) | Yes | Med |
| 4 | Climb stairs | DP / Fibonacci | No | No | Low |
| 5 | Level-order traversal | BFS + queue | Partial | No | Low |
| 6 | Course schedule | Topological sort | No | No | Low |
| 7 | Number of islands | DFS flood fill | Partial | No | Low |
| 8 | Insert/Delete/Random | Array + map swap | No | Partial | Med |