原创 leetcode: Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the orig
原创 leetcode: Remove Duplicates from Sorted Array II
Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For example, Given sorted array A =
原创 leetcode: Single Number II
Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algor
原创 leetcode: Reverse Linked List II
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL,
原创 leetcode: Restore IP Addresses
Given a string containing only digits, restore it by returning all possible valid IP address combinations. For examp
原创 leetcode: Distinct Subsequences
Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a
原创 leetcode: Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example
原创 leetcode: regular expression match
太醜bool isMatch(string s, string p) { vector<vector<bool> > dp(s.size() + 1, vector<bool>(p.size() + 1, false));
原创 leetcode 題型 數據結構 解法 分類總結
第2章 線性表 2.1 數組 2.1.1 Remove Duplicates from Sorted Array 2.1.2 Remove Duplicates from Sorted Array II 2.1.3 Sea
原创 leetcode: Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode
原创 leetcode: Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new lengt
原创 leetcode: Regular Expression Matching
Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zer
原创 leetcode: Largest Rectangle in Histogram
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area
原创 leetcode: Substring with Concatenation of All Words
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of subs
原创 leetcode: Balanced Binary Tree
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined