6 kyu

Exercise in Summing

1,085 of 2,100jmusto
Description
Loading description...
Arrays
Fundamentals
  • Please sign in or sign up to leave a comment.
  • ahmet_popaj Avatar

    Nice one, well done.

  • saudiGuy Avatar

    python : random tests always test for n=200

  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • Cloud Walker Avatar

    Fun kata. I notice I'm one of the only ones to use negative n for both functions.

  • e_zelenkov Avatar

    Hi, can you help me ? "maximumSum with n>values.length not working as expected"

    var values = [5, 4, 3, 2, 1]; console.log( maximumSum(values, 7)) // 7 > 5 return 5

    What is problem ?

  • FArekkusu Avatar

    No random tests.

  • Ice_Fly Avatar

    This comment has been hidden.

  • twhyn Avatar

    This comment has been hidden.

  • Orgasm69 Avatar

    This comment has been hidden.

  • Javatlacati Avatar

    This comment has been hidden.

  • Unnamed Avatar

    I think the tests can't be changed now. At least, what behavior is expected for negative ns in Haskell?

  • banebot Avatar

    There's a problem with the Haskell random tests, I think it's switching minimum and maximum function calls.

  • haydemtzl Avatar

    This comment has been hidden.

  • altre Avatar

    The instructions say: "n: how many integers should be summed; always 0 or bigger"

    However the random tests seem to also give input data with negative n, see the following failure message for haskell:

    Falsifiable (after 2 tests): expected: 0 but got: 1 [1] -1

  • freinn Avatar

    This comment has been hidden.

  • IcarusComplex Avatar

    This comment has been hidden.

  • kp9r4d Avatar

    Hello! In statemants I see: "values always 0 or bigger" but when I try to run my programm on test cases I see: "uncaught exception: ErrorCall (Prelude.tail: empty list) (after 2 tests) [] -1" Is there "[] -1" valid test?

  • karakfa Avatar

    Tests seems have index off by one. My results look correct to me. Or, I'm doing something wrong.

    minimumSum should work for some examples Test Passed should work for random inputs Falsifiable (after 15 tests and 13 shrinks): expected: 0 but got: 1 [0,0,0,1,0] 4

    minimumSum should work for some examples Test Passed should work for random inputs Falsifiable (after 8 tests and 8 shrinks): expected: -1 but got: 0 [0,0,-1] 1

    minimumSum should work for some examples Test Passed should work for random inputs Falsifiable (after 7 tests and 5 shrinks): expected: -1 but got: 0 [0,-1] 1

  • costas Avatar

    The instruction somewhat clearer: "if n is larger than values.length, simply include all values to the sum"!!!!!

  • NemoPraeterNos Avatar

    Got an error : "maximumSum with n=3 not working" while submitting. While inspecting console.log gives :

    1. values : [ 11, 12 ]
    2. n : 3
    3. returns : 23

    What's wrong???

  • Snecil Avatar

    When trying to submit I recieve the following error:

    "maximumSum with n>values.length not working as expected"

    How is it expected to work?

    Thanks for any input.

  • IVBakker Avatar

    I have a problem to pass the test: minimumSum with large random array not working - Expected: 191, instead got: 5881

    It's not the first time I run into this kind of problem, it seems to appear when using "sort" on a very large array. Is it really my code that has a problem or the "compiler" that can't handle more than a certain number of actions?

    Should the function sort be used in this kata?

  • snewcomer Avatar

    This comment has been hidden.

  • user3482173 Avatar

    7 kyu is a bit underevaluated. There is multiple non-trivial things to do in this kata.

  • kmeurer Avatar

    Great Kata. My only complaint is that the "add values.length integers to the array if n>values.length" confused me. I wrote code that calculated the array sum and then added values.length*(n-values.length)

  • kushite Avatar

    How does the kata handle multiples of the same number?

  • jrochelly Avatar

    This comment has been hidden.

  • rockncode Avatar

    This comment has been hidden.

  • Andy Avatar

    Kata should explain what should happen when n is negative.

  • Paul Avatar

    This kata should be reranked, the use of negative numbers puts this above simple fundamentals

  • wthit56 Avatar

    I think you should add something describing what should happen if n is larger than values.length. Other than that, nice kata! ^^