Update 0200.岛屿数量.广搜版.md

This commit is contained in:
fwqaaq
2024-01-11 16:58:01 +08:00
committed by GitHub
parent 0dc7f2f765
commit 26fc4c4172

View File

@ -199,7 +199,9 @@ class Solution {
### Python
BFS solution
```python
class Solution:
def __init__(self):
@ -240,6 +242,7 @@ class Solution:
```
### JavaScript
```javascript
var numIslands = function (grid) {
let dir = [[0, 1], [1, 0], [-1, 0], [0, -1]]; // 四个方向
@ -324,7 +327,6 @@ function numIslands2(grid: string[][]): number {
### Go
```go
var DIRECTIONS = [4][2]int{{-1, 0}, {0, -1}, {1, 0}, {0, 1}}
func numIslands(grid [][]byte) int {