MEDIUMasked at 1 company

Escape The Ghosts

A medium-tier problem at 63% community acceptance, tagged with Array, Math. Reported in interviews at Wix and 0 others.

Founder's read

Escape The Ghosts is a medium-difficulty problem that shows up in Wix interviews and trips up candidates who overthink it. The acceptance rate sits at 62%, which means a third of people who attempt it blank or timeout. You're given a grid, a starting position, and ghost positions. The naive instinct is to simulate movement or run BFS. That's wrong. The actual solution is pure math. No data structures, no loops over time steps. If you hit this live and your first instinct is to code a path simulation, StealthCoder surfaces the geometric insight in seconds while the proctor sees nothing.

Companies asking
1
Difficulty
MEDIUM
Acceptance
63%

Companies that ask "Escape The Ghosts"

If this hits your live OA

Escape The Ghosts 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 a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.

Get StealthCoder
What this means

The trick is Manhattan distance. You're not actually moving anywhere. The question reduces to: can you reach the exit before any ghost reaches it? For each ghost, calculate if you can reach the exit in fewer steps than that ghost can. If you can beat all ghosts to the exit, you escape. If even one ghost arrives at the same time or earlier, you're caught. Most candidates waste time building a grid simulator or considering multiple paths when the problem has a closed-form answer. The Array and Math topics hint at the simplicity, but candidates see 'ghosts' and 'escape' and build something elaborate. StealthCoder is your hedge for the moment you realize your BFS approach is overkill and you've burned 15 minutes.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Escape The Ghosts 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 a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Escape The Ghosts interview FAQ

Is this really a medium or does it feel harder?+

The 62% acceptance rate confirms it's legitimately tricky for the difficulty tier. The problem statement sounds like a game simulation, which baits you into complex code. The actual solution is elegant and short. The gap between the hard-sounding premise and the simple answer is what catches people.

How does Manhattan distance solve this?+

You measure the shortest distance from your start to the exit and from each ghost start to the exit. If your distance is strictly less than every ghost's distance, you win the race. If any ghost ties or beats your distance, it can intercept you at the exit no matter what path you take.

Why is Array in the topics if the solution is mostly Math?+

Input is typically an array of ghost positions and possibly the grid dimensions. Array tells you to iterate over the ghosts and compare distances. It's not about array manipulation, just iteration over the input structure.

Do I need to code different ghost behaviors or AI?+

No. Ghosts don't need behavior logic. They move optimally toward you, which means they also use Manhattan distance. The problem assumes each ghost takes the shortest path. That assumption makes it solvable in O(n) time without simulation.

Is Wix the only company asking this?+

According to reports, yes. It's not a high-frequency leetcode problem. That can work in your favor if you prepare for it, because fewer candidates will have drilled the Manhattan distance trick in advance.

Want the actual problem statement? View "Escape The Ghosts" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.