FLIPKART Coding Question – Solved

5 Live
There are N trolleys used to transport products and each trolley is given a unique ID from 0 to N-1. A trolley operates for a certain time period and is able to carry products. For each trolley, the automated system stores three parameters i.e., the start and end time of operation (both inclusive) and units of products carried. A trolley can be operated within a specified period. No two trolleys can be operated during the same period, but if a trolley's operating period ends at point T, then another trolley can be immediately started at T. The system must store the maximum number of products transported. Write an algorithm to find the maximum number of products transported. Input The first line of the input consists of two space-separated integers - trolleyList_row and trolleyList_col, representing the number of trolleys (N) and the number of parameters associated with each trolley (trolleyList_col(M) is always equal to three). The next N lines consist of M space-separated integers representing the starting of the period, ending of the period and, the number of products carried by the trolley, respectively. Output Print an integer representing the maximum number of products transported. Constraints 0 ≀ trolleyList_row ≀ 10^4 0 ≀ starting of the period, ending of the period ≀ 1000 0 < number of products carried by the trolley ≀ 104 trolleyList_col = 3 Example Input: 4 3 0 2 4 0 4 9 2 4 6 5 10 20 Output: 30

Asked in: FLIPKART

Image of the Question

Question Image Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| The supply chain manager at one of Amazon's warehouses is shipping the last con… |
| Determine the highest value after executing n steps on an infinite 2D grid that… |
| Amazon Prime Video is developing a new feature called "Segmentify." This featur… |
| In this new stock prediction game launched on Amazon Games, Player 1 provides P… |
| Amazon operates numerous warehouses, with each warehouse holding inventory[i] u… |
| In Amazon's highly efficient logistics network, minimizing operational overhead… |