From 783f1ca1f1be9cffa31d62ace5315fc31d87ab69 Mon Sep 17 00:00:00 2001 From: Jim Infield Date: Tue, 10 Aug 2021 13:43:08 -0500 Subject: [PATCH] add README --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0c11e11 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +## Ones and Zeros + +Given an array of ones and zeroes, 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:** + +```rust +Testing: [0, 0, 0, 1] ==> 1 +Testing: [0, 0, 1, 0] ==> 2 +Testing: [0, 1, 0, 1] ==> 5 +Testing: [1, 0, 0, 1] ==> 9 +Testing: [0, 0, 1, 0] ==> 2 +Testing: [0, 1, 1, 0] ==> 6 +Testing: [1, 1, 1, 1] ==> 15 +Testing: [1, 0, 1, 1] ==> 11 +``` + +>*However, the arrays can have varying lengths, not just limited to 4.*