See the report before you trust the prep.
This is the report Placed gives you after an interview, in all five tracks: every score, the quotes behind it, what to fix, and what to practice next. Only the interview is made up.
What Pro shows after every interview, and what every free account gets for its first one.
Session Report
Receipts & rationale
per-criterion evidenceRun the edge cases you name. Saying "single element" earns little; running it and showing the output earns the testing score.
Talk while you type. One sentence per block of code ("now I take the k largest by count") keeps the interviewer with you.
When you find a better approach, weigh it out loud before you set it aside: "buckets are O(n) time and O(n) space; I will write the heap because I can test it faster."
Close with a walkthrough on a small input instead of "I think that works".
Spent the first 9 minutes on approach, which was well used, but left about 2 minutes for testing. Writing the heap version took 6 minutes; that left room to run the two edge cases you named.
Count each value, then group values by their count: bucket i holds the values that appear exactly i times. Counts never exceed n, so there are n + 1 buckets. Walk them from the highest count down and collect values until you have k.
from collections import Counter
def topKFrequent(nums: list[int], k: int) -> list[int]:
counts = Counter(nums)
buckets = [[] for _ in range(len(nums) + 1)]
for value, count in counts.items():
buckets[count].append(value)
result = []
for count in range(len(buckets) - 1, 0, -1):
for value in buckets[count]:
result.append(value)
if len(result) == k:
return result
return resultPasses this problem's tests in Python 3.11.
O(n): one pass to count, one pass over at most n + 1 buckets.
O(n) for the counts and the buckets.
Counts are at most n, so I can index buckets by count instead of sorting. I walk from the highest count down and stop as soon as I have k values.
- Sizing the buckets by the number of distinct values instead of n + 1, so the highest count falls off the end.
- Returning after the outer loop finishes a bucket, which can return more than k values.
- Sorting the whole Counter and calling it optimal: that is O(n log n).
You think like someone who has solved this before: the right questions, the right complexity, and the optimal idea when pushed. What holds the score down is the finish. Test what you named, and say what you are doing while you do it.
Ask Plato why a score landed where it did, or what would have moved it. Answers come from the report and your transcript. Scores do not change.
Why did testing only get a 4 when I named the right edge cases?
Naming them shows you know where the bugs live, which is why it is not lower. The score is for checking: you ran only the given example and said "I did not run those". A 7 needs at least one edge case run and its output read aloud, and a hand trace of the heap on a small input would have taken under a minute.
Built from your weakest criterion: Testing & Verification
Re-read the testing & verification rubric
You need to TRACE through inputs and call out edge cases proactively — not just say "looks good to me".
Read the rubricWrite tests before you submit
Verification scored lowest. Pick any problem and run through edge cases.
Start next sessionDrill the habit next session
Before claiming the solution works, hand-trace the algorithm on one happy-path input and one edge case.
Write tests before you submit
Verification scored lowest. Pick any problem and run through edge cases.
sample report · the interview is made up; the layout and the level of detail are what you get
Ready to get yours?
Start an interview without an account. Sign up when you finish and your first report is the full one, free, no credit card.
Start free