3307. Find the K-th Character in String Game II
Alice and Bob are playing a game. Initially, Alice has a string
word = "a"
.You are given a positive integer
k
. You are also given an integer arrayoperations
, whereoperations[i]
represents the type of theith
operation.Now Bob will ask Alice to perform all operations in sequence:
- If
operations[i] == 0
, append a copy ofword
to itself.- If
operations[i] == 1
, generate a new string by changing each character inword
to its next character in the English alphabet, and append it to the originalword
. For example, performing the operation on"c"
generates"cd"
and performing the operation on"zb"
generates"zbac"
.Return the value of the
kth
character inword
after performing all the operations.Note that the character
'z'
can be changed to'a'
in the second type of operation.
3306. Count of Substrings Containing Every Vowel and K Consonants II
You are given a string
word
and a non-negative integerk
.Return the total number of substrings of
word
that contain every vowel ('a'
,'e'
,'i'
,'o'
, and'u'
) at least once and exactlyk
consonants.
3305. Count of Substrings Containing Every Vowel and K Consonants I
You are given a string
word
and a non-negative integerk
.Return the total number of substrings of
word
that contain every vowel ('a'
,'e'
,'i'
,'o'
, and'u'
) at least once and exactlyk
consonants.
3304. Find the K-th Character in String Game I
Alice and Bob are playing a game. Initially, Alice has a string
word = "a"
.You are given a positive integer
k
.Now Bob will ask Alice to perform the following operation forever:
- Generate a new string by changing each character in
word
to its next character in the English alphabet, and append it to the originalword
.For example, performing the operation on
"c"
generates"cd"
and performing the operation on"zb"
generates"zbac"
.Return the value of the
kth
character inword
, after enough operations have been done forword
to have at leastk
characters.Note that the character
'z'
can be changed to'a'
in the operation.
3303. Find the Occurrence of First Almost Equal Substring
You are given two strings
s
andpattern
.A string
x
is called almost equal toy
if you can change at most one character inx
to make it identical toy
.Return the smallest starting index of a substring in
s
that is almost equal topattern
. If no such index exists, return-1
.A substring is a contiguous non-empty sequence of characters within a string.
3302. Find the Lexicographically Smallest Valid Sequence
You are given two strings
word1
andword2
.A string
x
is called almost equal toy
if you can change at most one character inx
to make it identical toy
.A sequence of indices
seq
is called valid if:
- The indices are sorted in ascending order.
- Concatenating the characters at these indices in
word1
in the same order results in a string that is almost equal toword2
.Return an array of size
word2.length
representing the lexicographically smallest valid sequence of indices. If no such sequence of indices exists, return an empty array.Note that the answer must represent the lexicographically smallest array, not the corresponding string formed by those indices.
3301. Maximize the Total Height of Unique Towers
You are given an array
maximumHeight
, wheremaximumHeight[i]
denotes the maximum height theith
tower can be assigned.Your task is to assign a height to each tower so that:
- The height of the
ith
tower is a positive integer and does not exceedmaximumHeight[i]
.- No two towers have the same height.
Return the maximum possible total sum of the tower heights. If it’s not possible to assign heights, return
-1
.
3300. Minimum Element After Replacement With Digit Sum
You are given an integer array
nums
.You replace each element in
nums
with the sum of its digits.Return the minimum element in
nums
after all replacements.