Cadence Design Systems interview question

the famous 5 pirates problem