Technical Interview Question on Puzzles: Missionaries and Cannibals


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 CodeGround Online Testing PlatformCodeGround 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.

CodeGround supports Online Aptitude TestsSpoken English Communication Skills AssessmentsCoding Contests in JAVA, C, C++, Ruby, Python, JavaScript and PHP.  CodeGround also supports Automated asynchronous interviews. CodeGround Screening Tests can be used by Recruiters during campus hiring or to screen walkin candidates.


Please follow and like us:
Share this: