
leetcode
文章平均质量分 75
愉快的编码时光_LZT
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【Leetcode 题解】Min Stack
一、原题:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.to原创 2014-11-20 16:26:57 · 727 阅读 · 0 评论 -
【LeetCode】3Sum
一、原题Given an arraynumsofnintegers, are there elementsa,b,cinnumssuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must no...原创 2019-06-26 21:16:21 · 190 阅读 · 0 评论 -
【Leetcode】Linked List Cycle
一、原题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?二、分析选用两个指针扫描链表,一个速度快,一个速度慢,若两个指针相遇,说明有环。三、原创 2014-12-18 19:17:45 · 878 阅读 · 0 评论 -
【Leetcode】Find Peak Element
一原题Find Peak ElementA peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array m原创 2014-12-23 15:49:22 · 1109 阅读 · 0 评论 -
【Leetcode】Sort List解答
一、原题Sort List Sort a linked list in O(n log n) time using constant space complexity.二、分析快速排序和归并排序的时间复杂度是O(nlogn)。如果使用归并排序,在使用链表的情况下,不需要重新申请空间存放排序后的数组,可以做到空间复杂度数O(1)。我在这里使用归并排序来排序链表原创 2014-12-03 19:54:41 · 811 阅读 · 0 评论 -
【Leetcode】Reorder List
一、原题Reorder ListGiven a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given原创 2014-12-17 20:10:58 · 498 阅读 · 0 评论 -
【Leetcode】Intersection of Two Linked Lists
一原题Intersection of Two Linked Lists Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A:原创 2014-12-16 21:24:33 · 574 阅读 · 0 评论 -
【Leetcode】Binary Tree Preorder Traversal
一、原题Binary Tree Preorder TraversalGiven a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3原创 2014-12-16 21:17:18 · 480 阅读 · 0 评论 -
【leetcode】Find Minimum in Rotated Sorted Array 解答
一、原题:二、分析:三、代码:原创 2014-11-23 17:01:43 · 491 阅读 · 0 评论 -
【Leetcode】Evaluate Reverse Polish Notation答案
一、原题Evaluate Reverse Polish NotationEvaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer原创 2014-11-29 11:18:43 · 820 阅读 · 0 评论 -
【LeetCode】17. Letter Combinations of a Phone Number
一、原题Given a string containing digits from2-9inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) ...原创 2019-06-26 23:03:35 · 167 阅读 · 0 评论