Non-Leetcode Questions: Common String in Lists
Given a List of List of String, find the common String in all Lists, output them in sorted order. (could contain duplicates)Naive Way:Need to consider case [[a,a,a],[a,a],[a,a,b]] outputs [a,a]. Use a HashMap as pattern, go through the lists, for each list, match it with the pattern, update the pattern, what left in the pattern is common string.
Read full article from Non-Leetcode Questions: Common String in Lists
No comments:
Post a Comment