Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit103c86d

Browse files
edit 463
1 parentee6eed6 commit103c86d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Your ideas/fixes/algorithms are more than welcome!
150150
|467|[Unique Substrings in Wraparound String](https://leetcode.com/problems/unique-substrings-in-wraparound-string/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_467.java) | O(n) |O(1) | Medium| DP
151151
|466|[Count The Repetitions](https://leetcode.com/problems/count-the-repetitions/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_466.java)| O(max(m,n))|O(1) | Hard| DP
152152
|464|[Can I Win](https://leetcode.com/problems/can-i-win/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_464.java)| O(2^n)|O(n) | Medium| DP
153-
|463|[Island Perimeter](https://leetcode.com/problems/island-perimeter/)|[Solution](../master/src/main/java/com/fishercoder/solutions/IslandPerimeter.java)| O(m*n)|O(1)| Easy|
153+
|463|[Island Perimeter](https://leetcode.com/problems/island-perimeter/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_463.java)| O(m*n)|O(1)| Easy|
154154
|462|[Minimum Moves to Equal Array Elements II](https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii/)|[Solution](../master/src/main/java/com/fishercoder/solutions/MinimumMovestoEqualArrayElementsII.java)| O(nlogn)|O(1)| Medium|
155155
|461|[Hamming Distance](https://leetcode.com/problems/hamming-distance/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_461.java)| O(n)|O(1)| Easy|
156156
|460|[LFU Cache](https://leetcode.com/problems/lfu-cache/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_460.java) | O(?) |O(?) | Hard| Design

‎src/main/java/com/fishercoder/solutions/IslandPerimeter.javarenamed to‎src/main/java/com/fishercoder/solutions/_463.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
packagecom.fishercoder.solutions;
2-
/**You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells). The island doesn't have "lakes" (water inside that isn't connected to the water around the island). One cell is a square with side length 1. The grid is rectangular, width and height don't exceed 100. Determine the perimeter of the island.
2+
/**
3+
* You are given a map in form of a two-dimensional integer grid
4+
* where 1 represents land and 0 represents water.
5+
* Grid cells are connected horizontally/vertically (not diagonally).
6+
* The grid is completely surrounded by water,
7+
* and there is exactly one island (i.e., one or more connected land cells).
8+
* The island doesn't have "lakes" (water inside that isn't connected to the water around the island).
9+
* One cell is a square with side length 1.
10+
* The grid is rectangular, width and height don't exceed 100. Determine the perimeter of the island.
311
412
Example:
513
@@ -10,8 +18,9 @@
1018
1119
Answer: 16
1220
Explanation: The perimeter is the 16 yellow stripes in the image below:
21+
1322
*/
14-
publicclassIslandPerimeter {
23+
publicclass_463 {
1524
/**Inspired by this post: https://discuss.leetcode.com/topic/68983/java-9-line-solution-add-4-for-each-land-and-remove-2-for-each-internal-edge
1625
* 1. we increment the count by 4 whenever we encounter an island
1726
* 2. also, we check in two directions: island's left and island's top, we only check these two directions,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp