Rivigo interview question

Random logical reasoning