Variation Of Edit Distance: Longest String Path


  • 0
    I

    Given an array of strings, find longest path that consists of strings, which are either inserted or removed with only a character at a time. Such as ABCD, ACD, AD, D, which is length of 4.


  • 0

    One solution I can think of is first implement a helper function from One Edit Distance, then for each word in the input array run BFS, the edit distance between the BFS levels is one, what we need to do is to find the longest level.

    Maybe there is another better and faster solution.


Log in to reply
 

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