Pergunta de entrevista da empresa Freshworks

you are given a string array. print the longest common prefix in all the elements of a string array. The array size is not fixed. your answer should work for array containing n number of elements.