Ad
  • Default User Avatar
  • Default User Avatar

    starting at 3 is a clever thing to do.

  • Custom User Avatar
  • Custom User Avatar

    awesome solution

  • Default User Avatar

    The translator is @donaldsebleung. I don't know PureScript so I can't help. The two existing solutions don't use BigInt or BigRational.

  • Default User Avatar

    I get the same issue as you described. Even when using BigInt for intermediate calculations, the problem persists.

  • Custom User Avatar

    Look for "regular expressions".

  • Custom User Avatar

    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.

  • Default User Avatar

    Not done in PureScript but I suppose it is doable within the Int range.

  • Default User Avatar

    Ok. Just a string. Now if only I knew what the function is expected to return in case of an empty input array...

  • Default User Avatar

    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.

  • Custom User Avatar

    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.

  • Default User Avatar

    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?

  • Custom User Avatar

    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?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Loading more items...