Java-Questions-and-Solutions icon indicating copy to clipboard operation
Java-Questions-and-Solutions copied to clipboard

longest common substring between 2 string

Open iamsunil25 opened this issue 3 years ago • 7 comments

Enter your question -

Q. length of longest common substring between 2 string in java? input = 1. "sunil " 2. "sunita" output= 4 (suni)

Enter link to the question(if question belongs to any online platform) -

NA

Tags for the question(eg - Array, Basic, Stack, etc.) -

String

iamsunil25 avatar Oct 05 '21 12:10 iamsunil25

@SarthakKeshari assign me this issue.

iamsunil25 avatar Oct 05 '21 12:10 iamsunil25

@iamsunil25, I wish to reform this question and will put it under admin-choice

SarthakKeshari avatar Oct 05 '21 13:10 SarthakKeshari

@iamsunil25, I wish to reform this question and will put it under admin-choice

okk

iamsunil25 avatar Oct 05 '21 14:10 iamsunil25

@iamsunil25, I wish to reform this question and will put it under admin-choice

@iamsunil25, I wish to correct myself instead of admin-choice it would be appreciation tag.

SarthakKeshari avatar Oct 05 '21 15:10 SarthakKeshari

@iamsunil25, Updated question

Enter your question -

Q. length of longest common substring between 2 strings permutations in java?

NOTE - Lowercase and Uppercase alphabets will be treated differently Sample Test case 1 Input - cat tackle

Output - 3

Explaination - Permutations of "cat" are - cat, act, tca, cta, atc, tac Permutations of "tackle" are - tackle, atckle, ctakle, tcakle, actkle, catkle, etc.

If we see: 1st permutation of "cat" - cat 6th permutation of "tackle" - catkle We can see longest common substring is "cat" and is of "3" letters

Sample Test case 2 Input - cat taCkle

Output - 2

Explaination - Permutations of "cat" are - cat, act, tca, cta, atc, tac Permutations of "tackle" are - taCkle, atCkle, Ctakle, tCakle, aCtkle, Catkle, etc.

If we see: 1st permutation of "cat" - cat 6th permutation of "tackle" - Catkle We can see longest common substring is "at" and is of "2" letters. Since 'c' and 'C' will be treated differently.

Enter link to the question(if question belongs to any online platform) -

NA

Tags for the question(eg - Array, Basic, Stack, etc.) -

String

SarthakKeshari avatar Oct 05 '21 17:10 SarthakKeshari

@iamsunil25, Kindly add your solution to "String Handling" folder. Also mention "(admin-choice)" word in your filename and PR title. Deadline - 06/10/2021

SarthakKeshari avatar Oct 05 '21 18:10 SarthakKeshari

Please assign this issue to me.

GayatriChaudhari1281 avatar Oct 31 '21 09:10 GayatriChaudhari1281