Acquia interview question

1 and 2: Coding Round with LeetCode medium complexity question.