原创 [LeetCode] Valid Parenthese

class Solution { public: bool isValid(string s) { // Start typing your C/C++ solution below // DO N

原创 [LeetCode] Best Time to Buy and Sell Stock III

class Solution { public: int maxProfit(vector<int> &prices) { // Start typing your C/C++ solution below

原创 [LeetCode] Search in Rotated Sorted Array

class Solution { public: int search(int A[], int s, int t, int target) { int l = s; int r = t;

原创 [LeetCode] Remove Element

class Solution { public: int removeElement(int A[], int n, int elem) { // Start typing your C/C++ solution

原创 [LeetCode] Anagrams

bool compare(string s1, string s2) { sort(s1.begin(), s1.end()); sort(s2.begin(), s2.end()); return s1

原创 [LeetCode] Best Time to Buy and Sell Stock

class Solution { public: int maxProfit(vector<int> &prices) { // Start typing your C/C++ solution below

原创 [LeetCode] Unique Binary Search Trees II

/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right;

原创 [LeetCode] Remove Nth Node From End of List

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(i

原创 [LeetCode] Valid Palindrome

class Solution { public: bool isPalindrome(string s) { // Start typing your C/C++ solution below //

原创 [LeetCode] Gray Code

class Solution { public: vector<int> grayCode(int n) { // Start typing your C/C++ solution below //

原创 [LeetCode] Remove Duplicates from Sorted Array

class Solution { public: int removeDuplicates(int A[], int n) { // Start typing your C/C++ solution below

原创 [LeetCode] Search for a Range

class Solution { public: int find_left(int A[], int s, int t, int target) { int l = s; int r = t;

原创 [LeetCode] Rotate Image

class Solution { public: void rotate(vector<vector<int> > &matrix) { // Start typing your C/C++ solution be

原创 [LeetCode] Swap Nodes in Pairs

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(i

原创 [LeetCode] Binary Tree Maximum Path Sum

/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right;