1639.
破防 大家都去跨年开趴了吗
这题竟然都没人发
hard难得好写的dp欸==
先算frequency
然后dp一个一个推
开2d的话j就不用倒著计算了
记得要mod
using ll = long long;
class Solution {
public:
ll mod = 1e9 + 7;
int numWays(vector<string>& words, string target) {
int len = words[0].length();
int tlen = target.length();
vector<vector<ll>> ch(len, vector<ll>(26, 0));
for(int i = 0; i < len; i++){
for(auto& s: words){
ch[i][s[i]-'a']++;
}
}
ll res = 0;
vector<ll> dp(tlen, 0);
for(int i = 0; i < len; i++){
for(int j = min(i, tlen-1); j > 0; j