摘要: 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 @ 2015-09-23 13:38 茜茜的技术空间 阅读(217) 评论(0) 推荐(0) 编辑
摘要: There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costscost[... 阅读全文
posted @ 2015-09-23 13:25 茜茜的技术空间 阅读(239) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie... 阅读全文
posted @ 2015-09-23 12:46 茜茜的技术空间 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a... 阅读全文
posted @ 2015-09-23 12:13 茜茜的技术空间 阅读(158) 评论(0) 推荐(0) 编辑
摘要: This is afollow upofShortest Word Distance. The only difference is nowword1could be the same asword2.Given a list of words and two wordsword1andword2,... 阅读全文
posted @ 2015-09-23 02:34 茜茜的技术空间 阅读(1338) 评论(0) 推荐(0) 编辑
摘要: This is afollow upofShortest Word Distance. The only difference is now you are given the list of words and your method will be calledrepeatedlymany ti... 阅读全文
posted @ 2015-09-23 01:42 茜茜的技术空间 阅读(625) 评论(0) 推荐(0) 编辑
摘要: Given a list of words and two wordsword1andword2, return the shortest distance between these two words in the list.For example,Assume that words =["pr... 阅读全文
posted @ 2015-09-23 01:13 茜茜的技术空间 阅读(289) 评论(0) 推荐(0) 编辑
摘要: Given an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.For example, givenn... 阅读全文
posted @ 2015-09-23 00:46 茜茜的技术空间 阅读(228) 评论(0) 推荐(0) 编辑
摘要: Given a string, determine if a permutation of the string could form a palindrome.For example,"code"-> False,"aab"-> True,"carerac"-> True.Hint:Conside... 阅读全文
posted @ 2015-09-23 00:23 茜茜的技术空间 阅读(238) 评论(0) 推荐(0) 编辑