ByteDance Interview Question

Random leetcode question, do more practice