Grab Interview Question

Medium Level DSA question in codility