FLIPKART Coding Question – Solved

2 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

| Given an n x m grid, where rows are numbered from 7 to n and columns from 1 to … |
| There are 'N' coders standing in a line, where i denotes the ith position of a … |
| A birthday party was attended by N number of kids, and each kid was given a uni… |
| Given a matrix of size m * n, where m denotes the number of rows (starting with… |
| A traveler is traveling from the city of Zeta to Omega. He starts with X amount… |
| As an operations engineer at Amazon, you are responsible for organizing the dis… |