LeetCode问题解决
文章平均质量分 65
qq_37817947
这个作者很懒,什么都没留下…
展开
-
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)).给两个长度分别为m、n的已原创 2017-09-23 14:40:00 · 152 阅读 · 0 评论 -
688. Knight Probability in Chessboard
问题描述:On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves. The rows and columns are 0 indexed, so the top-left square is (0, 0), and t原创 2017-12-31 14:57:14 · 191 阅读 · 0 评论 -
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,原创 2017-12-24 21:18:13 · 106 阅读 · 0 评论 -
486. Predict the Winner
问题描述:Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a pla原创 2017-11-27 00:32:51 · 90 阅读 · 0 评论 -
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.给一个非空正整数数组,返回是否可以原创 2017-12-03 22:37:24 · 90 阅读 · 0 评论 -
698. Partition to K Equal Sum Subsets
问题描述:Given an array of integers nums and a positive integer k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal.给一个数组和一个正整数k,返回该数组是否可以分成k个子原创 2017-12-10 23:45:29 · 106 阅读 · 0 评论 -
647. Palindromic Substrings
问题描述:Given a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrings even原创 2017-11-20 00:35:18 · 88 阅读 · 0 评论 -
712. Minimum ASCII Delete Sum for Two Strings
问题描述:Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal.给两个字符串,删除字符串的字符,直到两个字符串相同,算出减去的字符的ASC码的和的最小值问题解决:使用动态规划,找到递推式,用a[i][j]表示s1前i个,s2前j个原创 2017-11-11 22:51:16 · 102 阅读 · 0 评论 -
Maximum Length of Repeated Subarray
问题描述:Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.给定两个数组A、B,返回两个数组中的最大相同子数组的长度问题解决:用二维数组a[i][j]储存通过动态规划找到A数组到i为止,B数组到j为止的最大相同字原创 2017-11-11 22:26:30 · 134 阅读 · 0 评论 -
406. Queue Reconstruction by Height
问题描述:Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in原创 2017-10-16 13:14:23 · 116 阅读 · 0 评论 -
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, which is the minimum原创 2017-10-22 20:07:11 · 105 阅读 · 0 评论 -
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原创 2017-10-30 16:46:00 · 142 阅读 · 0 评论 -
169. Majority Element
问题描述:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majori原创 2017-10-02 15:49:38 · 130 阅读 · 0 评论 -
53. 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,-3,4,-1,2,1,-5,4],the contiguous subarray [4原创 2017-10-09 16:32:49 · 123 阅读 · 0 评论 -
Two Sum
对LeetCode问题的解决方法的描述原创 2017-09-10 09:27:27 · 115 阅读 · 0 评论 -
740. Delete and Earn
问题描述:Given an array nums of integers, you can perform operations on the array.In each operation, you pick any nums[i] and delete it to earn nums[i] points. After, you must delete every ele原创 2017-12-18 16:47:52 · 103 阅读 · 0 评论