Maximize coins collected by 3-step pieces | Google Interview Question