Technical Interview Question on Puzzles: Missionaries and Cannibals

Recruitment Made Easy


Missionaries and Cannibals

Three missionaries and three cannibals must cross a river. There is a single boat which can carry a maximum of two people and there must be at least one person on board (the boat cannot cross by itself).
On either bank, if there are missionaries present, the count of missionaries must be equal or greater than the count of cannibals, else the cannibals would eat them.
This is a classic example of a puzzle that can be solved using state transition diagrams.
You can start drawing the state transition diagram, both from the start state as well as the desired end state, hoping to find a way to get them to meet in the middle. At each state, it is also possible to move backwards (i.e.) go back to the previous state, but this is usually ignored because the goal is to explore new states to find a way to connect the start state with the end state.

This content was brought to you by Evalground Online Testing PlatformEvalground is an online assessment and test evaluation system focused on helping Recruiters in initial screening of potential candidates from an ocean of job seekers in an automated way.
Evalground supports Online Aptitude Tests, Spoken English Communication Skills AssessmentsCoding Contests in JAVA, C, C++, Ruby, Python, JavaScript and PHP.  Evalground also supports Automated asynchronous interviews. Evalground Screening Tests can be used by Recruiters during campus hiring or to screen walkin candidates.

Sharing is caring!