Encircle interview question

boring and very long coding question.