Flexton interview question

Standard backtracking Leet Code question