Vanta Interview Question

First question Does the mapping of the array to string pass? Ie return True if the mapping does not change array=[1,2,1] string=“dog cat dog” -> true array=[1,2,2] string=“horse dog cat” -> false (mapping of 2-> dog changes) Second question Now 2d array and you pick 1 choice each time. If any combination of choices can make the string true, return True array=[ [1,2] , [1,4,5] , [6] string = “hello hello person” -> true array=[ [1.3] , [1] , [3] string = “hello bye person” -> false #fails since person must be 3 and bye must be 1. Interviewer strongly pushed me to use a recursive solution over the stack based solution that I had visualized. I was not able to determine the recursive solution but think I could have made the stack work