function cal(nums){ var sum = 0 while(nums>0){ sum += parseInt(nums%10) nums = parseInt(nums/10) } return sum } function dfs(r,c,threshold,rows,cols,isvisited){ if(r<0||r>rows-1||c<0||c>cols-1||isvisited[r][c]||cal(r)+cal(c)>threshold){ ...