摘要: 一. 题意描述Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of ... 阅读全文
posted @ 2015-12-30 17:38 铁之贝克 阅读(195) 评论(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).You are given a target v... 阅读全文
posted @ 2015-12-20 22:26 铁之贝克 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 一. 题意描述Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.二. 题目分析看到这道题想到的第一种方法是暴力枚举法,时间复杂度为O(n3),显然是不够好的... 阅读全文
posted @ 2015-12-12 21:29 铁之贝克 阅读(391) 评论(0) 推荐(0) 编辑
摘要: 一. 题目 Leetcode平台上天际线问题A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. No... 阅读全文
posted @ 2015-12-05 12:26 铁之贝克 阅读(503) 评论(0) 推荐(0) 编辑
摘要: 这是LeetCode上的一道题,让我们先来看一看题目:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LC... 阅读全文
posted @ 2015-11-22 15:23 铁之贝克 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 一. 题目简述,这是LeetCode上的一道题,是求直方图最大面积,原题题干如下:Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find th... 阅读全文
posted @ 2015-11-11 23:51 铁之贝克 阅读(471) 评论(0) 推荐(0) 编辑
摘要: 1.题目描述:题目大意是实现一个只有加法,减法和括号的表达式求值,表达式中所有数都是正整数。2.解题思路:这道题其实是一道简化版的表达式求值问题,可以使用经典的算符优先法求解,即建立运算符栈和操作数栈,然后进行各种进出栈操作。同时这道题只有加号,减号和括号三种运算符的特性有让我们对算符优先法进行一些... 阅读全文
posted @ 2015-10-28 22:40 铁之贝克 阅读(427) 评论(1) 推荐(0) 编辑