Microsoft Interview Question

A problem based on 2 pointers