- 博客(10)
- 收藏
- 关注
原创 [Leetcode]Word Break & Word Break II
Word Break is a problem that gives you a string and a dict of word, you have to indicate that if the string
2014-04-18 22:55:49 675
原创 Linked List Cycle
Linked List Cycle is a problem to tell if there is a cycle in the
2014-04-17 21:39:56 602
原创 [Leetcode]Reorder List
class Solution {public: void reorderList(ListNode *head) { if (!head) { return; } ListNode *a, *b; splitList(head, a, b); b = reverseList(b
2014-04-05 00:18:47 470
原创 [Leetcode]Binary Tree Iterative Traversal
Three problems of binary tree traversal of Leetcode:
2014-04-04 22:51:45 623
原创 [Leetcode Solution] LRU Cache
LRU, also known as "Least Recently Used", is a cache algorithm which discards the the least recently used entry when we push a new entry to the cache.This problem wants us to implement two funct
2014-03-29 22:10:29 608
原创 [Leetcode Solution]Insertion Sort List
Insertion Sort is a basic sorting algorithm invented decades ago. And the implementation is simple, too.Declare a head pointer of a sorted linked-list with initial value NULL. Then, add node to
2014-03-21 13:19:02 703
原创 [Leetcode Solution] Sort List
Sort a singly-linked list is easy with quick sort and merge sort algorithm. Quick sort will reach O(n ^ 2) time complexity in the worst case. Whereas merge sort is a stable sort with O(n logn) compl
2014-03-19 16:23:42 644
原创 [Leetcode Solution]Max Points on a Line
As we know, for three arbitrary points, A, B and C, if the slope of the line equals to the slope of line, we can confirm that these three points are on a same line. Further, if line, line ... line all
2014-03-18 23:35:24 694
原创 [Leetcode Soution]Evaluate Reverse Polish Notation
["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6Evaluate a RPN expression is simple with a specific algorithm to deal with.STACK stack;FOR not
2014-03-18 14:11:18 623
原创 [Leetcode Solution] Reverse Words in a String
The problem description is simple enough.For example, "the sky is blue" => "blue is sky the".However, this problem is not easy as it seems. We have to deal with the leading and trailing spaces, al
2014-03-17 23:29:11 956
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人