Element Matrix search

code: https://ide.codingblocks.com/s/406081
problem: https://hack.codingblocks.com/app/contests/1975/501/problem

not printing output why is that ?how to correct?

hello @kaustub

check now->

loop will run only till condition mentioned inside it is correct.

use return 0 to stop execution of thr program

What is difference between the 2 why cannot I use break?.

u can use break as well , but then u need to avoid printing both 0 and 1.

check this->

But why we have take bool? why it is not printing 1 and 0

it is printing. run by giving some sample case in input.

to avoid printing both 0 and 1 we are using bool.

we will print 0 only when we dont find key in matrix and for such case isPresent bool will remain false

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.