LIBSYS (India) interview question

A Difficult question from the patterns