• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
ying_vincent
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 27 下一页
2014年1月16日
LeetCode: Word Break II
摘要: 难题 1 class Solution { 2 public: 3 void dfs(string s, vector &tmp, vector &res, unordered_set &unused, unordered_set &dict) { 4 if (s.size(... 阅读全文
posted @ 2014-01-16 12:06 ying_vincent 阅读(137) 评论(0) 推荐(0)
LeetCode: Word Break
摘要: 看的别人的代码改了下 1 class Solution { 2 public: 3 bool wordBreak(string s, unordered_set &dict) { 4 vector f(s.size()+1); 5 f[0] = true; 6... 阅读全文
posted @ 2014-01-16 10:46 ying_vincent 阅读(123) 评论(0) 推荐(0)
2014年1月14日
LeetCode: Sort List
摘要: merge sort 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : ... 阅读全文
posted @ 2014-01-14 09:20 ying_vincent 阅读(136) 评论(0) 推荐(0)
2014年1月13日
LeetCode: Single Number II
摘要: 这题有点难,网上大神的这段代码太牛了。 1 class Solution { 2 public: 3 int singleNumber(int A[], int n) { 4 // Note: The Solution object is instantiated only ... 阅读全文
posted @ 2014-01-13 14:10 ying_vincent 阅读(169) 评论(0) 推荐(0)
LeetCode: Single Number
摘要: 简单题 1 class Solution { 2 public: 3 int singleNumber(int A[], int n) { 4 // IMPORTANT: Please reset any member data you declared, as 5 ... 阅读全文
posted @ 2014-01-13 08:34 ying_vincent 阅读(121) 评论(0) 推荐(0)
2014年1月12日
LeetCode: Reorder List
摘要: list的题最大的麻烦就在于细节,这题也是弄了挺久,思路很简单,双指针取终点,后面的list反向后搭一起就行了 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ... 阅读全文
posted @ 2014-01-12 13:53 ying_vincent 阅读(152) 评论(0) 推荐(0)
2014年1月9日
LeetCode: LRU Cache
摘要: 看别人的答案: 1 struct CacheNode { 2 int key, value; 3 CacheNode(int a, int b) : key(a), value(b) { } 4 }; 5 class LRUCache{ 6 public: 7 LRUCach... 阅读全文
posted @ 2014-01-09 08:46 ying_vincent 阅读(169) 评论(0) 推荐(0)
LeetCode: Max Points on a Line
摘要: 斜率问题 1 /** 2 * Definition for a point. 3 * struct Point { 4 * int x; 5 * int y; 6 * Point() : x(0), y(0) {} 7 * Point(int a, int... 阅读全文
posted @ 2014-01-09 07:59 ying_vincent 阅读(168) 评论(0) 推荐(0)
2014年1月8日
Insertion Sort List
摘要: 这题一开始想新建一个list,结果MLE了,后来想了想不用新建,insertion的概念理解好就行,具体编程部分不难 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 *... 阅读全文
posted @ 2014-01-08 11:20 ying_vincent 阅读(143) 评论(0) 推荐(0)
LeetCode: Evaluate Reverse Polish Notation
摘要: 这题只要理解RPN的原理就不难,用一个stack就行了。为虾米leetcode不提供atoi函数~~只好自己临时写个。注意负数的情况就可以了 1 class Solution { 2 public: 3 int stringtoint(string s) { 4 int an... 阅读全文
posted @ 2014-01-08 08:36 ying_vincent 阅读(171) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 27 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3