you give 2D integer array grid size m x n cell contain positive integerA cornered path define set adjacent cell turn more specifically path exclusively horizontally vertically turn return previously visit cell after turn path exclusively alternate direction vertically move horizontally vice versa return previously visit cellThe product path define product value pathreturn maximum number trail zero product corner path find gridnotehorizontal movement mean move left right directionvertical movement mean move direction Example 1input grid 231715320812027119462214091106227453output 3explanation the grid leave show valid cornered pathIt product 15 20 6 1 10 18000 3 trail zerosIt show maximum trail zero product corner pathThe grid middle cornered path turnthe grid right cornered path require return previously visit cellexample 2input grid 432761888output 0explanation the grid show figure abovethere corner path grid result product trail zero Constraintsm gridlengthn gridilength1 m n 1051 m n 1051 gridij 1000