03 2016 档案

摘要:查找等差数列中的缺失项. e.g.Input: arr[] = {2, 4, 8, 10, 12, 14} Output: 6 Input: arr[] = {1, 6, 11, 16, 21, 31}; Output: 26. 采用binary search. 若是arr[mid] - arr[l 阅读全文
posted @ 2016-03-30 04:14 Dylan_Java_NYC 阅读(398) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/binary-tree-vertical-order-traversal/ 题目: Given a binary tree, return the vertical order traversal of its nodes' 阅读全文
posted @ 2016-03-30 01:37 Dylan_Java_NYC 阅读(718) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree/ 题目: Given an array of numbers, verify whether it is the correct 阅读全文
posted @ 2016-03-28 06:46 Dylan_Java_NYC 阅读(826) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/paint-house-ii/ 题目: There are a row of n houses, each house can be painted with one of the k colors. The cost of 阅读全文
posted @ 2016-03-28 05:25 Dylan_Java_NYC 阅读(764) 评论(0) 推荐(1) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/paint-house/ 题目: There are a row of n houses, each house can be painted with one of the three colors: red, blue 阅读全文
posted @ 2016-03-28 05:04 Dylan_Java_NYC 阅读(870) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/house-robber-iii/ 题目: The thief has found himself a new place for his thievery again. There is only one entrance 阅读全文
posted @ 2016-03-27 04:55 Dylan_Java_NYC 阅读(700) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/ 题目: Given an array of integers that is already sorted in ascending order, find 阅读全文
posted @ 2016-03-27 04:04 Dylan_Java_NYC 阅读(271) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/two-sum-iii-data-structure-design/ 题目: Design and implement a TwoSum class. It should support the following oper 阅读全文
posted @ 2016-03-27 03:54 Dylan_Java_NYC 阅读(266) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/odd-even-linked-list/ 题目: Given a singly linked list, group all odd nodes together followed by the even nodes. P 阅读全文
posted @ 2016-03-27 03:21 Dylan_Java_NYC 阅读(372) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/burst-balloons/ 题目: Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represe 阅读全文
posted @ 2016-03-26 12:05 Dylan_Java_NYC 阅读(397) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/count-of-range-sum/ 题目: Given an integer array nums, return the number of range sums that lie in [lower, upper]  阅读全文
posted @ 2016-03-26 07:39 Dylan_Java_NYC 阅读(363) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times/ 题目: The API: int read4(char *buf) reads 4 characters at a 阅读全文
posted @ 2016-03-26 05:03 Dylan_Java_NYC 阅读(405) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/read-n-characters-given-read4/ 题目: The API: int read4(char *buf) reads 4 characters at a time from a file. The r 阅读全文
posted @ 2016-03-26 04:39 Dylan_Java_NYC 阅读(497) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/shortest-distance-from-all-buildings/ 题目: You want to build a house on an empty land which reaches all buildings 阅读全文
posted @ 2016-03-25 06:07 Dylan_Java_NYC 阅读(647) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/smallest-rectangle-enclosing-black-pixels/ 题目: An image is represented by a binary matrix with 0 as a white pixe 阅读全文
posted @ 2016-03-25 05:08 Dylan_Java_NYC 阅读(373) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/count-of-smaller-numbers-after-self/ 题目: You are given an integer array nums and you have to return a new counts 阅读全文
posted @ 2016-03-23 05:36 Dylan_Java_NYC 阅读(562) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/reconstruct-itinerary/description/ 题目: Given a list of airline tickets represented by pairs of departure and arr 阅读全文
posted @ 2016-03-23 01:23 Dylan_Java_NYC 阅读(984) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/minimum-height-trees/ 题目: For a undirected graph with tree characteristics, we can choose any node as the root. 阅读全文
posted @ 2016-03-21 12:18 Dylan_Java_NYC 阅读(367) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/missing-ranges/ 题目: Given a sorted integer array nums, where the range of elements are in the inclusive range [l 阅读全文
posted @ 2016-03-21 11:33 Dylan_Java_NYC 阅读(536) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree/ 题目: One way to serialize a binary tree is to use pre-order trave 阅读全文
posted @ 2016-03-21 10:44 Dylan_Java_NYC 阅读(306) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/patching-array/ 题目: Given a sorted positive integer array nums and an integer n, add/patch elements to the array 阅读全文
posted @ 2016-03-21 09:39 Dylan_Java_NYC 阅读(394) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/generalized-abbreviation/ 题目: Write a function to generate the generalized abbreviations of a word. Example: Giv 阅读全文
posted @ 2016-03-20 11:17 Dylan_Java_NYC 阅读(877) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/ 题目: Say you have an array for which the ith element is the price 阅读全文
posted @ 2016-03-17 01:28 Dylan_Java_NYC 阅读(322) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/alien-dictionary/ 题目: There is a new alien language which uses the latin alphabet. However, the order among lett 阅读全文
posted @ 2016-03-15 09:57 Dylan_Java_NYC 阅读(1008) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/3sum-smaller/ 题目: Given an array of n integers nums and a target, find the number of index triplets i, j, k with 阅读全文
posted @ 2016-03-11 14:15 Dylan_Java_NYC 阅读(384) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/palindrome-permutation-ii/ 题目: Given a string s, return all the palindromic permutations (without duplicates) of 阅读全文
posted @ 2016-03-11 13:51 Dylan_Java_NYC 阅读(520) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/palindrome-permutation/ 题目: Given a string, determine if a permutation of the string could form a palindrome. Fo 阅读全文
posted @ 2016-03-11 12:20 Dylan_Java_NYC 阅读(305) 评论(0) 推荐(0) 编辑
摘要:三种comments: 1 /* Test program */ 2 3 int main() 4 5 { 6 7 // variable declaration 8 9 int a, b, c; 10 11 /* This is a test 12 13 multiline 14 15 comme 阅读全文
posted @ 2016-03-09 09:47 Dylan_Java_NYC 阅读(207) 评论(0) 推荐(0) 编辑
摘要:以0.25为例, 0.25 * 100 = 25, 求25 和 100 的最大公约数gcd. 25/gcd 为分子. 100/gcd为分母. 与Fraction to Recurring Decimal类似. 阅读全文
posted @ 2016-03-09 07:31 Dylan_Java_NYC 阅读(1579) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/ 题目: Given n nodes labeled from 0 to n - 1 and a list of u 阅读全文
posted @ 2016-03-06 13:16 Dylan_Java_NYC 阅读(1108) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/reverse-words-in-a-string-ii/ 题目: Given an input string , reverse the string word by word. Example: Input: ["t", 阅读全文
posted @ 2016-03-06 03:35 Dylan_Java_NYC 阅读(332) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/range-sum-query-2d-mutable/ 题目: Given a 2D matrix matrix, find the sum of the elements inside the rectangle defi 阅读全文
posted @ 2016-03-06 03:10 Dylan_Java_NYC 阅读(573) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/paint-fence/ 题目: There is a fence with n posts, each post can be painted with one of the k colors. You have to p 阅读全文
posted @ 2016-03-05 04:40 Dylan_Java_NYC 阅读(494) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/strobogrammatic-number-ii/ 题目: A strobogrammatic number is a number that looks the same when rotated 180 degrees 阅读全文
posted @ 2016-03-05 04:01 Dylan_Java_NYC 阅读(937) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/strobogrammatic-number/ 题目: A strobogrammatic number is a number that looks the same when rotated 180 degrees (l 阅读全文
posted @ 2016-03-05 02:33 Dylan_Java_NYC 阅读(292) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/zigzag-iterator/ 题目: Given two 1d vectors, implement an iterator to return their elements alternately. For examp 阅读全文
posted @ 2016-03-05 00:08 Dylan_Java_NYC 阅读(303) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/remove-duplicate-letters/ 题目: Given a string which contains only lowercase letters, remove duplicate letters so 阅读全文
posted @ 2016-03-04 12:33 Dylan_Java_NYC 阅读(327) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/encode-and-decode-strings/ 题目: Design an algorithm to encode a list of strings to a string. The encoded string i 阅读全文
posted @ 2016-03-04 09:37 Dylan_Java_NYC 阅读(462) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/maximum-size-subarray-sum-equals-k/ 题目: Given an array nums and a target value k, find the maximum length of a s 阅读全文
posted @ 2016-03-03 13:28 Dylan_Java_NYC 阅读(424) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/unique-word-abbreviation/ 题目: An abbreviation of a word follows the form <first letter><number><last letter>. Be 阅读全文
posted @ 2016-03-03 12:20 Dylan_Java_NYC 阅读(383) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/graph-valid-tree/ 题目: Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair 阅读全文
posted @ 2016-03-03 11:27 Dylan_Java_NYC 阅读(724) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/super-ugly-number/ 题目: Write a program to find the nth super ugly number. Super ugly numbers are positive number 阅读全文
posted @ 2016-03-02 23:19 Dylan_Java_NYC 阅读(208) 评论(0) 推荐(0) 编辑
摘要:原题链接在这里:https://leetcode.com/problems/binary-tree-longest-consecutive-sequence/ 题目: Given a binary tree, find the length of the longest consecutive se 阅读全文
posted @ 2016-03-02 12:46 Dylan_Java_NYC 阅读(475) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示