Oracle interview question

DSA question on backtracking and hashmap