We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bab0e94 commit 3cc8c61Copy full SHA for 3cc8c61
1 file changed
ksinji/202601/23 PGM 가장 큰 정사각형 찾기.md
@@ -0,0 +1,26 @@
1
+```java
2
+class Solution {
3
+ public int solution(int[][] board) {
4
+ int n = board.length;
5
+ int m = board[0].length;
6
+
7
+ int[][] dp = new int[n][m];
8
+ int max = 0;
9
10
+ for (int i = 0; i < n; i++) {
11
+ for (int j = 0; j < m; j++) {
12
+ if (board[i][j] == 1) {
13
+ if (i == 0 || j == 0) {
14
+ dp[i][j] = 1;
15
+ } else {
16
+ dp[i][j] = Math.min(Math.min(dp[i-1][j], dp[i][j-1]),dp[i-1][j-1])+1;
17
+ }
18
+ max = Math.max(max, dp[i][j]);
19
20
21
22
23
+ return max * max;
24
25
+}
26
+```
0 commit comments