Skip to content

Latest commit

 

History

History
13 lines (12 loc) · 3.94 KB

38-sort-the-odd.md

File metadata and controls

13 lines (12 loc) · 3.94 KB

Problem:

You have an array of numbers.
Your task is to sort ascending odd numbers but even numbers must be on their places.

Zero isn't an odd number and you don't need to move it. If you have an empty array, you need to return it.

Example

sortArray([5, 3, 2, 8, 1, 4]) == [1, 3, 2, 8, 5, 4]
sortArray([5, 3, 2, 8, 1, 4]) == [1, 3, 2, 8, 5, 4]
sort_array([5, 3, 2, 8, 1, 4]) == [1, 3, 2, 8, 5, 4]
sort_array([5, 3, 2, 8, 1, 4]) == [1, 3, 2, 8, 5, 4]
sort_array([5, 3, 2, 8, 1, 4]) == [1, 3, 2, 8, 5, 4]
sortArray [5, 3, 2, 8, 1, 4] == [1, 3, 2, 8, 5, 4]
(= (sort-array [5 3 2 8 1 4]) [1 3 2 8 5 4])

Solution