06 2017 档案

摘要:题目: Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive. For example, given the range 阅读全文
posted @ 2017-06-26 20:23 panini 阅读(146) 评论(0) 推荐(0)
摘要:题目: Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For 阅读全文
posted @ 2017-06-25 22:24 panini 阅读(189) 评论(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 阅读全文
posted @ 2017-06-25 20:35 panini 阅读(237) 评论(0) 推荐(0)
摘要:题目: Given an input string, reverse the string word by word. A word is defined as a sequence of non-space characters. The input string does not contain 阅读全文
posted @ 2017-06-21 20:15 panini 阅读(143) 评论(0) 推荐(0)
摘要:题目: Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest form 阅读全文
posted @ 2017-06-21 19:51 panini 阅读(178) 评论(0) 推荐(0)
摘要:题目: Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return t 阅读全文
posted @ 2017-06-20 19:32 panini 阅读(162) 评论(0) 推荐(0)
摘要:题目: Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repea 阅读全文
posted @ 2017-06-20 09:28 panini 阅读(267) 评论(0) 推荐(0)
摘要:题目: Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0. You may a 阅读全文
posted @ 2017-06-16 19:54 panini 阅读(178) 评论(0) 推荐(0)
摘要:题目: Given a sorted integer array where the range of elements are [lower, upper] inclusive, return its missing ranges. For example, given [0, 1, 3, 50, 阅读全文
posted @ 2017-06-16 19:24 panini 阅读(227) 评论(0) 推荐(0)
摘要:题目: A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its 阅读全文
posted @ 2017-06-15 20:45 panini 阅读(149) 评论(0) 推荐(0)
摘要:题目: Given two strings S and T, determine if they are both one edit distance apart. 链接: http://leetcode.com/problems/one-edit-distance/ 6/14/2017 2ms, 阅读全文
posted @ 2017-06-14 20:15 panini 阅读(159) 评论(0) 推荐(0)
摘要:题目: Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent node) or empty, flip i 阅读全文
posted @ 2017-06-14 19:39 panini 阅读(147) 评论(0) 推荐(0)
摘要:题目: 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 7 0 1 2). Find the minimum elem 阅读全文
posted @ 2017-06-14 05:40 panini 阅读(114) 评论(0) 推荐(0)
摘要:题目: Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2, 阅读全文
posted @ 2017-06-14 01:53 panini 阅读(138) 评论(0) 推荐(0)
摘要:题目: Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the". Update (2015-02-12):For 阅读全文
posted @ 2017-06-13 20:06 panini 阅读(147) 评论(0) 推荐(0)
摘要:题目: Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or anoth 阅读全文
posted @ 2017-06-13 10:35 panini 阅读(132) 评论(0) 推荐(0)
摘要:题目: Sort a linked list in O(n log n) time using constant space complexity. 链接: http://leetcode.com/problems/sort-list/ 6/12/2017 10ms, 24%,merge sort, 阅读全文
posted @ 2017-06-13 06:13 panini 阅读(187) 评论(0) 推荐(0)
摘要:题目: Sort a linked list using insertion sort. Hide Tags Linked List Sort Sort a linked list using insertion sort. Hide Tags Linked List Sort Sort a lin 阅读全文
posted @ 2017-06-13 03:44 panini 阅读(112) 评论(0) 推荐(0)
摘要:题目: Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. 阅读全文
posted @ 2017-06-13 02:44 panini 阅读(142) 评论(0) 推荐(0)
摘要:题目: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up:Can you solve it without using extra spa 阅读全文
posted @ 2017-06-12 11:26 panini 阅读(126) 评论(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. 阅读全文
posted @ 2017-06-11 22:56 panini 阅读(195) 评论(0) 推荐(0)
摘要:题目: Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note:Your algorith 阅读全文
posted @ 2017-06-11 10:07 panini 阅读(161) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2017-06-10 07:19 panini 阅读(1) 评论(0) 推荐(0)
摘要:题目: 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 tank and it 阅读全文
posted @ 2017-06-09 06:56 panini 阅读(192) 评论(0) 推荐(0)
摘要:题目: Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrou 阅读全文
posted @ 2017-06-09 05:52 panini 阅读(127) 评论(0) 推荐(0)
摘要:题目: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3  阅读全文
posted @ 2017-06-09 05:39 panini 阅读(140) 评论(0) 推荐(0)
摘要:题目: Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWo 阅读全文
posted @ 2017-06-08 20:03 panini 阅读(276) 评论(0) 推荐(0)
摘要:题目: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given th 阅读全文
posted @ 2017-06-08 10:55 panini 阅读(171) 评论(0) 推荐(0)
摘要:题目: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 链接: http://leetcode.com/problems/con 阅读全文
posted @ 2017-06-08 04:09 panini 阅读(171) 评论(0) 推荐(0)
摘要:题目: Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 链接: http 阅读全文
posted @ 2017-06-07 20:14 panini 阅读(181) 评论(0) 推荐(0)
摘要:题目: Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 链接: http: 阅读全文
posted @ 2017-06-07 19:56 panini 阅读(174) 评论(0) 推荐(0)
摘要:题目: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level 阅读全文
posted @ 2017-06-06 05:37 panini 阅读(154) 评论(0) 推荐(0)
摘要:题目: Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique 阅读全文
posted @ 2017-06-06 01:24 panini 阅读(133) 评论(0) 推荐(0)
摘要:题目: Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example,Given n = 3, your program should return 阅读全文
posted @ 2017-06-06 01:04 panini 阅读(176) 评论(0) 推荐(0)
摘要:题目: Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given "25525511135", return 阅读全文
posted @ 2017-06-05 10:56 panini 阅读(212) 评论(0) 推荐(0)
摘要:题目: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3 阅读全文
posted @ 2017-06-05 07:39 panini 阅读(197) 评论(0) 推荐(0)
摘要:题目: A message containing letters from A-Z is being encoded to numbers using the following mapping: Given an encoded message containing digits, determi 阅读全文
posted @ 2017-06-05 06:54 panini 阅读(175) 评论(0) 推荐(0)
摘要:题目: The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total 阅读全文
posted @ 2017-06-05 01:09 panini 阅读(153) 评论(0) 推荐(0)
摘要:题目: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve 阅读全文
posted @ 2017-06-04 23:45 panini 阅读(149) 评论(0) 推荐(0)
摘要:题目: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example,Given  阅读全文
posted @ 2017-06-04 10:54 panini 阅读(153) 评论(0) 推荐(0)
摘要:题目: Follow up for "Remove Duplicates":What if duplicates are allowed at most twice? For example,Given sorted array nums = [1,1,1,2,2,3], Your function 阅读全文
posted @ 2017-06-01 06:11 panini 阅读(156) 评论(0) 推荐(0)