Pontera interview question

I was given 2 medium level Leetcode questions