Ad
  • Default User Avatar

    Invert the bits from index i to index j. If the given number is '1010' and it said ['I',2,4] then you would 'flip' (change from 1 to 0 or vice versa) the bits from index 2 to 4 and get '1101' (indexes start at 1 and not 0 for some reason).

  • Default User Avatar
  • Default User Avatar

    @ Chrono79 No it isn't, I tried the sample tests and the code worked just fine, then I go to the final tests, and it says that you cannot read property length of array. I checked my spelling, it wasn't wrong. It doesn't happen in the sample tests, none of that gibberrish saying I was not allowed to pick the property length of array, which of course should be a valid property of an array. I even tried to include 'if (array.isArray())', which should have no problem with any type of data type, and still it said that cannot read isArray() of item array. Maybe it's a problem with browsers. Please actually fix this instead of blaming the problem on us.
    Edit: if you wanted to blame the problem on me removing items from the array, I didn't remove any items from array.

  • Default User Avatar

    What does this bit mean?

    ['I', i, j] : Which means invert the bit from i to j (inclusive).

  • Default User Avatar

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

  • Custom User Avatar

    Same as above, check your code. The error message shows what the compiler finds wrong, but the problem is indeed in your code. I have just tested it and it worked for me.

  • Custom User Avatar

    It's a problem with your code, you have something (parentheses or curly braces) without closing it. Fix it.

    This code produces a similar error message:

    function array_diff(a, b) { // missing closing curly brace
    
  • Default User Avatar

    For Javascript
    it says unexpected token ) at line 31: });
    My code plus the testcode only had 29 lines. Please fix.

  • Default User Avatar

    For some reason it refuses to test, it said Unexpected token }); (The token was the ')' ). I searched my whole code for 10 times, and there was no such thing as '});'. I even tried to alter the testing code, it didn't work. Pls fix this