| 24 | } |
| 25 | |
| 26 | bool solve(vector<vector<int>>& mat) { |
| 27 | vector<vector<int>> vis(mat.size(),vector<int>(mat[0].size(),0)); |
| 28 | for(int i=0; i < mat.size();i++){ |
| 29 | for(int j=0; j < mat[0].size();j++){ |
| 30 | if(vis[i][j]==0){ |
| 31 | if(helper(mat,i,j,mat[i][j],vis))return 1; |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | return 0; |
| 36 | } |