Tony's Log

Algorithms, Distributed System, Machine Learning

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2015年8月22日

摘要: Simply store indices in ctor.class WordDistance { unordered_map> hm;public: WordDistance(vector& words) { for (int i = 0; i &vec1 = hm[w... 阅读全文
posted @ 2015-08-22 11:18 Tonix 阅读(179) 评论(0) 推荐(0)

摘要: Just take care of corner cases..class Vector2D { vector> &r; int i, i0;public: Vector2D(vector>& vec2d) : r(vec2d), i(0), i0(0) { i... 阅读全文
posted @ 2015-08-22 10:59 Tonix 阅读(182) 评论(0) 推荐(0)

摘要: Linear scan after sorting. Please note sorting detail.typedef std::pair Rec;class Solution {public: int minMeetingRooms(vector& intervals) { ... 阅读全文
posted @ 2015-08-22 10:37 Tonix 阅读(184) 评论(0) 推荐(0)

摘要: A typical DPclass Solution {public: int minCost(vector>& costs) { size_t len = costs.size(); if(len == 0) return 0; ve... 阅读全文
posted @ 2015-08-22 00:46 Tonix 阅读(177) 评论(0) 推荐(0)