14 Longest Common Prefix LeetCode (Google Interview Question) JavaScript

preview_player
Показать описание
14 Longest Common Prefix LeetCode (Google Interview Question) JavaScript

"Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string ."

Final code:

Gear I use:
Рекомендации по теме
Комментарии
Автор

i am from india ... i love your explaination.... i learn new onr thing from you.. thanks Guru

sundaranv
Автор

Great solution! Thank you for the explanation!

mikemagruder
Автор

IN PYTHON
s=["flow", "flew", "flower"]
k=s[0]
flag=0
a=""
for x in range(len(k)):
for j in s[1:]:
if k[x]!=j[x]:
flag=1
else:
a=""+k[x]
if flag==1:
break
else:
print(a, end="")

aadhi_dinesh
Автор

Are there any resources out there that explain each line of code step by step, for really really dumb people? 🤣🤣 besides this video of course

InspireeeVideos