Citadel interview question

Leet code type of question with time and space complexity.