Recursion And Backtracking Questions Leetcode Python