摘要: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function 阅读全文
posted @ 2017-10-14 21:22 daniel456 阅读(129) 评论(0) 推荐(0)
摘要: 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 comple 阅读全文
posted @ 2017-10-14 21:16 daniel456 阅读(135) 评论(0) 推荐(0)
摘要: 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 阅读全文
posted @ 2017-10-14 21:13 daniel456 阅读(139) 评论(0) 推荐(0)
摘要: [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] 含义:要求计算杨辉三角第K行的元素,For example, given k = 3,Return [1,3,3,1]. 思路: 同https://www.cnblogs.com/wzj4858/p/76 阅读全文
posted @ 2017-10-14 21:05 daniel456 阅读(102) 评论(0) 推荐(0)
摘要: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] 阅读全文
posted @ 2017-10-14 20:28 daniel456 阅读(107) 评论(0) 推荐(0)
摘要: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size tha 阅读全文
posted @ 2017-10-14 20:26 daniel456 阅读(90) 评论(0) 推荐(0)
摘要: Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leadin 阅读全文
posted @ 2017-10-14 20:20 daniel456 阅读(164) 评论(0) 推荐(0)
摘要: 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, 阅读全文
posted @ 2017-10-14 20:12 daniel456 阅读(128) 评论(0) 推荐(0)
摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or 阅读全文
posted @ 2017-10-14 20:09 daniel456 阅读(93) 评论(0) 推荐(0)
摘要: Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you 阅读全文
posted @ 2017-10-14 20:05 daniel456 阅读(98) 评论(0) 推荐(0)