- 3
How to solve this problem?
This is the problem: You have N toys and M toy boxes. Initially all boxes are empty, and each box can contain only one toy. Each toy has a price and a box number assigned to it. If you want to choose a toy, you must put it in its assigned box, and of course that box can’t be used for any other toys. You need choose some toys (with their boxes) such that summation of their price is maximized.
5 Réponses
0
Aadhish Sriram you can share the codes that have tried. So we can spot out what you have done wrong
- 2
This doesn't look like a coding-related question, rather like an assignment or homework.
If you have to solve this problem yourself, please give it an honest attempt first and show us the result.
- 2
Here is the code, I came up with:
https://code.sololearn.com/cFX82dgiHmX9/?ref=app
Sorry for not including the code before.
- 2
- 3
It's coding challenge my friend came up with, which I don't where he got. I tried several codes but didn't got the solution
Could you give me an algorithm to solve this problem?