How to Safely Get Three People and Three Ghosts Across a River? Step‑by‑Step Puzzle Solution
This article presents a classic river‑crossing puzzle where three people and three ghosts must use a two‑seat boat without ever letting ghosts outnumber people on either bank, detailing the analysis, each crossing round, and the logical search strategy to solve it.
Three people and three ghosts need to cross a river using a boat that can carry only two occupants. At any time on either bank, the number of people must be greater than or equal to the number of ghosts, otherwise the ghosts eat the people.
Story Origin
The puzzle starts with three people and three ghosts on one side and an empty boat that can hold two. The goal is to get everyone safely to the opposite bank.
Problem Analysis
Key observations:
The boat can transport either one person and one ghost, two people, or two ghosts each trip.
Someone must row the boat back; the boat cannot return on its own.
On both banks, the count of people must never be less than the count of ghosts.
These constraints shape the viable crossing strategy.
Crossing Rounds
Round 1
Send two ghosts across, bring one ghost back, resulting in the state (3 people, 1 ghost) on the starting bank and (0 people, 2 ghosts) on the far bank.
Round 2
All other possible moves (single person, single ghost, person‑ghost pair, two people) either leave a side vulnerable or revert to a previous state. The only viable move is again sending two ghosts across and bringing one back, reaching (3 people, 1 ghost) – (0 people, 2 ghosts).
Round 3
Continuing the same pattern, the only safe action is to send two ghosts across and return one, preserving the safe balance.
Round 4
Again, sending two ghosts across and bringing one back is the only move that avoids leaving any side with more ghosts than people.
Round 5
Finally, send the remaining two ghosts across, bring one back, and then send the last two ghosts together, achieving (0 people, 0 ghosts) on the starting bank and (3 people, 3 ghosts) safely on the far bank.
Thought Organization
The solution process mirrors a search tree: enumerate possible moves, prune those leading to unsafe states, and follow a branch until a solution is found. For larger numbers (e.g., five people and five ghosts), memorizing states becomes infeasible, so systematic tree exploration or recursion is essential.
Interview Insight
When faced with this puzzle in an interview, avoid jumping straight into intuition. Recognize the multi‑branch nature of the problem, model it as a multi‑way tree, and apply recursive reasoning to explore safe sequences efficiently.
NiuNiu MaTe
Joined Tencent (nicknamed "Goose Factory") through campus recruitment at a second‑tier university. Career path: Tencent → foreign firm → ByteDance → Tencent. Started as an interviewer at the foreign firm and hopes to help others.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
