- 博客(3)
- 收藏
- 关注
原创 LeetCode 421 数组中两个数的最大异或值
LeetCode 421 数组中两个数的最大异或值题目链接: https://leetcode-cn.com/problems/maximum-xor-of-two-numbers-in-an-array这道题要找出给定列表中两个元素的最大异或值,这里采用字典树来写。穷举法要求给定列表任意两个元素的最大异或值,如果暴力做法,可以直接穷举两层列表中的各个元素。初始化结果为0,不断求得元素i和...
2019-10-19 11:38:46
310
原创 hihocoder 1024:Trie树
2019/10/17题目链接:http://hihocoder.com/problemset/problem/1014对于trie树,要找出具有确定前缀的所有匹配的个数,这个任务可以从两个方面来考虑。第一方面找出具有确定前缀的所有字符串匹配是trie树的功能之一:通过自上而下,由根节点不断找到下一字符对应的子节点,遍历可以得到前缀串的最深节点,即末尾字符对应的节点。从当前结点出发,DFS深...
2019-10-17 23:14:29
119
原创 Two Sum - LeetCode 题解
1.Two SumGiven an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use ...
2019-09-18 11:45:01
132
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人