Advertisement
171. Excel Sheet Column Number
EasyView on LeetCode
171.cs
C#
public class Solution
{
public int TitleToNumber(string columnTitle)
{
return columnTitle.Aggregate(0, (subtotal, c) => subtotal * 26 + (c - 'A' + 1));
}
}Advertisement
Was this solution helpful?