7 kyu

Merge overlapping strings

829 of 1,619syeo66
Description
Loading description...
Algorithms
Strings
  • Please sign in or sign up to leave a comment.
  • mehrad.nrzz Avatar

    This comment has been hidden.

  • LinkFalcon0921 Avatar

    This comment has been hidden.

  • RokuMeow Avatar

    2 день решаю, не прохожу всего 6 тестов. И често, я как то не уверен, что эта ката подходит для 7 кю, мне кажется она сложней.

  • o2001 Avatar
  • estem8 Avatar
  • sidwick Avatar

    Nice Kata! Took me two hours to solve this :)

  • ASchreiber Avatar

    Please clarify the description: "... when they are an exact match, and appending the second string to the first if they are not. NOTE: The strings may be empty."

    Because these cases are not really clear from the given examples. Thank you!

  • mauro-1 Avatar
  • Unnamed Avatar

    The "more test" tests in JS and TS use assert instead of assert.equal and thus don't really work.

  • Unnamed Avatar

    There are 2 incorrect JS solutions that pass all current tests, but fail to handle the following edge cases:

    mergeStrings('', 'aaa'), 'aaa'
    mergeStrings('abcd', 'dabcd'), 'abcdabcd'
    

    The tests should be added to all languages (and perhaps other tests with empty strings too). UPD: and mergeStrings('abaa', 'aba'), 'abaaba'

  • JohanWiltink Avatar
  • rowcased Avatar

    Pretty sure I've seen this task before, probably by myjinxin2015. I'm surprised no-one has come up with a duplicate. I've tried searching but can't seem to get the right keywords.

  • JohanWiltink Avatar

    Missing fixed test cases mergeStrings('xabc', 'ab') and mergeStrings('abc', 'ab').

    At least one invalid solution has several bugs, which are not caught.

  • Voile Avatar

    Sometimes (very rarely) random tests generate wrong test cases, e.g:

    a = mX52t1wANfftrxRd2Hw
    overlap = w
    b = wiT
    
    expected 'mX52t1wANfftrxRd2HwwiT' to equal 'mX52t1wANfftrxRd2HwwwiT'