C3 AI Interview Question

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