EGYM interview question

An data structure coding problem to solve in Google docs.