ASUS interview question

one leetcode medium coding problem