Optimize attempts in a timed logic test | Shopify Interview Question