Given an index k, return the kth row of the Pascal's triangle.
For example, given k = 3,
Return [1,3,3,1].
Note:
Could you optimize your algorithm to use only O(k) extra space?
思路:最简单的方法就是按...
                            
                            
                                分类:
其他好文   时间:
2014-06-18 12:40:54   
                                阅读次数:
265
                             
                         
                    
                        
                            
                            
                                Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. Could you devise a constant space solution?
思路:因为需要遍历整个矩阵,时间复杂度肯定需要O(m * n),对于空间复杂度而言,第一种是可以使用O(m * n),...
                            
                            
                                分类:
其他好文   时间:
2014-06-18 12:33:39   
                                阅读次数:
167
                             
                         
                    
                        
                            
                            
                                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 to
m + n) to 
hold additional ele...
                            
                            
                                分类:
其他好文   时间:
2014-06-17 23:05:13   
                                阅读次数:
246
                             
                         
                    
                        
                            
                            
                                Kth number
Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4585    Accepted Submission(s): 1461
Problem Description
Give you a sequenc...
                            
                            
                                分类:
其他好文   时间:
2014-06-17 23:04:29   
                                阅读次数:
246
                             
                         
                    
                        
                            
                            
                                题目
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would ...
                            
                            
                                分类:
其他好文   时间:
2014-06-17 22:39:41   
                                阅读次数:
274
                             
                         
                    
                        
                            
                            
                                Given two words word1 and word2, find the minimum number of steps required to convert
word1 to word2. (each operation is counted as 1 step.)
You have the following 3 operations permitted...
                            
                            
                                分类:
其他好文   时间:
2014-06-17 21:43:38   
                                阅读次数:
219
                             
                         
                    
                        
                            
                            
                                The Android framework APIs provides a set 2D drawing APIs that allow you to render your owncustom graphics onto a canvas or to modify existing Views t...
                            
                            
                                分类:
移动开发   时间:
2014-06-17 19:48:07   
                                阅读次数:
255
                             
                         
                    
                        
                            
                            
                                Since we only have one bag to pay for it is something that you will not miss.Its always wanted to fight a bag of coffee. See the code inside - dark al...
                            
                            
                                分类:
其他好文   时间:
2014-06-17 15:27:14   
                                阅读次数:
204
                             
                         
                    
                        
                            
                            
                                Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complet...
                            
                            
                                分类:
其他好文   时间:
2014-06-17 14:57:30   
                                阅读次数:
269
                             
                         
                    
                        
                            
                            
                                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...
                            
                            
                                分类:
其他好文   时间:
2014-06-17 14:35:50   
                                阅读次数:
297