Slick way to solve P(pattern A appears before pattern B) type of problems in a coin toss process Let's consider a fair coin and an infinite toss game. We frequently got asked about how to compute the probability of pattern $A$ appearing before pattern $B$ where $A$ and $B$ are both one of the eight strings $\{H, T\}^3$. In principle, these can all be solved by Markov chains or first step analysis. But both these two methods sometimes can involve a good amount of calculation. Therefore:
Question: is there any slick, non computation-intensive approach that can solve this whole type of problems? (Let's restrict ourselves to $\{H,T\}^3$ for the time being and not consider longer patterns)

A friend of mine suggested a nice solution to find P(THH before TTT):


Explanation:
Since first toss = H means start over, we don't have to handle this event. If first toss = T, the binary tree of events is graphed as above, and we see that among all the cases that result in a determined outcome (i.e. not start-overs), the chances of $THH$ appearing first to that of $TTT$ appearing first is $(1/4 + 1/8):(1/4) = 3:2$. 
How do we conclude then the required probability = $3/5$? The way I see it is that the above tree actually defines a "fractal structure" on the whole probability space: among all the "start over" branches, the ratio of the chances of $THH$ appearing first to that of $TTT$ appearing first is always $3:2$. Thus the overall ratio is also $3:2$, hence the conclusion.

However, the above only works when $A$ and $B$ have a common prefix. If instead we want $THH$ before $HTH$ then it doesn't apply because there is no more "start over" states I guess. Also, the above approach suffers from lack of explainability and mathematical clarity (e.g., how is one supposed to explain the intuition like "fractal structure" to someone unfamiliar with this problem?)

So is there any better approach that is more widely applicable, more explainable or more efficient? Thanks!
 A: One fun way to solve this is with martingales. I'm going to give the intuitive explanation, although it's not hard to make this perfectly mathematically rigorous. Also I apologize in advance for the length of this answer, but I will try to justify at the end why this is a useful way of thinking.
The scheme: A dealer flips an infinite sequence of coins until the sequence THH or HTH comes up. There are two lines of bettors -- call them line A and line B.
Line A is full of bettors hoping to see THH. Here's how this works -- bettor #1 ("Aaron") first approaches the dealer and places a $\$1$ bet at even odds on the first coin being T. If he wins, he'll then hold $\$2$, and he'll bet the whole thing on the next coin being H. If he wins that, he'll bet his $\$4$ on the next coin being H. Should that happen as well, he'll take his $\$7$ profit (since one of the dollars was his) and leave happily; the entire game will shut down for all players.
Behind bettor #2 is another better ("Barb") who bets in the exact same way, but one coin behind Aaron, and bettor #3 ("Carl") behaves the same way; so does every other person in the line.
Let's examine how this would play out. Suppose the dealer's string of coins is THTTHH
in that order. Aaron bets first; he wins his first bet since the first coin was T! He also wins his second bet... only to lose his third bet and leave with a net loss of $\$1$. Barb has the same fate, but faster; she loses her initial dollar immediately. Carl wins one game but loses the second, suffering the same eventual fate. The fourth bettor ("Diana"), however, is destined to win, and she will leave with a net of $\$7$. Note that two more bettors follow her ("Eva" and "Frank") who each immediatley lose their first dollar.
Now, to line B. These bettors are hoping to see HTH, and will place the same kinds of bets with the dealer on the same sequence of coin flips... but will do so in the opposite direction. That is, the dealer will offer his dollars and place double-or-nothing bets on H, T, H in that order.
Here's how this would play out with the above sequence of coin flips. The first bettor ("Mike") immediately takes a dollar from the bettor, because the first coin was T instead of the H he was looking to see. (Remember, it's the same structure of bet as with line A, but the coin sequence is different, and the direction of wins and losses are flipped.) The second bettor ("Nelly") pays a dollar to the dealer after seeing H, and then pays two dollars to the dealer after seeing T, but gets all her money back (plus a dollar profit) when the next T comes. Hopefully you see the key insight here: The fate of every bettor is the same, except for possibly the last three before the game ends. In this case, only the last bettor of line B is still in play when the game ends, and that bettor will pay one dollar to the bettor (net).
The other key insight is that every bet placed is fair, which means that on average, the net holdings of the dealer don't change (see the technical justification below). This is pretty useful, because the game ends in precisely two ways that we can analyze carefully. Again, note that all bettors before the last three in either line are irrelevant; the dealer has taken $\$1$ from each line A bettor and has given $\$1$ to each line B bettor. So, what happens to the last three in each line?


*

*If the game ends in a THH sequence as above, then from line A the last three bettors take $7$, $-1$, and $-1$ dollars from the dealer. The line B bettors take $1$, $1$, and $-1$ dollars from the dealer. Thus, the dealer pays out $\$6$ in this case.

*If the game ends instead in a HTH sequence, then the last three line A bettors take $-1$, $3$, and $-1$ dollars from the dealer while the line B bettors take $-7$, $1$, $-1$ dollars from the dealer (total payout: $-\$6$).
Let $p$ denote the chance that THH comes before HTH. The dealer's expected net payout is then $$\mathbb E[\text{payout}] = p \cdot 6 + (1-p) \cdot (-6)$$ but since all bets were fair, this expected payout should be $0$. Thus, $$0 = p \cdot 6 + (1 - p) \cdot (-6) \implies \fbox{$p = 1/2$}$$
for these particular sequences.
Why I love this approach: It's quick and easy to analyze any head-to-head matchup of any 3-coin sequence. But notice how quickly you could generalize this to a 4-coin streak as well! For head-to-head matchups of $n$-coin streaks, your only task is to carefully analyze the behavior of the final $n$ bettors.
But wait! There's more! You can also use this betting scheme to think about other interesting questions. Want to know the expected number of throws before seeing HTH? Just consider one line of HTH bettors and count the profit that the dealer has made at the end. Want to know the expected wait time for the first of HTH and THH? Have two lines of bettors, but let both lines place bets in the normal direction (i.e. how line A behaved in the example I outlined). Want to discuss drawing letters randomly from A to Z and waiting for the sequence ABRACADABRA? Play the same game, but adjust the payout ratios of the bets to be 25:1 instead of 1:1. This is an incredibly powerful approach that generalizes really well and requires only minimal computational complexity.
Technical justifications: The fact that every wager placed with every bettor is fair, implies that the net holdings of the dealer constitute a martingale. The optional stopping theorem applies in this case because the stopping time can be shown to have finite expectation -- it can be dominated by a geometric random variable, for instance -- and the increments of the martingale are bounded.
