I'm trying to find the right max value from below dp. as you can see, the max value is 3.
dp = [[0, 0, 0, 1], [1, 1, 0, 1], [1, 2, 1, 1], [0, 1, 2, 2], [0, 1, 2, 3]]
When using max(max(dp))
, i got 2, which is wrong. But why?
max(dp)
gives me [1,2,1,1]
. If the max is taken along the y axis, shouldn't max(dp)
return [1,2,2,3]
??
when using max([max(x) for x in dp])
, i got 3, which is correct