LeetCode OJ
文章平均质量分 73
williamwyx
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Linked List Cycle
/* * Solution.cpp * * Created on: 2014年4月9日 * Author: William */ #include using namespace std; // Definition for singly-linked list. struct ListNode { int val; ListNode *next; ListNod原创 2014-04-16 16:59:22 · 417 阅读 · 0 评论 -
Insertion Sort List
/* * Solution.cpp * * Created on: 2014年4月8日 * Author: William */ #include using namespace std; // Definition for singly-linked list. struct ListNode { int val; ListNode *next; ListNode原创 2014-04-09 16:47:56 · 383 阅读 · 0 评论 -
Sort List
/* * Solution.cpp * * Created on: 2014年4月8日 * Author: William */ #include using namespace std; // Definition for singly-linked list. struct ListNode { int val; ListNode *next; ListNod原创 2014-04-09 16:47:17 · 359 阅读 · 0 评论 -
Evaluate Reverse Polish Notation
/* * Solution.cpp * * Created on: 2014年3月25日 * Author: William */ #include #include #include #include #include using namespace std; class Solution { public: int evalRPN(vector &toke原创 2014-04-09 16:45:32 · 367 阅读 · 0 评论 -
Reorder List
/* * Solution.cpp * * Created on: 2014年4月9日 * Author: William */ #include using namespace std; // Definition for singly-linked list. struct ListNode { int val; ListNode *next; ListNod原创 2014-04-09 16:51:31 · 374 阅读 · 0 评论 -
Binary Tree Preorder Traversal
/* * Solution.cpp * * Created on: 2014年4月9日 * Author: William */ #include #include #include using namespace std; // Definition for binary tree struct TreeNode { int val; TreeNode *le原创 2014-04-09 16:50:55 · 336 阅读 · 0 评论 -
LRU Cache
/* * Solution.cpp * * Created on: 2014年4月8日 * Author: William */ #include #include using namespace std; struct Node { int key; int val; Node *prev; Node *next; Node(int k, int v) :原创 2014-04-09 16:48:28 · 396 阅读 · 0 评论 -
Max Points on a Line
/* * Solution.cpp * * Created on: 2014年3月26日 * Author: William */ /** * Definition for a point. * struct Point { * int x; * int y; * Point() : x(0), y(0) {} * Point(in原创 2014-04-09 16:46:31 · 372 阅读 · 0 评论 -
Reverse Words in a String
/* * Solution.cpp * * Created on: 2014年3月25日 * Author: William */ #include #include using namespace std; class Solution { public: void reverseWords(string &s) { reverse(s.begin原创 2014-04-09 16:43:34 · 355 阅读 · 0 评论 -
Word Break II
不会做啊不会做~原创 2014-04-17 14:41:18 · 497 阅读 · 0 评论 -
Word Break
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. For example, given s = "leetcode", dict = ["leet"原创 2014-04-17 14:40:49 · 400 阅读 · 0 评论 -
Linked List Cycle II
分析转自:http://www.cnblogs.com/CSGrandeur/p/3520937.html 设置两个指针slow和fast,从head开始,slow一次一步,fast一次两步,如果fast能再次追上slow则有圈。 设slow走了n步,则fast走了2*n步,设圈长度m,圈起点到head距离为k,相遇位置距离圈起点为t,则有: n = k + t + pm;原创 2014-04-16 16:58:52 · 447 阅读 · 0 评论 -
Binary Tree Postorder Traversal
/* * Solution.cpp * * Created on: 2014年4月9日 * Author: William */ #include #include #include using namespace std; // Definition for binary tree struct TreeNode { int val; TreeNode *le原创 2014-04-09 16:49:10 · 357 阅读 · 0 评论
分享