simple 9 lines python code

  • 0

    simple 9 lines python code. if you have any questions. i'd love to discuss in comment section.

    class Solution(object):
        def replaceWords(self, dict, sentence):
            dict.sort(key = len)
            for i in range (len(dict)-1,-1,-1):
                for j in range (len(sentenceList)):
                    if dict[i]==sentenceList[j][:len(dict[i])]:
            return " ".join(sentenceList)

Log in to reply

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