Albertsons Companies Interview Question

Had to do whiteboard to write algorithm to solve a problem.