Tap here to switch tabs
Problem
Submissions

Problem: Make String a Subsequence Using Cyclic Increments

med
30 min
Try to solve the Make String a Subsequence Using Cyclic Increments problem.

Statement

You are given two strings, str1 and str2.

In a single operation, you can select any set of indices in str1 and cyclically increment the character at each chosen index. Incrementing a character cyclically means replacing 'a' with 'b', 'b' with 'c', and so forth, with 'z' wrapping around to become 'a'.

Return true if it is possible to make str2 a subsequence of str1 by applying this operation at most 11 time, and false otherwise.

Note: A subsequence of a string is a new string generated from the original string by deleting zero or more characters without changing the relative order of the remaining characters.

Constraints:

  • 1≤1 \leq str1.length ≤105\leq 10^5

  • 1≤1 \leq str2.length ≤105\leq 10^5

  • str1 and str2 consist of only lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Make String a Subsequence Using Cyclic Increments

med
30 min
Try to solve the Make String a Subsequence Using Cyclic Increments problem.

Statement

You are given two strings, str1 and str2.

In a single operation, you can select any set of indices in str1 and cyclically increment the character at each chosen index. Incrementing a character cyclically means replacing 'a' with 'b', 'b' with 'c', and so forth, with 'z' wrapping around to become 'a'.

Return true if it is possible to make str2 a subsequence of str1 by applying this operation at most 11 time, and false otherwise.

Note: A subsequence of a string is a new string generated from the original string by deleting zero or more characters without changing the relative order of the remaining characters.

Constraints:

  • 1≤1 \leq str1.length ≤105\leq 10^5

  • 1≤1 \leq str2.length ≤105\leq 10^5

  • str1 and str2 consist of only lowercase English letters.