Cleverbridge GmbH interview question

Leecode coding challenge (easy-medium difficulty)