1 hour ago · Tech · hide · 0 comments

I’m sharing this message to my kids after they came up with an algorithm for the CSES Movie Festival problem this morning. Here’s the (edited for clarity) message they sent me: We have found the algorithm to the problem! The problem can be solved by sorting the movies in ascending order according to the ending times. We can start from the movie with the earliest ending and watch it. Then continue moving to all the movies according to their ending times. For every subsequent movie, check if we can watch it or not. If we can watch it, then move till we find another movie whose starting time >= the current movie’s ending time. After traversing through all the movies, return the final answer. (I tried so hard to write the algorithm in a fancy way) Pascale, Linus, well done. But I’m not going to tell you whether it works or not. That’s your job to test it. And this applies to every problem you try to solve. Once you have an idea, it’s tempting to start looking for evidence that it works.…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.