*Leetcode 763. Partition Labels
Posted Z-Pilgrim
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了*Leetcode 763. Partition Labels相关的知识,希望对你有一定的参考价值。
https://leetcode.com/problems/partition-labels/description/
const int SIZE = 256;
class Solution
public:
bool judge( int cnt[], int hash[] )
// bool ret = true;
for (int i = 0; i < SIZE; i++)
if (hash[i] == cnt[i] || !hash[i])continue;
return false;
return true;
vector<int> partitionLabels(string s)
int mem[SIZE] = 0, hash[SIZE] = 0;
vector<int> ret;
int cnt = 0;
for (auto c : s) mem[c] ++;
for (auto c : s)
cnt ++;
hash[c] ++;
if (judge(mem, hash))
ret.push_back(cnt);
cnt = 0;
return ret;
;
以上是关于*Leetcode 763. Partition Labels的主要内容,如果未能解决你的问题,请参考以下文章
[LeetCode] 763. Partition Labels
leetcode 763 .Partition Labels 题解
Leetcode 763. Partition Labels