摘要: Total Accepted: 31557 Total Submissions: 116793Given a triangle, find the minimum path sum from top to bottom.Each step you may move to adjacent numbe... 阅读全文
posted @ 2015-02-18 16:33 Justin.cn 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 int strStr(char *haystack, char *needle) { 4 5 int i = 0 , skip[256]; 6 char *str = haystack, *substr = n... 阅读全文
posted @ 2015-02-18 13:00 Justin.cn 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), ne... 阅读全文
posted @ 2015-02-18 12:56 Justin.cn 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 1 #define ADDITION '+' 2 #define SUBSTRACTION '-' 3 #define MULTIPLICATION '*' 4 #define DIVISION '/' 5 6 7 class Solution { 8 public: 9 se... 阅读全文
posted @ 2015-02-18 12:52 Justin.cn 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 vector ret; 4 string src; 5 int len; 6 unordered_set added; 7 vector restoreIpAddresses(string... 阅读全文
posted @ 2015-02-18 12:47 Justin.cn 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 递归定义很简单,效率当然很低下,且极易超出栈空间大小.这样做纯粹是为了体现python的语言表现力而已, 并没有任何实际意义。1 def fib(x):2 return fib(x-1) + fib(x-2) if x - 2 > 0 else 1 阅读全文
posted @ 2015-02-18 01:04 Justin.cn 阅读(196) 评论(0) 推荐(0) 编辑