摘要: here is a garden with N slots. In each slot, there is a flower. The N flowers will bloom one by one in N days. In each day, there will be exactly one 阅读全文
posted @ 2017-11-23 17:06 jxr041100 阅读(329) 评论(0) 推荐(0)
摘要: Given strings S and T, find the minimum (contiguous) substring W of S, so that T is a subsequence of W. If there is no such window in S that covers al 阅读全文
posted @ 2017-11-23 17:04 jxr041100 阅读(362) 评论(0) 推荐(0)
摘要: Given a string s and a list of strings dict, you need to add a closed pair of bold tag <b> and </b> to wrap the substrings in s that exist in dict. If 阅读全文
posted @ 2017-11-23 17:02 jxr041100 阅读(211) 评论(0) 推荐(0)
摘要: Design an in-memory file system to simulate the following functions: ls: Given a path in string format. If it is a file path, return a list that only 阅读全文
posted @ 2017-11-23 17:01 jxr041100 阅读(235) 评论(0) 推荐(0)
摘要: LeetCode wants to give one of its best employees the option to travel among N cities to collect algorithm problems. But all work and no play makes Jac 阅读全文
posted @ 2017-11-23 16:59 jxr041100 阅读(119) 评论(0) 推荐(0)
摘要: Given a list of strings, you could concatenate these strings together into a loop, where for each string you could choose to reverse it or not. Among 阅读全文
posted @ 2017-11-23 16:57 jxr041100 阅读(210) 评论(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 decreas 阅读全文
posted @ 2017-11-23 16:56 jxr041100 阅读(126) 评论(0) 推荐(0)
摘要: Given an array with n integers, you need to find if there are triplets (i, j, k) which satisfies following conditions: where we define that subarray ( 阅读全文
posted @ 2017-11-23 16:54 jxr041100 阅读(169) 评论(0) 推荐(0)
摘要: Given a binary tree, return the values of its boundary in anti-clockwise direction starting from root. Boundary includes left boundary, leaves, and ri 阅读全文
posted @ 2017-11-23 16:53 jxr041100 阅读(162) 评论(0) 推荐(0)
摘要: Check whether the original sequence org can be uniquely reconstructed from the sequences in seqs. The org sequence is a permutation of the integers fr 阅读全文
posted @ 2017-11-23 16:51 jxr041100 阅读(323) 评论(1) 推荐(0)
摘要: Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list 阅读全文
posted @ 2017-11-23 16:49 jxr041100 阅读(121) 评论(0) 推荐(0)
摘要: You are given a m x n 2D grid initialized with these three possible values. Fill each empty room with the distance to its nearest gate. If it is impos 阅读全文
posted @ 2017-11-23 16:48 jxr041100 阅读(136) 评论(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 mak 阅读全文
posted @ 2017-11-23 16:46 jxr041100 阅读(111) 评论(0) 推荐(0)
摘要: Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference room 阅读全文
posted @ 2017-11-23 16:45 jxr041100 阅读(85) 评论(0) 推荐(0)
摘要: A group of two or more people wants to meet and minimize the total travel distance. You are given a 2D grid of values 0 or 1, where each 1 marks the h 阅读全文
posted @ 2017-11-23 16:44 jxr041100 阅读(146) 评论(0) 推荐(0)
摘要: Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition of a celebrity is tha 阅读全文
posted @ 2017-11-23 16:43 jxr041100 阅读(139) 评论(0) 推荐(0)
摘要: Given a binary tree, count the number of uni-value subtrees. A Uni-value subtree means all nodes of the subtree have the same value. For example:Given 阅读全文
posted @ 2017-11-23 16:41 jxr041100 阅读(124) 评论(0) 推荐(0)
摘要: Given a string, we can "shift" each of its letter to its successive letter, for example: "abc" -> "bcd". We can keep "shifting" which forms the sequen 阅读全文
posted @ 2017-11-23 16:40 jxr041100 阅读(134) 评论(0) 推荐(0)
摘要: You are playing the following Flip Game with your friend: Given a string that contains only these two characters: + and -, you and your friend take tu 阅读全文
posted @ 2017-11-23 16:38 jxr041100 阅读(116) 评论(0) 推荐(0)
摘要: Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), where largest means subtree with largest number of nodes in it. Not 阅读全文
posted @ 2017-11-23 16:37 jxr041100 阅读(127) 评论(0) 推荐(0)
摘要: Design a Snake game that is played on a device with screen size = width x height. Play the game online if you are not familiar with the game. The snak 阅读全文
posted @ 2017-11-23 15:13 jxr041100 阅读(154) 评论(0) 推荐(0)
摘要: Design a Phone Directory which supports the following operations: get: Provide a number which is not assigned to anyone. check: Check if a number is a 阅读全文
posted @ 2017-11-23 13:41 jxr041100 阅读(120) 评论(0) 推荐(0)
摘要: Given two sparse matrices A and B, return the result of AB. You may assume that A's column number is equal to B's row number. Example: 阅读全文
posted @ 2017-11-23 13:11 jxr041100 阅读(127) 评论(0) 推荐(0)
摘要: Given a string, find the length of the longest substring T that contains at most k distinct characters. For example, Given s = “eceba” and k = 2, T is 阅读全文
posted @ 2017-11-23 12:49 jxr041100 阅读(98) 评论(0) 推荐(0)
摘要: Given a non-empty string s and an integer k, rearrange the string such that the same characters are at least distance k from each other. All input str 阅读全文
posted @ 2017-11-23 08:00 jxr041100 阅读(211) 评论(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 find the number of connected 阅读全文
posted @ 2017-11-23 06:35 jxr041100 阅读(229) 评论(0) 推荐(0)
摘要: Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list -- w 阅读全文
posted @ 2017-11-23 06:19 jxr041100 阅读(108) 评论(0) 推荐(0)
摘要: Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list -- w 阅读全文
posted @ 2017-11-23 06:16 jxr041100 阅读(106) 评论(0) 推荐(0)
摘要: Design a logger system that receive stream of messages along with its timestamps, each message should be printed if and only if it is not printed in t 阅读全文
posted @ 2017-11-23 06:14 jxr041100 阅读(151) 评论(0) 推荐(0)