Skip to content

Pattern: Sliding Window (Arrays) #10

@sudosf

Description

@sudosf

Objective

Master the sliding window pattern and solve all problems from the RisingBrain DSA sheet.

References

Pattern Description

Maintain a window of fixed or variable size. Expand the right pointer, shrink the left pointer when a constraint is violated. Avoids nested loops by reusing computation from the previous window.

  • Fixed size: window length k, slide across (max sum, distinct elements)
  • Variable size: expand/shrink to satisfy a condition (longest substring, minimum subarray)

Nedbank VAS Relevance

Q70 (Optimizing Resource Allocation): fixed-size window of length k, all elements unique, return max sum.

Sub-issues

# Problem Difficulty
1 Maximum Sum Subarray of Size K Easy
2 Max Consecutive Ones Easy
3 Max Consecutive Ones III Medium
4 Subarray Product Less Than K Medium
5 Fruits Into Baskets Medium
6 Minimum Size Subarray Sum Medium
7 Sliding Window Maximum Hard
8 Subarray with K Distinct Integers Hard

Notes

Language: Java

Metadata

Metadata

Assignees

No one assigned

    Labels

    arraysArray problemsnedbank-prepDirectly maps to Nedbank VAS assessmentsliding-windowSliding window pattern

    Projects

    Status
    In review

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions