随笔分类 -  LeetCode

上一页 1 ··· 6 7 8 9 10 11 12 下一页
摘要:Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexi 阅读全文
posted @ 2017-09-29 10:43 __Meng 阅读(162) 评论(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-09-28 09:31 __Meng 阅读(181) 评论(0) 推荐(0)
摘要:Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they 阅读全文
posted @ 2017-09-27 16:19 __Meng 阅读(151) 评论(0) 推荐(0)
摘要:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 1, 阅读全文
posted @ 2017-09-26 09:21 __Meng 阅读(156) 评论(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 @ 2017-09-25 11:06 __Meng 阅读(115) 评论(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]. Not 阅读全文
posted @ 2017-09-24 10:47 __Meng 阅读(107) 评论(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 @ 2017-09-23 16:27 __Meng 阅读(115) 评论(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-09-23 15:53 __Meng 阅读(140) 评论(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-09-23 15:25 __Meng 阅读(136) 评论(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 us 阅读全文
posted @ 2017-09-23 14:58 __Meng 阅读(148) 评论(0) 推荐(0)
摘要:Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return java(1ms): 阅读全文
posted @ 2017-09-21 16:11 __Meng 阅读(159) 评论(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-09-21 09:08 __Meng 阅读(145) 评论(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-09-20 14:58 __Meng 阅读(168) 评论(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-09-19 09:23 __Meng 阅读(140) 评论(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-09-18 16:34 __Meng 阅读(152) 评论(0) 推荐(0)
摘要: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 @ 2017-09-18 16:06 __Meng 阅读(191) 评论(0) 推荐(0)
摘要:Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the 阅读全文
posted @ 2017-09-17 15:49 __Meng 阅读(153) 评论(0) 推荐(0)
摘要:Given an unsorted array of integers, find the length of longest continuous increasing subsequence. Example 1: Example 2: 在未排序的数组中,找出最长递增序列的长度 c++(16ms 阅读全文
posted @ 2017-09-16 15:51 __Meng 阅读(141) 评论(0) 推荐(0)
摘要: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 ex 阅读全文
posted @ 2017-09-14 09:50 __Meng 阅读(145) 评论(0) 推荐(0)
摘要:如果一个数组里所有数都不同,则返回false 如果有重复数字,则返回true C++(36ms): 阅读全文
posted @ 2017-09-13 16:33 __Meng 阅读(106) 评论(0) 推荐(0)

上一页 1 ··· 6 7 8 9 10 11 12 下一页