https://ide.codingblocks.com/s/163520 this is function problem question when i submitted code it
give run time error
(73) Search a 2D Matrix ( leet code question)
Hi @khemchandrs
You are facing run time error because when matrix is of size 0 then you are trying to access matrix[0] to evaluate c. Instead you should use the following :
int r=matrix.size();
if(r==0)
return false;
int c=matrix[0].size();
if(c==0)
return 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.