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.
I'd recommend changing this example in the description - minCoins("L200") == "Invalid input - enter a positive amount of money"
to this one : minCoins("L200") == "100 £2 coins"
Also, this example led me astray: minCoins("2£1p") == "Invalid input - enter a positive amount of money". There's actually nothing wrong with that example, but I took away from it that you "can't have both "£" and "p" in a string (wrong conclusion). A helpful add-on would be: minCoins("£2p") == "1 £2 coin". Then if this string were allowed (I don't recall if you had such a test case where there was £ AND decimal AND p, but... minCoins("£1.95p") == minCoins("1.95p") == "1 1£ coin, 1 50p coin, 2 20p coins and 1 5p coin".
And maybe, for clarificaiton: minCoins("1.95p") != minCoins("2p") since we know that you round to the nearest pence but your decimal rule means pounds, not pence.
I think that would reinforce the £ symbol/decimal rule you had because there would be less possible confusion with cases where symbols were messed up (two £ symobls, two p symbols, etc.) In other words, I was unclear that one could have both £ and p in the same string and still be valid. I hope that helps!
This comment is hidden because it contains spoiler information about the solution
ah ok my code SEEMS to pass your Steps problem.... exccept that it just has a problem becuse it takes more than 6 s. What's the deal?
Step
Basic tests
Test Passed: Value == [101,103]
Test Passed: Value == [103,107]
Test Passed: Value == [101,107]
Test Passed: Value == [359,367]
Test Passed: Value == [307,317]
Test Passed: Value == [30109,30113]
Test Passed: Value == [30091,30097]
Test Passed: Value == [30089,30097]
Test Passed: Value == null
Test Passed: Value == [10000139,10000141]
Test Passed: Value == [1321,1373]
Test Passed: Value == [4909,4919]
Test Passed: Value == [4903,4933]
Test Passed: Value == [4931,4933]
Test Passed: Value == [104087,104089]
Test Passed: Value == null
Test Passed: Value == null
Test Passed: Value == [30133,30137]
Test Passed: Value == [30319,30323]
Test Passed: Value == [30109,30113]
Random tests
Testing Step:
Test Passed: Value == [840941,840943]
Process was terminated. It took longer than 6000ms to complete
21 Passed
0 Failed
0 Errors
Is there a problem with the tests for the JavaScript version? I get this output:
Test Passed: Value == [101,103]
Test Passed: Value == [103,107]
Expected: null, instead got: [101,107]
Test Passed: Value == [359,367]
Expected: [337,347], instead got: [307,317]
Test Passed: Value == [30109,30113]
Test Passed: Value == [30091,30097]
Expected: [30161,30169], instead got: [30089,30097]
Test Passed: Value == null
Test Passed: Value == [10000139,10000141]
The 3 tests "failed" should not be failing.
In the first case, Expected: null, instead got: [101,107] My answers are prime numbers that fit the bill.
In the other two case, not only are my answers prime numbers, but they also occur BEFORE the "correct" numbers. That is, they shoudl be the true answers I would think.