0%
AI-Assisted Coding Interviews: Prompting, Reviewing AI Output, Testing, and Handling the Twist
How AI-Assisted Rounds Work
Prompting the Assistant
Reviewing AI Output
Thinking Out Loud
Time Management
Worked Round: Link Shortener
The third worked round is a link shortener. The room booking round was about boundaries in time, and the leaderboard round was about an assumption a twist removed. This round is about encoding and uniqueness: turning numbers into short strings correctly, and keeping codes unique when two different sources start producing them. The candidate works in Python, with notes for TypeScript and Java at the end of each section.
The README
The README says: the service stores long URLs and hands out short codes. Each new link gets the next numeric id from a counter. Its short code is the id written in base 62, using the alphabet of digits 0 to 9, then lowercase a to z, then uppercase A to Z. The most significant digit comes first, and there are no leading zeros. Implement short_codes(ids), which returns the code for every id in the list, in order. Ids are non negative integers that fit in a signed 32 bit integer.
There are two visible tests: a list with a single digit id, the last single digit id and the first two digit id, and a list with one id whose code has two digits.
Minutes zero to five: reading
Interview Dialogue
The candidate restated the rule and singled out two things: the alphabet order and the range of ids. Both matter. The alphabet order decides what every code looks like; a different order, uppercase before lowercase for example, produces valid looking codes that are simply wrong. The range decides which inputs the encoder must handle, and writing it down gives the candidate something concrete to test against later.
Minutes five to eight: the existing code and tests
The module contains a stub for short_codes, a constant holding the alphabet and a small store class that maps codes to URLs for the later stages. The candidate checks that the alphabet constant matches the README, character by character in groups: ten digits, twenty six lowercase, twenty six uppercase. It does.
Interview Dialogue
Listing what the visible tests do not cover is the same habit as in the earlier rounds. Here the gaps are mostly about the domain: how big, how small, how empty. The candidate does not yet know which gap matters most, but the list exists, and it will be the starting point for review.
Minutes eight to ten: questions
Interview Dialogue
The case sensitivity question is not idle. If codes were case insensitive, a base 62 alphabet would be wrong, because lowercase a and uppercase A would collide. The answer confirms the README. The question about decoding gets a non answer, which is normal; the candidate notes that decoding is likely and moves on.
Minutes ten to twelve: plan
Interview Dialogue
Commentary
The candidate spent twelve minutes before any code. They restated the rule, checked the alphabet constant against the README, wrote down the id range as the domain, listed the gaps in the visible tests and asked four short questions. None of this needed cleverness. It produced two artefacts that the rest of the round depends on: a written domain and a gap list.
Why the domain matters more than the algorithm
Base 62 encoding is a well known algorithm, and an assistant will almost always produce something that looks right. The risk in this kind of task is rarely the algorithm itself. It is whether the loop handles every input the README allows. An encoder that is correct for most numbers and wrong for a few is the classic failure, and the few are almost always at the edges of the domain. That is why the candidate wrote the range down before asking for code.
What a weaker orientation looks like
A weaker candidate sees base 62, says this is easy and asks the assistant immediately. They do not check the alphabet constant, do not write down the range and do not list gaps. When the assistant's code passes both visible tests, they move on. If the encoder mishandles part of the domain, they will not find out until a hidden test or the interviewer points it out.
Restating rules as tests
As in the leaderboard round, turn each README sentence into a test you could write. The alphabet order becomes: ten encodes as lowercase a, thirty six as uppercase A. Most significant digit first becomes: one hundred and twenty five encodes as 2 then 1, not 1 then 2. No leading zeros becomes: no code longer than it needs to be. The id range becomes: one test near each end of the range. Each sentence gives you at least one concrete case.
What changes in TypeScript and Java
In TypeScript, the signature is shortCodes(ids: number[]): string[]. Numbers are floating point, so integer division must use Math.floor, and the candidate should ask whether ids could exceed the safe integer range; within 32 bits, they cannot. In Java, shortCodes takes a list of Integer and returns a list of String. A StringBuilder is the natural way to build each code, and the review must check whether the builder is reversed at the end, because digits come out lowest first.
Summary of orientation
Restate the rule, check the alphabet constant against the README, write down the id range as the domain, list the gaps in the visible tests, ask about case sensitivity, empty input and the call pattern and plan to review against the domain.
Practising this orientation
Take any small encoding task, such as writing numbers in base 36, formatting durations as hours and minutes or turning row numbers into spreadsheet column letters. Give yourself ten minutes. Restate the rule, write the input range down, mark its boundaries, list the gaps in whatever examples you have and write three questions. Write no code. The aim is to make the domain list automatic, so that by the time any code appears, you already know what it must handle.
The more often you do it, the faster it gets, and the more of your round is left for review.
When a task is a known algorithm, the risk is in the inputs it must cover. Writing the stated range down before seeing code gives your review a checklist that does not depend on what the code happens to do.