Cisco Interview Question

a leet code intermediate question