Ad
  • Custom User Avatar

    My appoligies, this is a mistake I made in the Initial Solution.

    The method signature should read:

    func allNonConsecutive (_ arr: [Int]) -> [(Int, Int)] {  
    

    (Note the underscore before arr)

    This is because the tests expect a function with an un-named argument but the Initial Solution names it arr. I've updated the Kata for future takers's but you'll have to either reset your code or update it yourself.

  • Custom User Avatar

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

  • Custom User Avatar

    I can't believe i missed that. Well done !

  • Custom User Avatar

    Edit : Should have replace .components(separatedBy: CharacterSet.decimalDigits.inverted).compactMap{Int($0)}
    by .components(separatedBy: " ").compactMap{Int($0)}

  • Custom User Avatar

    Oh ok, I got it now :)
    Thanks for your time.

  • Custom User Avatar

    It's not the wrong place, it was the wrong label only ;)
    Check what's printed in the second sample test.

     Log
    [0, 0, 0, 0, 0, 1, 0]
    [0, 1, 1, 1, 1, 0, 0]
    

    Are those the right values?

  • Custom User Avatar

    Thanks for your quick answer.
    Sorry about the wrong place to post, I'm new on the platform, I'll know for the next time :)
    I checked what you advice me to do, but those vars contains what I'm expecting: an array of int from what's passed in parameters.

  • Custom User Avatar

    For problems with your code, use Question label, not Issue, that's for problems with the kata itself. Print your vars goodRacesCount and evilRacesCount you'll see the problem.

  • Custom User Avatar

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