摘要:
class Solution { public: bool isValid(string s) { if(s.size()==0) return true; map<char,char> hash={ {')','('}, {'}','{'}, {']','['} }; stack<int> st; 阅读全文
摘要:
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solu 阅读全文
摘要:
class Solution { public: void dfs(string digits, int idx, map<char,string> hash, string path, vector<string>& res){ if(idx==digits.size()){ res.push_b 阅读全文
摘要:
题目:三数之和 题目描述: 给你一个整数数组 nums ,判断是否存在三元组 [nums[i], nums[j], nums[k]] 满足 i != j、i != k 且 j != k ,同时还满足 nums[i] + nums[j] + nums[k] == 0 。请 你返回所有和为 0 且不重复 阅读全文
摘要:
class Solution { public: int maxArea(vector<int>& height) { if(height.size()==0) return 0; int left=0,right=height.size()-1; int res=INT_MIN; while(le 阅读全文
摘要:
class Solution { public: bool isMatch(string s, string p) { int m=s.size(),n=p.size(); vector<vector<bool>> dp(m+1,vector<bool>(n+1,false)); dp[0][0]= 阅读全文
摘要:
class Solution { public: string longestPalindrome(string s) { if(s.size()==0 || s.size()==1) return s; int n=s.size(); vector<vector<bool>> isPail(n,v 阅读全文
摘要:
class Solution { public: double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) { int len1=nums1.size(),len2=nums2.size(); if(len1>len2 阅读全文