Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 509 Bytes

(7 kyu) Even numbers in an array.md

File metadata and controls

13 lines (9 loc) · 509 Bytes

Even numbers in an array (7 kyu)

https://www.codewars.com/kata/even-numbers-in-an-array/

Given an array of digitals numbers, return a new array of length number containing the last even numbers from the original array (in the same order). The original array will be not empty and will contain at least "number" even numbers.

For example:

([1, 2, 3, 4, 5, 6, 7, 8, 9], 3) => [4, 6, 8]
([-22, 5, 3, 11, 26, -6, -7, -8, -9, -8, 26], 2) => [-8, 26]
([6, -25, 3, 7, 5, 5, 7, -3, 23], 1) => [6]