Added initial while-based solution proposed on Piazza.