Ad
  • Custom User Avatar

    That's my understanding as well

  • Custom User Avatar

    I believe this is better than sorting, but not sure?

    With n the size of a single word, sorting is O(n * log(n)), whereas counting should be only O(n).

  • Custom User Avatar

    D is actually a Least Common Multiplier, not a common denominator.

    In fact D (in Rust an in some other languages) is a "Least Common Denominator" hence a common denominator.

    So I read the title and skimmed through the description ... and thought "okay, it's just reducing fractions" ... I read the example and it looked like the exact opposite

    "Réduire des fractions au même dénominateur" is misleading: "reduced fractions" don't have necessary a "smaller" denominator.

    D is quite large and I didn't notice it was the same ... reading the Discourse here I'm not the only one to find this description confusing

    Problem is: before coding, it is better to carefully read in order to clearly understand the task...
    Unfortunately it is a quality badly shared. Skimming through the description saves you a few minutes to lose a lot more later.

    Thanks for your post.

  • Custom User Avatar

    Okay, let me reformulate.

    I know what a Greatest Common Denominator is, and that it's used to reduce a fraction. So I read the title and skimmed through the description and thought "okay, it's just reducing fractions", but then I read the example and it looked like the exact opposite: you start with a reduced fraction and arbitrarily unreduce it to a bigger fraction?? That's what I meant by "it doesn't make any sense". I should have added "to me", because missing that information, the exercise felt like nonsense. So I read the sample tests, and the description, again and again, but D is quite large and I didn't notice it was the same.

    Now, this is just my experience, and yes I am probably to blame for sticking with my initial assumption and failing to notice the subtlety of the description, but reading the Discourse here I'm not the only one to find this description confusing. And indeed -- please don't take it personally but -- I've read clearer descriptions.

    So, to sum it up:

    • "Common Denominators" doesn't help: it only takes 2 integers to have many common denominators. Plus, D is actually a Least Common Multiplier, not a common denominator.
    • Examples don't necessarily make it clearer when you don't know what to look for. Lots of numbers aren't what the human eye is best at parsing.
    • The many syntaxes for all the languages don't help either.

    I eventually realised my mistake and solved the Kata, so it's all the same to me, but I'm thinking about the people that'll come after me.

    I'm not asking for much. Just adding something like the following would make it clearer imo:

    You have to return a list of rationals that all share the same denominator D such that ...

  • Custom User Avatar

    The title is "Common Denominators". The word common shows clearly that it has to be the same for all elements!
    Moreover you have below:

    You have to produce a result in the form:
    
    (N_1, D) ... (N_n, D) 
    or
    [ [N_1, D] ... [N_n, D] ] 
    or
    ...
    

    and everybody can see that D is the same for all elements.
    You take Rust. You should have seen in "Sample Tests" that in each test D was the same for all elements.

  • Custom User Avatar

    Please reword the description to make it clear that D should be the same for all elements.

    Otherwise it doesn't make any sense and I spent way to too long figuring this out.

  • Custom User Avatar

    @ThibaultLemaire: Now, it worked. Could you please check again.

  • Custom User Avatar

    then don't resolve the issue before you update the version.

  • Custom User Avatar

    You're right. But at the moment it is not possible to update because of an error of codewars...

  • Custom User Avatar

    How to turn a top down approach into a naive approach... nice.

  • Custom User Avatar

    In F#, the actual and expected are reversed in test cases. It's a bit confusing when debugging

  • Custom User Avatar

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

  • Custom User Avatar

    That's not very constructive. What don't you like about it?

    For example, I think your solution is pretty clean, but I don't consider the single-line initialization a good practice.

  • Custom User Avatar

    Better to better your solution...

  • Custom User Avatar

    This solution sucks a lot!

  • Loading more items...