Two Sigma interview question

Basic HackerRank questions, arrays, trees, dynamic programming