Tap here to switch tabs
Problem
Submissions

Problem: Total Characters in String After Transformations II

med
30 min
Try to solve the Total Characters in String After Transformations II problem.

Statement

You are given a string s, an integer t representing the number of transformations to apply, and an integer array nums of length 2626.

In a single transformation, each character c in the string is replaced simultaneously with the next nums[c - 'a'] consecutive lowercase English letters in cyclical alphabetical order (where 'a' immediately follows 'z'). For example, if nums[25] equals 22, then 'z' is replaced by the characters 'a' and 'b'.

Return the total length of the string after performing the transformation exactly t times. Since the result may be very large, return it modulo 109+710^9 + 7.

Constraints:

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

  • s consists only of lowercase English letters.

  • 1≤1 \leq t ≤109\leq 10^9

  • nums.length =26= 26

  • 1≤1 \leq nums[i] ≤25\leq 25

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Total Characters in String After Transformations II

med
30 min
Try to solve the Total Characters in String After Transformations II problem.

Statement

You are given a string s, an integer t representing the number of transformations to apply, and an integer array nums of length 2626.

In a single transformation, each character c in the string is replaced simultaneously with the next nums[c - 'a'] consecutive lowercase English letters in cyclical alphabetical order (where 'a' immediately follows 'z'). For example, if nums[25] equals 22, then 'z' is replaced by the characters 'a' and 'b'.

Return the total length of the string after performing the transformation exactly t times. Since the result may be very large, return it modulo 109+710^9 + 7.

Constraints:

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

  • s consists only of lowercase English letters.

  • 1≤1 \leq t ≤109\leq 10^9

  • nums.length =26= 26

  • 1≤1 \leq nums[i] ≤25\leq 25