Grability interview question

Feature solution