Question: IN JAVA!!!! Write a method that returns the longest common prefix between a phrase A and a phrase B. If the two phrases do not
IN JAVA!!!!
Write a method that returns the longest common prefix between a phrase A and a phrase B. If the two phrases do not share a common prefix, return the empty string no prefix. Your method should either take two strings or two char arrays as arguments (A, B) and return a string.
Test your method in the main with these three pairings.
Example
A: snowball
B: snowcone
Return: snow
A: river
B: rover
Return: r
A: monday
B: tuesday
Return: no prefix
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
