forked from luliyucoordinate/Leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0940.cpp
More file actions
25 lines (23 loc) · 656 Bytes
/
0940.cpp
File metadata and controls
25 lines (23 loc) · 656 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
static int x = []() {std::ios::sync_with_stdio(false); cin.tie(0); return 0; }();
class Solution
{
public:
int distinctSubseqII(string S)
{
int ends[26] = {}, mod = 1e9 + 7;
auto lambda = [&](int s, int i) { return (s + i) % mod; };
for (auto c : S)
ends[c - 97] = accumulate(begin(ends), end(ends), 1, lambda);
return accumulate(begin(ends), end(ends), 0, lambda);
}
};
int main()
{
vector<vector<int>> points = {{1,1},{1,3},{3,1},{3,3},{4,1},{4,3}};
cout << Solution().minAreaRect(points);
return 0;
}