Type an input and write what you think is the output . Each problem is converted to Web Assembly, so any possible input will show the corresponding output. Only correct predictions count.
Locked until you have predicted 3 outputs correctly.
| 1 | int solution(const string& s, const string& t) { |
| 2 | |
| 3 | int m = s.size(); |
| 4 | int n = t.size(); |
| 5 | |
| 6 | vector<long long> ways(n + 1, 0); |
| 7 | ways[0] = 1; |
| 8 | |
| 9 | for (int i = 1; i <= m; i++) { |
| 10 | for (int j = n; j >= 1; j--) { |
| 11 | |
| 12 | if (s[i - 1] == t[j - 1]) { |
| 13 | ways[j] += ways[j - 1]; |
| 14 | } |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | return ways[n]; |
| 19 | } |
Names have been stripped. The signature is the only clue you get for free. Compiled as C++20 with the standard headers and using namespace std; already in scope.