Microsoft Interview Question

2 Leetcode style questions (easy)