ByteDance Interview Question

Algorithm question was related to recursion