Solution of the riddler express from here.

On a lovely spring day, you and I agree to meet for a lunch picnic at the fountain in the center of our favorite park. We agree that we’ll each arrive sometime from noon and 1 p.m., and that whoever arrives first will wait up to 15 minutes for the other. If the other person doesn’t show by then, the first person will abandon the plans and spend the day with a more punctual friend. If we both arrive at the fountain at an independently random time between noon and 1, what are the chances our picnic actually happens?

Let the \(x\) be the number of minutes past 12 that I arrive and \(y\) be the number of minutes past 12 that you arrive. Then the picnic will take place once \(|x-y| <= 15\).

Half the time \(x \in [15,45]\). In this scenario \(y \in [x-15, x+15]\) with probability \(\frac{1}{2}\).

One quarter of the time \(x \in [0,15)\). If this happens \(y \in [0, x+15]\) with probability \(\frac{1}{15} \times \frac{1}{60} \int_{0}^{15} \frac{x + 15}{60} = \frac{3}{8}\).

The final case is that \(x \in (45,60]\). This also occurs with probability \(\frac{1}{4}\) and we will have \(y \in [x-15, 60]\) with probability \(\frac{1}{15} \times \frac{1}{60} \int_{45}^{60} \frac{75 - x}{60} = \frac{3}{8}\)

Putting all this together, we get that \(P(|x-y| <= 15) = \frac{1}{2}\times \frac{1}{2} + \frac{1}{2} \times \frac{3}{8} = \frac{7}{16}\).

This can also be simulated with some code from R.

library(ggplot2)
library(ggthemes)
prop <- function(tries){
  a <- runif(tries, min = 0, max = 60)
  b <- runif(tries, min = 0, max = 60)
  
  data.frame(x=abs(a - b))
}
tries <- 10000
gaps <- prop(tries)

ggplot(gaps, aes(x = x) ) + 
  stat_ecdf() + 
  geom_vline(xintercept = 15, col = 'red') +
  geom_hline(yintercept = sum(gaps <= 15)/tries, col = 'blue') +
  labs(y = 'Probability that gap between arrivals <= x') +
  theme_minimal()