leetcode
Matafight
这个作者很懒,什么都没留下…
展开
-
unique binary search trees
class Solution {public:int trees(int x,int y){ int way = 1; if (x<y) { way = 0; for (int i = x; i <=y; i++) { way += trees(x, i-1) * trees(i+1, y); } } return way;} int numTr原创 2014-09-05 10:39:06 · 431 阅读 · 0 评论 -
Linked List Cycle
先贴代码class Solution {public: bool hasCycle(ListNode *head) { bool flag=false; ListNode * p; ListNode * q; if(head==NULL) return false;原创 2014-09-05 11:13:14 · 452 阅读 · 0 评论 -
Populating Next Right Pointers in each Node
http://leetcode.com/2010/03/first-on-site-technical-interview.html这代码简直酷炫啊原创 2014-09-05 14:53:04 · 474 阅读 · 0 评论 -
leetcode-single number
LeetCode通过率最高的一题原创 2014-08-26 16:37:52 · 557 阅读 · 0 评论 -
leetcode 判断平衡二叉树
二叉树的高度和深度分别指什么?原创 2014-09-09 15:34:29 · 553 阅读 · 0 评论 -
sort list
快速排序来排序链表,leetcode上竟然是超时了。。先贴上再说原创 2014-09-26 10:35:39 · 534 阅读 · 0 评论