leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

0171.cpp (223B)


      1 class Solution {
      2   public:
      3     int titleToNumber(string columnTitle) {
      4         int res = 0;
      5         for (char c : columnTitle) {
      6             res *= 26;
      7             res += c - 'A' + 1;
      8         }
      9         return res;
     10     }
     11 };