/Solutions

Solutions to the assignment

Primary LanguageC++

Solutions

Solutions to the assignment

The Following Repository contains solutions to two questions

Assignment 1

Assume Indian Railways Bullet Train Division has tied up with Amazon Prime to provide in-coach entertainment system with on-demand movie streaming (Future Scenario).

Riders on intercity journey like to watch a second movie just after the first one ends, but they complain that the train usually reaches before they can see the ending. You are assigned a task to build a feature for choosing two movies whose total runtimes will equal the exact train travel length.

Write function that takes an integer travel_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 travel_length.

Assumptions:

  1. Assume the users will watch exactly two movies
  2. Users won’t watch the same movie twice
  3. Optimize for runtime over memory

Assignment 2

Mumbai dabbawalas have started delivering corporate lunches via drones. One day something goes wrong.

Each & every lunch delivery is assigned a unique ID. When one of the company's 1000 drones takes off with a delivery, the delivery's ID is added to a list, delivery_id_confirmations. When the drone comes back, the ID is again added to the same list.

After lunch deliveries this afternoon there were only 999 drones on the landing area. One of the drones went missing after the delivery. We suspect a secret agent from competition placed an order and stole one of the patented drones. To track them down, we need to find their delivery ID.

Given the list of IDs, which contains many duplicate integers and one unique integer, find the unique integer. The IDs are not guaranteed to be sorted or sequential. Orders aren't always fulfilled in the order they were received, and some deliveries get cancelled before takeoff. Assumption: Unique IDs are only positive integer

The Solutions are provied and can be used for Knowledge