Brave AI Lab Interview Question

Leet code style array problems,