- 博客(7)
- 收藏
- 关注
原创 leetcode 题解:Word Ladder 2(单词接龙 2)
Given two words (beginWord and endWord), and a dictionary’s word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:(给定两个单词(beginWord 和 endWord)和一个字典 wordList,找出所有从 beginWord 到 endWord 的最短转换序列。转换需遵循如下规则Only one letter
2021-01-18 00:07:04
320
原创 leetcode(力扣题解) 15. 3Sum(三数之和)
题目:Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.(给定一个含有n个数的数组,找出数组中三个元素a,b,c, 使得a+b+c=0, 找出所以互不重复的满足三数之和为0的数组)Notice that the solution set
2020-12-25 20:02:54
274
1
原创 leetcode (力扣)题解 206. Reverse Linked List (链表反转)
leetcode (力扣)题解 206. Reverse Linked List (链表反转)题目:Reverse a singly linked list.(反转单链表)Example:Input: 1->2->3->4->5->NULLOutput: 5->4->3->2->1->NULLFollow up:A linked list can be reversed either iteratively or recursivel
2020-12-25 17:03:43
220
原创 通过归并排序算法(mergesort)理解递归在程序中的运行过程
递归的重要性不言而喻,它是很多算法实现的基础,比如含有分治思想的算法(归并排序,二分查找),有关遍历二叉树的算法,或者求解数学递推式的算法(斐波那契数列,n的阶乘),回溯法,动态规划等等, 一提到递归总有点发蒙,理论上比较好理解,但是一遇到复杂一点的递归算法,在大脑中很难想象递归在计算机中是怎么实现的。跟着一步步debug才终于搞明白,所以在这里先把过程给记录下来。 归并排序算法...
2020-03-27 17:38:45
1456
原创 leetcode题解:784. Letter Case Permutation(字母大小写排列)
Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible strings we could create.(对于给定的字符串S,我们可以将其中的每一个字母转成大写或...
2020-03-20 21:13:32
276
原创 leetcode题解 169. Majority Element 求大多数的元素
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.(给定一个大小为n 的数组,找出其中数量占大多数的元素,这个元素 的个数会大于 [n/2])You may assume that the arr...
2020-03-20 17:05:04
368
原创 Leetcode 题解:1046. Last Stone Weight
这里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入欢迎使用Ma...
2020-03-19 17:13:53
226
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人