Clarification about prefix problem. "abc" and "ab"


  • 1

    One thing that really bothers some problem solver is what the heck is going on when one input string is the prefix of another input string.
    e.g. 1 "abc" "ab" expected answer ==> ""
    e.g. 2 "ab" "abc" expected answer ==> "abc"
    So, what is the logic here?
    The fact is that, in a real dictionary the word "good" always shows before the word "goods" right? and "cook" always shows before "cooks".
    So, there is a "rule" or "assumption" untold to us is that if one string is another string's prefix, the "prefix string" must be ahead of the other one to make it a valid order, ortherwise return "".
    I hope the description of the problem should be modified accordingly.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.