原始链接:https://blog.csdn.net/haimianjie2012/article/details/93344894?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.pc_relevant_is_cache&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.pc_relevant_is_cache

LeetCode题解,151道题完整版

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

haimianjie2012 2019-06-22 18:16:25  6108  收藏

分类专栏: leetcode 文章标签: leetcode 数据结构 算法 数据库

版权

写在前面的话

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

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

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

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

该书代码开源,github地址:https://github.com/soulmachine/leetcode

编程技巧:

???用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):https://leetcode.com/problems/balanced-binary-tree/description/

层次遍历(513):https://leetcode.com/problems/find-bottom-left-tree-value/description/

前中后序遍历(144):https://leetcode.com/problems/binary-tree-preorder-traversal/description/

BST(230):https://leetcode.com/problems/kth-smallest-element-in-a-bst/description/

Trie(208):https://leetcode.com/problems/implement-trie-prefix-tree/description/

图:

二分图(785):https://leetcode.com/problems/is-graph-bipartite/description/

拓扑排序(207):https://leetcode.com/problems/course-schedule/description/

并查集(684):https://leetcode.com/problems/redundant-connection/description/

第三周LeetCode参考答案:

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

提取码:x041

第五周

LeetCode算法题:

搜索:

BFS(279):https://leetcode.com/problems/perfect-squares/description/

DFS(695):https://leetcode.com/problems/max-area-of-island/description/

Backtracking(17):https://leetcode.com/problems/letter-combinations-of-a-phone-number/description/

动态规划:

斐波那契数列(70):https://leetcode.com/problems/climbing-stairs/description/

矩阵路径(64):https://leetcode.com/problems/minimum-path-sum/description/

数组区间(303):https://leetcode.com/problems/range-sum-query-immutable/description/

分割整数(343):https://leetcode.com/problems/integer-break/description/

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

0-1 背包(416):https://leetcode.com/problems/partition-equal-subset-sum/description/

股票交易(309):https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/description/

字符串编辑(583):https://leetcode.com/problems/delete-operation-for-two-strings/description/

第四周LeetCode刷题参考答案:

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

提取码:q8uw

第五周LeetCode答案:

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

提取码:adpb

转载:《算法刷题LeetCode(中文版)》LeetCode题解,151道题完整版相关推荐

  1. 机器学习 - 竞赛网站,算法刷题网站

    数据竞赛类网站 Kaggle 阿里巴巴天池大数据比赛 DataCastle CCF大数据与计算智能大赛 Di-Tech算法大赛 KDD-Cup KDnuggets Competition 全国高校云计 ...

  2. 数据挖掘竞赛,算法刷题网址汇总

    数据竞赛类网站 Kaggle 阿里巴巴天池大数据比赛 DataCastle CCF大数据与计算智能大赛 Di-Tech算法大赛 KDD-Cup KDnuggets Competition 全国高校云计 ...

  3. 【秋招必备】LeetCode神器,算法刷题宝典.pdf

    Hello~最近正值各大厂校园秋招热季,今天向大家推荐关于「算法刷题宝典」的开源项目:力扣Cookbook. 获取方式: 点击下方链接,在消息对话框回复关键词:LeetCode  即可获取这本电子书! ...

  4. LeetCode神器,算法刷题宝典.pdf

    Hello~今天向大家推荐关于「算法刷题宝典」的开源项目:力扣Cookbook. 获取方式: 点击下方链接,关注后在消息对话框回复关键词:LeetCode  即可获取这本电子书!   力扣 Cookb ...

  5. LeetCode 牛客网 C++ 算法 刷题必备基础知识

    LeetCode 牛客网 C++ 算法 刷题必备基础知识 {ignore} 文章目录 LeetCode 牛客网 C++ 算法 刷题必备基础知识 {ignore} main综合模板 数组排序库 字符串库 ...

  6. 无意中发现一位大佬的算法刷题pdf笔记

    昨晚逛GitHub,无意中看到一位大佬(https://github.com/halfrost)的算法刷题笔记,感觉发现了宝藏!有些小伙伴可能已经发现了,但咱这里还是忍不住安利一波,怕有些小伙伴没有看 ...

  7. 经典算法刷题笔记pdf

    昨晚逛GitHub,无意中看到一位大佬(https://github.com/halfrost)的算法刷题笔记,感觉发现了宝藏!有些小伙伴可能已经发现了,但咱这里还是忍不住安利一波,怕有些小伙伴没有看 ...

  8. Github最强算法刷题笔记.pdf

    资料一 昨晚逛GitHub,无意中看到一位大佬(https://github.com/halfrost)的算法刷题笔记,感觉发现了宝藏!有些小伙伴可能已经发现了,但咱这里还是忍不住安利一波,怕有些小伙 ...

  9. Leetode算法刷题宝典.pdf

    今天推荐一个关于「算法刷题宝典」的开源项目:力扣Cookbook. 力扣 Cookbook是@halfrost(中文名:霜神)去年刷的 力扣整理出的 520 题,每道题都写了解题思路,并且每题都 ru ...

  10. 神了,无意中发现一位1500道的2021LeetCode算法刷题pdf笔记

    昨晚逛GitHub,无意中看到一位大佬的算法刷题笔记,感觉发现了宝藏!有些小伙伴可能已经发现了,但咱这里还是忍不住安利一波,怕有些小伙伴没有看到. 关于算法刷题的困惑和疑问也经常听朋友们提及.这份笔记 ...

最新文章

  1. jQuery日期和时间插件(jquery-ui-timepicker-addon.js)中文破解版使用
  2. php directoryiterator,PHP DirectoryIterator getBasename()用法及代码示例
  3. 工欲善其事必先利其器——web调试工具firebug
  4. matlab求系统根轨迹代码_根轨迹法、PID参数整定和matlab指令计算
  5. linux查看最近修改过的文件
  6. 事务的特性及事务的隔离级别(转)
  7. Domino Web开发规则之二:DOMINO与开发相关的管理规范
  8. Android应用开发提高篇(2)-----文本朗读TTS(TextToSpeech)
  9. php gzip 关闭,php能否在当前脚本页关闭nginx的gzip输出
  10. hdu 4351 Digital root
  11. TBase环境部署过程及使用一
  12. 脚本 金盾替换机器码_金盾2018SS加密视频机器码替换工具的分析过程三
  13. vue的history模式,页面刷新404,以及引入得第三方插件或者JS路径错误的解决办法
  14. 基于 arm 设计开发工具包的 Arm Cortex-M3 处理器设计(第二章:示例微处理器组成及各个Verilog文件功能及作用)
  15. 警告:Google公开Windows零日漏洞
  16. 2.12 手机GPS定位
  17. 数字孪生3D可视化,人员定位系统助力企业数字化转型
  18. Win7笔记本电脑启用虚拟WIFI共享上网
  19. Unix时间戳(Unix timestamp)在线转换工具
  20. 微信小程序dayjs customParseFormat引用

热门文章

  1. Makefile中调用make命令,-C和-f选项的区别
  2. 基于GIS技术的智慧城市数字底盘(时空大数据平台)
  3. Excel:数据处理
  4. 64qam带宽计算_64QAM有效传输速率计算
  5. C功底挑战Java菜鸟入门概念干货(三)
  6. linux nginx rtmp 直播,nginx+rtmp简单直播
  7. matlab基础与实例教程,MATLAB R2018基础与实例教程
  8. 闲人闲谈PS之九——项目定义及WBS结构设计
  9. IP地址自动切换脚本
  10. Linux 安装ifconfig命令