LLD - Design — Elevator System
Identify the error in this SCAN algorithm implementation snippet where the head moves from 30 to 90 with requests at [20, 40, 60, 80]:
requests = [20, 40, 60, 80]
head = 30
for track in range(head, 100):
if track in requests:
print(f"Servicing {track}")
for track in range(head-1, -1, -1):
if track in requests:
print(f"Servicing {track}")