qingcheng奕 |
|
||
2013年10月26日
摘要:
http://oj.leetcode.com/problems/two-sum/求是否存在两个数的和为target,暴力法,两层循环#include #include #include using namespace std;class Solution {public: vector twoSum(vector &numbers, int target) { // Note: The Solution object is instantiated only once and is reused by each test case. //sort(number... 阅读全文
摘要:
http://oj.leetcode.com/problems/longest-valid-parentheses/最大括号匹配长度,括号是可以嵌套的#include #include #include #include using namespace std;class Solution {public: int longestValidParentheses(string s) { const int s_len = s.size(); stack indexstack; vector flagvector; int templ... 阅读全文
摘要:
http://oj.leetcode.com/problems/longest-valid-parentheses/最大括号匹配长度,括号是可以嵌套的。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 class Solution { 7 public: 8 int longestValidParentheses(string s) { 9 const int s_len = s.size();10 11 stack indexstack;12 ... 阅读全文
|
Copyright © 2024 qingcheng奕
Powered by .NET 8.0 on Kubernetes |