Compass Interview Question

Round 2: Recursion - Back Tracking related question