A practice prompt we wrote. No company or candidate report names it, so it carries no company tag.
How to answer
Palantir’s careers page names working within existing codebases as an interviewed competency, noting that developers spend far more time debugging and extending existing code than writing new code. Source 1Working Inside Existing SystemsPublisherPalantirSource typecompany hiring page The page covers Palantir hiring in general, not the loop specifically. A failing test shows that skill in minutes.
-
Restate the report as expected and actual. “A sale on the last day of the month should be in the monthly total, and isn’t.” Ask for the exact input, version and time zone; without them, say your hypothesis.
-
Shrink the input. Confirm on the real path, then cut to the smallest input and lowest function still showing the wrong value: one record, not the customer’s export.
-
Assert the correct behavior, and name the test after it. Not today’s wrong output.
def test_sale_on_last_day_of_month_is_counted(): sales = [Sale(datetime(2026, 3, 31, 14, 5), Decimal("40.00"))] assert monthly_total(sales, 2026, 3) == Decimal("40.00") -
Run it and read the failure aloud.
assert Decimal('0') == Decimal('40.00')is the symptom. AnImportErroror fixture error is a broken test, not a reproduction. Run it on the version the customer runs; if it passes there, the failure you saw is a different bug from theirs. -
Make it fail every run, with the customer’s values. Pin the clock, time zone, seed and ordering to what the customer had, not your laptop’s defaults: pinning UTC can make a month-end bug disappear.
-
Fix, then guard the other side. A neighbor test keeps midnight on the first of the next month out, so the fix is not a widened window. Then rerun the customer’s original input: if it is still wrong, the small test caught one of two bugs.
The trap is fixing first: a test you never saw fail may test nothing. The bug hunt drill practices this on unfamiliar code.
Follow-ups
What the interviewer may ask next, once your first answer is on the table.
- Your test fails, but how do you know it fails for the same reason the customer saw?
- The bug only shows up on the customer’s machine. What do you pin down before you give up on a local reproduction?
- The existing suite passes. Why did it miss this, and what else did it miss for the same reason?
Where answers go wrong
- Writes a test that fails because the setup is broken, such as an import error or a missing fixture, and calls the bug reproduced.
- Feeds the customer’s whole file into the test, so it fails for several reasons and nobody can tell which one the fix addressed.
Answer this in two minutes
Write the answer you would say out loud. The clock starts with your first word.
Model answer
The report: “Our March statement for the Denver store is short. The till says 78,847.50, and your statement says 76,734.19.”