随笔分类 -  Google

上一页 1 2 3 4 5 6 7 8 ··· 10 下一页
摘要:Design a data structure that supports all following operations in O(1) time. insert(val): Inserts an item val to the set if not already present.remove 阅读全文
posted @ 2016-12-08 10:51 北叶青藤 阅读(254) 评论(0) 推荐(0)
摘要:Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), determine if a person could attend all mee 阅读全文
posted @ 2016-12-01 05:55 北叶青藤 阅读(724) 评论(0) 推荐(0)
摘要:A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but i 阅读全文
posted @ 2016-11-04 22:09 北叶青藤 阅读(452) 评论(0) 推荐(0)
摘要:Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or do 阅读全文
posted @ 2016-10-29 06:27 北叶青藤 阅读(244) 评论(0) 推荐(0)
摘要:Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or *between the di 阅读全文
posted @ 2016-10-23 23:07 北叶青藤 阅读(235) 评论(0) 推荐(0)
摘要:Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note: The input string may cont 阅读全文
posted @ 2016-10-23 10:06 北叶青藤 阅读(271) 评论(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 have t 阅读全文
posted @ 2016-10-11 11:48 北叶青藤 阅读(390) 评论(0) 推荐(0)
摘要:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. 阅读全文
posted @ 2016-10-11 11:09 北叶青藤 阅读(323) 评论(0) 推荐(0)
摘要:You are given a m x n 2D grid initialized with these three possible values. -1 - A wall or an obstacle. 0 - A gate. INF - Infinity means an empty room 阅读全文
posted @ 2016-10-10 07:37 北叶青藤 阅读(194) 评论(0) 推荐(0)
摘要:Contains Duplicate I Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at l 阅读全文
posted @ 2016-10-10 06:04 北叶青藤 阅读(256) 评论(0) 推荐(0)
摘要:There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list of words from the 阅读全文
posted @ 2016-09-01 23:07 北叶青藤 阅读(286) 评论(0) 推荐(0)
摘要:Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating 阅读全文
posted @ 2016-08-08 11:39 北叶青藤 阅读(331) 评论(0) 推荐(0)
摘要:Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of th 阅读全文
posted @ 2016-08-07 05:21 北叶青藤 阅读(283) 评论(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 @ 2016-08-06 11:19 北叶青藤 阅读(219) 评论(0) 推荐(0)
摘要:Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0. You may assum 阅读全文
posted @ 2016-08-06 05:51 北叶青藤 阅读(204) 评论(0) 推荐(0)
摘要:Preorder: 因为是preorder traversal, 我们需要先print root,然后左节点,最后右节点,而且root左边子树一定比右边子树先print出来,所以,我们可以先把当前root的右节点压栈,然后把root的左节点压栈,这样每次从栈里取的时候,可以保证左边节点的root先取 阅读全文
posted @ 2016-08-06 02:47 北叶青藤 阅读(337) 评论(0) 推荐(0)
摘要:Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true Note: It is intended for the 阅读全文
posted @ 2016-08-05 23:11 北叶青藤 阅读(264) 评论(0) 推荐(0)
摘要:Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can f 阅读全文
posted @ 2016-08-05 08:11 北叶青藤 阅读(129) 评论(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 @ 2016-08-05 00:34 北叶青藤 阅读(262) 评论(0) 推荐(0)
摘要:Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column). If two nodes are in the sam 阅读全文
posted @ 2016-08-04 04:19 北叶青藤 阅读(329) 评论(0) 推荐(0)

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