关键词:
class Solution
public:
vector<int> partitionLabels(string S)
vector<int> last_indx(128, 0);
for(int i = 0; i < S.size(); i++)
last_indx[S[i]] = i;
vector<int> ans;
int start = 0;
int end = 0;
for(int i = 0; i < S.size(); i++)
// cout << "1> i: " << i << " ,end: " << end << endl;
end = max(end, last_indx[S[i]]);
// cout << "2> i: " << i << " ,end: " << end << endl;
if (i == end)
ans.push_back(end - start + 1);
start = end + 1;
return ans;
;
c_cpp^(代码片段)
查看详情
c_cpp最后的片段(代码片段)
查看详情
c_cpp代码信号08(代码片段)
查看详情
c_cpp幽灵示例代码(代码片段)
查看详情
c_cpp幽灵示例代码(代码片段)
查看详情
c_cpp游戏代码注入(代码片段)
查看详情
c_cpp界()(代码片段)
查看详情
c_cpp输入(代码片段)
查看详情
c_cpp分类(代码片段)
查看详情
c_cpp访问(代码片段)
查看详情
c_cpp填()(代码片段)
查看详情
c_cpp阵列(代码片段)
查看详情
c_cpp功能(代码片段)
查看详情
c_cpp包括(代码片段)
查看详情
c_cpp延缓(代码片段)
查看详情
c_cpp冒泡(代码片段)
查看详情
c_cpp向量(代码片段)
查看详情
c_cpp加(代码片段)
查看详情