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
- Mark and Toys
- Discussions
Mark and Toys
Mark and Toys
Sort by
recency
|
1042 Discussions
|
Please Login in order to post a comment
Java:
Here is my c++ solution, you also have a vidéo explanation here : https://youtu.be/DFQO52aB-qI
I've added a little optimisation to filter out elements above the budget, that we don't need spending time ordering.
My Java solution with o(n log n) time complexity and o(1) space complexity: