#14 Longest Common Prefix | Ultimate Leetcode Challenge

Опубликовано: 01 Март 2026
на канале: Coders by Yutish
109
4

Longest Common Prefix

Subscribe to my channel ---    / @codersbyyutish3249  

Link to Ultimate Leetcode Challenge Playlist ---    • Ultimate Leetcode Challenge  

Also checkout my playlist on Coding Interview Problems ---   • Coding Interview Problems for Beginners  

-------------------------------------------------------------------------------------------------------------------


Problem Statement - 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 "".

Example 1:

Input: strs = ["flower","flow","flight"]
Output: "fl"

Example 2:

Input: strs = ["dog","racecar","car"]
Output: ""
Explanation: There is no common prefix among the input strings.

Constraints:

strs.length = [1, 200]
strs[i].length = [0, 200]
strs[i] consists of only lower-case English letters.


Link to the problem --- https://leetcode.com/problems/longest...


#timeenthusiast​​ #ultimateleetcodechallenge​​ #leetcodeinhindi​