Cisco Interview Question

Write a code to solve a puzzle