Trilitech interview question

Problem solving challenge even though it was meant to be a data structures and algorithms interview