摘要:        
都能求最小了,就能求最大:int maxDepth(TreeNode* root) { if (root == nullptr) { return 0; } constexpr int MIN_DEPTH = 0; constexpr int in...    阅读全文
        
            posted @ 2015-08-11 21:50
wu_overflow
阅读(614)
评论(0)
推荐(0)
        
        
            
        
        
摘要:        
int minDepth(TreeNode* root) { if (root == nullptr) { return 0; } constexpr int MAX_DEPTH = INT16_MAX; constexpr int initLay...    阅读全文
        
            posted @ 2015-08-11 17:23
wu_overflow
阅读(292)
评论(0)
推荐(0)
        
        
            
        
        
摘要:        
在我的 Xcode 上明明行为都是正常的,但是 leetcode 总是说测试到 “ab” 的时候,我的程序返回的是 true。我特么再试几次返回的都是 false,所以觉得是不是网站错了。首先是我一开始写的版本,简单倒是简单,只是效率低:bool isPalindrome(string s) { ...    阅读全文
        
            posted @ 2015-08-11 16:22
wu_overflow
阅读(302)
评论(0)
推荐(0)
        
        
            
        
        
摘要:        
先安装 sublime REPL, 然后在用户自定义的键绑定中更新为以下代码:[ { "keys": ["super+shift+r"], "command": "repl_open", "caption": "Python", ...    阅读全文
        
            posted @ 2015-08-11 13:04
wu_overflow
阅读(723)
评论(0)
推荐(0)
        
        
            
        
        
摘要:        
我一开始没想太多,觉得把标准库里现有的数据结构拼一下,完全就可以了,这是我的代码:class MinStack {private: multiset sortedElems; list stack;public: void push(int x) { sort...    阅读全文
        
            posted @ 2015-08-11 02:26
wu_overflow
阅读(175)
评论(0)
推荐(0)
        
        
            
        
        
摘要:        
把这个像复杂了,因为之前判断链表是否回文的经验,想从递归的延迟求值的特性来从两个链表的终点递归来确定交集的头结点,甚难。后来看了一位朋友的博客,明白了原来是只要找第一个相同的头结点就行了,那这个就简单了。代码如下:ListNode *getIntersectionNode(ListNode *hea...    阅读全文
        
            posted @ 2015-08-11 00:34
wu_overflow
阅读(409)
评论(0)
推荐(0)
        
        
                    
                
浙公网安备 33010602011771号