Snippet
def reverse_list_with_twist(lst, left, right):
if left >= right:
return None
if lst[left] % 2 == 1 and lst[right] % 2 == 1:
+ 1, right - 1)
reverse_list_with_twist(lst, left else:
= lst[left]
temp = lst[right]
lst[left] = temp
lst[right] + 1, right - 1)
reverse_list_with_twist(lst, left
= [1, 2, 3, 4, 5, 6]
lst1 0, 5)
reverse_list_with_twist(lst1, print(lst1)
Solution
(Coming Soon)
Image Description
(Coming Soon)