Kemuri Technology interview question

coding related and logical reasoning