Skip to content

Commit

Permalink
Add more examples to rotate_list algorithm as requested
Browse files Browse the repository at this point in the history
  • Loading branch information
staging-devin-ai-integration[bot] committed Oct 22, 2024
1 parent 85c5640 commit da2771c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions array/rotate_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,15 @@ def rotate_list(lst, k):
print(f'Original list: {test_list}')
print(f'Rotated list (k=2): {rotate_list(test_list, 2)}')
print(f'Rotated list (k=3): {rotate_list(test_list, 3)}')

# Additional examples
test_list2 = ['a', 'b', 'c', 'd', 'e', 'f']
print(f'\nOriginal list: {test_list2}')
print(f'Rotated list (k=1): {rotate_list(test_list2, 1)}')
print(f'Rotated list (k=4): {rotate_list(test_list2, 4)}')

test_list3 = [10, 20, 30, 40, 50, 60, 70]
print(f'\nOriginal list: {test_list3}')
print(f'Rotated list (k=0): {rotate_list(test_list3, 0)}')
print(f'Rotated list (k=7): {rotate_list(test_list3, 7)}')
print(f'Rotated list (k=10): {rotate_list(test_list3, 10)}')

0 comments on commit da2771c

Please sign in to comment.