<body>
Minimum path is: & lt;/p>
<script>
Var themin=0;
Var grid=[
,5,0,6,0,7,0,8,0 [0],
,0,1,0,3,0,1,0,3 [3],
,1,0,2,0,3,0,4,0 [0],
,0,2,0,2,0,2,0,2 [2],
,5,0,6,0,7,0,8,0 [0],
,0,3,0,1,0,3,0,1 [1],
,4,0,3,0,2,0,1,0 [0]]
The function minPathSum (grid) {
Var I, k, j;
Var sum=new Array (63);
for (var i=0; i<7. I++) {
The sum [I]=new Array (0,0,0,0,0,0,0,0,0);
}
The sum [0] [0]=grid [0] [0].
For (k=0; K<7. K +=2) {
for (j=0; j<9. J +=2) {
If ((k===0) & amp; & (j===0)) {
The sum [0] [0]=grid [0] [0].
} else if (k - 1 & lt; 0 {
Sum [k] [j]=sum [k] [1] + grid [k] [j - 2];
} else if (j - 1 & lt; 0 {
The sum [k] [j]=sum (k - 1) [j] + grid [k - 2] [j];
} else {
The sum [I] [j]=math.h min (sum [j] + [k - 2] sum [j], [k - 1] sum [k] [j] 2 + sum [k] [1]).
}
}
}
Return the sum [7] [9].
}
Var x=minPathSum (grid);
Var p=document. GetElementById (" yyy ");
P.i nnerHTML=x;
</script>