Beta
Coping with NP-Hardness #2: Max Weight Independent Set of a Tree
Loading description...
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This comment has been hidden.
Now deepcopying inputs prior to administrating tests, so mutation doesn't affect validation. Ty for callout.
Hey,
It is not clear from the description and sample tests that the boss->employee dictionary might not contain all company members, but the dictionary doesn't include all the members in the full test suite. You might want to fix that or mention the same in the description.
(A quick way to check replace all
s.get(j, [])
bys[j]
in my solution)Other than that, this problem when done on trees has a linear time algorithm, so this doesn't fit in the NP-Hard series.
(I raised this as a suggestion couple of months ago, now I think that this is a small issue :D (quite easy to fix though))
Added to description. I think it fits. This is a special case of the more generalized NP-Hard problem where there is no strict hierarchy.
Hi, I had a solution and it got "You have passed all of the tests! :) ". Although, when I pushed 'attempt' it said
'''...Exception("The baseline algorithm found a result with {} total fun, LESS than your proposed {} fun. This should NEVER happen. Please contact the test administrator, something is wrong with the tests.".format(base_fun, proposed_fun)) Exception: The baseline algorithm found a result with [3, 4, 4, 5, 0, 3] total fun, LESS than your proposed [5, 3, 4, 5] fun. This should NEVER happen. Please contact the test administrator, something is wrong with the tests.'''
Shell I send my code to you somehow or public here? Sorry, I am completely new...
Thx
Thanks for the notification, this means my code is wrong. Dm me on one of the Gitter channels. https://gitter.im/Codewars/codewars.com/kata-solving-help# I'm listed as ALowVerus
Resolved.
Hi, I'm seeing random tests failing but not actually indicating what the expected answer is, I'm just seeing 'Value is not what was expected'.
Thanks for the heads-up. Added more descriptive testing messages. Good now?