We’ll continue our theme of list rotation by flipping the problem: given a sorted list rotated
k times, return the index where the “unrotated” list would begin.
rotated_list = ['c', 'd', 'e', 'f', 'a'] rotation_point(rotated_list) # index 4 # a sorted list would start with 'a' another_rotated_list = [13, 8, 9, 10, 11] rotation_point(rotated_list) # index 1 # a sorted list would start with 8
Write a function
count_rotations() which has one parameter
count_rotations() should return the index where the sorted list would begin.