Here is a probability interview questions: two independent unfair coins with probabilities of head, $p_1,p_2\sim U(0,1).$ Then what's the probability of $p_1>p_2$ if we tossed each coin 3 times with 2 head for $p_1$ and 1 head for $p_2?$ We simply denote as:
$$P(p_1>p_2| 2H^1,1H^2).$$
I know we should use Bayes formula: $$P(p_1>p_2| 2H^1,1H^2)P(2H^1)P(1H^1) = P(p_1>p_2,2H^1, 1H^2).$$
And I know we can calculate $P(2H^1),P(1H^2)$ by $$P(2H^1) = \int^1_0p_1P(2H^1|p_1)dp_1.$$
But how to calculate the joint distribution $P(p_1>p_2,2H^1, 1H^2)?$ Am I right to calculate as: $$P(p_1>p_2,2H^1, 1H^1) = \int_{p_1,p_2\in [0,1],p_1 > p_2}P(2H^1|p_1)P(1H^2|p_2)dp_1dp_2?$$