How do you create a version of a bag which can take at most 3 of any single element. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do you create a version of a bag which can take at most 3 of any single element.

Means that any element can be in your bag up to 3 times. Bag has to manage strings as elements Implemente this:Max3Bag()- constructorAdd(element)-add elementsRemove(element) -removes on ocurrence of elemmenber(element) -true if the element is in the bag And Print()

15th Sep 2016, 9:48 PM
Alexis
1 Answer
0
LinkedList should help you in this case
5th Nov 2016, 12:39 AM
Bozhidar Ivanov
Bozhidar Ivanov - avatar