Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- knakul853
- **/
- class Solution {
- public:
- int titleToNumber(string s) {
- int ans = 0;
- for( int i=0;i<s.size(); i++ )
- {
- int num = (s[i] - 'A') + 1;
- ans *=26;
- ans += num;
- }
- return ans;
- }
- };
Add Comment
Please, Sign In to add comment