there m x n grid 0 0 topleft cell m 1 n 1 bottomright cell you give integer array startpos startpos startrow startcol indicate initially robot cell startrow startcol you give integer array homePos homepos homerow homecol indicate home cell homerow homecolthe robot need home it cell direction leave right outside boundary every incur cost you give 0indexed integer array rowcost length m colcost length nif robot move cell row r cost rowcostsrif robot move leave right cell column c cost colcostscreturn minimum total cost robot return home Example 1input startpos 1 0 homepos 2 3 rowcost 5 4 3 colcosts 8 2 6 7output 18explanation one optimal path thatstarte 1 0 it go 2 0 this cost rowcosts2 3 it go right 2 1 this cost colcosts1 2 it go right 2 2 this cost colcosts2 6 it go right 2 3 this cost colCosts3 7the total cost 3 2 6 7 18example 2input startpos 0 0 homepos 0 0 rowcost 5 colcosts 26output 0explanation the robot home since move occur total cost 0 constraintsm rowcostslengthn colCostslength1 m n 1050 rowcostsr colcostsc 104startposlength 2homeposlength 20 startrow homerow m0 startcol homecol n