+ 2

Algorithm

Write a function my_sort which takes in a list of numbers (positive integers). The function should return a list of sorted numbers such that odd numbers come first and even numbers come last. For example: my_sort([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) => [1, 3, 5, 7, 9, 2, 4, 6, 8] my_sort([1, 2]) => [1, 2] my_sort([2, 1]) => [1, 2] my_sort([3, 3, 4]) => [3, 3, 4] my_sort([90, 45, 66]) => [45, 66, 90]

10th Oct 2017, 11:17 PM
Franklin Yaw Frimpong
Franklin Yaw Frimpong - avatar
3 Answers
11th Oct 2017, 12:01 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
0
We can use any sort right?
10th Oct 2017, 11:50 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
11th Oct 2017, 12:03 AM
林偉雄
林偉雄 - avatar