上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 17 下一页
摘要: class Solution { public: vector> getSkyline(vector>& buildings) { vector> v; for (const auto& b : buildings) { v.push_back({b[0], -b[2]}); v.push_back({b[1... 阅读全文
posted @ 2018-05-21 21:13 JTechRoad 阅读(80) 评论(0) 推荐(0)
摘要: class Solution { public: int findKthLargest(vector& nums, int k) { int left = 0, right = nums.size() - 1; while (true) { int p = partition(nums, left, right); ... 阅读全文
posted @ 2018-05-21 14:23 JTechRoad 阅读(92) 评论(0) 推荐(0)
摘要: class Solution { public: int minSubArrayLen(int s, vector& nums) { int w = 0, _sum = 0, res = INT_MAX; for (int i = 0; i = s) { res = min(res, i-w+1); ... 阅读全文
posted @ 2018-05-21 12:05 JTechRoad 阅读(65) 评论(0) 推荐(0)
摘要: class Node { public: char c; bool isWord; unordered_map children; Node(char c) { this->c = c; isWord = false; } }; class Trie { Node* root; Node* find... 阅读全文
posted @ 2018-05-21 09:23 JTechRoad 阅读(89) 评论(0) 推荐(0)
摘要: /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class BSTIt... 阅读全文
posted @ 2018-05-21 09:00 JTechRoad 阅读(80) 评论(0) 推荐(0)
摘要: class LRUCache { public: list> q; unordered_map>::iterator> m; int cap; LRUCache(int capacity) { cap = capacity; } int get(int key) { if (!m.count(key)) ... 阅读全文
posted @ 2018-05-21 08:45 JTechRoad 阅读(85) 评论(0) 推荐(0)
摘要: class Solution { public: bool wordBreak(string s, vector& wordDict) { int n = s.length(); if (n == 0) return false; unordered_set wordSet(wordDict.begin(), wordDict.end()); ... 阅读全文
posted @ 2018-05-21 00:57 JTechRoad 阅读(79) 评论(0) 推荐(0)
摘要: /** * Definition for undirected graph. * struct UndirectedGraphNode { * int label; * vector neighbors; * UndirectedGraphNode(int x) : label(x) {}; * }; */ class Solution { public: ... 阅读全文
posted @ 2018-05-20 15:23 JTechRoad 阅读(84) 评论(0) 推荐(0)
摘要: class Solution { public: int longestConsecutive(vector& nums) { unordered_set s(nums.begin(), nums.end()); int res = 0; while (!s.empty()) { int p = *(s.begin(... 阅读全文
posted @ 2018-05-20 14:34 JTechRoad 阅读(87) 评论(0) 推荐(0)
摘要: class Solution { public: int ladderLength(string beginWord, string endWord, vector& wordList) { unordered_set s(wordList.begin(), wordList.end()); if (!s.count(endWord)) return 0... 阅读全文
posted @ 2018-05-20 14:27 JTechRoad 阅读(80) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 17 下一页