Skip to content

2017-2: Good Evening

Write a function that takes an integer array and replaces all the odd numbers with the next greater even number.

Examples:

     (your_function) 1 2 3 4 5
2 2 4 4 6       
     (your_function) ⍬ ⍝ should return an empty vector      

     (your_function) 4 4⍴⍳16 ⍝ should work with arrays of any rank  
 2  2  4  4
 6  6  8  8
10 10 12 12
14 14 16 16
your_function ←

Solutions

Video Thumbnail YouTube

Chat transcript Code on GitHub