SAP Interview Question

leetcode medium two pointer question