File tree 3 files changed +31
-0
lines changed
solution/0100-0199/0171.Excel Sheet Column Number
3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,18 @@ class Solution {
76
76
}
77
77
```
78
78
79
+ ### ** TypeScript**
80
+
81
+ ``` ts
82
+ function titleToNumber(columnTitle : string ): number {
83
+ let res: number = 0 ;
84
+ for (let char of columnTitle ) {
85
+ res = res * 26 + char .charCodeAt (0 ) - 64 ;
86
+ }
87
+ return res ;
88
+ };
89
+ ```
90
+
79
91
### ** C++**
80
92
81
93
``` cpp
Original file line number Diff line number Diff line change @@ -87,6 +87,18 @@ class Solution {
87
87
}
88
88
```
89
89
90
+ ### ** TypeScript**
91
+
92
+ ``` ts
93
+ function titleToNumber(columnTitle : string ): number {
94
+ let res: number = 0 ;
95
+ for (let char of columnTitle ) {
96
+ res = res * 26 + char .charCodeAt (0 ) - 64 ;
97
+ }
98
+ return res ;
99
+ };
100
+ ```
101
+
90
102
### ** C++**
91
103
92
104
``` cpp
Original file line number Diff line number Diff line change
1
+ function titleToNumber ( columnTitle : string ) : number {
2
+ let res : number = 0 ;
3
+ for ( let char of columnTitle ) {
4
+ res = res * 26 + char . charCodeAt ( 0 ) - 64 ;
5
+ }
6
+ return res ;
7
+ } ;
You can’t perform that action at this time.
0 commit comments