File tree Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -1732,6 +1732,31 @@ func islandPerimeter(grid [][]int) int {
1732
1732
}
1733
1733
```
1734
1734
1735
+ #### ** Java**
1736
+
1737
+ ``` java
1738
+ class Solution {
1739
+ public int islandPerimeter (int [][] grid ) {
1740
+ if (grid == null || grid. length <= 0 || grid[0 ] == null || grid[0 ]. length <= 0 ) return 0 ;
1741
+ int height = grid. length;
1742
+ int width = grid[0 ]. length;
1743
+
1744
+ int result = 0 ;
1745
+
1746
+ for (int i = 0 ; i < height; i++ ) {
1747
+ for (int j = 0 ; j < width; j++ ) {
1748
+ if (grid[i][j] == 1 ) {
1749
+ if (i == 0 || grid[i - 1 ][j] == 0 ) result++ ;
1750
+ if (j == 0 || grid[i][j - 1 ] == 0 ) result++ ;
1751
+ }
1752
+ }
1753
+ }
1754
+
1755
+ return result * 2 ;
1756
+ }
1757
+ }
1758
+ ```
1759
+
1735
1760
<!-- tabs:end -->
1736
1761
1737
1762
## 485. 最大连续1的个数
Original file line number Diff line number Diff line change 10
10
< style >
11
11
: root {
12
12
--docsifytabs-border-color : # ededed ;
13
- --docsifytabs-tab-highlight-color : purple ;
13
+ --docsifytabs-tab-highlight-color : # F77F00 ;
14
14
}
15
15
</ style >
16
16
</ head >
43
43
tabComments : true ,
44
44
tabHeadings : true ,
45
45
} ,
46
+ // 更新日期
47
+ formatUpdated : '{YYYY}-{MM}-{DD} {HH}:{mm}:{ss}' ,
48
+ // 插件
49
+ plugins : [
50
+ function ( hook , vm ) {
51
+ // 底部
52
+ hook . beforeEach ( function ( content ) {
53
+ var url = 'https://github.com/JalanJiang/leetcode-notebook/tree/master/docs/' + vm . route . file ;
54
+ var editHtml = '> 🧐发现错误,想一起完善?[在 Github 编辑此页](' + url + ')!\n'
55
+
56
+ var footer = [
57
+ '----' ,
58
+ '> Last modified {docsify-updated}.' ,
59
+ '> [Jalan](http://jalan.space/), [Csming](https://csming1995.github.io/) ©2019. Proudly published with [docsify](https://github.com/docsifyjs/docsify) and powered by love.' ,
60
+ ] . join ( "\n" ) ;
61
+
62
+ return editHtml
63
+ + "\n----\n"
64
+ + content
65
+ + "\n\n"
66
+ + footer
67
+ } )
68
+ } ,
69
+ ]
46
70
}
47
71
</ script >
48
72
< script src ="//unpkg.com/docsify/lib/docsify.min.js "> </ script >
You can’t perform that action at this time.
0 commit comments