12 2015 档案

摘要:祝大家圣诞快乐!昨天下班在电梯里遇见HR大BOSS,她说公司今天上午有2200个员工要带小孩子来参加Children's Holidy Party...我问了句,那是不是有免费早餐和午餐啊,她说 "Ye",然后就再也不理我了。都说电梯里十几秒的时间很宝贵,我是不是没有get到她的点 -______-... 阅读全文
posted @ 2015-12-24 23:26 YRB 阅读(244) 评论(0) 推荐(0)
摘要:从9月12号开始,到现在三个多月了,现在进度是300/304,后面几题难度比较大,尤其是dietpepsi加的一些Dynamic Programming的新题,自己往往做不出来要去看答案。今天起决定暂停做新题了,从头开始刷第二遍,之后的新题目,等到第二遍结束的时候再尝试挑战。 第二遍打算在两个月内刷 阅读全文
posted @ 2015-12-24 00:33 YRB 阅读(417) 评论(0) 推荐(0)
摘要:题目: You want to build a house on an empty land which reaches all buildings in the shortest amount of distance. You can only move up, down, left and ri 阅读全文
posted @ 2015-12-23 11:49 YRB 阅读(1532) 评论(0) 推荐(0)
摘要:题目:Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure y... 阅读全文
posted @ 2015-12-23 05:07 YRB 阅读(1427) 评论(0) 推荐(0)
摘要:题目:You are given an integer arraynumsand you have to return a newcountsarray. Thecountsarray has the property wherecounts[i]is the number of smaller e... 阅读全文
posted @ 2015-12-23 01:25 YRB 阅读(4079) 评论(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 阅读全文
posted @ 2015-12-22 05:59 YRB 阅读(9348) 评论(2) 推荐(0)
摘要:题目:Write a program to find the nthsuper ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given prime listprimeso... 阅读全文
posted @ 2015-12-22 02:45 YRB 阅读(2339) 评论(0) 推荐(0)
摘要:题目:Givennballoons, indexed from0ton-1. Each balloon is painted with a number on it represented by arraynums. You are asked to burst all the balloons. ... 阅读全文
posted @ 2015-12-21 03:58 YRB 阅读(1323) 评论(0) 推荐(0)
摘要:题目:Given twosparse matricesAandB, return the result ofAB.You may assume thatA's column number is equal toB's row number.Example:A = [ [ 1, 0, 0], [-... 阅读全文
posted @ 2015-12-20 12:48 YRB 阅读(2254) 评论(0) 推荐(0)
摘要:题目: For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible r 阅读全文
posted @ 2015-12-20 06:41 YRB 阅读(2365) 评论(2) 推荐(0)
摘要:题目:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complet... 阅读全文
posted @ 2015-12-20 04:05 YRB 阅读(2402) 评论(0) 推荐(0)
摘要:题目:Given a 2D matrixmatrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1,col1) and lower right corner (row... 阅读全文
posted @ 2015-12-19 11:00 YRB 阅读(5491) 评论(0) 推荐(1)
摘要:题目: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The update(i, val) function modifies nums by 阅读全文
posted @ 2015-12-18 13:02 YRB 阅读(2888) 评论(0) 推荐(1)
摘要:题目: Additive number is a string whose digits can form additive sequence. A valid additive sequence should contain at least three numbers. Except for t 阅读全文
posted @ 2015-12-17 12:44 YRB 阅读(1157) 评论(0) 推荐(0)
摘要:题目: A 2d grid map of m rows and n columns is initially filled with water. We may perform an addLand operation which turns the water at position (row, 阅读全文
posted @ 2015-12-16 12:15 YRB 阅读(2663) 评论(0) 推荐(0)
摘要:题目:Given a 2D matrixmatrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1,col1) and lower right corner (row... 阅读全文
posted @ 2015-12-16 05:15 YRB 阅读(1440) 评论(0) 推荐(0)
摘要:题目: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Note: 链接: http://leetcode.com/probl 阅读全文
posted @ 2015-12-16 04:43 YRB 阅读(1165) 评论(0) 推荐(0)
摘要:题目:An image is represented by a binary matrix with0as a white pixel and1as a black pixel. The black pixels are connected, i.e., there is only one blac... 阅读全文
posted @ 2015-12-16 04:11 YRB 阅读(5543) 评论(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 co... 阅读全文
posted @ 2015-12-15 23:29 YRB 阅读(3391) 评论(0) 推荐(0)
摘要:题目:Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given[10, 9, 2, 5, 3, 7, 101, 18],The longest in... 阅读全文
posted @ 2015-12-15 12:24 YRB 阅读(2917) 评论(0) 推荐(0)
摘要:题目: You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each 阅读全文
posted @ 2015-12-15 09:00 YRB 阅读(902) 评论(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 @ 2015-12-15 07:36 YRB 阅读(2627) 评论(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 @ 2015-12-15 07:16 YRB 阅读(3604) 评论(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 t 阅读全文
posted @ 2015-12-15 01:58 YRB 阅读(861) 评论(0) 推荐(0)
摘要:题目: Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the 阅读全文
posted @ 2015-12-14 12:10 YRB 阅读(1943) 评论(1) 推荐(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 @ 2015-12-13 21:57 YRB 阅读(2723) 评论(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 tak 阅读全文
posted @ 2015-12-13 07:58 YRB 阅读(1174) 评论(0) 推荐(0)
摘要:题目: You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 阅读全文
posted @ 2015-12-13 07:36 YRB 阅读(406) 评论(0) 推荐(0)
摘要:题目:Given apatternand a stringstr, find ifstrfollows the same pattern.Herefollowmeans a full match, such that there is a bijection between a letter inp... 阅读全文
posted @ 2015-12-13 06:30 YRB 阅读(1273) 评论(0) 推荐(0)
摘要:题目: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a l 阅读全文
posted @ 2015-12-12 23:58 YRB 阅读(983) 评论(0) 推荐(1)
摘要:题目: According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician J 阅读全文
posted @ 2015-12-12 08:55 YRB 阅读(1097) 评论(0) 推荐(0)
摘要:题目: An abbreviation of a word follows the form <first letter><number><last letter>. Below are some examples of word abbreviations: a) it --> it (no ab 阅读全文
posted @ 2015-12-12 07:30 YRB 阅读(1461) 评论(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 exi 阅读全文
posted @ 2015-12-12 03:55 YRB 阅读(1117) 评论(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 阅读全文
posted @ 2015-12-11 12:23 YRB 阅读(2098) 评论(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 @ 2015-12-11 08:07 YRB 阅读(3638) 评论(0) 推荐(0)
摘要:题目: Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation -- 阅读全文
posted @ 2015-12-11 05:25 YRB 阅读(704) 评论(0) 推荐(0)
摘要:题目: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, 阅读全文
posted @ 2015-12-11 03:33 YRB 阅读(323) 评论(0) 推荐(0)
摘要:题目:Given a string that contains only digits0-9and a target value, return all possibilities to addbinaryoperators (not unary)+,-, or*between the digits... 阅读全文
posted @ 2015-12-11 03:24 YRB 阅读(1315) 评论(0) 推荐(0)
摘要:题目:Given two 1d vectors, implement an iterator to return their elements alternately.For example, given two 1d vectors:v1 = [1, 2]v2 = [3, 4, 5, 6]By c... 阅读全文
posted @ 2015-12-10 12:35 YRB 阅读(951) 评论(0) 推荐(0)
摘要:题目: Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3].... For example, given nums = [3, 5, 2, 1, 6, 阅读全文
posted @ 2015-12-10 12:00 YRB 阅读(601) 评论(0) 推荐(0)
摘要:题目: Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. For example, given n = 阅读全文
posted @ 2015-12-10 11:43 YRB 阅读(2463) 评论(0) 推荐(0)
摘要:题目: You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quali 阅读全文
posted @ 2015-12-10 05:45 YRB 阅读(297) 评论(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 阅读全文
posted @ 2015-12-10 05:37 YRB 阅读(1835) 评论(0) 推荐(1)
摘要:题目: 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 adjac 阅读全文
posted @ 2015-12-10 01:35 YRB 阅读(884) 评论(0) 推荐(0)
摘要:题目: Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm? Hint: Expected runtime complex 阅读全文
posted @ 2015-12-09 10:34 YRB 阅读(574) 评论(0) 推荐(0)
摘要:题目:Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.Accordi... 阅读全文
posted @ 2015-12-09 09:59 YRB 阅读(930) 评论(0) 推荐(0)
摘要:题目:Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231- 1.For example,123 -> "One Hundre... 阅读全文
posted @ 2015-12-09 06:54 YRB 阅读(1349) 评论(0) 推荐(0)
摘要:题目: Given a non-empty binary search tree and a target value, find k values in the BST that are closest to the target. Note: Given target value is a fl 阅读全文
posted @ 2015-12-09 02:55 YRB 阅读(2216) 评论(0) 推荐(1)
摘要:题目: 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 阅读全文
posted @ 2015-12-08 00:51 YRB 阅读(1751) 评论(0) 推荐(0)
摘要:题目: Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target. Note: Given target value is a fl 阅读全文
posted @ 2015-12-07 14:16 YRB 阅读(1749) 评论(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 阅读全文
posted @ 2015-12-07 13:49 YRB 阅读(4182) 评论(0) 推荐(0)
摘要:题目: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 阅读全文
posted @ 2015-12-06 03:25 YRB 阅读(1333) 评论(0) 推荐(0)
摘要:题目:Given a strings, return all the palindromic permutations (without duplicates) of it. Return an empty list if no palindromic permutation could be fo... 阅读全文
posted @ 2015-12-06 01:03 YRB 阅读(1132) 评论(0) 推荐(0)
摘要:题目: Given a string, determine if a permutation of the string could form a palindrome. For example,"code" -> False, "aab" -> True, "carerac" -> True. H 阅读全文
posted @ 2015-12-05 13:13 YRB 阅读(1929) 评论(0) 推荐(0)
摘要:题目: There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different 阅读全文
posted @ 2015-12-05 12:44 YRB 阅读(1485) 评论(0) 推荐(0)
摘要:题目: Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 阅读全文
posted @ 2015-12-05 03:23 YRB 阅读(868) 评论(0) 推荐(0)
摘要:题目: Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For 阅读全文
posted @ 2015-12-04 12:10 YRB 阅读(222) 评论(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 @ 2015-12-04 11:58 YRB 阅读(1920) 评论(0) 推荐(0)
摘要:题目: Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two eleme 阅读全文
posted @ 2015-12-04 02:32 YRB 阅读(316) 评论(0) 推荐(0)
摘要:题目:Given an array ofnintegersnumsand atarget, find the number of index tripletsi, j, kwith0 <= i < j < k < nthat satisfy the conditionnums[i] + nums[j... 阅读全文
posted @ 2015-12-03 06:29 YRB 阅读(1205) 评论(0) 推荐(0)
摘要:题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is l 阅读全文
posted @ 2015-12-03 05:16 YRB 阅读(357) 评论(0) 推荐(0)
摘要:题目: Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: All root-to-leaf paths are: 链接: http://leetcode. 阅读全文
posted @ 2015-12-03 05:04 YRB 阅读(1531) 评论(0) 推荐(0)
摘要:题目: There are a row of n houses, each house can be painted with one of the three colors: red, blue or green. The cost of painting each house with a ce 阅读全文
posted @ 2015-12-03 04:36 YRB 阅读(741) 评论(0) 推荐(0)
摘要:题目:Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary search tree.You may assume each number in the s... 阅读全文
posted @ 2015-12-03 03:36 YRB 阅读(2966) 评论(0) 推荐(0)
摘要:题目: Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a function that takes an integer n and return all po 阅读全文
posted @ 2015-12-03 00:42 YRB 阅读(2956) 评论(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 阅读全文
posted @ 2015-12-02 11:51 YRB 阅读(3287) 评论(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 阅读全文
posted @ 2015-12-02 10:54 YRB 阅读(720) 评论(0) 推荐(0)
摘要:题目: Implement an iterator to flatten a 2d vector. For example,Given 2d vector = By calling next repeatedly until hasNext returns false, the order of e 阅读全文
posted @ 2015-12-02 06:01 YRB 阅读(2020) 评论(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:G 阅读全文
posted @ 2015-12-02 04:21 YRB 阅读(1686) 评论(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 se 阅读全文
posted @ 2015-12-01 13:00 YRB 阅读(833) 评论(0) 推荐(0)
摘要:题目:A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).Write a function to count the total strob... 阅读全文
posted @ 2015-12-01 06:02 YRB 阅读(700) 评论(0) 推荐(0)
摘要:题目: A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Find all strobogrammatic numbers that a 阅读全文
posted @ 2015-12-01 04:17 YRB 阅读(1118) 评论(0) 推荐(0)
摘要:题目: A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to determine if a numb 阅读全文
posted @ 2015-12-01 01:07 YRB 阅读(963) 评论(0) 推荐(0)
摘要:题目:This is afollow upofShortest Word Distance. The only difference is nowword1could be the same asword2.Given a list of words and two wordsword1andwor... 阅读全文
posted @ 2015-12-01 00:42 YRB 阅读(746) 评论(0) 推荐(0)