Given an array of integers of any length, return an array that has 1 added to the value represented by the array.
- the array can't be empty
- only non-negative, single digit integers are allowed
- Return nil for invalid inputs.
For example the array [2, 3, 9]
equals 239
, adding one would return the array [2, 4, 0]
.
[4, 3, 2, 5]
would return [4, 3, 2, 6]
- The solution is written using idiomatic ruby
- There are tests to verify the correctness of your solution
- clone or download repo using
git@github.com:Kalunge/array_plus.git
cd intoarray_plus
runbundle install
then runrspec