leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
2405.cpp (368B)
0 class Solution {
1 public:
2 int partitionString(string s) {
3 bitset<26> st;
4 int res = 0;
5 for (char c : s) {
6 int n = c - 'a';
7 if (!st[n])
8 st.set(n);
9 else {
10 res++;
11 st.reset();
12 st.set(n);
13 }
14 }
15 return res + 1;
16 }
17 };