Lucid Software Interview Question

Implement the given code file