07 2016 档案

摘要:96. Unique Binary Search Trees Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, the 阅读全文
posted @ 2016-07-31 08:24 新一代的天皇巨星 阅读(241) 评论(0) 推荐(0)
摘要:201. Bitwise AND of Numbers Range Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive 阅读全文
posted @ 2016-07-31 08:09 新一代的天皇巨星 阅读(123) 评论(0) 推荐(0)
摘要:221. Maximal Square Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. For example, gi 阅读全文
posted @ 2016-07-27 13:58 新一代的天皇巨星 阅读(248) 评论(0) 推荐(0)
摘要:376. Wiggle Subsequence A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between pos 阅读全文
posted @ 2016-07-26 12:48 新一代的天皇巨星 阅读(751) 评论(0) 推荐(0)
摘要:331. Verify Preorder Serialization of a Binary Tree One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null nod 阅读全文
posted @ 2016-07-26 12:47 新一代的天皇巨星 阅读(159) 评论(0) 推荐(0)
摘要:127. Word Ladder Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from begin 阅读全文
posted @ 2016-07-25 11:16 新一代的天皇巨星 阅读(335) 评论(0) 推荐(0)
摘要:365. Water and Jug Problem You are given two jugs with capacities x and y litres. There is an infinite amount of water supply available. You need to d 阅读全文
posted @ 2016-07-25 10:02 新一代的天皇巨星 阅读(160) 评论(0) 推荐(0)
摘要:355. Design Twitter Design a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most re 阅读全文
posted @ 2016-07-25 08:04 新一代的天皇巨星 阅读(199) 评论(0) 推荐(0)
摘要:93. Restore IP Addresses Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given  阅读全文
posted @ 2016-07-25 08:03 新一代的天皇巨星 阅读(146) 评论(0) 推荐(0)
摘要:73. Set Matrix Zeroes Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. Hide Tags Array Hide Similar Probl 阅读全文
posted @ 2016-07-25 07:33 新一代的天皇巨星 阅读(149) 评论(0) 推荐(0)
摘要:222. Count Complete Tree Nodes Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a compl 阅读全文
posted @ 2016-07-25 06:28 新一代的天皇巨星 阅读(107) 评论(0) 推荐(0)
摘要:169. Majority Element Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. Y 阅读全文
posted @ 2016-07-25 06:08 新一代的天皇巨星 阅读(269) 评论(0) 推荐(0)
摘要:48. Rotate Image You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up:Could you do this in-pl 阅读全文
posted @ 2016-07-25 05:24 新一代的天皇巨星 阅读(174) 评论(0) 推荐(0)
摘要:134. Gas Station There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas 阅读全文
posted @ 2016-07-25 03:17 新一代的天皇巨星 阅读(211) 评论(0) 推荐(0)
摘要:368. Largest Divisible Subset Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this sub 阅读全文
posted @ 2016-07-25 01:58 新一代的天皇巨星 阅读(193) 评论(0) 推荐(0)
摘要:89. Gray Code The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing 阅读全文
posted @ 2016-07-25 01:21 新一代的天皇巨星 阅读(211) 评论(0) 推荐(0)
摘要:26. Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such that each element appear only once and return the ne 阅读全文
posted @ 2016-07-25 01:07 新一代的天皇巨星 阅读(128) 评论(0) 推荐(0)
摘要:35. Search Insert Position 35. Search Insert Position Given a sorted array and a target value, return the index if the target is found. If not, return 阅读全文
posted @ 2016-07-24 13:27 新一代的天皇巨星 阅读(204) 评论(0) 推荐(0)
摘要:33. Search in Rotated Sorted Array Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 阅读全文
posted @ 2016-07-24 07:58 新一代的天皇巨星 阅读(154) 评论(0) 推荐(0)
摘要:12. Integer to Roman Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. Hide Tags Math String 阅读全文
posted @ 2016-07-24 05:10 新一代的天皇巨星 阅读(134) 评论(0) 推荐(0)
摘要:343. Integer Break Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Ret 阅读全文
posted @ 2016-07-24 05:05 新一代的天皇巨星 阅读(195) 评论(0) 推荐(0)
摘要:5. Longest Palindromic Substring Find the longest palindromic substring in string S. You may assume that there exists one unique longest palindromic s 阅读全文
posted @ 2016-07-23 12:54 新一代的天皇巨星 阅读(262) 评论(0) 推荐(0)
摘要:373. Find K Pairs with Smallest Sums You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v)  阅读全文
posted @ 2016-07-23 12:41 新一代的天皇巨星 阅读(276) 评论(0) 推荐(0)
摘要:69. Sqrt(x) Implement int sqrt(int x). Compute and return the square root of x. Binary Search Math 69. Sqrt(x) Implement int sqrt(int x). Compute and 阅读全文
posted @ 2016-07-20 02:09 新一代的天皇巨星 阅读(4295) 评论(0) 推荐(0)
摘要:375. Guess Number Higher or Lower II We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which numbe 阅读全文
posted @ 2016-07-18 07:52 新一代的天皇巨星 阅读(530) 评论(2) 推荐(0)
摘要:274. H-Index Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-ind 阅读全文
posted @ 2016-07-18 07:01 新一代的天皇巨星 阅读(358) 评论(0) 推荐(0)
摘要:209. Minimum Size Subarray Sum Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum 阅读全文
posted @ 2016-07-18 06:56 新一代的天皇巨星 阅读(118) 评论(0) 推荐(0)
摘要:30. Substring with Concatenation of All Words You are given a string, s, and a list of words, words, that are all of the same length. Find all startin 阅读全文
posted @ 2016-07-18 06:10 新一代的天皇巨星 阅读(178) 评论(0) 推荐(0)
摘要:Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the 阅读全文
posted @ 2016-07-18 03:22 新一代的天皇巨星 阅读(138) 评论(0) 推荐(0)
摘要:303. Range Sum Query - Immutable Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given 阅读全文
posted @ 2016-07-17 12:34 新一代的天皇巨星 阅读(183) 评论(0) 推荐(0)
摘要:All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to 阅读全文
posted @ 2016-07-17 12:23 新一代的天皇巨星 阅读(151) 评论(0) 推荐(0)
摘要:Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive intege 阅读全文
posted @ 2016-07-15 13:26 新一代的天皇巨星 阅读(178) 评论(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-07-15 12:47 新一代的天皇巨星 阅读(142) 评论(0) 推荐(0)
摘要:A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are give 阅读全文
posted @ 2016-07-13 13:42 新一代的天皇巨星 阅读(183) 评论(0) 推荐(0)
摘要:116. Populating Next Right Pointers in Each Node Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next 阅读全文
posted @ 2016-07-12 13:32 新一代的天皇巨星 阅读(189) 评论(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 = 12, 阅读全文
posted @ 2016-07-11 13:47 新一代的天皇巨星 阅读(197) 评论(0) 推荐(0)
摘要:263. Ugly Number Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 阅读全文
posted @ 2016-07-11 12:33 新一代的天皇巨星 阅读(214) 评论(0) 推荐(0)
摘要:290. Word Pattern 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 bijecti 阅读全文
posted @ 2016-07-08 13:45 新一代的天皇巨星 阅读(229) 评论(0) 推荐(0)
摘要:11. Container With Most Water Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are 阅读全文
posted @ 2016-07-07 13:21 新一代的天皇巨星 阅读(217) 评论(0) 推荐(0)
摘要:53. Maximum Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the a 阅读全文
posted @ 2016-07-07 12:16 新一代的天皇巨星 阅读(137) 评论(0) 推荐(0)
摘要:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except  阅读全文
posted @ 2016-07-06 23:13 新一代的天皇巨星 阅读(158) 评论(0) 推荐(0)
摘要:228. Summary Ranges Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2 阅读全文
posted @ 2016-07-02 13:37 新一代的天皇巨星 阅读(169) 评论(0) 推荐(0)
摘要:217. Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears a 阅读全文
posted @ 2016-07-01 14:05 新一代的天皇巨星 阅读(185) 评论(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 ston 阅读全文
posted @ 2016-07-01 00:50 新一代的天皇巨星 阅读(122) 评论(0) 推荐(0)