01 April 2017

isLucky

My solution:
bool isLucky(int n) 
{
    return Equals(n.ToString().Substring(0, n.ToString().Length / 2).Sum(x => int.Parse(x.ToString())), n.ToString().Substring(n.ToString().Length / 2, n.ToString().Length / 2).Sum(x => int.Parse(x.ToString())));
}

Previous Next