Ash Software interview question

Problem statement to solve