Rippling Interview Question

leetcode236 and leetcode 4567 with follow