Petuum interview question

Medium leetcode question and one ML question.