File tree 2 files changed +21
-2
lines changed
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ public class _143MaximumXORPair {
32
32
public static int N = 100010 ;
33
33
// trie树的最大结点数:最多有10w个数,每个数最多有31位的长度,一个结点只能表示一位
34
34
public static int M = 3000000 ;
35
- // son是Trie树,第一维表示结点数;第二维是结点的类型,记录该位0还是1。数组值表示其在trie树中第几个的索引结点
35
+ // son是Trie树,(下标) 第一维表示结点数;第二维是结点的类型,记录该位0还是1。数组值表示其在trie树中第几个的索引结点
36
36
public static int [][] son = new int [M ][2 ];
37
37
// trie的当前指针,0是根结点
38
38
public static int idx = 0 ;
@@ -77,7 +77,7 @@ public static void insert(int x) {
77
77
// for走完,一个数的二进制位在trie中就构建完成
78
78
}
79
79
80
-
80
+ // 查询x对应的在trie数中存在的最大异或对
81
81
public static int query (int x ) {
82
82
// res记录当前数x的最大异或对是几。p遍历指针
83
83
int res = 0 , p = 0 ;
Original file line number Diff line number Diff line change
1
+ package offer ;
2
+
3
+ /**
4
+ * @author : CodeWater
5
+ * @create :2022-07-25-12:53
6
+ * @Function Description :17. 打印从1到最大的n位数
7
+ */
8
+ public class _17PrintFrom1ToTheLargestNDigits {
9
+ class Solution {
10
+ public int [] printNumbers (int n ) {
11
+ int end = (int )Math .pow ( 10 , n ) - 1 ;
12
+ int [] res = new int [end ];
13
+ for ( int i = 1 ; i <= end ; i ++ ){
14
+ res [i - 1 ] = i ;
15
+ }
16
+ return res ;
17
+ }
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments