Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This code doesn't work in all cases. I copied it and pasted it to VS Code and tried it with a test polynomial I made up.
poly = '2ac+8ca+9poy-21opy'
The answer should be
10ac-12opy
but it returns0ac-2opy
.The problem has to do with replacing the
1
with an empty string in the return line.In the kata desciption, it's unclear whether the result is supposed to the sales id or the department id.
The image links in the kata are broken.
This comment is hidden because it contains spoiler information about the solution
For this and other SQL kata, is it possible to download the databases so I can play around with solutions locally on my laptop? If so, how can I download them?
I figured out the issue in that my code would work when the there wasn't enough money to buy all the gifts but not when there was money left over. I think this kata would be improved if the latter situation was put in the "Attempt."
I pass all the 100+ tests except for three, and I can't figure out why. These are the three I fail:
should return all gifts (12)
Expected: 12, instead got: [5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10]
should return all gifts (4)
Expected: 4, instead got: [1, 1, 1, 1]
should return all gifts (56)
Expected: 56, instead got: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]