ANZ interview question

Coding test for python, medium difficulty leetcode problem