### You only have free questions left (including this one).

But it doesn't have to end here! Sign up for the 7-day coding interview crash course and you'll get a free Interview Cake problem every week.

You've built an inflight entertainment system with on-demand movie streaming.

Users on longer flights like to start a second movie right when their first one ends, but they complain that the plane usually lands before they can see the ending. So you're building a feature for choosing two movies whose total runtimes will equal the exact flight length.

Write a function that takes an integer flight_length (in minutes) and a list of integers movie_lengths (in minutes) and returns a boolean indicating whether there are two numbers in movie_lengths whose sum equals flight_length.

• Assume your users will watch exactly two movies
• Don't make your users watch the same movie twice
• Optimize for runtime over memory

We can do this in time, where n is the length of movie_lengths.

Remember: your users shouldn't watch the same movie twice. Are you sure your function won’t give a false positive if the list has one element that is half flight_length?

Actually, we don't support password-based login. Never have. Just the OAuth methods above. Why?

1. It's easy and quick. No "reset password" flow. No password to forget.
2. It lets us avoid storing passwords that hackers could access and use to try to log into our users' email or bank accounts.
3. It makes it harder for one person to share a paid Interview Cake account with multiple people.

Actually, we don't support password-based login. Never have. Just the OAuth methods above. Why?

1. It's easy and quick. No "reset password" flow. No password to forget.
2. It lets us avoid storing passwords that hackers could access and use to try to log into our users' email or bank accounts.
3. It makes it harder for one person to share a paid Interview Cake account with multiple people.

time, and space. Note while optimizing runtime we added a bit of space cost.

1. What if we wanted the movie lengths to sum to something close to the flight length (say, within 20 minutes)?
2. What if we wanted to fill the flight length as nicely as possible with any number of movies (not just 2)?
3. What if we knew that movie_lengths was sorted? Could we save some space and/or time?