摘要: 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-06-24 22:41 OpenSoucre 阅读(136) 评论(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-06-24 22:21 OpenSoucre 阅读(145) 评论(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-06-24 21:51 OpenSoucre 阅读(157) 评论(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 @ 2014-06-24 20:35 OpenSoucre 阅读(93) 评论(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 @ 2014-06-24 20:13 OpenSoucre 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 第一节 Floyd-Warshall算法本算法可以求任意两个点之间的最短路径,又称“多源最短路径”,其时间复杂度为O(n^3)其核心部分只有下面几行,注意加法的溢出处理 //floyd最短路径算法的核心部分 for(int k = 0; k grid[i][k]+grid[k][j])... 阅读全文
posted @ 2014-06-24 11:38 OpenSoucre 阅读(348) 评论(0) 推荐(0) 编辑