原创 leetcode101. Symmetric Tree
Q: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this
原创 leetcode92. Reverse Linked List II
medium程度 題目: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3-
原创 leetcode25. Reverse Nodes in k-Group
Hard程度題 題目: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a
原创 leetcode143. Reorder List
medium程度題 題目: Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this
原创 STL源碼剖析——內存空間管理
STL內存空間管理工具alloc 1.第一級配置器__malloc_alloc_template staic void *allocate(size_t n) { void *result = malloc(n);//直接
原创 leetcode 96. Unique Binary Search Trees
題目: 思路: 以k爲根節點的樹,左子樹爲【1,…,K - 1】,右子樹爲【K + 1,…,N】,定義f(n)爲【1,…,n】能產生不同的二叉搜索樹的個數,則以K爲根節點能產生f(k - 1) * f(n - k)種不同的樹
原创 leetcode100. Same Tree
easy程度題 Q: Given two binary trees, write a function to check if they are equal or not. Two binary trees are conside
原创 STL源碼剖析——type traits編程技法
type traits 負責萃取元素類型的特性,如果元素具有某個性質則我們調用某個函數,如果不具有某個性質則調用另一個函數。它充分利用了C++模板編程和編譯器的參數推導功能(編譯器只有面對類類型參數纔會進行參數推導)。STL大量運
原创 leetcode10. Regular Expression Matching
難度:hard 題目: AC解: class Solution { public: bool isMatch(string s, string p) { int slen = s.length();
原创 leetcode260. Single Number III
先說第一種題 題目: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your
原创 leetcode125. Valid Palindrome
easy程度題 題目: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring ca
原创 leetcode8. String to Integer (atoi)
medium程度題 題目: Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. I
原创 leetcode93. Restore IP Addresses
難度:medium 題目: IP 地址是一個32位的整數,每8位的十進制組成一個數,用 . 分隔 很明顯是一個回朔法的題,特別注意的是遇到0時的情況,還有每個數值要小於256,進行剪枝減小運算量 AC解: class Solut
原创 leetcode28. Implement strStr()
easy程度題 題目: Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is
原创 STL源碼剖析——deque的實現
deque簡介 deque是一個雙向開口的容器,可在頭尾兩端插入和刪除元素,deque由動態的連續空間組合而成,因爲迭代器的良好設計,提供了隨機訪問,造成一種deque爲連續空間的假象 deque的數據結構 deque有一個二級指針map