#include
using namespace std;
bool fin(int a[100][100],int n,int m,int k){
int i=0,j=m-1;
int ch;
if(k==a[n-1][0]){
return true;
}
while(ch!=a[n-1][0]){
ch=a[i][j];
if(ch==k){
return true;
}
else if(ch<k){
i++;
}
else if(ch>k){
jā;
}
}
return false;
}
int main() {
int n,m;
cin>>n>>m;
int a[100][100];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>a[n][m];
}
}
int k;
cin>>k;
if(fin(a,n,m,k)){
cout<<ā1ā;
}
else {
cout<<ā0ā;
}
return 0;
}
this is my code for staircase approach
I am getting only 1 test case right where am I wrong I am not able to locate