Tap here to switch tabs
Problem
Submissions

Problem: Find the Width of Columns of a Grid

med
30 min
Try to solve the Find the Width of Columns of a Grid problem.

Statement

You are given a 00-indexed m×nm \times n integer matrix grid. The width of a column is defined as the maximum length among the decimal string representations of all integers in that column.

Return an integer array ans of size nn, where ans[c] is the width of the cthc^{\text{th}} column.

The length of an integer is the total number of characters in its string representation, including a negative sign if the number is negative.

Constraints:

  • m == grid.length

  • n == grid[i].length

  • 1≤1 \leq m, n ≤100\leq 100

  • −109≤-10^9 \leq grid[r][c] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Width of Columns of a Grid

med
30 min
Try to solve the Find the Width of Columns of a Grid problem.

Statement

You are given a 00-indexed m×nm \times n integer matrix grid. The width of a column is defined as the maximum length among the decimal string representations of all integers in that column.

Return an integer array ans of size nn, where ans[c] is the width of the cthc^{\text{th}} column.

The length of an integer is the total number of characters in its string representation, including a negative sign if the number is negative.

Constraints:

  • m == grid.length

  • n == grid[i].length

  • 1≤1 \leq m, n ≤100\leq 100

  • −109≤-10^9 \leq grid[r][c] ≤109\leq 10^9