Skip to content

Commit 267e27a

Browse files
add 2639
1 parent 030fcfc commit 267e27a

File tree

2 files changed

+18
-0
lines changed
  • paginated_contents/algorithms/3rd_thousand
  • src/main/java/com/fishercoder/solutions/thirdthousand

2 files changed

+18
-0
lines changed

Diff for: paginated_contents/algorithms/3rd_thousand/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
| 2644 | [Find the Maximum Divisibility Score](https://leetcode.com/problems/find-the-maximum-divisibility-score/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2644.java) | | Easy |
2828
| 2643 | [Row With Maximum Ones](https://leetcode.com/problems/row-with-maximum-ones/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2643.java) | | Easy |
2929
| 2641 | [Cousins in Binary Tree II](https://leetcode.com/problems/cousins-in-binary-tree-ii/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2641.java) | | Medium |Tree, BFS, HashTable
30+
| 2639 | [Find the Width of Columns of a Grid](https://leetcode.com/problems/find-the-width-of-columns-of-a-grid/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2639.java) | | Easy |
3031
| 2605 | [Form Smallest Number From Two Digit Arrays](https://leetcode.com/problems/form-smallest-number-from-two-digit-arrays/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2605.java) | | Easy |
3132
| 2609 | [Find the Longest Balanced Substring of a Binary String](https://leetcode.com/problems/find-the-longest-balanced-substring-of-a-binary-string/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2609.java) | | Easy |
3233
| 2600 | [K Items With the Maximum Sum](https://leetcode.com/problems/k-items-with-the-maximum-sum/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2600.java) | | Easy |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.fishercoder.solutions.thirdthousand;
2+
3+
public class _2639 {
4+
public static class Solution1 {
5+
public int[] findColumnWidth(int[][] grid) {
6+
int[] ans = new int[grid[0].length];
7+
for (int j = 0; j < grid[0].length; j++) {
8+
int width = 0;
9+
for (int i = 0; i < grid.length; i++) {
10+
width = Math.max(width, String.valueOf(grid[i][j]).length());
11+
}
12+
ans[j] = width;
13+
}
14+
return ans;
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)