This is solution I gave for one of the interview question using