Connection Status:
Competition Arena > IdentifyingWood
SRM 635 · 2014-08-25 · by Xellos0 · Brute Force, Simple Search, Iteration
Class Name: IdentifyingWood
Return Type: String
Method Name: check
Arg Types: (string, string)
Problem Statement

Problem Statement

We call a pair of Strings (s, t) "wood" if t is contained in s as a subsequence. (See Notes for a formal definition.)


Given Strings s and t, return the String "Yep, it's wood." (quotes for clarity) if the pair (s, t) is wood and "Nope." otherwise.

Notes

  • String t is contained in string s as a subsequence if we can obtain t by removing zero or more (not necessarily consecutive) characters from s.

Constraints

  • s and t will consist only of lowercase English letters.
  • s and t will each be between 1 and 10 characters long, inclusive.
Examples
0)
"absdefgh"
"asdf"
Returns: "Yep, it's wood."
1)
"oxoxoxox"
"ooxxoo"
Returns: "Nope."
2)
"oxoxoxox"
"xxx"
Returns: "Yep, it's wood."
3)
"qwerty"
"qwerty"
Returns: "Yep, it's wood."
4)
"string"
"longstring"
Returns: "Nope."

Submissions are judged against all 80 archived test cases, of which 5 are shown here. Case numbers match the judge’s.

Coding Area

Language: C++17 · define a public class IdentifyingWood with a public method string check(string s, string t) · 80 test cases · 2 s / 256 MB per case

Submitting as anonymous