[Unsolved]Zuma game | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

[Unsolved]Zuma game

Hi SoloLearn!I have a question: given a zuma board like: AAABBBCCCA and a number k that means that you can only pop a section from the board that has minimum k elements, print the minimum length of the board after a convenient choose of operations. You can only pop sections that have the same letter. For the example above the result is 0;

29th Oct 2019, 6:21 PM
Stefan Secrieru
Stefan Secrieru - avatar
9 Answers
+ 1
Stefan Secrieru Yes sure try. One more thing if the string is BBBCCCA. So what will be the length. 1?
29th Oct 2019, 7:48 PM
A͢J
A͢J - avatar
0
It's looking like a assignment so please first try to do by yourself to become a good programmer
29th Oct 2019, 6:41 PM
A͢J
A͢J - avatar
0
A J It is actually from the national Olimpiad of Informatics in Romania, and I tried to do it with dynamic programming , but nothing good came out of that. You can see the problem here:. http://oni2018.liceulovidius.ro/index.php/subiecte/Maybe if I just had a starting ideea...
29th Oct 2019, 7:13 PM
Stefan Secrieru
Stefan Secrieru - avatar
0
Stefan Secrieru Ok. You should try first here means on Sololearn Playground and share your code so we can check what is going on. I can give you hint. Count the number of occurrence of alphabet. If it is greater than 2 then remove that alphabet from String.
29th Oct 2019, 7:20 PM
A͢J
A͢J - avatar
0
A J Ok I will try that, but I think that the order of the removals are very important, that is what I can't figure out, in Wich order do I have to remove them , because if I remove the first 3 As than I will be left with an A so the length is 1, but if I remove the B's and the C's than I will have 4 As that I can remove and the length will be 0, but I will implement this simple removal and maybe after that think about the order.
29th Oct 2019, 7:43 PM
Stefan Secrieru
Stefan Secrieru - avatar
0
I also forgot to mention that after you pop a section of the board the left pieces will basically spring in that section's place e.g AAABBBA I remove the B's and I will have AAAA
29th Oct 2019, 7:47 PM
Stefan Secrieru
Stefan Secrieru - avatar
0
A J Yes
29th Oct 2019, 7:55 PM
Stefan Secrieru
Stefan Secrieru - avatar
0
Stefan Secrieru Ok then I am getting some logic but you also should try to do by yourself.
29th Oct 2019, 7:59 PM
A͢J
A͢J - avatar
0
A J I have implemented an algorithm that removes the sections from left to right in the order of their appearance. Now the question that remains is: how do i choose the right order? https://code.sololearn.com/cASrmC3t3upj/#cpp
30th Oct 2019, 5:44 PM
Stefan Secrieru
Stefan Secrieru - avatar