摘要:
class Solution { public: void SplitString(const string& s, vector& v, const string& c) { string::size_type pos1, pos2; pos2 = s.find(c); pos1 = 0; while (strin...
阅读全文
posted @ 2018-09-27 22:40
Sempron2800+
阅读(109)
推荐(0)
编辑
摘要:
vector shortestToChar(string S, char C) { vector V; const int N = 10001; int AYC[N]; int countC = 0; for (int i = 0; i < S.size(); i++) { if (S[i] == C) { ...
阅读全文
posted @ 2018-09-27 22:14
Sempron2800+
阅读(84)
推荐(0)
编辑
摘要:
class Solution { public: vector v1; vector v2; void GetLeaf(TreeNode* tree, int type) { if (tree->left != NULL || tree->right != NULL) { if (tree->left != ...
阅读全文
posted @ 2018-09-27 20:41
Sempron2800+
阅读(84)
推荐(0)
编辑
摘要:
class Solution { public: TreeNode* searchBST(TreeNode* root, int val) { if (root == NULL) { return nullptr; } if (root->val == val) { ...
阅读全文
posted @ 2018-09-27 18:56
Sempron2800+
阅读(122)
推荐(0)
编辑
摘要:
vector numberOfLines(vector& widths, string S) { map MAP; MAP.insert(make_pair('a', widths[0])); MAP.insert(make_pair('b', widths[1])); MAP.insert(make_pair('c', widths[2])); MAP....
阅读全文
posted @ 2018-09-27 18:46
Sempron2800+
阅读(197)
推荐(0)
编辑
摘要:
class Solution { public: ListNode* middleNode(ListNode* head) { if (head == NULL) { return nullptr; } vector List; List.push_back(head); ...
阅读全文
posted @ 2018-09-27 18:26
Sempron2800+
阅读(110)
推荐(0)
编辑
摘要:
int smallestRangeI(vector& A, int K) { int min = INT_MAX; int max = INT_MIN; for (auto a : A) { if (min > a) { min = a; } if (max 2 * K) ...
阅读全文
posted @ 2018-09-27 18:09
Sempron2800+
阅读(90)
推荐(0)
编辑