Scale interview question

Had to write helper code for their codebase