LeetCode
文章平均质量分 75
Lonvon_
这个作者很懒,什么都没留下…
展开
-
LeetCode329. 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. You may NOT move diagonally or mov原创 2016-11-07 14:28:20 · 376 阅读 · 0 评论 -
LeetCode 121. 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 th原创 2016-11-22 23:07:24 · 320 阅读 · 0 评论 -
LeetCode 435. Non-overlapping Intervals
题目:给定一个区间数组,求可以去掉的使得剩余区间不重叠的最少区间数目。Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Note: You may assume the i原创 2016-11-17 18:05:06 · 426 阅读 · 0 评论 -
LeetCode 45. Jump Game II
题目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 maximum jump length at that position.Your goal is to re原创 2016-11-16 10:52:06 · 302 阅读 · 0 评论 -
LeetCode 44. Wildcard Matching
题目:字符串匹配问题Implement wildcard pattern matching with support for ‘?’ and ‘*’.‘?’ Matches any single character. ‘*’ Matches any sequence of characters (including the empty sequence).The matching should c原创 2016-11-16 00:17:39 · 256 阅读 · 0 评论 -
LeetCode25. Reverse Nodes in k-Group
题目:对一个链表的长度为k的块进行reverse,要求常数空间。Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out n原创 2016-11-08 19:36:57 · 279 阅读 · 0 评论 -
LeetCode10. Regular Expression Matching
题目:简单正则表达式匹配Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover t原创 2016-11-08 19:56:14 · 291 阅读 · 0 评论 -
LeetCode144. Binary Tree Preorder Traversal
题目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 solution is trivial, coul原创 2016-11-07 17:23:41 · 285 阅读 · 0 评论 -
LeetCode413. 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.For example, these are arithmeti原创 2016-11-07 16:39:55 · 221 阅读 · 0 评论 -
LeetCode403. 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.Given原创 2016-11-07 15:29:23 · 325 阅读 · 0 评论 -
LeetCode112. Path Sum
题目Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example: Given the below binary tree and sum =原创 2016-11-07 15:26:00 · 219 阅读 · 0 评论 -
LeetCode 5 Longest Palindromic Substring
LeetCode 5 Longest Palindromic Substring题目:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palind原创 2016-09-14 09:11:59 · 236 阅读 · 0 评论 -
LeetCode 11. Container With Most Water
题目:Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two原创 2016-09-24 18:06:37 · 213 阅读 · 0 评论 -
LeetCode 327. Count of Range Sum
题目:Given an integer array nums, return the number of range sums that lie in [lower, upper] inclusive. Range sum S(i, j) is defined as the sum of the elements in nums between indices i and j (i ≤ j), i原创 2016-09-24 20:51:43 · 296 阅读 · 0 评论 -
LeetCode 15. 3Sum
题目:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not contain dup原创 2016-09-24 21:04:00 · 204 阅读 · 0 评论 -
LeetCode 199. Binary Tree Right Side View
题目:Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example: Given the following binary tree, 1原创 2016-09-24 21:24:57 · 195 阅读 · 0 评论 -
LeetCode 29. Divide Two Integers
题目:Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.分析:这道题最基本的想法是进行减法,dividend-divisor,每一次成功减去之后divisor加倍(左移一位),如果不能减,并且divisor是加倍之后的,那么divi原创 2016-09-24 23:30:39 · 253 阅读 · 0 评论 -
LeetCode 122. 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 a原创 2016-11-22 23:15:48 · 246 阅读 · 0 评论