Brave AI Lab interview question

Leet code style array problems,