Ad
  • Custom User Avatar

    An O(N^2) time complexity algorithm will timeout, opt for an O(N) time complexity algorithm.

  • Custom User Avatar

    without diving too much, looks like there must be a shorter way to define the game result.

  • Custom User Avatar

    We can forget about 1-5 and 16-19 because they are inside 1-6 an 10-20. 1-6 and 5-11 = 1-11. And 1-11 and 10-20 = 1-20. It's length = 20-1 = 19;

  • Custom User Avatar

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

  • Custom User Avatar

    Hmm... I don't like this kata.

  • Custom User Avatar

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

  • Custom User Avatar

    You're right, everything overlaps, so you end with a unique interval [1, 20], which length is 19.

  • Custom User Avatar

    all 3 others overlap each other so it's like [1, 11], which gives 10 as well.

    But you already used number 10 in the previous intervals (so, only 9 for those)

  • Custom User Avatar

    after looking on the instructions I don't get how this case should equal 19

    sumIntervals( [
       [1, 5],
       [10, 20],
       [1, 6],
       [16, 19],
       [5, 11]
    ] ) => 19
    

    which ones overlap each other here?

    Clearly, [10, 20] and [16, 19] overlapping one another. So it gives, 10.

    To me, all 3 others overlap each other so it's like [1, 11], which gives 10 as well.

    As a result, shouldn't I get 20 here?

    Skipping this one for now.

  • Custom User Avatar

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

  • Custom User Avatar

    The representation of a number as floating point or strings is exactly that: a representation. A string can exactly represent the input and output, so that's what's used. What you want to do with them is up to you.

  • Custom User Avatar

    You should add the numbers. That's it.

    There's no ambiguity in the input or output. How you would implement it is your task.

  • Custom User Avatar

    Should I write a function to convert an output a sum of two numbers (which is 9.100232822049192e+28) to become a full number without a scientific notation? Is it a main idea? Or it is supposed to convert arguments firstly, i.e. to be displayed as an entire numbers without notation, and then sum up them?

  • Custom User Avatar

    yep, got it now, thx!

  • Custom User Avatar

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

  • Loading more items...