Find the Largest Even Number

Published by Werdna in

Write a function that finds the largest number in an array nums that is also even. If there is no even number, return -1.

Examples

largest_even([3, 7, 2, 1, 7, 9, 10, 13]) ➞ 10

largest_even([1, 3, 5, 7]) ➞ -1

largest_even([0, 19, 18973623]) ➞ 0

Notes

N/A

Watch a quick demo on how Edabit works.