05 2017 档案
摘要:题目: 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 "a
阅读全文
摘要:题目: 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 an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order r
阅读全文
摘要:题目: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sort
阅读全文
摘要:题目: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. 链接: http://leetcode.com/problems/set-matrix-zeroes/
阅读全文
摘要:题目: Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c" Corner Cases
阅读全文
摘要:题目: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its pa
阅读全文
摘要:DescriptionGiven a node from a cyclic linked list which has been sorted, write a function to insert a value into the list such that it remains a cycli
阅读全文
摘要:题目: Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, suc
阅读全文
摘要:题目: Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For ex
阅读全文
摘要:题目: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get
阅读全文
摘要:Problem Given a 2D grid, each cell is either a wall 2, an house 1 or empty 0 (the number zero, one, two), find the place to build a post office, the d
阅读全文
摘要:题目: Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer,
阅读全文
摘要:题目: Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are lab
阅读全文
摘要:题目: Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges
阅读全文
摘要:DescriptionGiven a 2D grid, each cell is either a wall 2, a zombie 1 or people 0 (the number zero, one, two).Zombies can turn the nearest people(up/do
阅读全文
摘要:DescriptionGiven a knight in a chessboard (a binary matrix with 0 as empty and 1 as barrier) with a source position, find the shortest path to a desti
阅读全文
摘要:题目: There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you ha
阅读全文
摘要:DescriptionGiven a undirected graph, a node and a target, return the nearest node to given node which value of it is target, return NULL if you can't
阅读全文
摘要:题目: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adj
阅读全文
摘要:DescriptionConvert a binary search tree to doubly linked list with in-order traversal.ExampleGiven a binary search tree: 4 / \ 2 5 / \1 3return 1<->2<
阅读全文
摘要:题目: Given a binary search tree and a node in it, find the in-order successor of that node in the BST. Note: If the given node has no in-order successo
阅读全文
摘要:题目: Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node i
阅读全文
摘要:题目: Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, return [3,2,1]. Note: Recursive
阅读全文
摘要:题目 Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree [1,null,2,3], return [1,3,2]. Note: Recursive
阅读全文
摘要:题目: Given a binary tree, return the preorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3]. Note:
阅读全文
摘要:DescriptionIt's follow up problem for Binary Tree Longest Consecutive Sequence IIGiven a k-ary tree, find the length of the longest consecutive sequen
阅读全文
摘要:题目: Given a binary tree, you need to find the length of Longest Consecutive Path in Binary Tree. Especially, this path can be either increasing or dec
阅读全文
摘要:题目: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example:Given the below binary tree and
阅读全文
摘要:DescriptionGiven the root and two nodes in a Binary Tree. Find the lowest common ancestor(LCA) of the two nodes.The lowest common ancestor is the node
阅读全文
摘要:DescriptionGiven the root and two nodes in a Binary Tree. Find the lowest common ancestor(LCA) of the two nodes.The lowest common ancestor is the node
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The l
阅读全文
摘要:题目: Given a binary tree, flatten it to a linked list in-place. For example,Given The flattened tree should look like: click to show hints. Hints: If y
阅读全文
摘要:DescriptionGiven a binary tree, find the subtree with maximum average. Return the root of the subtree.NoticeLintCode will print the subtree which root
阅读全文
摘要:DescriptionGiven a binary tree, find the subtree with minimum sum. Return the root of the subtree.NoticeLintCode will print the subtree which root is
阅读全文
摘要:题目: Given a binary tree, find the length of the longest consecutive sequence path. The path refers to any sequence of nodes from some starting node to
阅读全文
摘要:题目: Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Suppose an
阅读全文
摘要:题目: Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Suppo
阅读全文
摘要:DescriptionImplement double sqrt(double x) and x >= 0.Compute and return the square root of x.NoticeYou do not care about the accuracy of the result,
阅读全文
浙公网安备 33010602011771号