2016年8月27日

【LeetCode】81. Search in Rotated Sorted Array II

摘要: 题目: Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a fun 阅读全文

posted @ 2016-08-27 14:50 医生工程师 阅读(126) 评论(0) 推荐(0) 编辑

【LeetCode】33. Search in Rotated Sorted Array 解题小结

摘要: 题目: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a targe 阅读全文

posted @ 2016-08-27 10:43 医生工程师 阅读(129) 评论(0) 推荐(0) 编辑

【LeetCode】217. Contains Duplicate 解题小结

摘要: 题目: 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 阅读全文

posted @ 2016-08-27 10:24 医生工程师 阅读(111) 评论(0) 推荐(0) 编辑

2016年8月26日

【LeetCode】121. Best Time to Buy and Sell Stock 解题小结

摘要: 题目: 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 transac 阅读全文

posted @ 2016-08-26 17:49 医生工程师 阅读(110) 评论(0) 推荐(0) 编辑

【LeetCode】283. Move Zeroes 解题小结

摘要: 题目: 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, 阅读全文

posted @ 2016-08-26 16:51 医生工程师 阅读(110) 评论(0) 推荐(0) 编辑

【LeetCode】119. Pascal's Triangle II QuestionEditorial Solution 解题小结

摘要: 题目: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. 思路大概是一步一步从后往前算出每行的各个元素。 阅读全文

posted @ 2016-08-26 15:33 医生工程师 阅读(139) 评论(0) 推荐(0) 编辑

【LeetCode】26. Remove Duplicates from Sorted Array 解题小结

摘要: 题目: 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 spac 阅读全文

posted @ 2016-08-26 05:19 医生工程师 阅读(108) 评论(0) 推荐(0) 编辑

2016年8月25日

【LeetCode】189. Rotate Array 解题小结

摘要: 题目: 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]. 阅读全文

posted @ 2016-08-25 22:32 医生工程师 阅读(87) 评论(0) 推荐(0) 编辑

2016年8月23日

【LeetCode】1. Two Sum 解题小结

摘要: 题目: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 阅读全文

posted @ 2016-08-23 16:39 医生工程师 阅读(277) 评论(0) 推荐(0) 编辑

【LeetCode】27. Remove Element 解题小结

摘要: 题目: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, y 阅读全文

posted @ 2016-08-23 15:53 医生工程师 阅读(94) 评论(0) 推荐(0) 编辑

导航