上一页 1 ··· 44 45 46 47 48
摘要: [ [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 阅读(96) 评论(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 阅读(100) 评论(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 阅读(82) 评论(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 阅读(157) 评论(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 阅读(121) 评论(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 阅读(88) 评论(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 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 给定一个有序数组,原地删除重复元素,使得每个元素只出现一次,并返回新的长度。不为另一个数组分配额外空间,必须用常量内存做到这一点。 阅读全文
posted @ 2017-10-14 20:02 daniel456 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 题目:给定一个整型数组,返回两个数的下标,满足两个数相加为一个特定整数。假定只有一个正确答案 例如: nums = [2, 7, 11, 15], target = 9,因为nums[0] + nums[1] = 2 + 7 = 9,返回[0,1] 思路:如果是只返回两个数,可以将数组排序后,从两边 阅读全文
posted @ 2017-10-14 19:44 daniel456 阅读(129) 评论(0) 推荐(0) 编辑
上一页 1 ··· 44 45 46 47 48