Ad
  • Custom User Avatar

    Unpublishing due to being a dup (despite this being earlier), as well as old unresolved issues and a long since unactive author.

  • Custom User Avatar

    Won't call it a duplicate of a later kata ( Jun 28, 2014 vs. Jan 7, 2018 ), but this kata has been overtaken by the much better executed Packing your backpack.

  • Custom User Avatar

    Needs more testcases than ONE FIXED TEST.

    DP or memoisation is not even necessary, and generally wrong solutions can pass the tests test.

  • Custom User Avatar

    So, another dp problem? ;-)

  • Custom User Avatar

    Needs more test cases, other than that it's a great kata, thank you :)

  • Default User Avatar

    Hey, just a small feedback:

    1. The "500,000" got me really confused first. Maybe remove the ",000" part if you ask me, not all languages do use the "," as a limiter (we have always problem at work with that haha)
    2. You may want to add a big bold "Task" in the Description. Function would be to separate "story" from the actual task.
    3. I think you need more testcases. My solution for example would crash for no people to be paid. Also some more tests would be nice to sort out "corner cases".
  • Default User Avatar

    i think you can simple calculate the quotient of (score / debt), sort by that as first criteria, sort by debt as second criteria and use the result as stack, of which you pick items as long as you are below the max debt. At least thats what i did :)

  • Custom User Avatar

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

  • Custom User Avatar

    Nice kata.

    It would be nice with a few more test cases. Especially to sort out some corner cases, such as when no debts can be paid.

    I would also advice you to use Test.assertEquals instead of Test.expect. It makes it easier for the developer to see in what way his result differs from the expected one.

    Thanks!

  • Custom User Avatar

    Good point @greghmerrill - I've updated the description as per your suggestion. Thanks!

  • Custom User Avatar
  • Custom User Avatar

    Agreed and updated. Thanks again!

  • Custom User Avatar

    Ah, I see. Now I've passed. Thanks.

    Maybe even clearer would be "His goal is to reach the highest possible sum of scores." As it is, it could be read as "highest sum of scores for the number of debts paid," which would come up with the same problem.

    Thanks for your help!

  • Custom User Avatar

    From your solution, I can see that my problem statement was poor. I have changed "His goal is to reach the highest possible sum of scores for debts paid, thereby reducing the risk of war with as many houses as possible." to simply "His goal is to reach the highest possible sum of scores for debts paid."

    With this in mind, try changing your objective function, and I think you will find the rest of your solution holds good.

  • Custom User Avatar

    Passed the example test fixture, but getting the Test Failed: Bolton,Frey,Swyft,Tarth,Tully is not optimal. Looks like the Lannisters are going to war ... message on the first real test. Though I see the reason to hide it, I feel like it would be really helpful to know what the expected result is.

    I've tried many ways of balancing total score with number of houses, but cannot figure it out. Maybe I'm thinking about this the wrong way?

    (My code so far to follow.)

  • Loading more items...