ION Group interview question

puzzle was asked in technical round