
LeetCode
文章平均质量分 77
Hooting
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
查找列表是否含有环(二)——Leetcode系列(十)
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?Proof:原创 2014-06-18 13:53:29 · 841 阅读 · 0 评论 -
Search a 2D Matrix ——Leetcode系列(十八)
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each原创 2014-09-24 15:29:29 · 845 阅读 · 0 评论 -
Gas Station——Leetcode系列(十六)
Gas Station Total Accepted: 14176 Total Submissions: 57777My SubmissionsThere are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car w原创 2014-07-08 10:18:01 · 845 阅读 · 0 评论 -
分配糖果问题——Leetcode系列(十五)
Candy There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must原创 2014-07-04 18:58:26 · 1410 阅读 · 0 评论 -
查找数组中只出现一次的数(一)——Leetcode系列(十四)
Single Number Total Accepted: 24874 Total Submissions: 55282My SubmissionsGiven an array of integers, every element appears twice except for one. Find that single one.Note:Your algor原创 2014-06-30 20:18:47 · 866 阅读 · 0 评论 -
查找列表是否含有环(一)——Leetcode系列(九)
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?My Answer:/** * Definition for singly-linked list. * class ListNode { *原创 2014-06-16 10:42:11 · 773 阅读 · 0 评论 -
列表重新排序——Leetcode系列(八)
Given 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 {1,2,3,4}, reorder it to原创 2014-06-13 14:58:14 · 833 阅读 · 0 评论 -
使用迭代法对二叉树进行后序遍历——Leetcode系列(六)
Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recursive solut原创 2014-06-10 21:15:43 · 922 阅读 · 0 评论 -
深度复制链表——Leetcode系列(十三)
Copy List with Random Pointer A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the原创 2014-06-30 19:32:46 · 976 阅读 · 0 评论 -
使用迭代法对二叉树进行前序遍历——Leetcode系列(七)
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive soluti原创 2014-06-11 09:53:25 · 1151 阅读 · 0 评论 -
使用插入排序算法对列表进行排序——Leetcode系列(五)
Sort a linked list using insertion sort.My Answer:原创 2014-06-09 14:08:54 · 1072 阅读 · 0 评论 -
判断字符串是否能分割成字典中的单词(二)——Leetcode系列(十二)
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example, givens = "原创 2014-06-29 22:27:10 · 3457 阅读 · 0 评论 -
逆序输出字符串的单词——Leetcode系列(二)
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Clarification:What constitutes a word?A sequence of non-spac原创 2014-06-06 14:01:07 · 1061 阅读 · 0 评论 -
同一直线上最多的点的个数——Leetcode系列(三)
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.原创 2014-06-07 15:04:24 · 878 阅读 · 0 评论 -
计算逆波兰式——Leetcode系列(一)
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:原创 2014-06-06 13:50:07 · 935 阅读 · 0 评论 -
使用快速排序算法对列表进行排序——Leetcode系列(四)
Sort a linked list in O(n log n) time using constant space complexity.My Answer:原创 2014-06-08 14:29:55 · 2858 阅读 · 0 评论 -
判断字符串是否能分割成字典中的单词(一)——Leetcode系列(十一)
Word BreakGiven 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 = "leetco原创 2014-06-22 19:04:53 · 4182 阅读 · 0 评论 -
Sum Root to Leaf Numbers ——Leetcode系列(十七)
Sum Root to Leaf NumbersGiven a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents th原创 2014-09-10 22:31:01 · 888 阅读 · 0 评论