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.
When I attempt to pass the randomized test cases, i see other data after my output.
[ { location: 'DEU', ammonia: 165, nOxide: 132, cMonoxide: 164 },
{ location: 'USA', ammonia: 141, nOxide: 184, cMonoxide: 160 },
{ location: 'AUS', ammonia: 120, nOxide: 159, cMonoxide: 190 },
{ location: 'BHS', ammonia: 151, nOxide: 103, cMonoxide: 104 },
{ location: 'BRB', ammonia: 192, nOxide: 106, cMonoxide: 174 },
{ location: 'CHN', ammonia: 159, nOxide: 160, cMonoxide: 143 },
{ location: 'COG', ammonia: 180, nOxide: 184, cMonoxide: 193 },
{ location: 'CRI', ammonia: 110, nOxide: 173, cMonoxide: 132 },
{ location: 'ISL', ammonia: 193, nOxide: 151, cMonoxide: 147 },
{ location: 'VEN', ammonia: 143, nOxide: 145, cMonoxide: 163 } ]
And the tester program prompts "TypeError: _.where is not a function"
Does anyone have the same problem?
Hey, I finally solved it.
Once I found the formula i needed for this problem. I solved it in minutes
This problem is challenging and rewarding, I will recommend people to try it.
don't worry. still tackling it.
I don't know which gcd algo is the fastest.
https://en.wikipedia.org/wiki/Binary_GCD_algorithm
The wiki says this gcd implementation is effiecient
"Akhavi and Vallée proved that, in theory, binary GCD can be about 60% more efficient (in terms of the number of bit operations) on average than the Euclidean algorithm"
How many test cases are there?
It timeout after running 1500 test cases.
When I googled, it says to find the gcd of numerator and denominator.
So I wrote a binary gcd for my solution, then it timeout when the input is 123456789 or 9999999999.
I am lost.
Can you provide the theorem? I don't have any direction to tackle the problem.
Thanks.
Process was terminated. It took longer than 12000ms to complete
when running randomized tests.
Does it mean each test case need to run within 12 seconds?
Any hint?
This comment is hidden because it contains spoiler information about the solution
okay, let me think more. Thanks for your reply.
I fail the performance requirement again.
I suppose brute-force approach fails in this katas. I will other approach like dynamic programming.
i tried to find all the prime divisors of n and count the number of integers that are divisible by them, say m
then return n - 1 - m.
Sometime, the results are not correct. I am still working on it though.
How to beat the 12000ms requirement when testing on large number?
I realize my algorithm is inefficient but how to optimize it?
Any suggestion?
Loading more items...