Ad
  • Custom User Avatar

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

  • Custom User Avatar

    You just linked the general solution page. I think you wanted to link your solution instead.

    Your solution includes multiple loops, just not by yourself but by called functions. includes(), indexOf(), slice() and string concatenation all loop over the strings again and again and also create new string objects every time. Since you call them in a loop your solution is O(n²) while this solution loops over each string exactly once and once over the stack, which contains at most 26 elements.

  • Custom User Avatar

    Leave it, maybe it helps someone.

  • Custom User Avatar

    Your task is to return the first longest string

    Two strings are the longest: "folingtrashy" and "abcdefuvwxyz".
    The first that came is "folingtrashy" so 
    longest_consec(strarr, 2) should return "folingtrashy".
    

    It's explained in the description.

  • Default User Avatar

    A person of principles (+1 for not using eval ^^)