Sasken interview question

basic dsa quetion using boolean