Ad
  • Custom User Avatar

    wow haha i would have never thought of this. Very clever indeed

  • Custom User Avatar
  • Custom User Avatar

    Yep, definitely "very minor" issues. I thought about that, and in production one should really think about the implementation of the correct algorigthm to compute overlapping intervals. But still, it's a funny, dumb and straightforward solution :)

  • Custom User Avatar

    Wow. A clever solution indeed. Just never thought it this way. !!

  • Custom User Avatar

    It's a problem with your code, print the input with: Console.WriteLine("[{0}]", string.Join(", ", intervals));
    The expected value for ShouldHandleRandomIntervals, the only test I could see the input there is also ok.

  • Custom User Avatar

    Where is your proof that there is an issue? Show us the input, expected value and your function's output at least.

  • Custom User Avatar

    ShouldHandleRandomIntervals is also ok:

     ShouldHandleRandomIntervals
     Log
    [(-529, 1103), (-3242, 2588), (4883, 7280), (-7324, -4208), (-5794, 9742), (-1899, 9867), (-2967, 3545), (-1934, 845), (-5227, -4772), (-808, 904), (3275, 8605), (9630, 9653), (3106, 6560), (-8482, 9012), (-8779, -5298), (-900, 6187), (-9338, -5215), (-3115, 7763), (4517, 7755), (-9686, -8132), (2339, 6978), (-9105, -1684), (-2842, -137), (-7313, -1270), (-3259, 6189), (-7812, -3846), (3029, 8661), (5901, 7827), (-160, 2934), (-8224, 197), (-3221, 5761)]
    Test Failed
      testing: [(-529, 1103)], [(-3242, 2588)], [(4883, 7280)], [(-7324, -4208)], [(-5794, 9742)], [(-1899, 9867)], [(-2967, 3545)], [(-1934, 845)], [(-5227, -4772)], [(-808, 904)], [(3275, 8605)], [(9630, 9653)], [(3106, 6560)], [(-8482, 9012)], [(-8779, -5298)], [(-900, 6187)], [(-9338, -5215)], [(-3115, 7763)], [(4517, 7755)], [(-9686, -8132)], [(2339, 6978)], [(-9105, -1684)], [(-2842, -137)], [(-7313, -1270)], [(-3259, 6189)], [(-7812, -3846)], [(3029, 8661)], [(5901, 7827)], [(-160, 2934)], [(-8224, 197)], [(-3221, 5761)]
      Expected: 19553
      But was:  -1
    

    Check your code.

  • Custom User Avatar

    At least ShouldAddOverlappingIntervals expects the same answer as the kata description:

    ShouldAddOverlappingIntervals
     Log
    [(1, 4), (3, 5), (7, 10)]
    Test Failed
      Expected: 7
      But was:  -1
    
  • Default User Avatar

    Both test on my pc and your "RUN SAMPLE TESTS" are correct. However the same test at "ATTEMPT" button gives other (wrong) result. Lang C#.

  • Custom User Avatar

    c# ShouldHandleRandomIntervals and ShouldAddOverlappingIntervals dont compile true answers in attempt, but in sample tests all good.