File tree 10 files changed +4647
-4524
lines changed
1300-1399/1323.Maximum 69 Number
1800-1899/1885.Count Pairs in Two Arrays
10 files changed +4647
-4524
lines changed Original file line number Diff line number Diff line change 58
58
<!-- 这里可写当前语言的特殊实现逻辑 -->
59
59
60
60
``` python
61
-
61
+ class Solution :
62
+ def maximum69Number (self , num : int ) -> int :
63
+ return int (str (num).replace(" 6" , " 9" , 1 ))
62
64
```
63
65
64
66
### ** Java**
65
67
66
68
<!-- 这里可写当前语言的特殊实现逻辑 -->
67
69
68
70
``` java
71
+ class Solution {
72
+ public int maximum69Number (int num ) {
73
+ return Integer . valueOf(String . valueOf(num). replaceFirst(" 6" , " 9" ));
74
+ }
75
+ }
76
+ ```
77
+
78
+ ### ** C++**
79
+
80
+ ``` cpp
81
+ class Solution {
82
+ public:
83
+ int maximum69Number(int num) {
84
+ string s = to_string(num);
85
+ for (char& ch: s)
86
+ {
87
+ if (ch == '6')
88
+ {
89
+ ch = '9';
90
+ break;
91
+ }
92
+ }
93
+ return stoi(s);
94
+ }
95
+ };
96
+ ```
69
97
98
+ ### **Go**
99
+
100
+ ```go
101
+ func maximum69Number(num int) int {
102
+ s := strconv.Itoa(num)
103
+ nums := []byte(s)
104
+ for i, ch := range nums {
105
+ if ch == '6' {
106
+ nums[i] = '9'
107
+ break
108
+ }
109
+ }
110
+ ans, _ := strconv.Atoi(string(nums))
111
+ return ans
112
+ }
70
113
```
71
114
72
115
### ** ...**
Original file line number Diff line number Diff line change @@ -53,13 +53,56 @@ The maximum number is 9969.
53
53
### ** Python3**
54
54
55
55
``` python
56
-
56
+ class Solution :
57
+ def maximum69Number (self , num : int ) -> int :
58
+ return int (str (num).replace(" 6" , " 9" , 1 ))
57
59
```
58
60
59
61
### ** Java**
60
62
61
63
``` java
64
+ class Solution {
65
+ public int maximum69Number (int num ) {
66
+ return Integer . valueOf(String . valueOf(num). replaceFirst(" 6" , " 9" ));
67
+ }
68
+ }
69
+ ```
70
+
71
+ ### ** C++**
72
+
73
+ ``` cpp
74
+ class Solution {
75
+ public:
76
+ int maximum69Number(int num) {
77
+ string s = to_string(num);
78
+ for (char& ch: s)
79
+ {
80
+ if (ch == '6')
81
+ {
82
+ ch = '9';
83
+ break;
84
+ }
85
+ }
86
+ return stoi(s);
87
+ }
88
+ };
89
+ ```
62
90
91
+ ### **Go**
92
+
93
+ ```go
94
+ func maximum69Number(num int) int {
95
+ s := strconv.Itoa(num)
96
+ nums := []byte(s)
97
+ for i, ch := range nums {
98
+ if ch == '6' {
99
+ nums[i] = '9'
100
+ break
101
+ }
102
+ }
103
+ ans, _ := strconv.Atoi(string(nums))
104
+ return ans
105
+ }
63
106
```
64
107
65
108
### ** ...**
Original file line number Diff line number Diff line change
1
+ class Solution {
2
+ public:
3
+ int maximum69Number (int num) {
4
+ string s = to_string (num);
5
+ for (char & ch: s)
6
+ {
7
+ if (ch == ' 6' )
8
+ {
9
+ ch = ' 9' ;
10
+ break ;
11
+ }
12
+ }
13
+ return stoi (s);
14
+ }
15
+ };
Original file line number Diff line number Diff line change
1
+ func maximum69Number (num int ) int {
2
+ s := strconv .Itoa (num )
3
+ nums := []byte (s )
4
+ for i , ch := range nums {
5
+ if ch == '6' {
6
+ nums [i ] = '9'
7
+ break
8
+ }
9
+ }
10
+ ans , _ := strconv .Atoi (string (nums ))
11
+ return ans
12
+ }
Original file line number Diff line number Diff line change
1
+ class Solution {
2
+ public int maximum69Number (int num ) {
3
+ return Integer .valueOf (String .valueOf (num ).replaceFirst ("6" , "9" ));
4
+ }
5
+ }
Original file line number Diff line number Diff line change
1
+ class Solution :
2
+ def maximum69Number (self , num : int ) -> int :
3
+ return int (str (num ).replace ("6" , "9" , 1 ))
Original file line number Diff line number Diff line change 1
- # [ 1885. ] ( https://leetcode.cn/problems/count-pairs-in-two-arrays )
1
+ # [ 1885. 统计数对 ] ( https://leetcode.cn/problems/count-pairs-in-two-arrays )
2
2
3
3
[ English Version] ( /solution/1800-1899/1885.Count%20Pairs%20in%20Two%20Arrays/README_EN.md )
4
4
Load Diff Large diffs are not rendered by default.
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -197,17 +197,17 @@ def save(result):
197
197
198
198
199
199
if __name__ == '__main__' :
200
- # cookie_cn = ''
201
- # cookie_en = ''
202
- # spider = Spider(cookie_cn, cookie_en)
203
- # res = spider.run()
204
- # save(res)
200
+ cookie_cn = ''
201
+ cookie_en = ''
202
+ spider = Spider (cookie_cn , cookie_en )
203
+ res = spider .run ()
204
+ save (res )
205
205
206
206
with open ('./result.json' , 'r' , encoding = 'utf-8' ) as f :
207
207
res = f .read ()
208
208
res = json .loads (res )
209
209
210
- # generate_readme(res)
211
- # generate_question_readme(res)
212
- # generate_summary(res)
213
- refresh (res )
210
+ generate_readme (res )
211
+ generate_question_readme (res )
212
+ generate_summary (res )
213
+ # refresh(res)
You can’t perform that action at this time.
0 commit comments