6 kyu
Sherlock on pockets
290hagi
Loading description...
Algorithms
Arrays
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.
pretty bad description, you say if pockets == nil i.e. if the first argument is nil, but what you really mean is if all the values in the hash are nil or empty arrays, or if the hash itself is empty.
I had to click Train to figure out the real task here. The best description of this problem is hidden away in some comment in the code setup:
what do you think about removing pockets being nil and replace them with an empty array instead? That would make way more sense, imo.
Agreed. I thought of doing that, but it would invalidate pretty much all of the existing solutions. Would that be ok?
no, that won't change anything since currently that's the user who's converting the nils to an empty array (I mean... If the user coded it in a clever way... 'XD ). But yeah, that's what beta phase is made for, so go ahead. That way, I won't have second thoughts when approving it to 7 kyus. ;)
EDIT: mmh damn... already approved... :( Then, keep it that way instead.
Eh, sorry, I wasn't getting notifications on this post for some reason and approved it before seeing your first comment. I published it with the power user average ranking (6kyu), since the overall average seemed a bit too high (5kyu). Are you sure it's too late to change the nil/empty array thing, though? The author's solution would have to be updated, but aside from that it's a minor change.
Also need random tests.
This comment has been hidden.
It's not mentioned how a value of
nil
should be handled.Description updated.
Good concept, but the description is very difficult to read and understand, as it is not in very idiomatic English. I had to read it a number of times to get the gist of the task.
Noting something is hard to understand isn't a resolvable issue as there is no way for anyone to know what you found hard to understand.
The 2nd test case provided in the description is incorrect
you're right, examples changed, thx
What is the difference between nil and [] for pockets?
I think this doesn't matter for kata, but few comments ago I had idea that empty array can be for empty pockets, and nil can be for 'no pockets' in real life example ;)
The description says values in
pockets
will be one or more things represented by numbers, but some test cases havenil
values. If you want to have empty pockets in your test cases, either leave the person (and her/his pockets) out or make it an empty array and change the description to say that values will be zero or more numbers.I think the most straight-forward way to set up
pockets
is to have the key be a name (as it is) and the value be an array of pocket contents (numbers). An empty array will then mean an empty pocket.I also think the return value should be an array of suspects. Notably, this means returning an empty array instead of
nil
when there are no suspects.This comment has been hidden.
This comment has been hidden.
This comment has been hidden.