Monty Hall Problem suggests that when a person swaps the doors after knowing the location of goat in one of the two doors. The probability of getting a car in the swapped door is 66%, increased from the previous 33%.
Solution—
So, we can randomly choose the initial door and accordingly swap the doors. It’s a very naive approach but works.
My solution
I completely agree with your answer, but maybe test cases were too weak.