LinkedIn interview question

Online coding test. Although, it was not unexpected.