wes d2a2ba9e15 first commit | 4 anos atrás | |
---|---|---|
.. | ||
README.md | 4 anos atrás | |
code.cpp | 4 anos atrás | |
unitTest.cpp | 4 anos atrás |
by Helen Yu tags: arrays, control_flow, numbers, language_fundamentals
Create a function that goes through the array, incrementing (+1) for each odd number and decrementing (-1) for each even number. Examples transform([1, 2, 3, 4, 5]) ➞ [2, 1, 4, 3, 6] transform([3, 3, 4, 3]) ➞ [4, 4, 3, 4] transform([2, 2, 0, 8, 10]) ➞ [1, 1, -1, 7, 9] Notes N/A
Create a function that goes through the array, incrementing (+1) for each odd number and decrementing (-1) for each even number.
transform([1, 2, 3, 4, 5]) ➞ [2, 1, 4, 3, 6]
transform([3, 3, 4, 3]) ➞ [4, 4, 3, 4]
transform([2, 2, 0, 8, 10]) ➞ [1, 1, -1, 7, 9]
N/A