随笔分类 -  LeetCode

上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 61 下一页
摘要:Given the root of a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of any one  阅读全文
posted @ 2017-09-10 06:41 Grandyang 阅读(8952) 评论(19) 推荐(1)
摘要:Print a binary tree in an m*n 2D string array following these rules: Example 1: Example 2: Example 3: Note: The height of binary tree is in the range 阅读全文
posted @ 2017-09-07 12:37 Grandyang 阅读(6102) 评论(0) 推荐(0)
摘要:Imagine you have a special keyboard with the following keys: Key 1: (A): Print one 'A' on screen. Key 2: (Ctrl-A): Select the whole screen. Key 3: (Ct 阅读全文
posted @ 2017-08-29 15:18 Grandyang 阅读(7861) 评论(0) 推荐(0)
摘要:Initially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step: Copy All: You can copy all the 阅读全文
posted @ 2017-08-27 09:27 Grandyang 阅读(8590) 评论(8) 推荐(1)
摘要:In the world of Dota2, there are two parties: the Radiant and the Dire. The Dota2 senate consists of senators coming from two parties. Now the senate 阅读全文
posted @ 2017-08-27 07:17 Grandyang 阅读(4665) 评论(0) 推荐(0)
摘要:In English, we have a concept called root, which can be followed by some other words to form another longer word - let's call this word successor. For 阅读全文
posted @ 2017-08-24 15:39 Grandyang 阅读(6648) 评论(0) 推荐(0)
摘要:Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are c 阅读全文
posted @ 2017-08-21 15:44 Grandyang 阅读(18268) 评论(9) 推荐(0)
摘要:You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can follow an 阅读全文
posted @ 2017-08-17 14:51 Grandyang 阅读(5747) 评论(4) 推荐(0)
摘要:Solve a given equation and return the value of x in the form of string "x=#value". The equation contains only '+', '-' operation, the variable x and i 阅读全文
posted @ 2017-08-12 16:02 Grandyang 阅读(7109) 评论(1) 推荐(0)
摘要:The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another n 阅读全文
posted @ 2017-08-09 11:17 Grandyang 阅读(5306) 评论(0) 推荐(1)
摘要:Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the 阅读全文
posted @ 2017-08-06 13:54 Grandyang 阅读(7763) 评论(0) 推荐(0)
摘要:A message containing letters from A-Z is being encoded to numbers using the following mapping way: Beyond that, now the encoded string can also contai 阅读全文
posted @ 2017-08-03 13:07 Grandyang 阅读(8268) 评论(4) 推荐(1)
摘要:In LeetCode Store, there are n items to sell. Each item has a price. However, there are some special offers, and a special offer consists of one or mo 阅读全文
posted @ 2017-07-31 10:05 Grandyang 阅读(7753) 评论(2) 推荐(0)
摘要:Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Input: 3 / \ 9 20 / \ 15 7 Outp 阅读全文
posted @ 2017-07-30 15:08 Grandyang 阅读(5419) 评论(0) 推荐(0)
摘要:Given the running logs of n functions that are executed in a nonpreemptive single threaded CPU, find the exclusive time of these functions. Each funct 阅读全文
posted @ 2017-07-27 14:42 Grandyang 阅读(9107) 评论(5) 推荐(0)
摘要:You are given several logs that each log contains a unique id and timestamp. Timestamp is a string that has the following format: Year:Month:Day:Hour: 阅读全文
posted @ 2017-07-23 14:01 Grandyang 阅读(11472) 评论(0) 推荐(0)
摘要:In combinatorial mathematics, a derangement is a permutation of the elements of a set, such that no element appears in its original position. There's 阅读全文
posted @ 2017-07-20 14:05 Grandyang 阅读(4552) 评论(0) 推荐(0)
摘要:You have k lists of sorted integers in ascending order. Find the smallest range that includes at least one number from each of the k lists. We define 阅读全文
posted @ 2017-07-18 13:26 Grandyang 阅读(9489) 评论(4) 推荐(2)
摘要:Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Example 2: 这道题让我们求一个数是否 阅读全文
posted @ 2017-07-16 14:43 Grandyang 阅读(8023) 评论(3) 推荐(2)
摘要:Your task is to design the basic function of Excel and implement the function of sum formula. Specifically, you need to implement the following functi 阅读全文
posted @ 2017-07-14 14:42 Grandyang 阅读(5940) 评论(7) 推荐(0)

上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 61 下一页
Fork me on GitHub