7 kyu
Duplicate sandwich
894 of 1,756topping
Loading description...
Lists
Fundamentals
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.
python new test framework is required. updated in this fork
Approved
it doesnt make sense: [0, 1, 2, 3, 4, 5, 6, 1, 7, 8] => [2, 3, 4, 5, 6] here we dont have 1 and 1 in the answer so we learn that we have to return only those in between ['None', 'Hello', 'Example', 'hello', 'None', 'Extra'] => ['Hello', 'Example', 'hello'] but here we do have hello and hello -which means we also return those duplicates, why? [0, 0] => [] [True, False, True] => [False] why dont we have in the answer True and True? ['e', 'x', 'a', 'm', 'p', 'l', 'e'] => ['x', 'a', 'm', 'p', 'l']and here again only those in between so the second example is the one that is different from the others but the question stand - whats up with this kata, what should i return Your task is to output a list of everything inbetween both occurrences of this element in the list.
nothing mentioned about the duplicats em selves
Sorry for the late response. I haven't been on codewars in a while. 'Hello' and 'hello' are not duplicates. One is capitalised and one isn't.
thanx!
JS Version - The spec says there should only be 1 duplicate in each input.
During the random tests I receive an input array containing a list of 28 duplicate symbols "symbol()". Weirdly, it's my current understanding that the point of a symbol is that it should be unique.
Can anyone point me in the direction of what I am not understanding or how to approach this? Thank you!
Why do you think those symbols were all the same? Or all different?
They were all represented the same, but that's not the same thing.
Thanks Johan, I thought they were all the same because this is the input array I am receiving. This is my first time working with symbols in this way. I'm curious why they are represented in this manner rather than the actual symbols.
Input Array:
[ Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol(), Symbol() ]
How do I acess the actual content of the symbol in order to differentiate them?
Since I'm using a hash map to determine duplicates, I will end up having a symbol within a symbol?
_ _
I am console logging the following to understand what is going on:
Type of elements in input array: symbol
My HashMap: I do see that it records a second entry for one of the symbols. Though I can't differentiate it myself visually.
valueMap { [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 2, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1, [Symbol()]: 1 }
I iterate over the hash map to find and return the prop that contains 2 and set that prop equal to a variable, and the console log it, this is where my logic seems to be breaking at the moment.
Duplicate is undefined (meant to be return value) as a undefined (meant to be data type of the value)
This comment has been hidden.
What I am realizing is that I need to figure out why this prop comes back as "undefined" when I try to access them. Because of that I am unable to determine the index location of the duplicates.
This comment has been hidden.
JavaScript translation
Thanks again! Its approved now.
Haskell translation
I approved it.
And I already fixed the Notes. They didn't display properly - and I could not see that when doing the translation, because I can't choose a language there. It's OK now.
Ok nice. Thanks for making the translation.
NP. I've run out of kata to solve a bit. Now mostly doing translations, which is just as good really. :]
start python? x)
Nah.
I've learned Haskell on here, which was everything I hoped it would be.
If Python is everything I suspect it to be, I do not want to learn that. Does it have constants yet? :P
Seriously, I have no need for another language. I can always translate instead of solve. That opens up more kata than learning one new language anyway.
This kata smells of duplicated effort. There already exist many katas that ask the user to find a duplicate value in a list/array/string (just do a search for 7/8 kyu katas with the keyword "duplicate", "repeat", "double", and so on). The additional trivial task of returning a slice of a list doesn't really help differentiate this from the rest.
When I came up with the idea for this kata, I assumed it would already be made, however I couldn't find anything.
Yes there are lots of katas about duplicates or repeats or doubles but clearly the additional things have an impact on whether it is classed as a duplicate or not or otherwise there wouldn't be all these similar katas like you have mentioned.
I will un publish if I have to but normally when there is a duplicate, the satisfaction rating is quite low, however mine isn't as low as it normally would be, which makes me think that not as many people think this is a duplicate kata.
When I came across this kata, it felt very much like a duplicate. Though I didn't find an exact duplicate, I did find many white katas with significant overlap, which, for white katas, is a strong indicator of a duplicate task.
While there are plenty of katas that share similarities, their mere existence doesn't prove uniqueness; it may simply be a consequence of having been overlooked (which is very likely to happen with over 9000 katas). This site gets new users all the time, and to a new user this kata may appear unique because they hadn't encountered something similar before. I'd imagine the chances are high that a new user will encounter a newer duplicate than the original kata published years ago because newer katas rise to the top of the list (assuming most users don't change the sorting criteria, which defaults to "Newest").
Also, a notable reason why there are many similar katas is because many of those are from a few years before. Back when there were far fewer users, things were much more lax and authors got away with things like no random tests, no sample tests, poorly written descriptions, and so on. It was only later on that the bar got raised and users put in the collective effort to maintain some level of standards.
Ultimately, my point is that people should be more conscientious of what they decide to publish. As you said yourself, you felt that this kata was already made, which sounds like a gut reaction, meaning you probably encountered very similar katas before. I know I certainly have.
I think the combination works.
Low level kata always have this problem - they're all somewhat the same. There just isn't that much to do, or you'd have a higher kyu task. In theory, the number of low level kata is finite, but I don't think we're there yet.
you should say explcitely that all used elements will be hashable
Is it ok now?
yup