
leetcode
专业跳大神儿
吾生也有涯,学也无涯。
展开
-
minimum-depth-of-binary-tree
leetcode上的一道题:minimum-depth-of-binary-tree 问题描述:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf原创 2017-08-11 09:45:11 · 167 阅读 · 0 评论 -
evaluate-reverse-polish-notation
leetcode 的一道利用栈来求后缀表达式的简单的栈应用的题具体思路: 逐个字符串进行判断 1:如果是操作符则栈中至少有两个数,将两个数从栈中弹出,判断操作符是什么并对这两个数进行计算,再将计算的结果存到栈中。 2:如果是数字,则利用toInteger(const string &str)函数进行转化,然后压入栈中。 当vector遍历一遍之后,栈中就只剩下最终结果。 代码如下:class原创 2017-08-12 13:41:36 · 182 阅读 · 0 评论 -
max-points-on-a-line
leetcode 题目:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 题意:给出二维平面的n个点,需要找到位于同一直线上的最大点数。分析: 1:首先考虑特殊情况,没有点的时候,最大的点数为0,只有一个点的时候则为1。 2:对于一般情况来讲原创 2017-08-13 11:02:00 · 207 阅读 · 0 评论