Rippling interview question

leetcode236 and leetcode 4567 with follow