原创 301. Remove Invalid Parentheses 去掉不合理的括號

Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results

原创 327. Count of Range Sum 滿足某個範圍數內的區間個數

Given an integer array nums, return the number of range sums that lie in [lower, upper] inclusive. Range sum S(i, j) 

原创 30. Substring with Concatenation of All Words 找出包含所有字典中詞的開頭

You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of s

原创 239. Sliding Window Maximum 固定的滑動窗口裏找最大值

Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very

原创 330. Patching Array 給數組添上元素,使得滿足存在所有1~n元素

Given a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in

原创 99. Recover Binary Search Tree 將二叉查找樹中亂序的兩個元素值調整

Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. N

原创 87. Scramble String

Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. B

原创 41. First Missing Positive 第一個不在的正整數

Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, and [3

原创 Expression Add Operators

Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (n

原创 164. Maximum Gap

Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Try to sol

原创 363. Max Sum of Rectangle No Larger Than K 最大累加子矩陣的和且不超過K

Given a non-empty 2D matrix matrix and an integer k, find the max sum of a rectangle in the matrix such that its sum i

原创 51. N-Queens

The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other

原创 2017 網易有道內推

第三題: 一個隊列,先pop一個頭結點放在隊尾,再pop一個頭結點輸出其值並丟棄。最後輸出的序列爲1,2,3,。。。n 問原始隊列元素排列是什麼 輸入:n     //n個數 輸出:一個串 // // main.cpp // y

原创 72. Edit Distance 最小編輯距離

Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation

原创 23. Merge k Sorted Lists 合併k個鏈表

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 1.我的思路      超時了