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.
Fixed.
ran into the same problem, you'll have to find another way to run this in less iterations! Not sure what your solution is, I know the easy way out is checking to see if the number N modulo'd by 2...3...4...N-2...N-1, but this takes way too many iterations with large numbers.
Another scenario you might be running into (which I ran into) was keeping an array of prime numbers within the bounds, this also gets really large and requires a large amount of iterations, try not using an array of prime numbers if yo uare doing so.
The whole point of the kata is to parse input from a "dumb" user, so cases are meant to be confusing - edge cases are meant to be messed up. And while I might agree with some of your observation, as far as I know and have seen here in the UK, you almost always prepend "£" to the amount, never seen it put inside it with a following "p", so that in my book should be wrong.
For the rest, I will make clearer that "£" wins over "p".
Thanks for your feed :)
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!
Thanks for the feed; if you want to suggest some edit to the description, just be my guest :)
This comment is hidden because it contains spoiler information about the solution
That means your solution has either entered an infinite loop or it's inefficient to handle the supplied data, if you post your solution and mark it as a spoiler people can help debug your code :)
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
No problems with the tests. Did you make the distinction between "gap" in primes and "step" in primes? To see the difference look at: http://www.codewars.com/kata/5613d06cee1e7da6d5000055. Maybe you could begin with "Steps in Primes" kata. Hope that helps!
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.