Fork me on GitHub
摘要: 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-03-02 12:55 hellowOOOrld 阅读(227) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and su 阅读全文
posted @ 2017-03-02 10:08 hellowOOOrld 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Given [100, 4, 200, 1, 3, 2], The long 阅读全文
posted @ 2017-03-01 17:22 hellowOOOrld 阅读(160) 评论(0) 推荐(0) 编辑
摘要: There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it cost 阅读全文
posted @ 2017-02-28 23:27 hellowOOOrld 阅读(128) 评论(0) 推荐(0) 编辑
摘要: There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following re 阅读全文
posted @ 2017-02-28 17:25 hellowOOOrld 阅读(193) 评论(0) 推荐(0) 编辑
摘要: Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the". Update (2015-02-12): For C 阅读全文
posted @ 2017-02-28 15:10 hellowOOOrld 阅读(197) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequ 阅读全文
posted @ 2017-02-27 14:56 hellowOOOrld 阅读(362) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 whic 阅读全文
posted @ 2017-02-26 23:31 hellowOOOrld 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. Fo 阅读全文
posted @ 2017-02-26 14:43 hellowOOOrld 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? 判断链表是否带环,我们可以采用在头结点设两个指针,一个叫fast,一个叫slo 阅读全文
posted @ 2017-02-25 20:19 hellowOOOrld 阅读(166) 评论(0) 推荐(0) 编辑