摘要: Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an inte 阅读全文
posted @ 2018-03-28 20:11 还是说得清点吧 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be 阅读全文
posted @ 2018-03-26 22:30 还是说得清点吧 阅读(102) 评论(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 @ 2018-03-26 21:56 还是说得清点吧 阅读(121) 评论(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 @ 2018-03-25 21:53 还是说得清点吧 阅读(96) 评论(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 @ 2018-03-25 21:16 还是说得清点吧 阅读(121) 评论(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 @ 2018-03-25 20:38 还是说得清点吧 阅读(103) 评论(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 @ 2018-03-22 21:58 还是说得清点吧 阅读(81) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers nums, write a method that returns the "pivot" index of this array. We define the pivot index as the index where the sum of 阅读全文
posted @ 2018-03-22 20:48 还是说得清点吧 阅读(174) 评论(0) 推荐(0) 编辑
摘要: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return 贴上一个更加简洁的方法: 阅读全文
posted @ 2018-03-21 21:41 还是说得清点吧 阅读(115) 评论(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 @ 2018-03-21 20:59 还是说得清点吧 阅读(117) 评论(1) 推荐(0) 编辑