随笔分类 -  Leetcode

摘要:题目链接 "https://leetcode.com/problems/candy/" 题目原文 There are N children standing in a line. Each child is assigned a rating value. You are giving candie 阅读全文
posted @ 2016-04-08 10:33 slurm 阅读(355) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/gas station/" 题目原文 There are N gas stations along a circular route, where the amount of gas at station i is . You 阅读全文
posted @ 2016-04-08 10:24 slurm 阅读(804) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/clone graph/" 题目原文 Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. 阅读全文
posted @ 2016-04-08 09:53 slurm 阅读(399) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/palindrome partitioning ii/" 题目原文 Given a string s, partition s such that every substring of the partition is a pa 阅读全文
posted @ 2016-04-08 09:49 slurm 阅读(465) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/palindrome partitioning/" 题目原文 Given a string s, partition s such that every substring of the partition is a palin 阅读全文
posted @ 2016-04-08 09:41 slurm 阅读(269) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/surrounded regions/" 题目原文 Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region 阅读全文
posted @ 2016-04-03 11:22 slurm 阅读(558) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/sum root to leaf numbers/" 题目原文 Given a binary tree containing digits from 0 9 only, each root to leaf path could 阅读全文
posted @ 2016-04-03 11:17 slurm 阅读(143) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/longest consecutive sequence/" 题目原文 Given an unsorted array of integers, find the length of the longest consecutiv 阅读全文
posted @ 2016-04-03 11:14 slurm 阅读(272) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/word ladder/" 题目原文 Given two words (beginWord and endWord), and a dictionary's word list, find the length of short 阅读全文
posted @ 2016-04-03 11:09 slurm 阅读(563) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/valid palindrome/" 题目原文 Given a string, determine if it is a palindrome, considering only alphanumeric characters 阅读全文
posted @ 2016-04-01 19:10 slurm 阅读(163) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/binary tree maximum path sum/" 题目原文 Given a binary tree, find the maximum path sum. For this problem, a path is de 阅读全文
posted @ 2016-04-01 19:06 slurm 阅读(349) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/best time to buy and sell stock iii/" 题目原文 Say you have an array for which the ith element is the price of a given 阅读全文
posted @ 2016-04-01 19:00 slurm 阅读(319) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/best time to buy and sell stock ii/" 题目原文 Say you have an array for which the ith element is the price of a given 阅读全文
posted @ 2016-04-01 18:57 slurm 阅读(192) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/best time to buy and sell stock/" 题目原文 Say you have an array for which the ith element is the price of a given sto 阅读全文
posted @ 2016-04-01 18:52 slurm 阅读(188) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/triangle/" 题目原文 Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent 阅读全文
posted @ 2016-03-25 11:37 slurm 阅读(136) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/pascals triangle ii/" 题目原文 Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3 阅读全文
posted @ 2016-03-25 11:32 slurm 阅读(126) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/pascals triangle/" 题目原文 Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows 阅读全文
posted @ 2016-03-25 11:29 slurm 阅读(213) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/populating next right pointers in each node ii/" 题目原文 题目大意 和上一题类似,但是可能会有些节点没有左子树或者右子树 解题思路 使用层次遍历: 1. 临时节点指向根节点的左子 阅读全文
posted @ 2016-03-25 11:25 slurm 阅读(405) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/populating next right pointers in each node/" 题目原文 题目大意 二叉树的每个节点都包含左子树和右子树,将同一层的子树用链表连接起来 解题思路 递归求解: 1.如果该节点有左子树:1 阅读全文
posted @ 2016-03-25 11:15 slurm 阅读(226) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/distinct subsequences/" 题目原文 Given a string S and a string T, count the number of distinct subsequences of T in S. 阅读全文
posted @ 2016-03-17 16:27 slurm 阅读(205) 评论(0) 推荐(0)