Ancient Astronaut Theory
You are given a string dictionary, representing a partial lexicographic ordering of ancient astronauts’ dictionary. Given a string s, return whether it’s a lexicographically sorted string according to this ancient astronaut dictionary.
https://binarysearch.com/problems/Ancient-Astronaut-Theory
Examples
Example 1
Input
- dictionary = acb
- s = aaaacccbc
Output
- answer = False
Explanation
This is false because of the last c, which comes after b.
Example 2
Input
- dictionary = acb
- s = aaaa h ccc i bbb
Output
- answer = True
Explanation
The only constraint is that a comes before c which comes before b .
 
       
      
Leave a comment