3297. Count Substrings That Can Be Rearranged to Contain a String I
You are given two strings
word1andword2.A string
xis called valid ifxcan be rearranged to haveword2as a prefix.Return the total number of valid substrings of
word1.
3297. Count Substrings That Can Be Rearranged to Contain a String I
You are given two strings
word1andword2.A string
xis called valid ifxcan be rearranged to haveword2as a prefix.Return the total number of valid substrings of
word1.
3296. Minimum Number of Seconds to Make Mountain Height Zero
You are given an integer
mountainHeightdenoting the height of a mountain.
You are also given an integer arrayworkerTimesrepresenting the work time of workers in seconds.
The workers work simultaneously to reduce the height of the mountain. For workeri:
To decrease the mountain’s height by
x, it takesworkerTimes[i] + workerTimes[i] * 2 + ... + workerTimes[i] * xseconds. For example:To reduce the height of the mountain by 1, it takes
workerTimes[i]seconds.- To reduce the height of the mountain by 2, it takes
workerTimes[i] + workerTimes[i] * 2seconds, and so on.Return an integer representing the minimum number of seconds required for the workers to make the height of the mountain 0.
You are given an array of strings
messageand an array of stringsbannedWords.An array of words is considered spam if there are at least two words in it that exactly match any word in
bannedWords.Return
trueif the arraymessageis spam, andfalseotherwise.