
算法
文章平均质量分 77
Matcha_ee
这个作者很懒,什么都没留下…
展开
-
LeetCode - 28. Implement strStr()
题目:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.思路与步骤:两个字符串逐个字符比较,如果两个字符串第一个不同,则大的下标加1,小的不变,依次循环;如果相同,则依次逐个比较原创 2017-02-19 22:19:55 · 261 阅读 · 0 评论 -
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]. Note:Try to come up as many solutions as原创 2017-02-22 17:52:27 · 245 阅读 · 0 评论 -
LeeyCode - 167. Two Sum II - Input array is sorted
题目:Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two n原创 2017-02-23 13:56:33 · 374 阅读 · 0 评论 -
LeetCode - 268. Missing Number
题目:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.思路与步骤:思路1:先排序,然后将数组与下标比较,第一次出现不相等的下标即确实数据。学习别人的思路:思路2:先对0到原创 2017-02-22 22:51:25 · 240 阅读 · 0 评论 -
LeetCode - 35. Search Insert Position
题目: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 order.You may assume no duplicates in the a原创 2017-02-24 17:30:18 · 269 阅读 · 0 评论