求和
文章平均质量分 73
jmspan
这个作者很懒,什么都没留下…
展开
-
LeetCode 325. Maximum Size Subarray Sum Equals k(和为k的最长子数组)
原题网址:https://leetcode.com/problems/maximum-size-subarray-sum-equals-k/Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0原创 2016-04-26 06:10:18 · 2436 阅读 · 0 评论 -
LeetCode 16. 3Sum Closest(最接近的和)
原题网址:https://leetcode.com/problems/3sum-closest/Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integ原创 2016-05-19 06:09:48 · 454 阅读 · 0 评论 -
LeetCode 18. 4Sum(四数之和)
原题网址:https://leetcode.com/problems/4sum/Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which原创 2016-05-19 06:31:51 · 751 阅读 · 0 评论 -
LeetCode 124. Binary Tree Maximum Path Sum(二叉树最大路径和)
原题网址:https://leetcode.com/problems/binary-tree-maximum-path-sum/Given a binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting原创 2016-05-27 00:27:32 · 2069 阅读 · 0 评论 -
LeetCode 39. Combination Sum(组合求和)
原题网址:https://leetcode.com/problems/combination-sum/Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The原创 2016-05-20 10:40:51 · 1471 阅读 · 0 评论 -
LeetCode 40. Combination Sum II(组合求和)
原题网址:https://leetcode.com/problems/combination-sum-ii/Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to原创 2016-05-20 10:41:06 · 1480 阅读 · 0 评论 -
LeetCode 53. Maximum Subarray(最大子数组)
原题网址: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原创 2016-05-21 06:53:56 · 1289 阅读 · 0 评论 -
LeetCode 64. Minimum Path Sum(最小路径和)
原题网址:https://leetcode.com/problems/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 it原创 2016-05-21 11:59:41 · 1259 阅读 · 0 评论 -
LeetCode 343. Integer Break(整数分拆)
原题网址:https://leetcode.com/problems/integer-break/Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximu原创 2016-04-30 12:00:37 · 1202 阅读 · 0 评论 -
LeetCode 120. Triangle(三角形)
原题网址: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 the原创 2016-05-24 00:20:03 · 813 阅读 · 0 评论 -
LeetCode 188. Best Time to Buy and Sell Stock IV(股票买卖)
原题网址:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/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原创 2016-05-02 15:03:28 · 1952 阅读 · 0 评论 -
LeetCode 373. Find K Pairs with Smallest Sums
原题网址:https://leetcode.com/problems/find-k-pairs-with-smallest-sums/You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k.Define a pair (u,v) which consists原创 2016-07-14 00:51:28 · 793 阅读 · 0 评论 -
HackerRank The Maximum Subarray
原题网址:https://www.hackerrank.com/challenges/maxsubarrayGiven an array of elements, find the maximum possible sum of aContiguous subarrayNon-contiguous (not necessarily contiguou原创 2016-07-22 06:56:23 · 894 阅读 · 0 评论 -
437. Path Sum III
原题网址:https://leetcode.com/problems/path-sum-iii/You are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given value.The path does原创 2016-10-27 01:42:32 · 670 阅读 · 0 评论 -
454. 4Sum II
原题网址:https://leetcode.com/problems/4sum-ii/Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make原创 2016-12-01 02:15:16 · 832 阅读 · 0 评论 -
LeetCode 473. Matchsticks to Square
原题网址:https://leetcode.com/problems/matchsticks-to-square/Remember the story of Little Match Girl? By now, you know exactly what matchsticks the little match girl has, please find out a way you c原创 2016-12-26 04:05:48 · 1479 阅读 · 0 评论 -
LeetCode 396. Rotate Function
原题网址:https://leetcode.com/problems/rotate-function/Given an array of integers A and let n to be its length.Assume Bk to be an array obtained by rotating the array A k positions clock-wise,原创 2017-01-04 09:06:31 · 587 阅读 · 0 评论 -
LeetCode 15. 3Sum(三数之和)
原题网址:https://leetcode.com/problems/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 ze原创 2016-05-19 06:03:50 · 861 阅读 · 0 评论 -
LeetCode 346. Moving Average from Data Stream(数据流移动平均值)
原题网址:https://leetcode.com/problems/moving-average-from-data-stream/Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window.For exampl原创 2016-05-01 06:23:14 · 2953 阅读 · 0 评论 -
LeetCode 216. Combination Sum III(数字之和)
原题网址:https://leetcode.com/problems/combination-sum-iii/Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combinati原创 2016-05-06 04:17:52 · 864 阅读 · 0 评论 -
LeetCode 112. Path Sum(路径和)
原题网址:https://leetcode.com/problems/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.原创 2016-05-24 00:18:59 · 483 阅读 · 0 评论 -
LeetCode 113. Path Sum II(路径和)
原题网址:https://leetcode.com/problems/path-sum-ii/Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree原创 2016-05-24 00:19:11 · 804 阅读 · 0 评论 -
LeetCode 119. Pascal's Triangle II(帕斯卡三角)
原题网址:https://leetcode.com/problems/pascals-triangle-ii/Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize原创 2016-05-24 00:19:56 · 879 阅读 · 0 评论 -
LeetCode 122. Best Time to Buy and Sell Stock II(股票买卖)
原题网址: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原创 2016-05-24 00:36:52 · 435 阅读 · 0 评论 -
LeetCode 259. 3Sum Smaller(三数值和)
原题网址:https://leetcode.com/problems/3sum-smaller/Given an array of n integers nums and a target, find the number of index triplets i, j, k with 0 that satisfy the condition nums[i] + nums[j]原创 2016-04-09 08:31:17 · 1615 阅读 · 1 评论 -
LeetCode 339. Nested List Weight Sum(加权和)
原题网址:https://leetcode.com/problems/nested-list-weight-sum/Given a nested list of integers, return the sum of all integers in the list weighted by their depth.Each element is either an intege原创 2016-04-30 08:44:55 · 1876 阅读 · 0 评论 -
LeetCode 170. Two Sum III - Data structure design(两数和)
原题网址:https://leetcode.com/problems/two-sum-iii-data-structure-design/Design and implement a TwoSum class. It should support the following operations: add and find.add - Add the number to an原创 2016-05-25 01:36:58 · 917 阅读 · 0 评论 -
LeetCode 167. Two Sum II - Input array is sorted(两数和)
原题网址:https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific tar原创 2016-05-25 01:39:48 · 625 阅读 · 0 评论 -
LeetCode 327. Count of Range Sum(区间和计数)
原题网址:https://leetcode.com/problems/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 su原创 2016-04-28 00:32:14 · 3726 阅读 · 0 评论 -
LeetCode 1. Two Sum(两数之和)
原题网址:https://leetcode.com/problems/two-sum/Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have原创 2016-05-01 06:52:09 · 967 阅读 · 0 评论 -
LeetCode 303. Range Sum Query - Immutable(数组求和)
原题网址:https://leetcode.com/problems/range-sum-query-immutable/Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2原创 2016-04-19 07:21:12 · 621 阅读 · 0 评论 -
LeetCode 134. Gas Station(加油站)
原题网址: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 and i原创 2016-05-27 00:22:49 · 744 阅读 · 0 评论 -
LeetCode 129. Sum Root to Leaf Numbers(节点求和)
原题网址: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-l原创 2016-05-27 00:26:01 · 514 阅读 · 0 评论 -
LeetCode 307. Range Sum Query - Mutable(区间之和)
原题网址:https://leetcode.com/problems/range-sum-query-mutable/Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.The update(i, val) function mo原创 2016-04-20 07:58:00 · 652 阅读 · 0 评论 -
LeetCode 209. Minimum Size Subarray Sum(最小子数组之和)
原题网址:https://leetcode.com/problems/minimum-size-subarray-sum/Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there原创 2016-05-04 13:17:10 · 1789 阅读 · 0 评论 -
LeetCode 308. Range Sum Query 2D - Mutable(二维区间求和)
原题网址:https://leetcode.com/problems/range-sum-query-2d-mutable/Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower原创 2016-04-20 10:31:57 · 1618 阅读 · 0 评论 -
LeetCode 445. Add Two Numbers II
原题网址:https://leetcode.com/problems/add-two-numbers-ii/You are given two linked lists representing two non-negative numbers. The most significant digit comes first and each of their nodes contain原创 2017-01-04 09:33:07 · 923 阅读 · 0 评论