《算法刷题LeetCode(中文版)》

写在前面的话

该书包含了LeetCode Online Judge(http://leetcode.com/onlinejudge)所有题目的答案。

该书假定读者已经学过《数据结构》《算法》这两门课,熟练掌握C++或Java.

《数据结构》严蔚敏等著,清华大学出版社

《Algorithms》,Robert Sedgewick,Addison-Weslev Professional.

该书代码开源,github地址:GitHub - soulmachine/leetcode: LeetCode题解,151道题完整版

编程技巧:

???用char的值作为数组小标(例如,统计字符串中每个字符出现的次数),char可能为负数?

(a).有人考虑,可以先强制转型为unsigned int再用作下标,这任然是错滴?

(b)正确的做法:先强制为unsigned char,再用做小标。

使用reserve来避免不必要的重新分配?

第一周

双指针(题号:167):https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/description/
排序:
快速选择、堆排序(题号:215):https://leetcode.com/problems/kth-largest-element-in-an-array/description/
桶排序(题号:347):https://leetcode.com/problems/top-k-frequent-elements/description/
荷兰国旗问题(题号:75):https://leetcode.com/problems/sort-colors/description/
贪心(题号:455):https://leetcode.com/problems/assign-cookies/description/

链接:https://pan.baidu.com/s/1QW2l4qx3tlYNINEKLyv4VA 

提取码:6tod 

第二周

链接:https://pan.baidu.com/s/19qAtmWbc1sXUWFEFb4wH2g 

提取码:wcx4

二分(题号:69):https://leetcode.com/problems/sqrtx/description/

分治(题号:241):https://leetcode.com/problems/different-ways-to-add-parentheses/description/

链表(题号:160):https://leetcode.com/problems/intersection-of-two-linked-lists/description/

哈希表(题号:1):https://leetcode.com/problems/two-sum/description/

字符串(题号:242):https://leetcode.com/problems/valid-anagram/description/

栈和队列(题号:232):https://leetcode.com/problems/implement-queue-using-stacks/description/

第三周

字符串(409):https://leetcode.com/problems/longest-palindrome/description/

数组和矩阵(378):https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/description/

位运算(260):https://leetcode.com/problems/single-number-iii/description/

数学

进制转换(504):https://leetcode.com/problems/base-7/description/

相遇问题(462):https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii/description/

多数投票问题(169):https://leetcode.com/problems/majority-element/description/

第四周

Leetcode算法题:

树:

递归(110):Loading...

层次遍历(513):Loading...

前中后序遍历(144):Loading...

BST(230):Loading...

Trie(208):Loading...

图:

二分图(785):Loading...

拓扑排序(207):Loading...

并查集(684):Loading...

第三周LeetCode参考答案:

链接:https://pan.baidu.com/s/1kpEu2QAzRQgBOZKav8mGcA 

提取码:x041

第五周

LeetCode算法题:

搜索:

BFS(279):Loading...

DFS(695):Loading...

Backtracking(17):Loading...

动态规划:

斐波那契数列(70):Loading...

矩阵路径(64):Loading...

数组区间(303):Loading...

分割整数(343):Loading...

最长递增子序列(300):https://leetcode.com/problems/longest-increasing-subsequence/description/

0-1 背包(416):Loading...

股票交易(309):Loading...

字符串编辑(583):Loading...

第四周LeetCode刷题参考答案:

链接:https://pan.baidu.com/s/1BvLJbAWRxCHEejod-sf7iQ 

提取码:q8uw

第五周LeetCode答案:

链接:https://pan.baidu.com/s/18t8TagTwy5R9kUO678ftqw 

提取码:adpb

  • 6
    点赞
  • 48
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

haimianjie2012

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值