Skip to content

Latest commit

 

History

History
 
 

08.2-Divide_and_conquer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

08.2 Divide and conquer:

📝Instructions:

  1. Create a function called merge_two_list that expects an list of numbers (integers).

  2. Loop through the list and separate the odd and the even numbers in different lists.

  3. If the number is odd number push it to a placeholder list named odd.

  4. If the number is even number push it to a placeholder list named even.

  5. Then concatenate the odd list to the even list to combine them. Remember, the odd list comes first and you have to append the even mergeTwoList.

💡 Hint:

  • Create empty (placeholder) variables when you need to store data.

Expected result:

mergeTwoList([1,2,33,10,20,4])

[[1,33,2], [10,20,4]]