Solving problems is fun. But solving the same problem over and over is pain. Once solved, forever solved.
sourcecode
Saturday, February 7, 2015
Excel Sheet Column Number
class Solution { public: int titleToNumber(string s) { int result = 0; for (int ii = 0; ii < s.size(); ++ii) { result = result * 26 + s[ii] - 'A' + 1; } return result; } };
No comments:
Post a Comment