Skip to content

Commit

Permalink
Update Longest Common Prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
JonJagger committed Nov 10, 2022
1 parent 46cf928 commit dbb2b1b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions start-points/Longest_Common_Prefix/readme.txt
@@ -1,27 +1,28 @@

You task is to find the longest common prefix from a set of strings.
You task is to find the length of the longest common prefix from a set of strings.
There are two variations:

Variation 1.
Find the longest common prefix across ALL strings in the set.
Find the length of longest common prefix across ALL strings in the set.
For example:

{ "new", "next" } ==> "ne"
{ "new", "next" } ==> 2

{ "newest", "new", "newly" } ==> "new"
{ "newest", "new", "newly" } ==> 3

{ "pond", "pod", "new", "newest" } ==> ""
{ "pond", "pod", "new", "newest" } ==> 0


Variation 2.
Find the longest common prefix across ANY two or more strings in the set.
Find the length of longest common prefix across ANY two or more strings in the set.
For example:

{ "pond", "newest" } ==> ""
{ "pond", "newest" } ==> 0

{ "new", "night" } ==> "n"
{ "new", "night" } ==> 1

{ "newest", "new", "newly" } ==> "new"
{ "newest", "new", "newly" } ==> 3

{ "pond", "pod", "new", "newest" } ==> 3

{ "pond", "pod", "new", "newest" } ==> "new"

0 comments on commit dbb2b1b

Please sign in to comment.