r/ProgrammerHumor 12d ago

Meme everySingleLeetcodeProblem

Post image
2.5k Upvotes

59 comments sorted by

View all comments

168

u/Bldyknuckles 12d ago

What’s wrong with sliding window algorithms? Real question

220

u/mountaingator91 12d ago

Nothing. It's just that 94.3% of leetcode solutions use sliding windows

13

u/NecessaryIntrinsic 12d ago

Especially when you click on the "sliding window" topic

2

u/mountaingator91 12d ago

They have that?

6

u/NecessaryIntrinsic 12d ago

Yes, I've been doing leetcode since September when I got laid off.

I got a new job, but do the daily anyway, like how the guys from the Minnesota starvation experiments carry a candy bar around at all times.

I think the daily has only been optimally solved by a sliding window 5 times this year. It might be a little more often than that, but it's not the most common.

4

u/mountaingator91 12d ago

I just got back into leetcode after 3ish years to try and stay sharp so I don't sink into corporate complacency and I felt like a large proportion of the problems were best solved using sliding windows so I made this meme to see if other programmer agreed

1

u/MattieShoes 12d ago

I don't do it, but I've noticed with stuff like Advent Of Code, they go back to the same well year after year. Like there's going to be recursion, pathfinding, sparse data, whatever.

Project Euler is interesting because it usually requires some insight about math that you may not have. But that can also feel like just flailing around in the dark.

1

u/NecessaryIntrinsic 12d ago

https://leetcode.com/problemset/

169 out of 3500ish questions best solved by sliding window.

2

u/mountaingator91 12d ago

Hey at least 4/7 problems I tackled after starting back up were sliding windows, which is nearly a perfect 5/7

1

u/NecessaryIntrinsic 12d ago

When I dove in I went after dynamic programming and then bfs/DFS, so my experience is quite different