LeetCode - Submission Details

Posted 朽木の半夏

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode - Submission Details相关的知识,希望对你有一定的参考价值。

int r,w;
void ser(char** s,int i,int j){
    if(i<0 || j <0 || i >= r || j >= w)return;
    if(s[i][j]==‘1‘){
        s[i][j]=0;
        ser(s,i-1,j);
        ser(s,i+1,j);
        ser(s,i,j-1);
        ser(s,i,j+1);
        return ;
    }
    else
        return ;
}

 

int numIslands(char** grid, int gridRowSize, int gridColSize) {
    int ans = 0;
    r = gridRowSize;
    w = gridColSize;
    for(int i = 0 ; i < gridRowSize; i ++){
        for(int j = 0 ; j < gridColSize; j ++){
            if(grid[i][j]==‘1‘){
                ser(grid,i,j);
                ans ++;
            }
        }
    }
    return ans;
}



























以上是关于LeetCode - Submission Details的主要内容,如果未能解决你的问题,请参考以下文章

LeetCode 134. Gas Station

LeetCode 454. 4Sum II

LeetCode 300. Longest Increasing Subsequence

LeetCode 437. Path Sum III

LeetCode 516. Longest Palindromic Subsequence

LeetCode 436. Find Right Interval