10 2014 档案

Word Ladder II
摘要:Given two words (startandend), and a dictionary, find all shortest transformation sequence(s) fromstarttoend, such that:Only one letter can be changed... 阅读全文

posted @ 2014-10-29 17:45 Ryan-Xing 阅读(200) 评论(0) 推荐(0)

Find Minimum in Rotated Sorted Array II
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element.The a... 阅读全文

posted @ 2014-10-29 16:04 Ryan-Xing 阅读(144) 评论(0) 推荐(0)

Find Minimum 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 7might become4 5 6 7 0 1 2).Find the minimum element.You m... 阅读全文

posted @ 2014-10-29 11:55 Ryan-Xing 阅读(131) 评论(0) 推荐(0)

Text Justification
摘要:Given an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) justified.You should p... 阅读全文

posted @ 2014-10-26 17:00 Ryan-Xing 阅读(145) 评论(0) 推荐(0)

Reverse Words in a String
摘要:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".click to show clarification.Cl... 阅读全文

posted @ 2014-10-25 21:05 Ryan-Xing 阅读(117) 评论(0) 推荐(0)

LRU Cache
摘要:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu... 阅读全文

posted @ 2014-10-25 20:31 Ryan-Xing 阅读(176) 评论(0) 推荐(0)

Surrounded Regions
摘要: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 surrounded region... 阅读全文

posted @ 2014-10-24 22:31 Ryan-Xing 阅读(162) 评论(0) 推荐(0)

Wildcard Matching
摘要:Implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character.'*' Matches any sequence of characters (including the e... 阅读全文

posted @ 2014-10-22 22:38 Ryan-Xing 阅读(134) 评论(0) 推荐(0)

String to Integer (atoi)
摘要:Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ... 阅读全文

posted @ 2014-10-22 16:03 Ryan-Xing 阅读(129) 评论(0) 推荐(0)

Maximum Product Subarray
摘要: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,4],the... 阅读全文

posted @ 2014-10-22 14:01 Ryan-Xing 阅读(220) 评论(0) 推荐(0)

Decode Ways
摘要:A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message conta... 阅读全文

posted @ 2014-10-22 12:15 Ryan-Xing 阅读(133) 评论(0) 推荐(0)

Divide Two Integers
摘要:Divide two integers without using multiplication, division and mod operator.分析:不能用乘、除、取模运算,我们可以用的运算还有加、减、位运算。一个比较简单的想法是在dividend上不断减去divisor,知道余数小于div... 阅读全文

posted @ 2014-10-20 19:52 Ryan-Xing 阅读(136) 评论(0) 推荐(0)

3Sum
摘要:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen... 阅读全文

posted @ 2014-10-19 19:39 Ryan-Xing 阅读(127) 评论(0) 推荐(0)

Median of Two Sorted Arrays
摘要:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ... 阅读全文

posted @ 2014-10-19 16:57 Ryan-Xing 阅读(142) 评论(0) 推荐(0)

Class
摘要:1. No const constructorUnlike other member functions, constructors may not be declared as const . When we create a const object of a class type, the o... 阅读全文

posted @ 2014-10-14 16:14 Ryan-Xing 阅读(243) 评论(0) 推荐(0)

Substring with Concatenation of All Words
摘要:You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenati... 阅读全文

posted @ 2014-10-06 11:43 Ryan-Xing 阅读(212) 评论(0) 推荐(0)

Functions
摘要:1 Local static variablesLocal static variables are not destroyed when the function ends; they are destroyed when the program terminates.2. Function pa... 阅读全文

posted @ 2014-10-04 21:43 Ryan-Xing 阅读(228) 评论(0) 推荐(0)

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="ADOBECODEBA... 阅读全文

posted @ 2014-10-04 16:56 Ryan-Xing 阅读(184) 评论(0) 推荐(0)

Word Ladder
摘要:Given two words (startandend), and a dictionary, find the length of shortest transformation sequence fromstarttoend, such that:Only one letter can be ... 阅读全文

posted @ 2014-10-03 23:48 Ryan-Xing 阅读(285) 评论(0) 推荐(0)

Namespace, string, vector and array
摘要:1. Headers should not include using declarationCode inside headers ordinarily should not include using declarations. The reason is that the contents o... 阅读全文

posted @ 2014-10-03 16:52 Ryan-Xing 阅读(185) 评论(0) 推荐(0)

C++ Variables and Basic Types Notes
摘要:1. Type conversion:If we assign an out-of-range value to an object of unsigned type, the result is the remainder of the value modulo the number of val... 阅读全文

posted @ 2014-10-03 15:37 Ryan-Xing 阅读(184) 评论(0) 推荐(0)