Ad
  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    Dope solution.

    Although, need to do flooring to get it to work but that's an easy fix I guess, either way still sick.

  • Custom User Avatar

    Honestly, I don't know why this works. The test case: "(()lghk)k)lck)" should have never passed in this code.

  • Custom User Avatar

    Why not try thinking through it with an example and see if with notetaking, you can find a solution that works for you!

    Example, imagine an infinite list of ascending numbers:
    [1, 2, 3, 4, 5, 6, 7, ...] # find a sum 7

    As you go through the list, would you need to parse to infinity to know what values add up to 7? In this constrained example, the fact that ther numbers are ordered gives you the advantage to know that once we're past values that can sum up to 7, that you don't need to look further.

    Beyond that, you know by the time you hit [3, 4] that there's a matching pair, and you didn't even need to look past the 4th value in that list!

  • Default User Avatar

    The JavaScript code isn't executed by the browser, but by Node JS. It's a runtime to run JavaScript outside a browser (in this case: Codewars's server). So it doesn't matter whether you use Chrome/Firefox/etc.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    Given an array of integers, find the one that appears an odd number of times.

    That's very clear to me. And you can look at the sample tests:

    test.assert_equals(find_it([20,1,-1,2,-2,3,3,5,5,1,2,4,20,4,-1,-2,5]), 5)
    

    5 appears 3 times, and the expected answer is 5, so, it's the integer, not the times it appears.

  • Default User Avatar

    You need to return the value of the integer that appears an odd number of times.

  • Default User Avatar

    I don't understand what we are supposed to return. Do we return the value of the integer that appears an odd number of times? Or do we return the number of times the odd integer appeared? This kata is very unclear.

  • Default User Avatar

    well, looks like it is my mistake. I did not understood correctly the word odd

  • Custom User Avatar

    Well, for [18, 1, 7, 1, 1, 1, 18, 18, 7], 18 occurs 3 times (odd number). The other array seems impossible, unless you're modifying the input. (but if so, 3 occurs 7 times, so it's a valid answer)

  • Default User Avatar

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

  • Custom User Avatar

    Wow, I actually thought my solution was decently short lol. Seems to be a pattern

  • Loading more items...