Ad
  • Custom User Avatar

    Could you expand on why you think an algorithm doesn't need to travel the entire array? I thought it would have to move through the entirety of the array to determine which numbers are odd/even.

    Or is it that due to the limitations of the problem just as long as there is more odds than evens and vice versa, it won't have to travel through the entire array?

  • Custom User Avatar

    How do you figure out that it takes 3N? I don't know how to do this so I'm curious to learn.

  • Custom User Avatar

    Your code is returning

    J
    K
    D
     
     
    W
    B
    I
    R
    A
    Q
    K
    F
     
     
    Y
    E
     
    W
    V
    

    and the expected solution is

    J
    K
    D
     
    W
    B
    I
    R
    A
    Q
    K
    F
     
    Y
    E
     
    W
    V
    

    You are only replacing the substring with exactly 3 spaces instead of multiple. That means it will not replace any whitespace with more than 3 characters. You need to deal with multiple not 3.

  • Custom User Avatar
  • Custom User Avatar

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

  • Custom User Avatar

    Hmm weird. Post code and I'll check for you.

  • Custom User Avatar

    The tests are not working, they give back this error: ': undefined method length' for 3:Fixnum (NoMethodError). When I changed the length method for something else, like the count method it spat this out instead ': undefined method count' for 3:Fixnum (NoMethodError), so it seems to me there is some tests that are not functioning. I cannot do anything about it because I cannot pass it. My code works perfectly with the test cases - and others - on my own computer.

  • Custom User Avatar

    I had this exact same problem! I hope it gets fixed soon.

  • Custom User Avatar

    I'm not 100% sure but there seems to be a mistake. I get this error: Expected: "JKD WBIRAQKF YE WV", instead got: "JKD WBIRAQKF YE WV". How can the expected be the same as the input?? Doesn't this mean the code passed the test??

  • Custom User Avatar

    This is the issue I'm having: square_digits': undefined method digits' for 3212:Fixnum (NoMethodError)
    from `
    '

    The code I have runs fine on my computer, but not with this. I'm wondering if there's an issue with the version number as Integer#Digits came with the lastest verion of ruby.