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.
Too much code..
starting at 3 is a clever thing to do.
Clever !
awesome solution
The translator is @donaldsebleung. I don't know PureScript so I can't help. The two existing solutions don't use BigInt or BigRational.
I get the same issue as you described. Even when using BigInt for intermediate calculations, the problem persists.
Look for "regular expressions".
Hi,
could anyone direct me to the documentation where I can find details like the "(WUB)+" in this code.
I'm not sure if I explain clearly what I'm looking for.
I am looking for the predefined symbols that do operations inside quots "" and are not actually part of the String.
Thanks in advance.
Not done in PureScript but I suppose it is doable within the Int range.
Ok. Just a string. Now if only I knew what the function is expected to return in case of an empty input array...
I hadn't checked with the sample tests. I'd just read the instructions which lists several formats for acceptable results, of which one appears to be an array of arrays [ [numer_1, denom_1] , ... [numer_n, denom_n] ]. I've only been learning Javascript for a few months and am not sure whether (numer_1, D)(number_2, D)... simply means a string of literal parentheses and commas concatenated with the values of the numerators and lcd or whether this is a special structure that I haven't yet learned about.
Did you check what is expected by sample tests? In sample tests you can see that the answer should be an appropriatelly formatted string. Parentheses, nubmers and commas are parts of the string.
Question regarding the required syntax for the solution (Javascript). My solution returns the correct numerators and denominators but is rejected due to syntax. Specifically, I wrote the function to return an array of 2-item arrays (each one consisting of the numerator and least common denominator). I see that instead of returning, e.g. [[6, 12], [3, 12], [4, 12]], my function should return (6, 12), (3, 12), (4, 12).
My question is are the expected parentheses and commas simply string literals? Or is this some data structure with which I'm not yet familiar?
Hello everyone,
I'm stuck with my PureScript implementation.
It passes all manual test cases. When it comes to the generated tests though, the inputs comprise of over a hundred fractions.
Even after simplifying, their common denominator would overflow the Int type giving an implredictable value.
There are data types to handle big numbers but in the end I am constrained to return them back as Ints anyway, which defeats the point of such a convertion.
Could somebody who accomplished this exercise in Purescript confirm that all the fractions are reductible to numbers within the Int range and my algorithm is just wrong,
or perhaps that is a deliberate catch of this exercise and the solution requires a different take?
This comment is hidden because it contains spoiler information about the solution
Loading more items...