6 kyu

Most improved - Puzzles #4

76 of 189matt c
Description
Loading description...
Arrays
Puzzles
  • Please sign in or sign up to leave a comment.
  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • FArekkusu Avatar

    Description formatting is broken.

  • user9644768 Avatar

    Ruby 3.0 should be enabled.
    Description formatting is broken.

  • tmxk Avatar

    Once again annoyed by the difference when writing the same thing in different ways..when there are round&random..

  • Voile Avatar

    If there is a tie in improvements then order by name.

    It doesn't mention that it's sort by case first, then letters. (and even in the case of... cases, it doesn't say which case should come up first.) It makes a difference when you have to compare letters of both cases, because there are two ways to sort characters:

    [...'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'].sort((a,b)=>a<b?-1:a>b?1:0).join('') // => "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    [...'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'].sort((a,b)=>a.localeCompare(b)).join('') // => "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"
    
  • niko79542 Avatar

    Cool Kata!

    For the ruby translation: In ruby, hash values are accessed by keys which are either symbols or strings. In the description it tells the warrior to use symbols, where in reality the problem uses strings, so: Example of student Object: {"name" => 'Henry, Johns',"marks"=>[25,50]} instead of Example of student Object: {name:'Henry, Johns',marks:[25,50]} And same with the expected output...Thanks!

  • mihaowei Avatar

    For some reason codewars won't run the test on my code. It just draws a blank. Not sure what's going on but it works in the IDE.

  • WillLearn Avatar

    I'd have this kata solved in ruby except out of the hundreds of scores one improvement is -57.49999999999999. 13 nines rounds to -57. If my value had 14 nines then it would round to -58, which is the answer for the test case.

  • jeffwright13 Avatar

    Looking at the first few test cases, it appears the "overall improvement percentage" is only dependent on the first and last scores. The middle scores are not taken into account. Is that correct? If I were a student in that class, I would not study for the first test, and then skip all the other tests until the final, which I would try to get 100%. Then I would be top of the improvement list!

  • flatline Avatar

    everything in this kata is simply wrong.......

  • hilary Avatar

    The description for the ruby translation talks about a 'student class', when in fact, no such class exists. That's quite confusing :(

  • Hacker Sakana Avatar

    In Python version, I don't understand where an integer or a floating point number is wanted for the key improvement . In basic tests and examples integers are expected while floating point numbers are wanted in random testing??? Quite confusing.

  • Insti Avatar

    For the case of [nil, 100] the kata seems to be expecting the improvment to be 0 rather than infinite. How/why/is this correct behaviour?

  • Insti Avatar

    It would be nice if the test cases could provide better information about where in the array the errors were.

  • Insti Avatar

    Ruby: Random tests are not sorting correctly by student name.

    It should work for random inputs too - Expected: [{"name"=>"freeman, fire", "improvement"=>1625}, {"name"=>"whimpy, harold", "improvement"=>26}, {"name"=>"steve, plum", "improvement"=>0}, {"name"=>"ash, cow", "improvement"=>0}, {"name"=>"shaun, star", "improvement"=>-8}, {"name"=>"leroy, plum", "improvement"=>-65}, {"name"=>"dick, plum", "improvement"=>-100}], instead got: [{"name"=>"freeman, fire", "improvement"=>1625}, {"name"=>"whimpy, harold", "improvement"=>26}, {"name"=>"ash, cow", "improvement"=>0}, {"name"=>"steve, plum", "improvement"=>0}, {"name"=>"shaun, star", "improvement"=>-8}, {"name"=>"leroy, plum", "improvement"=>-65}, {"name"=>"dick, plum", "improvement"=>-100}]

    "ash, cow" should be before "steve, plum"

  • GiacomoSorbi Avatar

    Upvoted, translated :)

    [Sooner or later I will also find the mental strength to do the same with the messy bug fix #10 ;)]

  • sayfidz Avatar

    There is an issue with sorting in the random tests. From expected results:

    {"name":"leroy, plum","improvement":0},{"name":"blop, King","improvement":0},{"name":"frog, cow","improvement":0},{"name":"jeff, willow","improvement":0}

    {"name":"god, cow","improvement":-100},{"name":"freeman, Act","improvement":-100},{"name":"whimpy, brown","improvement":-100}