hackathon/question/q03/part2.go

26 lines
338 B
Go

package q03
func solveP2(nums [][]int) int {
var maxR, maxC int
for _, ns := range nums {
var sum int
for _, n := range ns {
sum += n
}
if sum > maxR {
maxR = sum
}
}
for i := range nums[0] {
var sum int
for j := range nums {
sum += nums[j][i]
}
if sum > maxC {
maxC = sum
}
}
return maxR * maxC
}