Ad
  • Custom User Avatar

    OP solved it, closing

  • Custom User Avatar
  • Custom User Avatar

    Do you pass the challenge?
    How did you deal with bug arrays?

  • Custom User Avatar

    I always do the brute force and get schooled in the solution ssection :((((

  • Custom User Avatar

    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.

  • Custom User Avatar

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

  • Custom User Avatar

    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)

  • Custom User Avatar

    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.

  • Custom User Avatar

    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!

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    Wow, your solution made me realize there is a differeance between .substring() and .substr().

  • Custom User Avatar

    @VivianSolide it returns False the test is correct. What issue do you have?

  • Custom User Avatar

    same issue here. a few (15 or 17) of the hidden tests are rejected. The visible tests are all OK.

  • Custom User Avatar

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

  • Loading more items...