C - Airport Code Editorial by evima

Supplement (Updated 2024-04-20)

Update on 2024-04-20: I had posted an implementation example in Python, but it has been removed due to computational weaknesses in Python’s regular expression library.

In languages that support regular expression libraries, you can easily implement the determination of whether string \(T\) is a subsequence of string \(S\). For example, to determine if NRT is a subsequence of string \(S\), it is equivalent to checking if the pattern N.*R.*T appears in \(S\).

Additionally, if you append X to the given \(S\), you can ignore the second of the two methods mentioned in the problem statement.

Sample Implementation (Python):

posted:
last update: