Ones and Zeros

From codewars.com by Edxael  (that’s me)

Instructions: Given an array of one’s and zero’s convert the equivalent binary value to an integer.

Eg: [0, 0, 0, 1] is treated as 0001 which is the binary representation of 1

Examples:

my solution:

Note:  The following code is not written by me, it was created by another user of codewars.com it belongs to the user: “basilekoko” enjoy.

Note:  The following code is not written by me, it was created by another user of codewars.com it belongs to the user: “dzNET” enjoy.

 

 



Copyright 2017. All rights reserved.

Posted December 31, 2016 by Edmundo in category "Ruby Examples