随笔分类 - LeetCode
摘要:题目链接Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example, If n = 4 and k = 2, a solution is:[ [2,4], ...
阅读全文
摘要:题目链接Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "ad...
阅读全文
摘要:LeetCode:Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear only once.For example, Give...
阅读全文
摘要:LeetCode:Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear only once and return th...
阅读全文
摘要:题目链接Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example, S = "ADOB...
阅读全文
摘要:题目链接Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.分析:一般一个题目我首先会想想怎么暴力解决,比如这一题,可...
阅读全文
摘要:题目链接Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the ...
阅读全文
摘要:题目链接Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the o...
阅读全文
摘要:题目链接Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representa...
阅读全文
摘要:题目链接Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space to hold additional element...
阅读全文
摘要:题目链接The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total nu...
阅读全文
摘要:题目链接A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message c...
阅读全文
摘要:求集合的所有子集问题LeetCode:SubsetsGiven a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.Th...
阅读全文
摘要:题目链接Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another exp...
阅读全文
摘要:题目链接Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NUL...
阅读全文
摘要:题目链接Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given"25525511135",return["2...
阅读全文
摘要:LeetCode:Unique Binary Search TreesGivenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there...
阅读全文
摘要:题目链接Givens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", return true.When...
阅读全文
摘要:题目链接Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains on...
阅读全文
摘要:其他LeetCode题目欢迎访问:LeetCode结题报告索引题目链接Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.N...
阅读全文