上一页 1 2 3 4 5 6 ··· 85 下一页
摘要: 题意:通过Trie求前缀和,相同字符串取最新的值。 class TrieNode{ public: int val; TrieNode *nex[26]; TrieNode(){ val = 0; for(int i = 0; i < 26; ++i){ nex[i] = NULL; } } }; 阅读全文
posted @ 2020-04-02 17:25 Somnuspoppy 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 题意:实现Trie class TrieNode{ public: bool isword; TrieNode* nex[26]; TrieNode():isword(false){ for(int i = 0; i < 26; ++i) nex[i] = NULL; } }; class Trie 阅读全文
posted @ 2020-04-02 15:55 Somnuspoppy 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 题意:归并两个有序数组,把归并结果存到第一个数组上。 class Solution { public: void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) { int pos1 = m - 1; int pos2 = n 阅读全文
posted @ 2020-04-01 00:37 Somnuspoppy 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 题意:寻找二叉查找树中出现次数最多的值 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : v 阅读全文
posted @ 2020-04-01 00:02 Somnuspoppy 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 题意:在二叉查找树中查找两个节点之差的最小绝对值 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x 阅读全文
posted @ 2020-03-31 23:31 Somnuspoppy 阅读(122) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 85 下一页