Your question is Linked List K-Position Reversal. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
An Xfinity service diagnostic tool stores ordered event codes in a Python list. To support a processing mode used by Comcast test automation, reverse the order of events within every consecutive group of k elements.
Modify the list in place and return the same list. If the final group contains fewer than k elements, leave that final group unchanged.
Implement reverse_in_groups(items, k).
items, a list of integers, and k, a positive integer.k consecutive elements reversed.def reverse_in_groups(items, k):