File tree 6 files changed +73
-2
lines changed
0168.Excel Sheet Column Title
6 files changed +73
-2
lines changed Original file line number Diff line number Diff line change 17
17
...
18
18
Z -> 26
19
19
AA -> 27
20
- AB -> 28
20
+ AB -> 28
21
21
...
22
22
</pre >
23
23
@@ -129,6 +129,20 @@ public class Solution {
129
129
}
130
130
```
131
131
132
+ ### ** Go**
133
+
134
+ ``` go
135
+ func convertToTitle (columnNumber int ) string {
136
+ res := []rune{}
137
+ for columnNumber != 0 {
138
+ columnNumber -= 1
139
+ res = append ([]rune{rune (columnNumber%26 + int (' A' ))}, res...)
140
+ columnNumber /= 26
141
+ }
142
+ return string (res)
143
+ }
144
+ ```
145
+
132
146
### ** ...**
133
147
134
148
```
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ C -> 3
15
15
...
16
16
Z -> ; 26
17
17
AA -> ; 27
18
- AB -> ; 28
18
+ AB -> ; 28
19
19
...
20
20
</pre >
21
21
@@ -112,6 +112,20 @@ public class Solution {
112
112
}
113
113
```
114
114
115
+ ### ** Go**
116
+
117
+ ``` go
118
+ func convertToTitle (columnNumber int ) string {
119
+ res := []rune{}
120
+ for columnNumber != 0 {
121
+ columnNumber -= 1
122
+ res = append ([]rune{rune (columnNumber%26 + int (' A' ))}, res...)
123
+ columnNumber /= 26
124
+ }
125
+ return string (res)
126
+ }
127
+ ```
128
+
115
129
### ** ...**
116
130
117
131
```
Original file line number Diff line number Diff line change
1
+ func convertToTitle (columnNumber int ) string {
2
+ res := []rune {}
3
+ for columnNumber != 0 {
4
+ columnNumber -= 1
5
+ res = append ([]rune {rune (columnNumber % 26 + int ('A' ))}, res ... )
6
+ columnNumber /= 26
7
+ }
8
+ return string (res )
9
+ }
Original file line number Diff line number Diff line change @@ -132,6 +132,19 @@ impl Solution {
132
132
}
133
133
```
134
134
135
+ ### ** Go**
136
+
137
+ ``` go
138
+ func reverseBits (num uint32 ) uint32 {
139
+ var ans uint32 = 0
140
+ for i := 0 ; i < 32 ; i++ {
141
+ ans |= (num & 1 ) << (31 - i)
142
+ num >>= 1
143
+ }
144
+ return ans
145
+ }
146
+ ```
147
+
135
148
### ** ...**
136
149
137
150
```
Original file line number Diff line number Diff line change @@ -120,6 +120,19 @@ impl Solution {
120
120
}
121
121
```
122
122
123
+ ### ** Go**
124
+
125
+ ``` go
126
+ func reverseBits (num uint32 ) uint32 {
127
+ var ans uint32 = 0
128
+ for i := 0 ; i < 32 ; i++ {
129
+ ans |= (num & 1 ) << (31 - i)
130
+ num >>= 1
131
+ }
132
+ return ans
133
+ }
134
+ ```
135
+
123
136
### ** ...**
124
137
125
138
```
Original file line number Diff line number Diff line change
1
+ func reverseBits (num uint32 ) uint32 {
2
+ var ans uint32 = 0
3
+ for i := 0 ; i < 32 ; i ++ {
4
+ ans |= (num & 1 ) << (31 - i )
5
+ num >>= 1
6
+ }
7
+ return ans
8
+ }
You can’t perform that action at this time.
0 commit comments