自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(48)
  • 收藏
  • 关注

原创 leetcode:Number of Digit One

Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Return 6, because digit 1 occurred in the followin

2016-03-28 19:38:26 280

原创 leetcode:Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()

2016-03-28 19:36:48 300

原创 lintcode:k Sum II

Description Notes Testcase JudgeGiven n unique integers, number k (1Find all possible k integers where their sum is target.Have you met this question in a real interview? Yes

2016-03-28 16:06:04 346

原创 lintcode:Reverse Nodes in k-Group

Description Notes Testcase JudgeGiven a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left

2016-03-28 14:11:01 288

原创 lintcode:Majority Number II

Description Notes Testcase JudgeGiven an array of integers, the majority number is the number that occursmore than 1/3 of the size of the array.Find it.Have you met this questi

2016-03-27 23:48:55 282

原创 lintcdoe:Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list.Analyze and describe its complexity.Have you met this question in a real interview? YesExampleGiven lists:[ 2

2016-03-27 19:21:25 415

原创 lintcode: Subarray Sum Closest

Given an integer array, find a subarray with sum closest to zero. Return the indexes of the first number and last number.Have you met this question in a real interview? YesExample

2016-03-27 18:52:16 420

原创 lintcode: Longest Common Prefix

Longest Common Prefix Description Notes Testcase JudgeGiven k strings, find the longest common prefix (LCP).Have you met this question in a real interview? Yes

2016-03-27 17:59:40 281

原创 lintcode:First Bad Version

Description Notes Testcase JudgeThe code base version is an integer start from 1 to n. One day, someone committed a bad version in the code case, so it caused this version and the following

2016-03-27 17:38:06 376

原创 lintcode:Construct Binary Tree from Preorder and Inorder Traversal

Description Notes Testcase JudgeGiven preorder and inorder traversal of a tree, construct the binary tree.Have you met this question in a real interview? Yes Notice

2016-03-27 17:20:42 345

原创 lintcode:Subsets II

Description Notes Testcase JudgeGiven a list of numbers that may has duplicate numbers, return all possible subsetsHave you met this question in a real interview? Yes N

2016-03-27 15:31:43 354

原创 lintcode:Subsets

解法1:  这种需要内部for循环,并且retVtr.push_back是在for循环内部class Solution { private: void subsetsHelper(vector &nums, int curIdx, vector &curVtr, vector> &retVtr) { if (curIdx == nums.size())

2016-03-27 13:22:13 342

原创 lintcode:Permutations II

Description Notes Testcase JudgeGiven a list of numbers with duplicate number in it. Find all unique permutations.Have you met this question in a real interview? YesExample

2016-03-27 12:17:20 457

原创 lintcode:Permutations

Description Notes Testcase JudgeGiven a list of numbers, return all possible permutations.Have you met this question in a real interview? YesExampleFor nums = [1,2,3]

2016-03-27 11:43:15 290

原创 lintcode:Heapify

Heapify Description Notes Testcase JudgeGiven an integer array, heapify it into a min-heap array.For a heap array A, A[0] is the root of heap, and for each A[i], A[i * 2 + 1]

2016-03-26 17:16:09 443

原创 lintcode:Paint House

Description Notes Testcase JudgeThere 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 certain color

2016-03-25 23:51:29 363

原创 leetcode: Next Permutation

Description Notes Testcase JudgeGiven a list of integers, which denote a permutation.Find the next permutation in ascending order.Have you met this question in a real interview? 

2016-03-25 23:16:33 246

原创 lintcode: Implement Queue by Two Stacks

Description Notes Testcase JudgeAs the title described, you should only use two stacks to implement a queue's actions.The queue should support push(element), pop() and top() where pop is

2016-03-25 17:55:19 342

原创 lintcode:Graph Valid Tree

Description Notes Testcase JudgeGiven 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 make

2016-03-25 17:52:38 413

原创 lintcode:First Position of Target

Description Notes Testcase JudgeFor a given sorted array (ascending order) and a target number, find the first index of this number in O(log n) time complexity.If the target number does

2016-03-25 10:33:07 313

原创 lintcode:Topological Sorting

Topological SortingShow result 07:18 ResetGiven an directed graph, a topological order of the graph nodes is defined as follow:For each directed edge A -> B in graph,

2016-03-23 23:23:00 278

原创 lintcode:Identical Binary Tree

Check if two binary trees are identical. Identical means the two binary trees have the same structure and every identical position has the same value.Have you met this question in a real intervi

2016-03-23 21:59:42 389

原创 leetcode:Expression Add Operators

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 digits so they evaluate to the target value.

2016-03-23 18:12:32 310

转载 clone() and the Cloneable Interface in Java

转自:http://www.java-samples.com/showtutorial.php?tutorialid=344Most of the methods defined by Object are discussedelsewhere in this book. However, one deserves special attention:clone( ). The c

2016-03-23 10:43:39 500

原创 leetcode:Find Median from Data Stream

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 two middle value.Examples: [2,3,4] , the median

2016-03-21 23:46:05 285

原创 leetcode:Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","

2016-03-20 15:15:48 222

原创 leetcode:Counting Bits

Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example:For num = 5

2016-03-20 14:07:32 2118 1

原创 leetcode:Palindrome Partitioning II

Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.For example, given s = "aab",Return

2016-03-20 13:43:56 261

原创 leetcode:Burst Balloons

Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i you will get num

2016-03-19 22:20:07 416

原创 liintcode: Permutation Index

Given a permutation which contains no repeated number, find its index in all the permutations of these numbers, which are ordered in lexicographical order. The index begins at 1.Have you met thi

2016-03-17 23:47:10 335

原创 leetcode:Unique Paths II

Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the

2016-03-15 16:36:28 242

原创 leetcode:Permutation Sequence

The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""213""231""3

2016-03-13 20:39:42 226

原创 leetcode:Repeated DNA Sequences

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 identify repeated sequences within the DNA.Wri

2016-03-13 17:32:46 231

原创 leetcode:Median of Two Sorted Arrays

There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Subscribe to see whic

2016-03-13 15:42:42 240

原创 lintcode: Wiggle Sort Show result

Wiggle SortShow result 30:00 StartGiven an unsorted array nums, reorder it in-place such thatnums[0] = nums[2] <= nums[3]....Have you met this question in a re

2016-03-12 22:58:06 255

原创 lintcode:Interleaving Positive and Negative Numbers

Interleaving Positive and Negative NumbersShow result You have exceeded the time limit ResetGiven an array with positive and negative integers. Re-range it to interleavin

2016-03-12 00:09:24 387

原创 leetcode:Perfect Squares

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, return 3 because 12 = 4 + 4 + 4; given n =

2016-03-10 20:44:03 259

原创 leetcode:N-Queens II

Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.Subscribe to see which companies asked this question这题的思想和数

2016-03-10 10:31:55 625

转载 leetcode: Best Meeting Point

转自:http://blog.csdn.net/pointbreak1/article/details/49422265题目: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,

2016-03-09 23:55:54 311

原创 leetcode:Minimum Window Substring

Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum window is "BAN

2016-03-07 22:00:58 208

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除