Group time series events into minimal amount of buckets
The first event at time $t_0$ needs to be in a bucket. We can safely choose the bucket $[t_0, t_0+30]$, as there is nothing to gain by making it start earlier. We then move on to the next event starting at $t&gt;t_0+30$ (earlier events fall into the bucket we chose). We once again choose the latest bucket containing that event. It is not hard to prove that repeating this strategy until all events are covered is optimal (you can do it by induction).
This procedure runs in $O(n)$ time if your events are sorted, $O(n\log(n))$ if you need to sort them first.