Microsoft interview question

Android coding, DS leetcode question