Citadel interview question

Online assessment - 2 leetcode mediums