Okta interview question

Leetcode medium question involved backtracking