Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
OP solved it, closing
What's the difference?
Do you pass the challenge?
How did you deal with bug arrays?
I always do the brute force and get schooled in the solution ssection :((((
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 is hidden because it contains spoiler information about the solution
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)
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.
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!
I was able to get the test to give me a pass. But my code was definitely not fully functional. This kata might need more test cases.
Well, I figured out what was wrong. Turns out there's a differeance between .substring() and .substr() in JS. Check it out if you're troubleshooting and are unaware of the differeance.
Wow, your solution made me realize there is a differeance between .substring() and .substr().
@VivianSolide it returns False the test is correct. What issue do you have?
same issue here. a few (15 or 17) of the hidden tests are rejected. The visible tests are all OK.
This comment is hidden because it contains spoiler information about the solution
Loading more items...