Dynamic programming
Can we apply this trick in 2D as well?
dx-1,y
dx,y
dx-1,y-1
dx,y-1
No: dx,y-1 and dx-1,y may depend on different values of dx-1,y-1