- 5

Plz explain me this code?

class Solution(object): def longestCommonPrefix(self, strs): result = "" for n in zip(*strs): if len(set(n)) == 1: result += n[0] else: return result return resultWrite a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "".

17th Aug 2021, 2:49 PM
Shahir
Shahir - avatar
1 Odpowiedź
+ 2
Your answer is given below in code👇👇👇 Actually it is long If you like it please give like and follow more for content https://code.sololearn.com/c7vot1F6uQ3K/?ref=app
17th Aug 2021, 5:18 PM
SHASHWAT MANDALI