File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 16
16
## Week 2 🚧
17
17
1 . [ Path Sum III] ( https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/550/week-2-august-8th-august-14th/3417/ ) ➡️ [ CPP Solution] ( Week2/pathSum.cpp )
18
18
2 . [ Rotting Oranges] ( https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/550/week-2-august-8th-august-14th/3418/ ) ➡️ [ CPP Solution] ( Week2/orangesRotting.cpp )
19
+ 3 . [ Excel Sheet Column Number] ( https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/550/week-2-august-8th-august-14th/3419/ ) ➡️ [ CPP Solution] ( Week2/titleToNumber.cpp )
19
20
20
21
## Where to find me? 🌟
21
22
* [ Website] ( https://akashwho.codes/ )
Original file line number Diff line number Diff line change
1
+ class Solution {
2
+ public:
3
+ int titleToNumber (string s) {
4
+ int power = 0 ;
5
+ int n = s.size ();
6
+ int result = 0 ;
7
+
8
+ for (int i = n - 1 ; i >= 0 ; --i) {
9
+ result += (s[i] - ' A' + 1 ) * (int ) pow (26 , power++);
10
+ }
11
+
12
+ return result;
13
+ }
14
+ };
You can’t perform that action at this time.
0 commit comments