- 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.

16th Feb 2019, 4:51 PM
Aadhish Sriram
Aadhish Sriram - avatar
5 Réponses
0
Aadhish Sriram you can share the codes that have tried. So we can spot out what you have done wrong
16th Feb 2019, 5:15 PM
Seniru
Seniru - avatar
- 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.
16th Feb 2019, 5:12 PM
HonFu
HonFu - avatar
- 2
Here is the code, I came up with: https://code.sololearn.com/cFX82dgiHmX9/?ref=app Sorry for not including the code before.
16th Feb 2019, 5:23 PM
Aadhish Sriram
Aadhish Sriram - avatar
- 2
17th Mar 2022, 6:05 AM
Syed Baresha
- 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?
16th Feb 2019, 5:14 PM
Aadhish Sriram
Aadhish Sriram - avatar