ASUS Interview Question

one leetcode medium coding problem