Nice kata, very clear description, pleasant to read and follow. Thanks!
Nice kata. always nice to see a greedy algorithm
'defined it as real frozen constant (but I never saw any actual change to the object in the tests... might have been updated in the meantime...)
updated JS, freezing the object and its arrays. Added a note about that to the description.
That should resolve that problem.
ok, now this is understandable.
first point: I bet you're mutating the lists using reverse without creating a copy. So there are 2 problems here: 1/ you shouldn't mutate the constant object, and 2/ the general design isn't good (I'll see to add a check that the data isn't modified)
second point: smallest amount of bank notes should be used means that you should use the smallest amount of bank notes, not the bank notes with the smallest amount.
edit: I misread the order of the log message, lemme check further
edit²: ok, I checked, and with a correct solution, the reference solution is returning the "should be expected result", meaning: 3 * 500 EUR, 1 * 200 EUR, 1 * 50 EUR, 1 * 10 EUR, 1 * 5 EUR. So I guess it's actually the very same problem than the first point.
smallest amount of bank notes should be used
3 * 500 EUR, 1 * 200 EUR, 1 * 50 EUR, 1 * 10 EUR, 1 * 5 EUR
Expected: 'Can\'t do 4246 EUR. Value must be divisible by 500!', instead got: 'Can\'t do 4246 EUR. Value must be divisible by 5!'
Expected: '353 * 5 EUR', instead got: '3 * 500 EUR, 1 * 200 EUR, 1 * 50 EUR, 1 * 10 EUR, 1 * 5 EUR'
Sorry I wasn't more specific. I'll add the issue again.
what do you even mean...?
if you open issues, plz do it properly, not using only vague sentences. Here, if Iwere about to tackle this I'd have no idea what this is about. Closing. Feel free to open a clear and detailed issue, tho.
Generic message, so that we're on the same page about some definitions (most doesn't apply here, but I'm confident you'll find what is relevant by yourself)
When you post issues:
When you post a question: well, most of the above apply too x)
When you post code, use proper github markdown, so that it's readable.
Putting a mutable global variable VALUES that are changed during testing is just plain bad design.
It should be supplied to the user function as an argument.
This solution fails on Unicode strings, for example "Иван Петров" should yeild "И.П", but yeilds "Ð.Ð" instead.
To work correctly, this function needs to use runes (see my comment on the top solution for the code)
I like the idea, but a false positive would result if a string were submitted with a literal 'x' where a digit should appear.