LeetCode
蓝色瞬间
这个作者很懒,什么都没留下…
展开
-
[LeetCode]Evaluate Reverse Polish Notation
这道题主要难点是栈的使用。#include #include #include #include using namespace std;class Solution {public: bool IsOp(string s) { if (s == "+" || s == "-" || s == "*" || s == "/") return true; els原创 2014-04-06 10:26:32 · 412 阅读 · 0 评论 -
[LleetCode]Reverse Words in a String
#include #include #include using namespace std;class Solution {public: string ss; void reverseWords(string &s) { stack s1, s2; int l = s.length(); char *a = new char[l + 1]; int i, sta原创 2014-04-06 10:22:03 · 485 阅读 · 0 评论 -
[LeetCode]Max Points on a Line
class Solution {public: int maxPoints(vector &points) { int size = points.size(); if (points.size() < 2) return points.size(); bool **a = new bool*[size]; for (int i = 0; i < size; i++)原创 2014-04-06 10:35:41 · 410 阅读 · 0 评论 -
【LeetCode】Min Stack
class MinStack {public: void push(int x) { if (mini.empty()) { mini.push(x); mystack.push(x); return; } if (mini.top()>=x) { mini.push(x); } mystack.push(x); ret原创 2014-12-26 12:29:12 · 475 阅读 · 0 评论