- 博客(120)
- 资源 (1)
- 收藏
- 关注
原创 [leetcode] Rotate List
From: https://leetcode.com/problems/rotate-list/Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->
2015-06-30 00:27:30 308
原创 [leetcode] Spiral Matrix II
From : https://leetcode.com/problems/spiral-matrix-ii/Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should re
2015-06-29 21:40:54 280
原创 [leetcode] Multiply Strings
From : https://leetcode.com/problems/multiply-strings/Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large an
2015-06-29 20:47:46 273
原创 [leetcode] Permutations
From : https://leetcode.com/problems/permutations/Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2
2015-06-28 23:01:26 262
原创 [leetcode] Jump Game
From : https://leetcode.com/problems/jump-game/Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your
2015-06-28 21:22:16 262
原创 [leetcode] Longest Substring Without Repeating Characters
From : https://leetcode.com/problems/longest-substring-without-repeating-characters/Given a string, find the length of the longest substring without repeating characters. For example, the longest su
2015-06-28 21:05:00 285
原创 [leetcode] Word Ladder
From : https://leetcode.com/problems/word-ladder/Given two words (beginWord and endWord), and a dictionary, find the length of shortest transformation sequence from beginWord to endWord, such that
2015-06-27 23:33:48 408
原创 [leetcode] Triangle
From : https://leetcode.com/problems/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 t
2015-06-27 20:28:47 279
原创 [leetcode] Summary Ranges
From : https://leetcode.com/problems/summary-ranges/Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5",
2015-06-27 01:54:12 338
原创 [leetcode] Populating Next Right Pointers in Each Node II
From : https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any bi
2015-06-25 23:48:48 332
原创 [leetcode] Populating Next Right Pointers in Each Node
From : https://leetcode.com/problems/populating-next-right-pointers-in-each-node/Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLin
2015-06-25 22:18:09 316
原创 [leetcode] Sum Root to Leaf Numbers
From : 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 represent a number.An example is the root-to
2015-06-25 21:27:17 289
原创 [leetcode] Set Matrix Zeroes
From : https://leetcode.com/problems/set-matrix-zeroes/Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Solution:常数空间:1.考虑是不是固定数量的几个变量能搞定2.考虑是
2015-06-25 20:52:41 328
原创 [leetcode] Swap Nodes in Pairs
From : https://leetcode.com/problems/swap-nodes-in-pairs/Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as
2015-06-25 08:29:38 326
原创 [leetcode] Unique Paths II
From : https://leetcode.com/problems/unique-paths-ii/Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle
2015-06-24 21:50:59 304
原创 [leetcode] Unique Paths
From : https://leetcode.com/problems/unique-paths/A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right
2015-06-24 20:43:42 328
原创 [leetcode] Maximum Subarray
From : https://leetcode.com/problems/maximum-subarray/Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1
2015-06-24 19:00:25 296
原创 [leetcode] Gray Code
From : https://leetcode.com/problems/gray-code/The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the tot
2015-06-24 14:51:17 353
原创 [leetcode] Generate Parentheses
From : https://leetcode.com/problems/generate-parentheses/Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a s
2015-06-24 12:42:09 324
原创 【leetcode】Unique Binary Search Trees II
From: https://leetcode.com/problems/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, you
2015-06-23 22:52:59 289
原创 【leetcode】 Unique Binary Search Trees
From : https://leetcode.com/problems/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
2015-06-23 22:51:38 289
原创 [leetcode] Validate Binary Search Tree
From : https://leetcode.com/problems/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 lef
2015-06-23 19:35:38 329
原创 [leetcode] Course Schedule II
From : https://leetcode.com/problems/course-schedule-ii/There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take co
2015-06-23 15:41:53 321
原创 【Course Schedule】Course Schedule
From : https://leetcode.com/problems/course-schedule/There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course
2015-06-22 22:42:51 393
原创 [leetcode] Basic Calculator II
From : https://leetcode.com/problems/basic-calculator-ii/Implement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *,
2015-06-22 20:44:05 441
原创 [leetcode] Best Time to Buy and Sell Stock
From : 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 stock on day i.If you were only permitted to comp
2015-06-21 23:08:23 322
原创 [leetcode] Best Time to Buy and Sell Stock II
From : 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 stock on day i.Design an algorithm to find the m
2015-06-21 22:35:06 293
原创 【leetcode】 Palindrome Partitioning II
From: https://leetcode.com/problems/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 p
2015-06-21 18:33:41 294
原创 [leetcode] Palindrome Partitioning
From : https://leetcode.com/problems/palindrome-partitioning/Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partition
2015-06-21 12:50:25 308
原创 [leetcode] Two Sum
From: https://leetcode.com/problems/two-sum/Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the tw
2015-06-21 10:41:58 345
原创 [leetcode] Gas Station
From : https://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 an
2015-06-20 22:49:47 324
原创 [leetcode] Letter Combinations of a Phone Number
From : https://leetcode.com/problems/letter-combinations-of-a-phone-number/Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to
2015-06-20 19:31:07 320
原创 [leetcode] Rotate Image
From : https://leetcode.com/problems/rotate-image/You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place
2015-06-20 16:10:46 267
原创 [leetcode] Largest Number
From : https://leetcode.com/problems/largest-number/Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the large
2015-06-20 15:09:05 275
原创 [leetcode] Single Number II
From : https://leetcode.com/problems/single-number-ii/Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a l
2015-06-18 22:28:02 309
原创 [leetcode] Divide Two Integers
From : https://leetcode.com/problems/divide-two-integers/Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.class Solution { pub
2015-06-17 23:23:07 319
原创 [leetcode] Flatten Binary Tree to Linked List
From : https://leetcode.com/problems/flatten-binary-tree-to-linked-list/Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5
2015-06-17 15:56:02 298
原创 [leetcode] Find Peak Element
From : https://leetcode.com/problems/decode-ways/A 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
2015-06-16 22:35:20 304
原创 [leetcode] Decode Ways
From : https://leetcode.com/problems/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 en
2015-06-16 22:17:17 302
原创 Convert Sorted List to Binary Search Tree
From :https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST./** * Defi
2015-06-16 15:43:48 309
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人