N/2 list swap (Problem 29) - InfyTQ Solution in Python
N/2 list swap (Problem 29)
InfyTQ Solution in Python
PROBLEM STATEMENT
Given a list of numbers, write a python function to exchange the first n/2 elements of a list with the last n/2 elements. The function should return the new list.
n represents the number of elements in the list. Assume that it will always be even.
Sample Input | Expected Output |
---|---|
[1,2,3,4,5,6,7,8,9,10] | [10,9,8,7,6,1,2,3,4,5] |
SOLUTION
SHARE
If you find this useful, please share with your friends and Community.
CODE TOGETHER..GROW TOGETHER.
CODE TOGETHER..GROW TOGETHER.
Newer Posts
Newer Posts
Older Posts
Older Posts
Comments