#100DaysOfCode - Day 69: Finding the longest common prefix in an array of strings

#100DaysOfCode – Day 69 String Manipulation Task: Find the longest common prefix among an array of strings. Example: Input: ["flower", "flow", "flight"] → Output: "fl" My Approach: Took the first string as the initial prefix. Iterated through each subsequent string. Trimmed the prefix until it matched the start of each word. Time Complexity: O(N × M) (where N = number of strings, M = average string length) String problems are all about observation understanding patterns, boundaries, and when to stop iterating. A few lines of logic can make a big difference in performance and clarity! #takeUforward #100DaysOfCode #Java #LeetCode #ProblemSolving #StringManipulation #CodingJourney #GeeksForGeeks #CodeNewbie #DataStructures #Algorithms

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories