摘要:
题目 很简单的字符串处理题 class Solution { public: map<string, char> m; map<char, string> m2; bool wordPattern(string pattern, string str) { string s = ""; int i, 阅读全文
摘要:
``` #include #include #include #include #include #include #include #include #include #include using namespace std; struct Node { int val; Node* left; Node* right; Node(int value) { this->val = value; 阅读全文
摘要:
``` #include #include #include #include #include #include #include #include #include #include using namespace std; struct ListNode { int value; ListNode* next; ListNode(int value) { this->value = valu 阅读全文
摘要:
"题目" 一道好题目。 发现数组里重复的数字是什么,不借助额外的数据结构。数组里的数字范围是1 n,数组的个数是n+1,所以一定存在重复的情况。重复的个数至少是1。如果题目说只有一个数字是重复的,那么就是另一道题目了。 首先根据这个数组的特性,按照数组的下标把从第0个数开始,把数组变成一个链表,链表 阅读全文
摘要:
"题目" 再维护一个iterator ,用来实现peek 阅读全文
摘要:
"题目" 题意:把一个数组里的所有0放到数组末尾,数组里其他数字的顺序不要变 题解: 可以利用冒泡的思想,写一个O(n^2)的方法。 更高效的是,从左往右计算每个非0数字在最后结果中的位置,就可以了。O(n) 阅读全文
摘要:
"题目" 题解: 如标题,其实就是暴搜啦 阅读全文