Watch all movies algorithm
<p>I came across this problem which seems pretty interesting. There are a few movies that we want to watch all of them but they only show at the following times:</p>

<pre><code>movieA : 15
movieB : 14, 15, 17
movieC : 15, 17
movieD : 15, 20
</code></pre>

<p>We can watch A at 15, B at 14, C at 17 and D at 20, so it's possible to watch them all. Note that you can't watch C at 15, not viable.</p>

<p>The problem as you have guessed, is whether we can watch them all.</p>

<p>Obviously we can solve it with backtracking, trying all possibilities. Is there better way to do it? I have an idea of starting with movies with least number of available times first, that way we can find the solution faster if there's a solution, the worst case time complexity is still the same.</p>

<p>Is there a better algorithm for this problem out there?</p>

<p>P.S.
As @gen asked, I forgot to point out that each movie is 1 hour, so if you watch one at 14:00, you won't miss the one at 15:00. Thanks for asking.</p>