Spurs

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页

2017年8月19日

摘要: Given a matrix, if an element is , set its entire row and column to . Do it in place. 重点是空间复杂度限制为常数. 人家想法: 用 matrix 的第0行和第0列的元素分别记录所对应的行和列是否有0. 比较特殊,我 阅读全文
posted @ 2017-08-19 12:19 英雄与侠义的化身 阅读(120) 评论(0) 推荐(0) 编辑

2017年8月18日

摘要: Given an array of integers, are there elements in such that ? Find all unique triplets in the array which gives the sum of zero. Note: The solution se 阅读全文
posted @ 2017-08-18 21:49 英雄与侠义的化身 阅读(123) 评论(0) 推荐(0) 编辑

2017年8月17日

摘要: 给一个非负数组A,元素们是A[i], i=0,...,n 1. 索引i代表x坐标,值A[i]表示高度.索引i与A[i],既(i, A[i])表示了垂直于x轴的线段. 请找出两条线段,与x轴组成的桶最多能装多少水? 人家想法: 先从底最宽搜起.两个边找最矮的移动,计算容积,保留最大值,循环条件 lef 阅读全文
posted @ 2017-08-17 23:12 英雄与侠义的化身 阅读(97) 评论(0) 推荐(0) 编辑

摘要: Follow up for "153. Find Minimum in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run time complexity? How and why? Sup 阅读全文
posted @ 2017-08-17 12:31 英雄与侠义的化身 阅读(88) 评论(0) 推荐(0) 编辑

2017年8月16日

摘要: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., might become ). Find the minimum element. You ma 阅读全文
posted @ 2017-08-16 18:23 英雄与侠义的化身 阅读(87) 评论(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 w 阅读全文
posted @ 2017-08-16 16:44 英雄与侠义的化身 阅读(100) 评论(0) 推荐(0) 编辑

2017年8月15日

摘要: Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Example 2: Note: 1. The length of the g 阅读全文
posted @ 2017-08-15 17:42 英雄与侠义的化身 阅读(100) 评论(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 阅读全文
posted @ 2017-08-15 16:27 英雄与侠义的化身 阅读(84) 评论(0) 推荐(0) 编辑

摘要: In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. 阅读全文
posted @ 2017-08-15 00:00 英雄与侠义的化身 阅读(100) 评论(0) 推荐(0) 编辑

2017年8月14日

摘要: Given an array of 2n integers, your task is to group these integers into n pairs of integer, say $(a_1, b_1), (a_2, b_2), ..., (a_n, b_n)$ which makes 阅读全文
posted @ 2017-08-14 23:00 英雄与侠义的化身 阅读(84) 评论(0) 推荐(0) 编辑

上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页