Ad
  • Custom User Avatar

    I'm such a dumb....

    thks !

  • Custom User Avatar

    Hi

    You have a test for submition that might be like this:

    Test.expect(isMerge('Bananas from Bahamas', 'Bahas', 'Bananas from am'));
    

    Here is what I've got when I'm doing this "manually" (args are separated with ><):

    >Bananas from Bahamas<>Bahas<>Bananas from am<
    >ananas from Bahamas<>ahas<>Bananas from am<
    >nanas from Bahamas<>has<>Bananas from am<
    

    So clearly this should be rejected if I understand instruction.

    Can you tell me what I miss ?

    Thks.

  • Custom User Avatar

    Just a remark; instead of:
    for item in range(len(order)):
    element = order[item]
    [...]
    you can use:
    for item, element in enumerate(order):
    [...]

    I think it's more elegant.

  • Custom User Avatar

    I do not think you solution is very elegant because you reparse your list ans for every element on order.

    So your complexity is (in the worst case) something like O(n^2) (exactly it would be n*(n-1)/2).