Microsoft Interview Question

They have asked me coding question based on recursion and backtracking it was medium level question