Boats Group interview question

Coding Round was a Leetcode Medium difficulty problem