by AskAI

Solutions:

Check these solutions from our community and artificial intelligence:
This is a great solution! It is very efficient and only iterates through the array once.