![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
九月的小海
这个作者很懒,什么都没留下…
展开
-
LeetCode笔记:283. Move Zeroes
这是一道难度为Easy的问题,但不知道为什么,每次做我都会掉入思维误区,想出超级复杂的方案。今天整理一下,以便加深印象。 问题 Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. ...原创 2019-02-28 22:38:40 · 148 阅读 · 0 评论 -
LeetCode笔记:121. Best Time to Buy and Sell Stock
又是一道很简单,但每次都让我误入歧途的问题。Mark一下。 问题 Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (i.e., buy one ...原创 2019-03-04 21:52:19 · 130 阅读 · 0 评论 -
LeetCode中的数据结构2:链表
链表问题要尤其注意,检查边界条件是否考虑全面,代码在边界条件下是否能正确运行,如:链表为空、链表只包含一个结点、链表只包含两个结点、代码逻辑处理头结点和尾结点时,能否正常执行。原创 2019-06-01 05:28:04 · 194 阅读 · 0 评论 -
LeetCode笔记:438. Find All Anagrams in a String
这是一道难度为Easy的问题,但我觉得挺难的。记录一下。 问题 Given a string s and a non-empty string p, find all the start indices of p’s anagrams in s. Strings consists of lowercase English letters only and the length of both s...原创 2019-04-08 14:22:27 · 132 阅读 · 0 评论 -
LeetCode中的数据结构3:二叉树
二叉树具有天然的递归性,二叉树问题也常用递归方式求解。递归函数应该包含两部分:递归终止条件和递归过程。例如求二叉树的最大深度,就是使用递归方法求解的非常简单的二叉树问题。原创 2019-06-02 02:10:36 · 236 阅读 · 0 评论 -
LeetCode中的数据结构1:数组
数组问题要明确变量的定义,并全程保持其定义,维护循环不变量。 维护循环不变量。原创 2019-06-11 23:01:20 · 142 阅读 · 0 评论 -
LeetCode中的数据结构4:查找表
Java中的Set和Map底层是哈希表实现,哈希表的缺点是失去了数据的顺序性。 如果需要数据的顺序性,需要使用底层是二叉查找树的实现。原创 2019-07-02 16:06:34 · 197 阅读 · 0 评论