Ad
  • Default User Avatar

    You are ignoring the overlapse. For example the ex.1 Has 1-5 and 1-5. if you were to write every number between the both of them you would indeed get 9 numbers(length 8), but all of them would be dublicated. So the number of the unique numbers is 5(and the length is 4): 1, 2, 3, 4, 5; it is simpler to understand if you write the intervals on one line in a pice of paper. :)

  • Custom User Avatar
  • Custom User Avatar

    Approved

  • Custom User Avatar

    thanks a lot

  • Custom User Avatar

    upper bound is excluded in the inputs, so:

    n:      1   5    ...
    1-5:    ----
    1-6:    -----
    5-11:       ------
    10-20:           ----------
    16-19:                 ---
    merged: ------------------- <=> from 1 to 19 (included), hence 19
    
  • Custom User Avatar

    Hi there.

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

    could you help me?
    I dont understand how to parse it, what are arrays overlapping.

  • Custom User Avatar

    The ISSUE label is for provable kata issues. Please use the QUESTION label when asking for help. See https://docs.codewars.com/training/troubleshooting#post-discourse.

    What do i do wrong? Golang

    Refer to the kata's description.

  • Custom User Avatar

    Hi there.

    I dont understand

      Expect(SumOfIntervals([][2]int{{1, 5}, {1, 5}})).To(Equal(4))
      Expect(SumOfIntervals([][2]int{{1, 4}, {7, 10}, {3, 5}})).To(Equal(7))
      Expect(SumOfIntervals([][2]int{{0, 20}, {-100_000_000, 10}, {30, 40}})).To(Equal(100_000_030))
    

    1 test has to equal 8

    2 test has to equal 8

    3 test has to equal 100_000_040. For example {-4, 1}: 1 - (- 4) = 5 :> -4, -3, -2, -1, 0, interval is 5,

    What do i do wrong?
    Golang

  • Custom User Avatar

    It's 10 years old :) Difficulty standards have increased since then.

  • Custom User Avatar

    Hi. =) U're rgiht. That may happen, I am chiting some times. This cata was needed only for my course passing

  • Custom User Avatar

    it is cheat =)
    good job

  • Custom User Avatar

    thank you a lot.
    I ve done this kata

  • Custom User Avatar
    Array a:       6, 9, 7, 0, 11,
    Array b:   -2,       7,        18, -1, 16, -19, 3, -18, -5,
    Answer:        6, 9,    0, 11,
    
    
  • Custom User Avatar

    Hello.

    My program has done tests which was wrong

    For example wrong test:
    Exptected:
    {6, 9, 11}
    Equal:
    {0, 6, 9, 11}

    My test has done:
    Expect(ArrayDiff([]int{6, 9, 7, 0, 11}, []int{-2, 7, 18, -1, 16, -19, 3, -18, -5})).To(Equal([]int{6, 9, 11})), passed

    Expect(ArrayDiff([]int{-18, 9, 13, 1, 6, 13, -5, 17, -4, -10, -10, -1, 3, 12, -4, 10, 0, -15}, {3, 19})).To(Equal([]int{6, 9, 11})), passed

    Why?

  • Custom User Avatar

    its amazing, thank you!

  • Loading more items...