Given a dictionary of words where each word follows CamelCase notation, print all words in the dictionary that match with a given pattern consisting of uppercase characters only.
CamelCase is the practice of writing compound words or phrases such that each word or abbreviation begins with a capital letter. Common examples include: “PowerPoint” and “WikiPedia”, “GeeksForGeeks”, “CodeBlocks”, etc.
Input: N=8 Dictionary=["Hi","Hello","HelloWorld", "HiTech","HiGeek","HiTechWorld", "HiTechCity","HiTechLab"] Pattern="HA" Output: Explanation: Since the pattern matches none of the words of the string,the output is empty.
Input: N=3 Dictionary=["WelcomeGeek", "WelcomeToGeeksForGeeks","GeeksForGeeks"] Pattern="WTG" Output: WelcomeToGeeksForGeeks Explanation: Since only WelcomeToGeeksForGeeks matches the pattern, it is the only answer.
You don't need to read input or print anything. Your Task is to complete the function CamelCase() which takes an integer N, a Vector of strings Dictionary and a string Pattern and returns the strings in the dictionary that match with the pattern.
Expected Time Complexity:O(N*|S|)
S=Longest string in Dictionary
Expected Auxillary Space:O(26*N)
S is the longest word in Dictionary.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes