C3 AI interview question

There were some algorithm exercises, the hard part is considering edge cases