原创 【leetcode】Word Ladder

Word Ladder 鏈接:https://oj.leetcode.com/problems/word-ladder/   描述: Given two words (start and end),

原创 【leetcode】Word Break && Word Break II

Word Break  DP 直接代碼: bool wordBreak(string &s, set<string> &dict) { int len = s.length(); if( len <= 0) return true

原创 【leetcode】Populating Next Right Pointers in Each Node

Populating Next Right Pointers in Each Node 鏈接:https://oj.leetcode.com/problems/populating-next-right-pointers-in

原创 Sum Root to Leaf Numbers

鏈接:https://oj.leetcode.com/problems/sum-root-to-leaf-numbers/ 描述: Given a binary tree containing digits from 0-9 onl

原创 【leetcode】Best Time to Buy and Sell Stock I && II && III

Best Time to Buy and Sell Stock 鏈接:https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock/ 描述: Say you hav

原创 【leetcode】Surrounded Regions

鏈接:https://oj.leetcode.com/problems/surrounded-regions/ 描述: Given a 2D board containing 'X' and 'O', capture all r

原创 【leetcode】Clone Graph

鏈接:https://oj.leetcode.com/problems/clone-graph/ 描述: Clone an undirected graph. Each node in the graph contains a la

原创 ×【leetcode】Binary Tree Maximum Path Sum

鏈接:https://oj.leetcode.com/problems/binary-tree-maximum-path-sum/ 描述: Given a binary tree, find the maximum path sum

原创 【leetcode】Palindrome Partitioning && Palindrome Partitioning II

Palindrome Partitioning 鏈接:https://oj.leetcode.com/problems/palindrome-partitioning/  描述: Given a stri

原创 確保對象的唯一性——單例模式

目錄(?)[+] 前言: 這是一篇我見過的講單例模式最完整的,也是講的最好的一篇博客文章。 3. 1 單例模式的動機       對於一個軟件系統的某些類而言,我們無須創建多個實例。舉個大家都熟知的例子——Wind

原创 【leetcode】Longest Consecutive Sequence

鏈接:https://oj.leetcode.com/problems/longest-consecutive-sequence/ 描述: Given an unsorted array of integers, find the

原创 C++ inline

一、什麼叫inline函數?  inline(小心,不是online),翻譯成“內聯”或“內嵌”。意指:當編譯器發現某段代碼在調用一個內聯函數時,它不是去調用該函數,而是將該函數的代碼,整段插入到當前位置。這樣做的好處是省去了調用的過程

原创 【leetcode】Pascal's Triangle && Pascal's Triangle II

鏈接:https://oj.leetcode.com/problems/pascals-triangle/ 描述: Given numRows, generate the first numRows of Pascal's tria

原创 【leetcode】Single Number && Single Number II

Single Number  鏈接:https://oj.leetcode.com/problems/single-number/ 描述: Given an array of integers, every element app

原创 【leetcode】Copy List with Random Pointer

鏈接:https://oj.leetcode.com/problems/copy-list-with-random-pointer/ 描述: A linked list is given such that each node c