240
笔下虽有千言,胸中实无一策
摘要: 题解 Hard 方法:Trie struct TrieNode { vector<int> indexes; vector<TrieNode*> next; TrieNode() : next(26, nullptr) { } }; class Solution { public: vector<v 阅读全文
posted @ 2020-10-01 07:47 CasperWin 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 题解 Medium Heap (Priority Queue) 难点是自己写comparator。 class comparator { public: bool operator() (const pair<string, int>& a, const pair<string, int>& b) 阅读全文
posted @ 2020-10-01 06:50 CasperWin 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 题解 Medium Topological Sort class Solution { public: vector<int> findOrder(int numCourses, vector<vector<int>>& prerequisites) { vector<vector<int>> gr 阅读全文
posted @ 2020-10-01 05:52 CasperWin 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 题解 Medium 方法:Topological Sort class Solution { public: bool canFinish(int numCourses, vector<vector<int>>& prerequisites) { vector<vector<int>> graph( 阅读全文
posted @ 2020-10-01 05:42 CasperWin 阅读(77) 评论(0) 推荐(0) 编辑