Find Third Transaction
A medium-tier problem at 54% community acceptance, tagged with Database. Reported in interviews at Cisco and 0 others.
You're staring at a SQL problem that looks simple on the surface but trips up candidates who haven't written a window function in months. Find Third Transaction is the kind of problem Cisco throws at you to see if you can rank rows and filter without overthinking it. Half the candidates who attempt it fail, and it's not because the logic is hard. It's because you forget whether to use ROW_NUMBER or RANK, or you write the window frame wrong. If you blank on the exact syntax during your live OA, StealthCoder surfaces a working solution in seconds, invisible to the proctor.
Companies that ask "Find Third Transaction"
Find Third Transaction is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.
Get StealthCoderThe trick here is ordering transactions by date and assigning a row number to each one per customer or entity, then filtering to keep only the third. Most candidates default to ROW_NUMBER OVER (ORDER BY date), which works. But you need to be careful about ties. If multiple transactions happen on the same day, RANK will give them the same rank and skip numbers, while ROW_NUMBER assigns unique numbers in insertion order. The problem expects you to pick the right window function, construct the OVER clause correctly, and then use a CTE or subquery to filter WHERE rank = 3. The common failure is forgetting to partition by the entity (customer ID or similar) so you rank globally instead of per customer. During the assessment, if the pattern doesn't click, StealthCoder runs invisibly and hands you a tested query.
Pattern tags
You know the problem.
Make sure you actually pass it.
Find Third Transaction recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Find Third Transaction interview FAQ
Is Find Third Transaction actually hard or does it just look that way?+
It's medium in reality but feels harder because window functions are easy to forget. The acceptance rate sits at 54%, meaning half fail. Most don't struggle with the concept. They slip up on ROW_NUMBER vs RANK, partition scope, or the WHERE clause syntax. Once you've seen it once, it's muscle memory.
Do I need to know both ROW_NUMBER and RANK for this problem?+
ROW_NUMBER is the safe bet. It assigns a unique integer to every row in order, which is exactly what you want for 'third transaction'. RANK handles ties differently (skips numbers), so unless the problem explicitly asks for tie handling, ROW_NUMBER is simpler and correct.
Will Cisco ask window functions at other points in their interview?+
Cisco asks database and SQL heavily, and window functions are a favorite pattern across their assessments. If you see this problem live, assume they value your comfort with OVER, PARTITION BY, and ORDER BY. Practice the syntax until you don't have to think.
What's the most common mistake candidates make on this one?+
Forgetting to partition by customer ID or account, so you rank all transactions globally instead of per entity. You end up returning the third transaction ever, not the third per person. The second mistake is using a self-join or nested loop when the window function does it in one pass.
Can I solve this without a CTE or subquery?+
Most database systems require a subquery or CTE to filter on the window function result. You can't put WHERE rank = 3 directly in the window clause. Write the window function in a subquery, alias it, then filter in the outer query. It's a little verbose but it's the standard pattern.
Want the actual problem statement? View "Find Third Transaction" on LeetCode →