Luciq interview question

How you handled the case X in your task