func findColumnWidth(grid [][]int) []int { m := len(grid) n := len(grid[0]) ans := make([]int, n) for i := 0; i < n; i++ { num := 0 for j := 0; j < m; j++ { num = max(num, max(grid[j][i]/10, -grid[j][i])) } ans[i] = calcWidth(num) + 1 } return ans }
func calcWidth(num int) int { count := 0 for num != 0 { count++ num /= 10 } return count }