- 博客(32)
- 收藏
- 关注
原创 【LeetCode】417. Pacific Atlantic Water Flow Add to List
题目:Given an m x n matrix of non-negative integers representing the height of each unit cell in a continent, the "Pacific ocean" touches the left and top edges of the matrix and the "Atlantic oce
2016-11-24 17:39:58 361
原创 【LeetCode】416. Partition Equal Subset Sum
题目: Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.Note: Each of the array ele
2016-11-23 18:25:24 357
原创 【LeetCode】455. Assign Cookies
题目: Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi
2016-11-23 18:18:29 274
原创 【LeetCode】309. Best Time to Buy and Sell Stock with Cooldown
题目: 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.
2016-11-23 18:12:56 424
原创 【LeetCode】300. Longest Increasing Subsequence
题目:Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is [2, 3, 7, 101
2016-11-01 19:42:08 240
原创 【LeetCode】392. Is Subsequence
题目: Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t.
2016-11-01 19:38:39 348
原创 【LeetCode】413. Arithmetic Slices
题目: A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.
2016-11-01 19:30:47 267
原创 【LeetCode】64. Minimum Path Sum
题目: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
2016-10-20 23:58:47 234
原创 【LeetCode】63. 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 and empty space is marked as 1 and 0 respectively in the grid.
2016-10-20 23:54:13 269
原创 62.【LeetCode】 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 at any point in time. The robot is trying to reach
2016-10-20 23:43:01 238
原创 【LeetCode】403. Frog Jump
题目: A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.
2016-10-20 23:36:45 306
原创 【LeetCode】338. Counting Bits
题目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array.
2016-10-17 20:24:00 228
原创 【LeetCode】213. House Robber II
题目: After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all houses at this place are arranged in
2016-10-17 15:05:47 535
原创 【LeetCode】198. House Robber
题目: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent h
2016-10-17 14:59:59 246
原创 【LeetCode】310. Minimum Height Trees
题目: For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree.
2016-10-13 23:03:07 261
原创 【LeetCode】70. Climbing Stairs
题目: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
2016-10-13 00:08:55 224
原创 【LeetCode】200. Number of Islands
题目: Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands.
2016-10-11 16:22:27 251
原创 【LeetCode】130. Surrounded Regions
题目: Given a 2D board containing ‘X’ and ‘O’ (the letter O), capture all regions surrounded by ‘X’. A region is captured by flipping all ‘O’s into ‘X’s in that surrounded region.
2016-10-08 22:18:27 234
原创 【LeetCode】111. Minimum Depth of Binary Tree
题目: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
2016-10-06 14:55:20 232
原创 【LeetCode】301. Remove Invalid Parentheses
题目: Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results.
2016-10-06 13:56:08 353
原创 【LeetCode】103. Binary Tree Zigzag Level Order Traversal
题目: Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate between).
2016-10-04 00:20:11 248
原创 【LeetCode】329. Longest Increasing Path in a Matrix
题目: Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or down.
2016-10-02 13:54:32 277
原创 【LeetCode】210. 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, Given the total number of courses and a list of prerequisite pairs, return the ordering of cour
2016-10-01 12:25:00 359
原创 【Leetcode】207. 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 0 you have to first take course 1, which is expressed as a
2016-09-26 16:40:51 273
原创 【Leetcode】315. Count of Smaller Numbers After Self
题目: You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i].
2016-09-21 23:54:45 533
原创 【Leetcode】240. Search a 2D Matrix II
题目: Write an efficient algorithm that searches for a value in an m x n matrix.
2016-09-19 20:53:26 275
原创 【Leetcode】241. Different Ways to Add Parentheses
题目: Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.
2016-09-17 23:28:01 316
原创 【LeetCode】53. Maximum Subarray
题目: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
2016-09-15 17:53:03 226
原创 【LeetCode】4. Median of Two Sorted Arrays
题目: There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
2016-09-10 23:28:02 211
原创 【Leetcode】 3. Longest Substring Without Repeating Characters
题目: Given a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, which the length is 3.Given “bbbbb”, the answer is “b”, with t
2016-09-04 21:09:20 426 1
原创 【Leetcode】 2.Add Two Numbers
题目: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a
2016-09-04 19:43:36 335
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人