摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11.11 is read off 阅读全文
posted @ 2017-01-11 14:14 rocksolid 阅读(98) 评论(0) 推荐(0) 编辑
摘要: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文
posted @ 2017-01-10 11:42 rocksolid 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 1 2 brute force 3 hash 有 阅读全文
posted @ 2017-01-05 17:06 rocksolid 阅读(102) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2017-01-05 16:53 rocksolid 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 24. Swap Nodes in Pairs 24. Swap Nodes in Pairs Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, 阅读全文
posted @ 2017-01-05 15:55 rocksolid 阅读(92) 评论(0) 推荐(0) 编辑