Ad
  • Custom User Avatar

    I'm such a dumb....

    thks !

  • Custom User Avatar
    Bananas from Bahamas
                 Bah  as
    Bananas from    am
    
  • 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

    True that, but while elegancy is rather subjective, I am not so sure it helps efficiency-wise to enumerate and get TWO values instead of one.

    It is also true that efficiency-wise I could have used and xrange, but I keep forgetting that, being used to Pyhon 3 ;)

  • 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).