摘要:
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space fo 阅读全文
posted @ 2016-07-15 10:45
U_F_O
阅读(77)
评论(0)
推荐(0)
摘要:
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 your algorithm to 阅读全文
posted @ 2016-07-15 08:41
U_F_O
阅读(77)
评论(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 @ 2016-07-15 08:30
U_F_O
阅读(82)
评论(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 @ 2016-07-14 09:07
U_F_O
阅读(108)
评论(0)
推荐(0)
摘要:
Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For example, giv 阅读全文
posted @ 2016-07-13 09:19
U_F_O
阅读(111)
评论(0)
推荐(0)
摘要:
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 阅读全文
posted @ 2016-07-13 08:55
U_F_O
阅读(72)
评论(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 th 阅读全文
posted @ 2016-07-09 14:37
U_F_O
阅读(99)
评论(0)
推荐(0)
摘要:
Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. 方法1 阅读全文
posted @ 2016-07-08 12:47
U_F_O
阅读(95)
评论(0)
推荐(0)
摘要:
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文
posted @ 2016-07-07 23:36
U_F_O
阅读(103)
评论(0)
推荐(0)
摘要:
Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the 阅读全文
posted @ 2016-07-07 13:05
U_F_O
阅读(92)
评论(0)
推荐(0)
浙公网安备 33010602011771号