摘要: code第一部分数组:第二十三题 奇数次中查找单独出现一次的数 Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorit 阅读全文
posted @ 2017-02-25 22:19 taoliu_alex 阅读(248) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:第二十二题 偶数次中查找单独出现一次的数 Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm shou 阅读全文
posted @ 2017-02-25 22:18 taoliu_alex 阅读(126) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:第二十一题:分糖果 给糖果,每人至少一颗,高分孩子得到比左右多,求糖果数。there are N children standing in a line. Each child is assigned a rating value.You are giving candies 阅读全文
posted @ 2017-02-25 22:17 taoliu_alex 阅读(280) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:第二十题:加油站 there are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited g 阅读全文
posted @ 2017-02-25 22:16 taoliu_alex 阅读(153) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:第十九题 矩阵元素为0,横列置零 分析 O(m + n) 空间的方法很简单,设置两个数组,记录每行和每列是否存在 0。 阅读全文
posted @ 2017-02-25 22:15 taoliu_alex 阅读(257) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:第十七题 爬楼梯问题 You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many dis 阅读全文
posted @ 2017-02-25 22:14 taoliu_alex 阅读(253) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:第十六题 数组表示数,加一操作 Given a number represented as an array of digits, plus one to the number. 阅读全文
posted @ 2017-02-25 22:13 taoliu_alex 阅读(230) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:第十五题 矩阵翻转(图像翻转) 首先想到,纯模拟,从外到内一圈一圈的转,但这个方法太慢。如下图,首先沿着副对角线翻转一次,然后沿着水平中线翻转一次。 源代码 阅读全文
posted @ 2017-02-25 22:12 taoliu_alex 阅读(291) 评论(0) 推荐(0) 编辑
摘要: code第一部分:数组 第十四题 雨水问题 Given n non-negative integers representing an elevation map where the width of each bar is 1, computehow much water it is able t 阅读全文
posted @ 2017-02-25 22:10 taoliu_alex 阅读(285) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:第十题:移除数组中目标元素 Given an array and a value, remove all instances of that value in place and return the new length.the order of elements can b 阅读全文
posted @ 2017-02-25 22:09 taoliu_alex 阅读(181) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:第九题 四个元素之和为给定目标 Given an array S of n integers, are there elements a, b, c, and d in S such that a+b+c+d = target?Find all unique quadruple 阅读全文
posted @ 2017-02-25 22:07 taoliu_alex 阅读(207) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:第八题 三个元素和最接近给定目标 Given an array S of n integers, find three integers in S such that the sum is closest to a given number,target. Return the 阅读全文
posted @ 2017-02-25 22:06 taoliu_alex 阅读(168) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:第七题 给定数组三个元素求和为0 Given an array S of n integers, are there elements a, b, c in S such that a+ b+ c = 0? Find all uniquetriplets in the arra 阅读全文
posted @ 2017-02-25 22:05 taoliu_alex 阅读(356) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:6 数组中最长连续序列 Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example, Given [100, 4, 2 阅读全文
posted @ 2017-02-25 22:03 taoliu_alex 阅读(265) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:两个有序数组的中位数 there are two sorted arrays A and B of size m and n respectively. Find the median of the two sortedarrays. the overall run time 阅读全文
posted @ 2017-02-25 22:02 taoliu_alex 阅读(168) 评论(0) 推荐(0) 编辑
摘要: code第一部分:数组, 在反转数组中查找,有重复数据 Would this affect the run-time complexity? How and why?Write a function to determine if a given target is in the array. 分析 阅读全文
posted @ 2017-02-25 22:00 taoliu_alex 阅读(187) 评论(0) 推荐(0) 编辑
摘要: code第一部分:数组:在反转数组中查找 在反转数组中查找,无重复数据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 阅读全文
posted @ 2017-02-25 21:59 taoliu_alex 阅读(458) 评论(0) 推荐(0) 编辑
摘要: code第一部分数组:从有序数组中移除重复的数据 第二题 从有序数组中移除重复的数据,但是可以保留2个重复的数。For example, Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and 阅读全文
posted @ 2017-02-25 21:55 taoliu_alex 阅读(308) 评论(0) 推荐(0) 编辑
摘要: code第一部分:数组 都说写代码一定要自己尝试,看再多也没有,确实是的;之前写过很多,感觉可以分享给大家的就放到博客上,希望激励自己好好敲代码。共勉吧! 之前一段时间把关于数组部分的内容做了一些;每周我会集中上传一次;任务量还是很大的;废话不多说,开始! 首先我把题目按照大的分类,总结起来了,这一 阅读全文
posted @ 2017-02-25 21:50 taoliu_alex 阅读(413) 评论(0) 推荐(0) 编辑