Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

05 Hashing --> 04 Math Specific Pattern #33

Closed
FazeelUsmani opened this issue Dec 24, 2020 · 0 comments · Fixed by #74
Closed

05 Hashing --> 04 Math Specific Pattern #33

FazeelUsmani opened this issue Dec 24, 2020 · 0 comments · Fixed by #74

Comments

@FazeelUsmani
Copy link
Owner

  1. Match specific pattern
    Easy Accuracy: 51.27% Submissions: 10277 Points: 2
    Given a dictionary of words and a pattern. Every character in the pattern is uniquely mapped to a character in the dictionary. Find all such words in the dictionary that match the given pattern.

Example 1:

Input:
N = 4
dict[] = {abb,abc,xyz,xyy}
pattern = foo
Output: abb xyy
Explanation: xyy and abb have the same
character at index 1 and 2 like the
pattern.
Your Task:
You don't need to read input or print anything. Your task is to complete the function findMatchedWords() which takes an array of strings dict[] consisting of the words in the dictionary and a string, Pattern and returns an array of strings consisting of all the words in the dict[] that match the given Pattern in lexicographical order.

Expected Time Complexity: O(N*K) (where K is the length of the pattern).
Expected Auxiliary Space: O(N).

Constraints:
1 <= N <= 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant