自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(110)
  • 资源 (1)
  • 收藏
  • 关注

原创 [LeetCode] Minimum Window Substring

class Solution {public: string minWindow(string S, string T) { // Start typing your C/C++ solution below // DO NOT write int main() function int m = S.size(); int

2013-01-29 20:35:14 725

原创 [LeetCode] Permutation Sequence

class Solution {public: void next(vector &v, int n) { if (n < 2) return; int i = n - 2; for (; i >= 0 && v[i] >= v[i + 1]; i--); int j = n - 1; fo

2013-01-29 20:14:03 459

原创 [LeetCode] Next Permutation

class Solution {public: void nextPermutation(vector &num) { // Start typing your C/C++ solution below // DO NOT write int main() function int n = num.size();

2013-01-29 20:06:37 511

原创 [LeetCode] Regular Expression Matching - Recursively

class Solution {public: bool match(const char *s, const char *p, char ch) { do { if (isMatch(s, p)) return true; } while (*s && (*s++ == ch || ch == '.

2013-01-29 19:49:31 863

原创 [LeetCode] Wildcard Matching - Iteratively

class Solution {public: bool isMatch(const char *s, const char *p) { // Start typing your C/C++ solution below // DO NOT write int main() function if (!*p) return !*s;

2013-01-29 19:08:32 758

原创 [LeetCode] 3Sum Closest

class Solution {public: int threeSumClosest(vector &num, int target) { // Start typing your C/C++ solution below // DO NOT write int main() function if (num.size() < 3) re

2013-01-29 18:11:05 443

原创 [LeetCode] 3Sum

class Solution {public: vector > threeSum(vector &num) { // Start typing your C/C++ solution below // DO NOT write int main() function vector > ret; if (num.empty(

2013-01-29 18:02:12 465

原创 [LeetCode] Longest Palindromic Substring - O(n)

#include #include using namespace std;class Solution {public: string longestPalindrome(string s) { // Start typing your C/C++ solution below // DO NOT write int main() functio

2013-01-29 16:48:21 632

原创 [LeetCode] Longest Palindromic Substring

class Solution {public: string longestPalindrome(string s) { // Start typing your C/C++ solution below // DO NOT write int main() function int len = s.length(); in

2013-01-29 15:24:22 517

原创 [LeetCode] Longest Substring Without Repeating Characters

class Solution {public: int lengthOfLongestSubstring(string s) { // Start typing your C/C++ solution below // DO NOT write int main() function vector v(256, -1);

2013-01-29 11:24:55 581

原创 [LeetCode] Longest Common Prefix

class Solution {public: string longestCommonPrefix(vector &strs) { // Start typing your C/C++ solution below // DO NOT write int main() function if (strs.empty()) return "

2013-01-29 11:10:02 704

原创 [LeetCode] Container With Most Water

struct Wrapper { int val; int pos;};bool compare(const Wrapper &w1, const Wrapper &w2) { return w1.val > w2.val;}class Solution {public: int maxArea(vector &height) { //

2013-01-29 10:57:37 465

原创 [LeetCode] Palindrome Number

class Solution {public: bool isPalindrome(int x) { // Start typing your C/C++ solution below // DO NOT write int main() function if (x < 0) return false;

2013-01-29 10:40:28 463

原创 [LeetCode] Reverse Integer

class Solution {public: int reverse(int x) { // Start typing your C/C++ solution below // DO NOT write int main() function bool neg = false; if (x < 0) {

2013-01-29 10:35:15 549

原创 [LeetCode] Zigzag Conversion

class Solution {public: string convert(string s, int nRows) { // Start typing your C/C++ solution below // DO NOT write int main() function if (nRows == 1) return s;

2013-01-29 10:31:18 1043

原创 [LeetCode] Add Two Numbers

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *ad

2013-01-29 10:04:53 502

原创 [LeetCode] Two Sum

struct Wrapper { int val; int pos;};bool compare(const Wrapper &w1, const Wrapper &w2) { return w1.val < w2.val;}class Solution {public: vector twoSum(vector &numbers, int targe

2013-01-29 00:39:08 503

原创 [LeetCode] Triangle

class Solution {public: int minimumTotal(vector > &triangle) { // Start typing your C/C++ solution below // DO NOT write int main() function int n = triangle.size();

2013-01-29 00:29:36 507

原创 [LeetCode] Pascal's Triangle

class Solution {public: vector > generate(int numRows) { // Start typing your C/C++ solution below // DO NOT write int main() function vector > ret; if (n

2013-01-29 00:29:20 388

原创 [LeetCode] Pascal's Triangle II

class Solution {public: vector getRow(int rowIndex) { // Start typing your C/C++ solution below // DO NOT write int main() function vector ret(rowIndex + 1, 1);

2013-01-29 00:29:11 393

原创 [LeetCode] Unique Binary Search Trees II

/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Soluti

2013-01-29 00:29:02 482

原创 [LeetCode] Restore IP Addresses

class Solution {public: vector ret; vector sln; int stoi(string s) { int n = s.size(); if (n >= 2 && s[0] == '0') return 256; int ret = 0;

2013-01-29 00:28:52 420

原创 [LeetCode] Gray Code

class Solution {public: vector grayCode(int n) { // Start typing your C/C++ solution below // DO NOT write int main() function vector v; v.push_back(0);

2013-01-29 00:28:38 379

原创 [LeetCode] Scramble String

class Solution {public: bool isScramble(string s1, string s2) { // Start typing your C/C++ solution below // DO NOT write int main() function int n = s1.size();

2013-01-29 00:28:23 512

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

class Solution {public: int maxProfit(vector &prices) { // Start typing your C/C++ solution below // DO NOT write int main() function int n = prices.size(); if (n

2013-01-28 19:47:43 349

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

class Solution {public: int maxProfit(vector &prices) { // Start typing your C/C++ solution below // DO NOT write int main() function int ret = 0; for (int i = 1;

2013-01-28 19:42:49 404

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

class Solution {public: int maxProfit(vector &prices) { // Start typing your C/C++ solution below // DO NOT write int main() function if (prices.empty()) return 0;

2013-01-28 19:40:42 329

原创 [LeetCode] Binary Tree Maximum Path Sum

/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Soluti

2013-01-28 19:36:48 414

原创 [LeetCode] Valid Palindrome

class Solution {public: bool isPalindrome(string s) { // Start typing your C/C++ solution below // DO NOT write int main() function vector v; for (int i =

2013-01-28 19:29:54 428

原创 [LeetCode] Letter Combinations of a Phone Number

class Solution {public: vector map; vector ret; vector sln; Solution() { map.push_back(""); map.push_back(""); map.push_back("abc"); map.push_back

2013-01-28 18:36:29 432

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

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *re

2013-01-28 18:26:49 395

原创 [LeetCode] Generate Parentheses

class Solution {public: vector ret; vector sln; void DFS(int p, int q) { if (p > q) return; if (q == 0) { string s = "";

2013-01-28 18:20:25 540

原创 [LeetCode] Valid Parenthese

class Solution {public: bool isValid(string s) { // Start typing your C/C++ solution below // DO NOT write int main() function stack stk; for (int i = 0;

2013-01-28 18:07:33 407

原创 [LeetCode] Swap Nodes in Pairs

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *sw

2013-01-28 17:59:43 395

原创 [LeetCode] Remove Duplicates from Sorted Array

class Solution {public: int removeDuplicates(int A[], int n) { // Start typing your C/C++ solution below // DO NOT write int main() function if (n == 0) return 0;

2013-01-28 17:50:43 397

原创 [LeetCode] Remove Element

class Solution {public: int removeElement(int A[], int n, int elem) { // Start typing your C/C++ solution below // DO NOT write int main() function int i = 0;

2013-01-28 17:44:55 378

原创 [LeetCode] Rotate Image

class Solution {public: void rotate(vector > &matrix) { // Start typing your C/C++ solution below // DO NOT write int main() function int n = matrix.size(); if (n

2013-01-28 17:39:45 536

原创 [LeetCode] Anagrams

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

2013-01-28 17:26:29 746

原创 [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; while (l <= r) { int p = (l + r) / 2; if (A[

2013-01-28 16:41:27 408

原创 [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; while (l <= r) { int p = (l + r) / 2; if

2013-01-28 15:10:16 456

IA-32 Intel manual

Intel IA-32 manual part 3A

2011-12-07

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除