ByteDance Interview Question

leetcode 88 and an easy one