What's the name of this technique?

I am reading some solutions of the problem AMSTRING (from this April’s cook off). It seems that most solutions (including setter’s one) use same loop structure like this.

for(d=1-n;d<n;d++) { .... }

I would like to know when we can use the technique like that. What’s the purpose of the method? and Could you recommend some problems about ‘sliding window’?

Could you give us an example of a solution with this structure for clarification?

I don’t think it means anything specific, other than the fact that we are looping from -(n-1) to (n-1).

Correction: It should be tester’s solution as setter’s solution is still not available for the problem.

Regarding related problems to sliding window, I can help youwiththesefollowingproblems :slight_smile:

1 Like