Problem Submissions Solution

Alien Dictionary

Difficulty: Hard

Acceptance: %

Points: 40.00

You are given a sorted dictionary of an alien language containing several words (dict) and k starting alphabets of the standard dictionary. Your task is to determine the order of characters in the alien language based on the given words. If no valid ordering of characters is possible, return an empty string.

Note: Multiple valid orders may exist for a given test case. The output will be considered correct if the returned order satisfies the conditions, otherwise, the output will be "false."

Topics

Companies

Articles

Examples:

Expected Time Complexity: O(n * |s| + k)

ExpectedAuxiliary Space: O(k)

Constraints:
  • 1 <= dict.size() <= 10^4
  • 1 <= k <= 26
  • 1 <= Length of words <= 50
Companies:
Amazon Microsoft Walmart Google Flipkart
Topics:
String
Locked Content
Access Restricted: Please Login to access the code editor and test cases.