PARTech interview question

Leetcode questions. Not too hard