LTM Limited Interview Question

Write queues structure program with O(n)