上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 16 下一页
摘要: 一、2Sum思路1:首先对数组排序。不过由于最后返回两个数字的索引,所以需要事先对数据进行备份。然后采用2个指针l和r,分别从左端和右端向中间运动:当l和r位置的两个数字之和小于目标数字target时,r减1;当l和r位置的两个数字之和大于目标数字target时,l加1。因此只需扫描一遍数组就可以检... 阅读全文
posted @ 2016-01-18 11:11 很好玩 阅读(4166) 评论(1) 推荐(0) 编辑
摘要: 题目:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Ele... 阅读全文
posted @ 2016-01-17 23:19 很好玩 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum ... 阅读全文
posted @ 2016-01-17 22:30 很好玩 阅读(189) 评论(0) 推荐(0) 编辑
摘要: Best Time to Buy and Sell Stock I题目:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to ... 阅读全文
posted @ 2016-01-16 00:14 很好玩 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 题目:Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints ... 阅读全文
posted @ 2016-01-15 23:46 很好玩 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element.Yo... 阅读全文
posted @ 2016-01-14 22:39 很好玩 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 题目:A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return its ind... 阅读全文
posted @ 2016-01-13 23:20 很好玩 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 今天做项目中,用background显示了二维码和一些文字,但显示到页面上时,二维码和图片都变得模糊了。于是将图片调整、放大,但在放大后,作为背景图片的它则显示不全,无奈之下用了backgroung-size。但background-size在IE下不兼容,故最后使用了img+width+hei... 阅读全文
posted @ 2016-01-13 16:54 很好玩 阅读(8486) 评论(0) 推荐(4) 编辑
摘要: 题目:According to theWikipedia's article: "TheGame of Life, also known simply asLife, is a cellular automaton devised by the British mathematician John ... 阅读全文
posted @ 2016-01-13 11:22 很好玩 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your max... 阅读全文
posted @ 2016-01-13 10:43 很好玩 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 一、什么是层叠上下文和层叠水平层叠上下文和层叠水平有一点儿抽象。我们可以吧层叠上下问想象成一张桌子,如果有另一个桌子在他旁边,则代表了另一个层叠上下文。Stacking context 1由文件根元素构建,Stacking context 2和Stacking context 3是在Stacking... 阅读全文
posted @ 2016-01-11 15:36 很好玩 阅读(1350) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an integer array of sizen, find all elements that appear more than⌊ n/3 ⌋times. The algorithm should run in linear time and in O(1) space.思路:... 阅读全文
posted @ 2016-01-10 22:42 很好玩 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 题目:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],... 阅读全文
posted @ 2016-01-10 20:55 很好玩 阅读(191) 评论(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 @ 2016-01-09 11:40 很好玩 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 题目:Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note... 阅读全文
posted @ 2016-01-08 22:44 很好玩 阅读(163) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 16 下一页