Leetcode – Excel Sheet Column Number (Java)

Given a column title as appear in an Excel sheet, return its corresponding column number.

For example:

Related to this question Excel Sheet Column Title

This is a normal number system conversion problem.  Think about how we convert a binary number to a decimal number?

1101001 = 1* 2 ^6 + 1 * 2^5 ..

We can easily have the following implementation: