Amazon Space Assigner as given
Amazon Space Assigner: my solution