摘要: Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an... 阅读全文
posted @ 2014-05-29 17:15 erictanghu 阅读(149) 评论(0) 推荐(0)
摘要: Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ... 阅读全文
posted @ 2014-05-29 17:14 erictanghu 阅读(326) 评论(0) 推荐(0)
摘要: Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n... 阅读全文
posted @ 2014-05-29 17:13 erictanghu 阅读(117) 评论(0) 推荐(0)
摘要: Givens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", return true.Whens3="... 阅读全文
posted @ 2014-05-29 17:12 erictanghu 阅读(117) 评论(0) 推荐(0)
摘要: Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note... 阅读全文
posted @ 2014-05-29 17:11 erictanghu 阅读(95) 评论(0) 推荐(0)
摘要: Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni... 阅读全文
posted @ 2014-05-29 17:10 erictanghu 阅读(190) 评论(0) 推荐(0)
摘要: Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1... 阅读全文
posted @ 2014-05-29 17:09 erictanghu 阅读(114) 评论(0) 推荐(0)
摘要: Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given"25525511135",return["255.2... 阅读全文
posted @ 2014-05-29 17:06 erictanghu 阅读(127) 评论(0) 推荐(0)
摘要: Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No... 阅读全文
posted @ 2014-05-29 17:05 erictanghu 阅读(105) 评论(0) 推荐(0)
摘要: Given a collection of integers that might contain duplicates,S, return all possible subsets.Note: Elements in a subset must be in non-descending o... 阅读全文
posted @ 2014-05-29 17:04 erictanghu 阅读(104) 评论(0) 推荐(0)
摘要: A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message c... 阅读全文
posted @ 2014-05-29 17:03 erictanghu 阅读(156) 评论(0) 推荐(0)
摘要: The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total number... 阅读全文
posted @ 2014-05-29 17:02 erictanghu 阅读(130) 评论(0) 推荐(0)
摘要: Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal... 阅读全文
posted @ 2014-05-29 17:01 erictanghu 阅读(106) 评论(0) 推荐(0)
摘要: Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi... 阅读全文
posted @ 2014-05-29 17:00 erictanghu 阅读(213) 评论(0) 推荐(0)
摘要: Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation... 阅读全文
posted @ 2014-05-29 16:59 erictanghu 阅读(148) 评论(0) 推荐(0)
摘要: Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.classSolution{public:intmaximalRe... 阅读全文
posted @ 2014-05-29 16:58 erictanghu 阅读(94) 评论(0) 推荐(0)
摘要: Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu... 阅读全文
posted @ 2014-05-29 16:57 erictanghu 阅读(121) 评论(0) 推荐(0)
摘要: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2->3-... 阅读全文
posted @ 2014-05-29 16:57 erictanghu 阅读(86) 评论(0) 推荐(0)
摘要: Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histog... 阅读全文
posted @ 2014-05-29 16:56 erictanghu 阅读(130) 评论(0) 推荐(0)
摘要: Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ret... 阅读全文
posted @ 2014-05-29 16:55 erictanghu 阅读(94) 评论(0) 推荐(0)
摘要: Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a function to... 阅读全文
posted @ 2014-05-29 16:54 erictanghu 阅读(75) 评论(0) 推荐(0)
摘要: Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjace... 阅读全文
posted @ 2014-05-29 16:53 erictanghu 阅读(139) 评论(0) 推荐(0)
摘要: Given a set of distinct integers,S, return all possible subsets.Note: Elements in a subset must be in non-descending order. The solution set m... 阅读全文
posted @ 2014-05-29 16:51 erictanghu 阅读(120) 评论(0) 推荐(0)
摘要: Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3], [1... 阅读全文
posted @ 2014-05-29 16:50 erictanghu 阅读(124) 评论(0) 推荐(0)
摘要: 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-05-29 16:49 erictanghu 阅读(145) 评论(0) 推荐(0)
摘要: Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, wh... 阅读全文
posted @ 2014-05-29 16:48 erictanghu 阅读(125) 评论(0) 推荐(0)
摘要: Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l... 阅读全文
posted @ 2014-05-29 16:47 erictanghu 阅读(94) 评论(0) 推荐(0)
摘要: Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A s... 阅读全文
posted @ 2014-05-29 16:46 erictanghu 阅读(122) 评论(0) 推荐(0)
摘要: Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the fol... 阅读全文
posted @ 2014-05-29 16:45 erictanghu 阅读(105) 评论(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 corner cas... 阅读全文
posted @ 2014-05-29 16:44 erictanghu 阅读(129) 评论(0) 推荐(0)
摘要: You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文
posted @ 2014-05-29 16:43 erictanghu 阅读(128) 评论(0) 推荐(0)
摘要: Implementint sqrt(int x).Compute and return the square root ofx.classSolution{public:intsqrt(intx){inti=0;intstep=1;while(step>0){while((i+step)>1);}r... 阅读全文
posted @ 2014-05-29 16:42 erictanghu 阅读(177) 评论(0) 推荐(0)
摘要: 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-05-29 16:41 erictanghu 阅读(131) 评论(0) 推荐(0)
摘要: Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at... 阅读全文
posted @ 2014-05-29 16:40 erictanghu 阅读(150) 评论(0) 推荐(0)
摘要: Validate if a given string is numeric.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>trueNote:It is intended for the problem stat... 阅读全文
posted @ 2014-05-29 16:39 erictanghu 阅读(148) 评论(0) 推荐(0)
摘要: Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".classSolution{public:stringaddBinary(stringa,st... 阅读全文
posted @ 2014-05-29 16:38 erictanghu 阅读(104) 评论(0) 推荐(0)
摘要: 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 i... 阅读全文
posted @ 2014-05-29 16:36 erictanghu 阅读(101) 评论(0) 推荐(0)
摘要: Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:Yo... 阅读全文
posted @ 2014-05-29 16:35 erictanghu 阅读(110) 评论(0) 推荐(0)
摘要: A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point ... 阅读全文
posted @ 2014-05-29 16:34 erictanghu 阅读(99) 评论(0) 推荐(0)
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists./***Defin... 阅读全文
posted @ 2014-05-29 16:33 erictanghu 阅读(120) 评论(0) 推荐(0)
摘要: Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3->NULL./***D... 阅读全文
posted @ 2014-05-29 16:32 erictanghu 阅读(197) 评论(0) 推荐(0)
摘要: The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie... 阅读全文
posted @ 2014-05-29 16:31 erictanghu 阅读(134) 评论(0) 推荐(0)
摘要: Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matri... 阅读全文
posted @ 2014-05-29 16:30 erictanghu 阅读(149) 评论(0) 推荐(0)
摘要: Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word doe... 阅读全文
posted @ 2014-05-29 16:29 erictanghu 阅读(119) 评论(0) 推荐(0)
摘要: Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially... 阅读全文
posted @ 2014-05-29 16:28 erictanghu 阅读(139) 评论(0) 推荐(0)
摘要: Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18]./***Definition... 阅读全文
posted @ 2014-05-29 16:25 erictanghu 阅读(149) 评论(0) 推荐(0)
摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文
posted @ 2014-05-29 16:24 erictanghu 阅读(119) 评论(0) 推荐(0)
摘要: Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ]... 阅读全文
posted @ 2014-05-29 16:22 erictanghu 阅读(178) 评论(0) 推荐(0)
摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2,1,... 阅读全文
posted @ 2014-05-29 16:21 erictanghu 阅读(90) 评论(0) 推荐(0)
摘要: Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.classSolution{public:inttot... 阅读全文
posted @ 2014-05-29 16:20 erictanghu 阅读(76) 评论(0) 推荐(0)
摘要: Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc... 阅读全文
posted @ 2014-05-29 16:19 erictanghu 阅读(119) 评论(0) 推荐(0)
摘要: Implement pow(x,n).classSolution{public:doublepow(doublex,intn){if(n==1)returnx;if(n==-1)return1/x;if(n==0)return1;doubleresult=1;doubletmp=pow(x,n/2)... 阅读全文
posted @ 2014-05-29 16:18 erictanghu 阅读(159) 评论(0) 推荐(0)
摘要: Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.classSolution{public:vectoranagrams(v... 阅读全文
posted @ 2014-05-29 16:18 erictanghu 阅读(94) 评论(0) 推荐(0)
摘要: You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?classSolution{publi... 阅读全文
posted @ 2014-05-29 16:17 erictanghu 阅读(136) 评论(0) 推荐(0)
摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文
posted @ 2014-05-29 16:16 erictanghu 阅读(108) 评论(0) 推荐(0)
摘要: Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,... 阅读全文
posted @ 2014-05-29 16:15 erictanghu 阅读(117) 评论(0) 推荐(0)
摘要: Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique perm... 阅读全文
posted @ 2014-05-29 16:15 erictanghu 阅读(120) 评论(0) 推荐(0)
摘要: Implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character. '*' Matches any sequence of characters (including the ... 阅读全文
posted @ 2014-05-29 16:14 erictanghu 阅读(146) 评论(0) 推荐(0)
摘要: Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega... 阅读全文
posted @ 2014-05-29 16:13 erictanghu 阅读(119) 评论(0) 推荐(0)
摘要: Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.Fo... 阅读全文
posted @ 2014-05-29 16:12 erictanghu 阅读(119) 评论(0) 推荐(0)
摘要: Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should ru... 阅读全文
posted @ 2014-05-29 16:11 erictanghu 阅读(121) 评论(0) 推荐(0)
摘要: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each number ... 阅读全文
posted @ 2014-05-29 16:10 erictanghu 阅读(181) 评论(0) 推荐(0)
摘要: Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated num... 阅读全文
posted @ 2014-05-29 16:09 erictanghu 阅读(270) 评论(0) 推荐(0)
摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is read off as"tw... 阅读全文
posted @ 2014-05-29 16:08 erictanghu 阅读(218) 评论(0) 推荐(0)
摘要: Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that there will be on... 阅读全文
posted @ 2014-05-29 16:07 erictanghu 阅读(165) 评论(0) 推荐(0)
摘要: Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with ... 阅读全文
posted @ 2014-05-29 16:02 erictanghu 阅读(125) 评论(0) 推荐(0)
摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or... 阅读全文
posted @ 2014-05-29 16:00 erictanghu 阅读(201) 评论(0) 推荐(0)
摘要: Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord... 阅读全文
posted @ 2014-05-29 15:59 erictanghu 阅读(129) 评论(0) 推荐(0)
摘要: 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).You are given a target value t... 阅读全文
posted @ 2014-05-29 15:58 erictanghu 阅读(97) 评论(0) 推荐(0)
摘要: Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest... 阅读全文
posted @ 2014-05-29 15:57 erictanghu 阅读(102) 评论(0) 推荐(0)
摘要: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possibl... 阅读全文
posted @ 2014-05-29 15:56 erictanghu 阅读(127) 评论(0) 推荐(0)
摘要: 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-05-29 15:55 erictanghu 阅读(143) 评论(0) 推荐(0)
摘要: Divide two integers without using multiplication, division and mod operator.classSolution{public:intdivide(intdividend,intdivisor){longlonginta=divide... 阅读全文
posted @ 2014-05-29 15:54 erictanghu 阅读(89) 评论(0) 推荐(0)
摘要: Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.classSolution{public:char*... 阅读全文
posted @ 2014-05-29 15:52 erictanghu 阅读(98) 评论(0) 推荐(0)
摘要: Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't mat... 阅读全文
posted @ 2014-05-29 15:51 erictanghu 阅读(89) 评论(0) 推荐(0)
摘要: Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a... 阅读全文
posted @ 2014-05-29 15:51 erictanghu 阅读(120) 评论(0) 推荐(0)
摘要: Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o... 阅读全文
posted @ 2014-05-29 15:50 erictanghu 阅读(131) 评论(0) 推荐(0)
摘要: Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor... 阅读全文
posted @ 2014-05-29 15:49 erictanghu 阅读(95) 评论(0) 推荐(0)
摘要: Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity./***Definitionforsingly-linkedlist.*structListNode{*in... 阅读全文
posted @ 2014-05-29 15:48 erictanghu 阅读(98) 评论(0) 推荐(0)
摘要: Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文
posted @ 2014-05-29 15:47 erictanghu 阅读(108) 评论(0) 推荐(0)
摘要: Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ... 阅读全文
posted @ 2014-05-29 15:46 erictanghu 阅读(107) 评论(0) 推荐(0)
摘要: Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After ... 阅读全文
posted @ 2014-05-29 15:45 erictanghu 阅读(100) 评论(0) 推荐(0)
摘要: Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephon... 阅读全文
posted @ 2014-05-29 15:36 erictanghu 阅读(120) 评论(0) 推荐(0)
摘要: Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of ... 阅读全文
posted @ 2014-05-29 15:35 erictanghu 阅读(148) 评论(0) 推荐(0)
摘要: Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m... 阅读全文
posted @ 2014-05-29 15:32 erictanghu 阅读(119) 评论(0) 推荐(0)
摘要: 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: E... 阅读全文
posted @ 2014-05-29 15:29 erictanghu 阅读(121) 评论(0) 推荐(0)
摘要: Write a function to find the longest common prefix string amongst an array of strings.classSolution{public:stringlongestCommonPrefix(vector&strs){if(s... 阅读全文
posted @ 2014-05-29 15:28 erictanghu 阅读(86) 评论(0) 推荐(0)
摘要: Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.classSolution{public:intromanToInt(strings){... 阅读全文
posted @ 2014-05-29 15:27 erictanghu 阅读(84) 评论(0) 推荐(0)
摘要: Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.classSolution{public:stringintToRoman(intnum... 阅读全文
posted @ 2014-05-29 15:26 erictanghu 阅读(97) 评论(0) 推荐(0)
摘要: Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ... 阅读全文
posted @ 2014-05-29 15:25 erictanghu 阅读(113) 评论(0) 推荐(0)
摘要: Implement regular expression matching with support for'.'and'*'.'.' Matches any single character. '*' Matches zero or more of the preceding element. T... 阅读全文
posted @ 2014-05-29 15:24 erictanghu 阅读(104) 评论(0) 推荐(0)
摘要: Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i... 阅读全文
posted @ 2014-05-29 15:23 erictanghu 阅读(86) 评论(0) 推荐(0)
摘要: 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-05-29 15:17 erictanghu 阅读(142) 评论(0) 推荐(0)
摘要: Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about this?Here are som... 阅读全文
posted @ 2014-05-29 15:08 erictanghu 阅读(138) 评论(0) 推荐(0)
摘要: The string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font fo... 阅读全文
posted @ 2014-05-29 15:07 erictanghu 阅读(106) 评论(0) 推荐(0)
摘要: Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa... 阅读全文
posted @ 2014-05-29 15:06 erictanghu 阅读(122) 评论(0) 推荐(0)
摘要: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ... 阅读全文
posted @ 2014-05-29 15:04 erictanghu 阅读(120) 评论(0) 推荐(0)
摘要: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo... 阅读全文
posted @ 2014-05-29 15:03 erictanghu 阅读(105) 评论(0) 推荐(0)
摘要: 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-05-29 15:01 erictanghu 阅读(105) 评论(0) 推荐(0)
摘要: Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu... 阅读全文
posted @ 2014-05-29 15:00 erictanghu 阅读(181) 评论(0) 推荐(0)