XYZ(NY) Interview Question

How to optimize cursors?