Rotate the elements of an array by d positions to the left. Let us initially look at an example.
def rotate_left(arr, d):
n = len(arr)
d = d % n # Handle cases where d is larger than the array size
return arr[d:] + arr[:d]
arr = [1, 2, 3, 4, 5]
d = 2
rotated_arr = rotate_left(arr, d)
print(rotated_arr)