摘要:        
题目:Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.Fo...    阅读全文
posted @ 2014-02-17 22:40
mickole
阅读(458)
评论(0)
推荐(0)
        
            
        
        
摘要:        
题目:Given a linked list, determine if it has a cycle in it.Follow up: Can you solve it without using extra space?解题思路:判断链表有无环,可用快慢指针进行,快指针每次走两步,慢指针每次走一...    阅读全文
posted @ 2014-02-17 19:20
mickole
阅读(261)
评论(0)
推荐(0)
        
            
        
        
摘要:        
题目:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up: Can you solve it without using extra spac...    阅读全文
posted @ 2014-02-17 19:14
mickole
阅读(308)
评论(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.F...    阅读全文
posted @ 2014-02-17 16:26
mickole
阅读(282)
评论(0)
推荐(0)
        
            
        
        
摘要:        
题目:Given a binary tree, return the preorder traversal of its nodes' values.For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,...    阅读全文
posted @ 2014-02-17 15:43
mickole
阅读(222)
评论(0)
推荐(0)
        
            
        
        
摘要:        
题目:Given a binary tree, return the postorder traversal of its nodes' values.For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3...    阅读全文
posted @ 2014-02-17 15:30
mickole
阅读(205)
评论(0)
推荐(0)
        
            
        
        
摘要:        
题目:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get t...    阅读全文
posted @ 2014-02-17 12:55
mickole
阅读(368)
评论(0)
推荐(0)
        
            
        
        
摘要:        
题目:Sort a linked list using insertion sort.解题思路:按题目要求,直接进行插入排序实现代码:#include using namespace std;/*Sort a linked list using insertion sort. */struct Li...    阅读全文
posted @ 2014-02-17 09:57
mickole
阅读(315)
评论(0)
推荐(0)
        
                    
                
浙公网安备 33010602011771号