Ad
  • Custom User Avatar

    Can someone explain me how it works please?
    it seems to be different related to other solutions!

    Edit:
    I think that just understand it! I give it a try and if i' ve mistaken something, correct me..

    it takes the string, calling replace(regexp, replacerFunction) and for every character ("/./g") it's calling the fuction. Function just uses the string "CGAT" (contains all possible letters of DNA) and the string "GCTA" (contains the opposite of the 1st string!). The method "indexOf()" practically returns the opposite character we need.

    Genious solution in my opinion and completely out of the box!

  • Custom User Avatar

    How does this work exactly? Could you explain it to me please?

  • Custom User Avatar

    No mistakes, probably, null inputs, no. Tests always generate a string for input.

  • Custom User Avatar

    thanks for answering akar-0.
    So, i have to deal with null inputs and with inputs that have no "mistakes"(so the length will be zero). more studying is the solution i guess..

  • Custom User Avatar

    null is not a string. And has not length. And no given string is null. That's the actual problem.

  • Custom User Avatar

    I get this error at Random tests:
    "TypeError: Cannot read property 'length' of null"

    Someone with the same problem? I undestand that the given string is null, am i wright?