What This Is

LeetCode #438, "Find All Anagrams in a String," is a high-frequency interview question: given strings s and p, find all starting indices of substrings in s that are anagrams of p (same characters and counts, different orderings). The solution has evolved from brute-force enumeration at O((n-m)·m·log m), to a sliding window (two pointers maintaining a fixed-size substring range) plus a 26-slot frequency array at O(n·26), to introducing a diff counter — a difference counter that tracks how many character types in the current window still don't match the target frequencies — reducing each match check from scanning 26 slots to O(1).

What truly exposes the skill gap isn't the technique itself, but the choice between if and while: fixed-length windows use if (each round only overshoots by 1; one contraction restores it); variable-length windows use while (the distance of a violating character from the left end is unknown, so contraction must continue). This is a universal principle for sliding-window problems, not a quirk of this question.

Industry View

This problem's solution progression is one of the most classic debates in today's tech community.

The pro-optimization camp argues that this diff-layer optimization reflects an engineering instinct for "squeezing every last drop out of a naive solution." A big-tech interviewer noted in related discussions that, out of 200+ candidates, fewer than 10 could clearly explain this layer on a whiteboard — precisely the scarcest capability in the AI era, because AI can write code, but humans must judge whether it's correct and good.

The anti-camp is equally pointed: in real-world engineering, almost no one hand-writes sliding windows, and no one obsesses over reducing O(n·26) to O(n) as a constant-factor optimization. The head of an AI startup publicly questioned the screening validity of algorithm interviews — being able to write a red-black tree from memory doesn't mean you can ship features, and pouring training energy into LeetCode is a kind of "involution inertia."

Our judgment: the debate itself is overblown. AI has lowered the coding threshold and raised the review threshold. Those who can clearly explain "why we write it this way" will always be the critical nodes on the collaboration chain.

Impact on Regular People

For enterprise IT: Code output volume is no longer the core KPI; code review and architectural judgment are gaining weight. Team talent profiles need to shift from "how fast can you write" to "how accurately can you see."

For individual careers: When pair-programming with AI, the ability to precisely describe problems, design correct data structures, and identify edge cases is worth more than memorizing APIs. Algorithmic "conceptual understanding" is replacing "implementation memory" as the dividing line.

For consumer markets: The direct impact is limited, but as AI coding tools proliferate, the tech training market may split — "teach code" courses will cool off, while "teach code reading" courses have room to grow.