WADIC Interview Question

solve the given programming challenge