
LeetCode
文章平均质量分 79
ai-exception
Github: https://github.com/DmrfCoder;
Gmail: xuefanggang97@gmail.com;
QQ:2296452542
展开
-
LeetCode——single-number-ii(出现一次的数2)
知识点:复杂度本文首发于github题目描述Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you imp...原创 2019-04-21 22:20:07 · 225 阅读 · 0 评论 -
LeetCode:计算逆波兰式的值(evaluate-reverse-polish-notation)
原文地址知识点:栈题目描述Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.Some examples:计算逆波兰式的值,给定式...原创 2019-04-12 11:01:41 · 364 阅读 · 0 评论 -
LeetCode:max-points-on-a-line(同一条直线上的点的最大数量)
原文地址知识点:穷举题目描述Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.给定2D平面上的n个点,找到位于同一直线上的最大点的数量。解题思路首先明确如何量化"直线"这一概念,最简单的,我们可以固定一个起始点S(Start),然后遍历剩余...原创 2019-04-12 11:03:48 · 596 阅读 · 0 评论 -
LeetCode:sort-list(排序List)
知识点:排序,链表原文链接题目描述Sort a linked list in O(n log n) time using constant space complexity.使用常量空间在O(n log n)时间复杂度内对链表进行排序。解题思路首先思考常见排序算法的事件复杂度及空间复杂度(参考:八大常见排序算法介绍):排序方法时间复杂度空间复杂度直接插入排序T...原创 2019-04-12 13:52:16 · 284 阅读 · 0 评论 -
LeetCode——insertion-sort-list(使用插入排序对链表进行排序)
知识点:排序,链表原文地址题目描述Sort a linked list using insertion sort.解题思路首先明确什么是数组的插入排序:首先将第二个数与第一个数进行对比,如果第二个数比第一个数小,则将第二个数插入到第一个数之前,这样保证前两个数是有序的;接下来将第三个数与前两个数对比,发现有比第三个数大的数即将第三个数插入到对应数的前面,这样一次插入可保证前三个数是有...原创 2019-04-13 11:36:21 · 499 阅读 · 0 评论 -
LeetCode——binary-tree-postorder-traversal(后序遍历二叉树)
知识点:树原文地址题目描述Given a binary tree, return the postorder traversal of its nodes’ values.For example:Given binary tree{1,#,2,3},return[3,2,1].Note: Recursive solution is trivial, could you do it ...原创 2019-04-13 17:03:52 · 443 阅读 · 0 评论 -
LeetCode——binary-tree-preorder-traversal(先序遍历二叉树)
知识点:树原文地址题目描述Given a binary tree, return the postorder traversal of its nodes’ values.For example:Given binary tree{1,#,2,3},return[1,2,3].Note: Recursive solution is trivial, could you do it ...原创 2019-04-13 17:31:03 · 240 阅读 · 0 评论 -
LeetCode——reorder-list(链表重排序)
知识点:链表[原文地址](https://github.com/DmrfCoder/AlgorithmAndDataStructure/blob/master/LeetCode/Doc/%E9%93%BE%E8%A1%A8%E9%87%8D%E6%8E%92%E5%BA%8F.md)题目描述Given a singly linked list$ L: L_0→L_1→…→L{n-1}→L_n...原创 2019-04-14 12:49:45 · 316 阅读 · 0 评论 -
LeetCode——linked-list-cycle-ii(找出链表中环的入口节点)
知识点:链表[原文地址](https://github.com/DmrfCoder/AlgorithmAndDataStructure/blob/master/LeetCode/Doc/%E6%89%BE%E5%87%BA%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%8E%AF%E7%9A%84%E5%85%A5%E5%8F%A3%E8%8A%82%E7%82%B9.md)题目...原创 2019-04-14 13:37:49 · 588 阅读 · 0 评论 -
LeetCode—— linked-list-cycle(判断链表中是否存在环)
知识点:链表原文地址题目描述Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?给定一个链表,判断其中是否存在环。额外要求:尽量不要使用额外空间解题思路使用快慢指针即可。代码public boolean hasC...原创 2019-04-14 13:55:46 · 260 阅读 · 0 评论 -
LeetCode——word-break(单词切分)
知识点:动态规划本文首发于github题目描述Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens =“leetc...原创 2019-04-15 17:00:36 · 326 阅读 · 0 评论 -
LeetCode——single-number(出现一次的数)
知识点:复杂度本文首发于github题目描述Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement...原创 2019-04-21 22:18:40 · 165 阅读 · 0 评论 -
LeetCode: 二叉树的最小深度(minimum-depth-of-binary-tree)
原文地址知识点:树题目描述Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.给定一个二叉树,找出其最小的深度。最小的深度指的是...原创 2019-04-12 10:59:10 · 208 阅读 · 0 评论