Linear easy O(n), am I doing it wrong?


#1

I see the official solutions are using nested iterations or recursion, but I see that you can just loop once through the three strings, increasing their current char pointers whenever the current C char matches the one in A or B, and in case it matches both, append that char to a queue.
Then, when the char does not match A neither B, read from the queue.
Return true if A, B and the queue are consumed, False otherwise.
Am I getting it wrong?