I was recently asked in a job interview to resolve a programming puzzle that I thought it would be interesting to share. It\'s about translating Excel column letters to actu
Assuming column A = 1
int GetColumnNumber(string columnName)
{
int sum = 0;
int exponent = 0;
for(int i = columnName.Length - 1; i>=0; i--)
{
sum += (columnName[i] - 'A' + 1) * (GetPower(26, exponent));
exponent++;
}
return sum;
}
int GetPower(int number, int exponent)
{
int power = 1;
for(int i=0; i