Ad
  • Custom User Avatar

    @ZooBiscuit1999 I didn't make the connection either. Could've been worded better to avoid confusion.

  • Custom User Avatar

    This one was tricky for sure (tricky for me because i'm brand new to c#), but I managed to solve it in c#. I don't know how "correct" my code is, but I passed all the tests. What's strange is that I tested my code in rextester.com and whenever I tried to pass an array to UniqueInOrder, it kept failing at compilation. Ex: UniqueInOrder([1,2,2,3,3]) I'm a novice programmer relatively speaking, but I've been here long enough to see that a lot of katas have legitimate issues. This one might be one of them? It'll be interesting to see what a (1 kyu) person says. Surprised nobody has responded to you yet.

  • Custom User Avatar

    By 'The first item' test, I assume you mean, cases where the test is like this arr = [1, 2, 2, 2]. It's not passing because you initially assign 0 to n (totally fine), but then later, you're reassigning n to be arr[1], since arr[1] is not in non_unique at this point (at this point, non_unique only has arr[0]). Since you are adding items to an array and comparing, try adding the 2nd item into your non_unique array, then go from there. If you do add the 2nd item though, be careful to start your loop at the 3rd index of the array, and then compare. Not sure if that's giving away too much.

  • Custom User Avatar

    Thanks for the heads up and for the doc. I actually tried to put the spoiler flag, but it said I didn't have enough privilege or whatever. I forgot what it said.

  • Custom User Avatar

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

  • Default User Avatar

    I agree that this should be a go to solution, but might I say ==> only if you are privy to the actual formula for finding the sum between two numbers? Safe to say, most folks aren't aware of this mathematical approach you're referring to, which probably explains why they're using other techniques. I'm coding in Ruby and I decided to use "one of those methods that adds values of an arr and returns the sum" method.

    btw: I tested that formula for this challenge, and it worked perfectly. Thanks for sharing :)

  • Default User Avatar

    i tested my code and 3 test cases failed, out of 58; for all 3 failed cases, i was off by literaly 1 second;

    then, while still in the codewars console window, i accidentally pressed "ctrl+s" because I thought I was in my atom editor, but after hitting that command, my code ran, and.... i passed all the cases

    why?

    whatever :)