随笔分类 -  Leetcode

上一页 1 2 3 4 5 6 7 8 9 10 ··· 19 下一页
摘要:Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a g 阅读全文
posted @ 2016-11-17 01:25 amazingzoe 阅读(360) 评论(0) 推荐(0)
摘要:Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between iand j equals 阅读全文
posted @ 2016-11-08 09:05 amazingzoe 阅读(218) 评论(0) 推荐(0)
摘要:There is a fence with n posts, each post can be painted with one of the k colors. You have to paint all the posts such that no more than two adjacent 阅读全文
posted @ 2016-11-04 00:26 amazingzoe 阅读(125) 评论(0) 推荐(0)
摘要:You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need t 阅读全文
posted @ 2016-11-03 11:50 amazingzoe 阅读(187) 评论(0) 推荐(0)
摘要:Given a sequence of words, check whether it forms a valid word square. A sequence of words forms a valid word square if the kth row and column read th 阅读全文
posted @ 2016-11-03 11:35 amazingzoe 阅读(162) 评论(0) 推荐(0)
摘要:Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example:Given a = 1 and b = 2, return 3. 阅读全文
posted @ 2016-11-01 06:34 amazingzoe 阅读(105) 评论(0) 推荐(0)
摘要:Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclu 阅读全文
posted @ 2016-11-01 06:20 amazingzoe 阅读(523) 评论(1) 推荐(0)
摘要:Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: Note: You may assume the 阅读全文
posted @ 2016-10-24 23:29 amazingzoe 阅读(389) 评论(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 @ 2016-10-15 06:50 amazingzoe 阅读(177) 评论(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 @ 2016-10-15 06:07 amazingzoe 阅读(211) 评论(0) 推荐(0)
摘要:Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. For example, MovingAverage m = new M 阅读全文
posted @ 2016-10-15 05:57 amazingzoe 阅读(172) 评论(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 @ 2016-10-14 05:51 amazingzoe 阅读(140) 评论(0) 推荐(0)
摘要:Given a binary tree Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL 阅读全文
posted @ 2016-10-13 03:10 amazingzoe 阅读(133) 评论(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 @ 2016-10-11 05:31 amazingzoe 阅读(183) 评论(0) 推荐(0)
摘要:Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For 阅读全文
posted @ 2016-10-10 08:05 amazingzoe 阅读(123) 评论(0) 推荐(0)
摘要:Description: Count the number of prime numbers less than a non-negative number, n. 阅读全文
posted @ 2016-10-04 05:51 amazingzoe 阅读(112) 评论(0) 推荐(0)
摘要:1. Excel Sheet Column Number Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding c 阅读全文
posted @ 2016-10-04 05:35 amazingzoe 阅读(151) 评论(0) 推荐(0)
摘要:Invert a binary tree. to Trivia:This problem was inspired by this original tweet by Max Howell: Runtime: 0ms 阅读全文
posted @ 2016-10-01 06:55 amazingzoe 阅读(122) 评论(0) 推荐(0)
摘要:Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two left leaves in the binary tree, with values 9 and 1 阅读全文
posted @ 2016-09-30 00:27 amazingzoe 阅读(300) 评论(0) 推荐(0)
摘要:Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c" click to show co 阅读全文
posted @ 2016-09-29 11:08 amazingzoe 阅读(110) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 10 ··· 19 下一页