
leetcode做题笔记
文章平均质量分 71
Connie_Chai
这个作者很懒,什么都没留下…
展开
-
leetcode:Palindrome Partitioning II
Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.For example, given s = "aab",Return原创 2014-09-11 16:38:26 · 477 阅读 · 0 评论 -
leetcode:Pascal's Triangle II
题目地址:原创 2014-10-22 21:37:51 · 500 阅读 · 0 评论 -
leetcode:Triangle
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [6,原创 2014-10-22 21:23:22 · 440 阅读 · 0 评论 -
leetcode:Validate Binary Search Tree
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.The原创 2014-10-29 16:13:57 · 455 阅读 · 0 评论 -
leetcode:Recover Binary Search Tree
又有好几天没有做题,这道题看了题目很久了,也看到jie原创 2014-10-29 15:39:46 · 531 阅读 · 0 评论 -
leetcode:Interleaving String
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbbaccc", ret原创 2014-11-04 20:33:21 · 451 阅读 · 0 评论 -
leetcode:Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \原创 2014-11-04 21:18:31 · 404 阅读 · 0 评论 -
leetcode:Unique Binary Search Trees II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all 5 unique BST's shown below. 1 3原创 2014-11-04 22:06:53 · 460 阅读 · 0 评论 -
leetcode:Reverse Linked List II
Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note:Given m, n satisfy the原创 2014-11-05 19:50:54 · 444 阅读 · 0 评论 -
leetcode:Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].Note: Recursive solutio原创 2014-11-05 13:14:46 · 590 阅读 · 0 评论 -
leetcode:Restore IP Addresses
Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"]. (Order do原创 2014-11-05 15:09:24 · 549 阅读 · 0 评论 -
leetcode:Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total numb原创 2014-11-06 22:20:56 · 556 阅读 · 0 评论 -
leetcode:Subsets
Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For exa原创 2014-11-06 19:40:35 · 513 阅读 · 0 评论 -
leetcode:Pascal's Triangle
Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]Hide Tags Array原创 2014-10-22 21:28:44 · 449 阅读 · 0 评论 -
leetcode:Best Time to Buy and Sell Stock
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 (ie, buy one and sell one share of the stock), d原创 2014-10-22 21:05:27 · 441 阅读 · 0 评论 -
leetcode:Palindrome Partitioning
Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","原创 2014-09-11 16:22:11 · 463 阅读 · 0 评论 -
leetcode:Word Break
题目:https://oj.leetcode.com/problems/word-break/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.原创 2014-09-11 16:48:15 · 480 阅读 · 0 评论 -
leetcode:Word Break II
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-09-11 17:10:05 · 564 阅读 · 0 评论 -
leetcode:candy
题目:https://oj.leetcode.com/problems/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 req原创 2014-09-12 10:39:03 · 493 阅读 · 0 评论 -
leetcode:Clone Gragh
题目:https://oj.leetcode.com/problems/clone-graph/Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes a原创 2014-09-13 15:10:29 · 633 阅读 · 0 评论 -
leetcode:Gas Station
题目:https://oj.leetcode.com/problems/gas-station/There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it原创 2014-09-12 17:48:10 · 693 阅读 · 0 评论 -
leetcode:Surrounded Regions
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,X X X XX O O X原创 2014-09-16 17:04:27 · 524 阅读 · 0 评论 -
leetcode:Sum Root to Leaf Numbers
Given 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 the number 123.Find the tota原创 2014-09-16 17:07:26 · 481 阅读 · 0 评论 -
leetcode:Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2, 3原创 2014-09-17 09:48:35 · 556 阅读 · 0 评论 -
leetcode:Populating Next Right Pointers in Each Node
题目地址:原创 2014-10-22 21:46:44 · 463 阅读 · 0 评论 -
leetcode:Best Time to Buy and Sell Stock III
之前刷题觉得没什么动力,因为觉得zhaogongz原创 2014-10-22 20:42:19 · 619 阅读 · 0 评论 -
leetcode:Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one原创 2014-10-22 21:03:09 · 623 阅读 · 0 评论 -
leetcode:
Subsets II Total Accepted: 21377 Total Submissions: 79102My SubmissionsQuestion Solution Given a collection of integers that might contain duplicates, S, return all possible subs原创 2014-11-06 20:27:33 · 581 阅读 · 0 评论