Lucid Imaging Interview Question

Matrix rotation with circular printing, merge intervals