Is there a simple way of iterating through a two dimensional array to store maximum value obtained so far while traversing along a particular dimension. For example, i have an array:
[[2 , 1, 5],
[-1, -1, 4],
[4, 3, 2],
[2 , 3, 4]]
and I would like the following output:
[[2 , 2, 5],
[-1, -1, 4],
[4, 4, 4],
[2 , 3, 4]]
Thanks!