Ad
  • Default User Avatar

    return a sorted array r in lexicographical order of the strings of a1 which are substrings of strings of a2

    Did you read the description?

  • Custom User Avatar

    Typesript:
    expected [ 'live', 'strong', 'arp' ] to deeply equal [ 'arp', 'live', 'strong' ]
    Why order is important? How you give, so it return.

  • Default User Avatar

    Hi - your current approach is basically a brute force search (it is trying all possible combinations of subarrays effectively), so it will indeed get the correct solution.

    However, the large random tests involve lists with up to 50,000 elements - if you perform the brute force approach you will therefore need to perform 50,000 ** 2 operations approximately, for each test, which is a huge number.

    That's why you are timing out; your solution is correct, but inefficient.

    To answer your question for advice about this; you cannot really speed up your current brute force approach - instead, you need to reduce the time complexity from O(n^2) to something less than O(n^2).

  • Default User Avatar

    I have the same problem as @eshis with python, everything seems to work excluding last random test.

  • Default User Avatar

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

  • Custom User Avatar
    1. Make showing array to log (For example C#: System.Console.WriteLine(string.Join(", ", arr)));
    2. Copy
    3. Try again
  • Default User Avatar

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

  • Default User Avatar

    Thanks for review + Github update :+1:

  • Custom User Avatar

    Thanks! It's working!

  • Custom User Avatar

    using System.Collections.Generic; maybe?

  • Custom User Avatar

    What are "using" have I missed? I tried: System, System.Linq, NUnit.Framework. But that didn't solve my problem.

  • Custom User Avatar
  • Custom User Avatar

    Hello! Have some problem in C# language:
    error CS0246: The type or namespace name 'List<>' could not be found (are you missing a using directive or an assembly reference?)