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 阅读全文
posted @ 2017-05-31 02:58 panini 阅读(165) 评论(0) 推荐(0)
摘要:题目: 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], 阅读全文
posted @ 2017-05-30 00:10 panini 阅读(171) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-29 22:50 panini 阅读(157) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-29 11:18 panini 阅读(160) 评论(0) 推荐(0)
摘要:题目: 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/ 阅读全文
posted @ 2017-05-29 10:33 panini 阅读(131) 评论(0) 推荐(0)
摘要:题目: Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c" Corner Cases 阅读全文
posted @ 2017-05-28 07:25 panini 阅读(135) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-21 07:22 panini 阅读(111) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2017-05-21 02:13 panini 阅读(2) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2017-05-20 11:53 panini 阅读(2) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2017-05-20 09:38 panini 阅读(2) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-05-19 05:25 panini 阅读(620) 评论(0) 推荐(0)
摘要:题目: Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, suc 阅读全文
posted @ 2017-05-18 11:32 panini 阅读(328) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-18 06:31 panini 阅读(337) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2017-05-16 01:26 panini 阅读(2) 评论(0) 推荐(0)
摘要:题目: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get 阅读全文
posted @ 2017-05-15 08:26 panini 阅读(183) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-05-15 02:32 panini 阅读(618) 评论(0) 推荐(0)
摘要:题目: 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, 阅读全文
posted @ 2017-05-15 00:06 panini 阅读(158) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-14 22:53 panini 阅读(176) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-14 12:01 panini 阅读(204) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-05-14 10:33 panini 阅读(529) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-05-14 09:16 panini 阅读(382) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-14 01:07 panini 阅读(232) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-05-13 23:24 panini 阅读(1008) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-13 22:52 panini 阅读(257) 评论(0) 推荐(0)
摘要: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< 阅读全文
posted @ 2017-05-12 09:16 panini 阅读(1048) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-12 08:02 panini 阅读(144) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-11 11:35 panini 阅读(127) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-11 06:12 panini 阅读(164) 评论(0) 推荐(0)
摘要:题目 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 阅读全文
posted @ 2017-05-11 05:43 panini 阅读(377) 评论(0) 推荐(0)
摘要:题目: 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:  阅读全文
posted @ 2017-05-11 05:25 panini 阅读(133) 评论(0) 推荐(0)
摘要:DescriptionIt's follow up problem for Binary Tree Longest Consecutive Sequence IIGiven a k-ary tree, find the length of the longest consecutive sequen 阅读全文
posted @ 2017-05-11 03:22 panini 阅读(692) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-11 01:39 panini 阅读(332) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-10 11:24 panini 阅读(130) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-05-10 10:55 panini 阅读(1075) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-05-10 10:35 panini 阅读(1395) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-10 10:00 panini 阅读(214) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-10 05:53 panini 阅读(202) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-09 10:51 panini 阅读(183) 评论(0) 推荐(0)
摘要:DescriptionGiven a binary tree, find the subtree with maximum average. Return the root of the subtree.NoticeLintCode will print the subtree which root 阅读全文
posted @ 2017-05-09 06:21 panini 阅读(2008) 评论(0) 推荐(0)
摘要:DescriptionGiven a binary tree, find the subtree with minimum sum. Return the root of the subtree.NoticeLintCode will print the subtree which root is 阅读全文
posted @ 2017-05-09 06:18 panini 阅读(788) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-09 06:06 panini 阅读(171) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-03 14:01 panini 阅读(206) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-05-03 13:52 panini 阅读(207) 评论(0) 推荐(0)
摘要: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, 阅读全文
posted @ 2017-05-03 12:27 panini 阅读(1265) 评论(0) 推荐(0)