Skip to main content

Posts

Showing posts from September, 2022

Questioons

 // #abba #include <iostream> #define ROW 5 #define COL 5 using namespace std; int count = 0; bool countIslands(int M[][COL],int visited[][COL] ,int i, int j) {     if( i<0 || j <0 || i>=ROW || j>=COL || visited[i][j]==1 || M[i][j]==0)     {         return false;     }     visited[i][j] = 1;     bool a = countIslands(M,visited,i+1,j);     bool b = countIslands(M,visited,i-1,j);     bool c = countIslands(M,visited,i,j+1);     bool d = countIslands(M,visited,i,j-1);     bool e = countIslands(M,visited,i-1,j-1);     bool f = countIslands(M,visited,i-1,j+1);     bool g = countIslands(M,visited,i+1,j+1);     bool h = countIslands(M,visited,i+1,j-1);          if(!a && !b && !c && !d && !e && !f && !g && !h  )     {       ...