自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 leetcode 85. Maximal Rectangle 最大矩形

Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.Example:Input:[ ["1","0","1","0","0"], ["1","0","1&quo

2018-09-29 12:44:21 279

原创 leetcode 84. Largest Rectangle in Histogram 柱状图中最大的矩形

Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each ...

2018-09-29 11:06:11 350

原创 leetcode 714. 买卖股票的最佳时机含手续费 best-time-to-buy-and-sell-stock-with-transaction-fee

给定一个整数数组 prices,其中第 i 个元素代表了第 i 天的股票价格 ;非负整数 fee 代表了交易股票的手续费用。你可以无限次地完成交易,但是你每次交易都需要付手续费。如果你已经购买了一个股票,在卖出它之前你就不能再继续购买股票了。返回获得利润的最大值。示例 1:输入: prices = [1, 3, 2, 8, 4, 9], fee = 2输出: 8解释: 能够达...

2018-09-26 15:24:28 653

原创 leetcode 4.两个排序数组的中位数

给定两个大小为 m 和 n 的有序数组 nums1 和 nums2 。请找出这两个有序数组的中位数。要求算法的时间复杂度为 O(log (m+n)) 。你可以假设 nums1 和 nums2 不同时为空。示例 1:nums1 = [1, 3]nums2 = [2]中位数是 2.0示例 2:nums1 = [1, 2]nums2 = [3, 4]中位数是 (...

2018-09-20 14:23:35 229

原创 lintcode 186. 最多有多少个点在一条直线上

描述给出二维平面上的n个点,求最多有多少点在同一条直线上。您在真实的面试中是否遇到过这个题?  是题目纠错样例给出4个点:(1, 2), (3, 6), (0, 0), (1, 3)。一条直线上的点最多有3个。 题意很简单,思路就是二重循环枚举一下计算i点和j点的斜率K_ij,然后记录K_ij出现的次数,取最大的那个就是直线过i点的最大共线点个数。枚举完所有的i...

2018-09-13 15:51:19 897

原创 lintcode 1259. Integer Replacement 搜索

描述Given a positive integer n and you can do operations as follow:1.If n is even, replace n with n/2.2.If n is odd, you can replace n with either n + 1 or n - 1.What is the minimum number of rep...

2018-09-13 14:31:04 231

原创 131. The Skyline Problem 矩形并问题

描述水平面上有 N 座大楼,每座大楼都是矩阵的形状,可以用一个三元组表示 (start, end, height),分别代表其在x轴上的起点,终点和高度。大楼之间从远处看可能会重叠,求出 N 座大楼的外轮廓线。外轮廓线的表示方法为若干三元组,每个三元组包含三个数字 (start, end, height),代表这段轮廓的起始位置,终止位置和高度。请注意合并同样高度的相邻轮廓,不同的...

2018-09-06 17:30:53 426

原创 lintcode 1363. ZigZag Conversion 字符串处理

描述The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S...

2018-09-04 12:41:29 249

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除