摘要:
1 class Solution { 2 public: 3 vector > partition(string s) { 4 int len = s.length(); 5 vector >* memo = new vector >[len + 1]; 6 vector > ret; 7 8 for (int i=1; i >& cur = memo[i];11 12 for (int j=i-1; j>=0; j--) {13 ... 阅读全文
摘要:
class Solution {public: int removeDuplicates(int A[], int n) { if (n == 0) return 0; int *rpos = A, *wpos = A + 1, *end = A + n; int cur; int pre = *(rpos++); while (rpos != end) { cur = *(rpos++); if (pre == cur) continue; *(wpos++) = pre = cur; } retur... 阅读全文