pathfinde task find route point it appear problem for example GPS navigation software driver query suggest route robot motion planning find valid sequence movement task simple maze solver find valid path point point this problem relate solving mazethe maze consider problem form matrix integer a n time N the value cell generate give array r c n integer specifically value ith row jth column cell ij equal R_i C_j Note index problem 1 NA path maze define sequence cell r_1c_1 r_2c_2 dot r_kc_k r_i r_i1 c_i c_i1 1 1 le k in word adjacent cell differ 1 row 1 column an path maze define path cell path contain numbersgiven tuple langle r_ac_ar_bc_b rangle query task determine exist path cell r_ac_a cell r_bc_b to simplify problem guarantee cell r_ac_a cell r_bc_b contain numbersfor example let N 5 r 6 2 7 8 3 c 3 4 8 5 1 the following figure depict matrix a 5 time 5 generate give array r c let consider query langle 2 2 1 3 rangle there path cell 22 cell 13 eg 22 23 13 of course 22 12 13 valid path langle 4 2 4 3 rangle there path cell 42 cell 43 42 43 langle 5 1 3 4 rangle there path cell 51 cell 34 Observe neighboring cell 51 cell 52 cell 41 contain odd number 7 11 respectively path originate cell 51