Question: Write a program in c# to find Longest Common Prefix in an array of Strings. If no common prefx is found, print NONE Input: grape

Write a program in c# to find Longest Common Prefix in an array of Strings.

If no common prefx is found, print NONE

Input: grape grace grab grand

Output: gra

Explanation: gra is the common prefx for all the elements present in the Array

Input: apple ape april

Output: ap Explanation: ap is the common prefix for all the elements present in the Array

Step by Step Solution

3.48 Rating (145 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

In order to solve this well follow the steps below 1 Sort the array This will bring the strings with ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!