We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Greedy
- Jim and the Orders
- Discussions
Jim and the Orders
Jim and the Orders
Sort by
recency
|
546 Discussions
|
Please Login in order to post a comment
Easy Approach by adding the values and assigning the index of each order to retrive based on their priority and then sorting the result based on the 2nd element in the summed array by using lambda function and then iterating through that sorted array in order to retrieve the order priority list and then returning it in type of res. Hope you understand!! Happy Coding!!
Here is my c++ solution, you can watch the explanation video here : https://youtu.be/ISg5mFFafws
My Java solution with o(n log n) time and o(n) space:
I got it in 2 lines!