Morgan Stanley Interview Question

One Leetcode Question which was a medium Leetcode.