Walmart interview question

Standard backtracking Leet Code question