re: Daily Coding Puzzles - Oct 29th - Nov 2nd VIEW POST

VIEW PARENT COMMENT VIEW FULL DISCUSSION
 

Here is a C# version

Note: Aggregate is equivalent to reduce in JavaScript or other languages
and seed value is the first argument unlike in JavaScript, in which it's the last argument.

using System;
using System.Linq;
namespace Solution
{
    class Kata
    {
        public static int binaryArrayToNumber(int[] a)
        {
            return Convert.ToInt32(a.Aggregate("", (acc, n) => acc + n.ToString()), 2);
        }
    }
}
code of conduct - report abuse