Block Interview Question

solve a leetcode coding problem.