摘要: 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,1,... 阅读全文
posted @ 2014-06-25 23:38 OpenSoucre 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.时间复杂度O(n^3),最大全1子矩阵,利用直方图求解,可以参考对... 阅读全文
posted @ 2014-06-25 23:10 OpenSoucre 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each number ... 阅读全文
posted @ 2014-06-25 22:10 OpenSoucre 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated num... 阅读全文
posted @ 2014-06-25 21:58 OpenSoucre 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matri... 阅读全文
posted @ 2014-06-25 21:40 OpenSoucre 阅读(144) 评论(0) 推荐(0) 编辑
摘要: Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".class Solution {public: string addBinary(str... 阅读全文
posted @ 2014-06-25 21:07 OpenSoucre 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 题目的意思是给一个01的字符串数组,让你去求解满足棋盘条件的最大棋盘棋盘的条件是: 相邻元素的值不能相同此题有点像求全1的最大子矩阵,当时求全1的最大子矩阵是用直方图求解的本题可以利用直方图求解首先找到子矩阵的两个顶点坐标(x0,y0),(x1,y1)我们能遍历开始和结束列,y0=i, y1=j,... 阅读全文
posted @ 2014-06-25 18:44 OpenSoucre 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 题目的意思是给你一组数,然后不断的进行除法(注意是大数除以小数),然后将得到的结果加入这组数种然后继续进行除法,直到没有新添加的数为止此题按照提议模拟即可注意要保持元素的不同 int CountNumbers(vector numbers) { set ss(numbers.b... 阅读全文
posted @ 2014-06-25 16:44 OpenSoucre 阅读(196) 评论(0) 推荐(0) 编辑