Using the programming language Java: Write a function to findthe longest common prefix string amongst an array of strings.
Answer
`Hey,
Note: Brother in case of any queries, just comment inbox I would be very happy to assist all your queries
public class Main {
// A Function to find the string having the
// minimum length and returns that length
public static int findMinLength(String arr[], int n)
{
int min = Integer.MAX_VALUE;
for (int i = 0; i <= (n – 1); i++)
{
if (arr[i].length() < min) {
min = arr[i].length();
}
}
return min;
}
static boolean allContainsPrefix(String arr[], int n,
String str, int start, int end)
{
for (int i = 0; i <= (n
OR
OR