BCL Mine interview question

my ways of problem solving