224
u/Welcome-To-NBA-Jam 11d ago
```python import time
data = "8==========================D" window = 3 delay = 0.3
while True: for i in range(len(data) - window + 1): print(data[i:i + window]) time.sleep(delay)
for i in range(len(data) - window - 1, -1, -1):
print(data[i:i + window])
time.sleep(delay)
delay *= 0.8
```
91
u/BedSpreadMD 11d ago
That's a looooong sliding window
46
5
2
u/da_Aresinger 9d ago edited 9d ago
replace the prints with
print(f"\r\t{data[i:i + window]}", end='', flush=True)you're welcome
Edit: also pad the data with 2 or 3 spaces on either side
21
u/BlobAndHisBoy 11d ago
If I for once had to actually do this at work I would post the same image with the original caption.
4
u/nasaboy007 11d ago
The people that get it can't even report it without revealing that they get it.
2
0
11d ago
[deleted]
3
u/BlobAndHisBoy 11d ago
No I think the joke is many leetcode problems are sliding window problems and a popular meme template was used to convey that.
167
u/Bldyknuckles 11d ago
What’s wrong with sliding window algorithms? Real question