LexCheck interview question

Was asked to solve two coding problems