Retired

Find Pattern in String (retired)

Description:

Your task is to determine, whether a string contains a given pattern or not.
The pattern's letters in a string can be alternated by any number of other letters and/or duplicated any number
of times. The string is valid if all letters from the pattern are present, and their sequence is preserved.
Examples:

Pattern: codewars
String: cccxxfoovbfffooddwqerdddeeuwrwrreqwwbnmjwwayaqrrarrs

cccxxfoovbfffooddwqerdddeeuwrwrreqwwbnmjwwayaqrrarrs
VALID

String: cccxxfeevbfffooddwqordddoouwrwrroqwwbnmjwwayaqrrarrs

cccxxfeevbfffooddwqordddoouwrwrroqwwbnmjwwayaqrrarrs
INVALID, wrong sequence

String: cooddwwwwwwaaaaarrrrsss
INVALID, 'e' is missing.

Write a function pattern_in_string, which takes pattern and string as arguments and returns 'FOUND'
if the patern was found, or 'NOT FOUND' otherwise. Apart from the sample test cases, you will not know
neither pattern nor string, so you need to come up with some general algorithm. Strings in performance tests
are 60k - 240k letters long, so it must be quite efficient, too.
Length of a pattern can be 3 - 10, and letters may repeat.
Both strings and patterns will contain only lower case English letters.
HAVE FUN!

Fundamentals
Strings
Data Types

More By Author:

Check out these other kata created by teoriachaosu

Stats:

CreatedJul 5, 2020
Warriors Trained19
Total Skips0
Total Code Submissions289
Total Times Completed13
Python Completions13
Total Stars0
% of votes with a positive feedback rating29% of 12
Total "Very Satisfied" Votes2
Total "Somewhat Satisfied" Votes3
Total "Not Satisfied" Votes7
Total Rank Assessments12
Average Assessed Rank
7 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • teoriachaosu Avatar
Ad