JZ56 删除链表中重复的结点 Solution 借助栈 123456789101112131415161718192021222324252627282930313233343536373839/*struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) 2021-10-10 algo 链表 nowcoder
JZ55 链表中环的入口结点 Solution 快慢指针 1234567891011121314151617181920212223242526272829/*struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { }} 2021-10-10 algo 链表 nowcoder
JZ54 字符流中第一个不重复的字符 Solution 12345678910111213141516171819class Solution{public: //Insert one char from stringstream void Insert(char ch) { v.push_back(ch); umap[ch]++; } //retur 2021-10-10 algo 字符串 nowcoder
JZ53 表示数值的字符串 Solution 12345678910111213141516171819202122232425262728293031323334353637383940414243class Solution {public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str s 2021-10-10 algo 字符串 nowcoder
JZ52 正则表达式匹配 Solution 123456789101112131415161718192021222324252627class Solution {public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 * @param pattern s 2021-10-10 algo 字符串 nowcoder
JZ51 构建乘积数组 Solution 123456789101112131415161718class Solution {public: vector<int> multiply(const vector<int>& A) { int n = A.size(); vector<int> left(n+1, 1) 2021-10-10 algo nowcoder 数组
JZ50 数组中重复的数字 Solution 利用数组来保存出现次数 123456789101112131415161718192021class Solution {public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param numbers int整型vector * @return 2021-10-10 algo nowcoder 数组
JZ49 把字符串转换成整数 Solution 123456789101112131415161718192021222324class Solution {public: int StrToInt(string str) { int len = str.size(); if (len == 0) return 0; long res = 0, fla 2021-10-10 algo 字符串 nowcoder
JZ48 不用加减乘除做加法 Solution 1234567891011class Solution {public: int Add(int num1, int num2) { while (num2) { // 当进位为 0 时。跳出 int c = ((unsigned int)(num1 & num2)) << 1; 2021-10-10 algo 数学 nowcoder
JZ47 求1+2+3+...+n Solution 12345678class Solution {public: int Sum_Solution(int n) { int sum = n; bool x = (n > 0) && (sum += Sum_Solution(n-1)); return sum; } 2021-10-10 algo 数学 nowcoder