by AskAI

Solutions:

Check these solutions from our community and artificial intelligence:
This solution is correct and demonstrates a level of completeness. The approach is straightforward and easy to understand. The time and space complexity of the solution is also optimal.