Skip to content

Conversation

@lufftw
Copy link
Owner

@lufftw lufftw commented Dec 14, 2025

This PR introduces a dual-track documentation system for algorithmic patterns, designed to support both intuition-first learning and production-ready implementation reference.

The objective is to help readers recognize patterns instantly before writing code, while still providing high-quality, reusable templates for real-world problem solving.


✨ Key Highlights

1. Dual-Track Learning Structure

Each pattern now provides two complementary learning paths:

  • Intuition Path (intuition.md)
    Focuses on mental models, invariants, irreversibility, and pattern recognition before code.

  • Templates Path (templates.md)
    Provides production-ready implementations with clear usage scenarios, variants, and complexity analysis.

Navigation between the two paths is clearly documented in each pattern README.


2. Backtracking Exploration Enhancements

  • Expanded core concepts in _header.md
  • Significantly enhanced _templates.md with:
    • Usage scenarios
    • Time and space complexity analysis
    • LeetCode problem mappings
    • Template variants (e.g., duplicates handling, constraint pruning)
  • Refactored filenames to be problem-specific and descriptive
  • Updated _config.toml to align with the new naming scheme

3. Sliding Window Intuition System

  • Introduced a dedicated intuition.md emphasizing pattern recognition over mechanics
  • Established Explorer / Gatekeeper mental models for window boundaries
  • Framed invariants as “promises” the window must maintain
  • Described maximize/minimize window modes using vivid metaphors
  • Added ASCII flowcharts, structured execution traces, and fixed-window examples
  • Integrated 5 complete, runnable LeetCode solutions with definitive O(n) complexity analysis

4. Two Pointers Intuition Guide

  • Added intuition.md covering six canonical two-pointer shapes
  • Explained irreversibility and invariant principles
  • Included visual traces for:
    • Opposite pointers
    • Same-direction pointers
    • Fast–slow pointers
    • Dutch National Flag pattern
  • Added a pattern recognition flowchart for instant identification

5. Documentation Navigation & Tone Improvements

  • Added a “How to Use This Documentation” section explaining both learning paths
  • Updated pattern tables with direct links to Intuition and Templates
  • Applied the dual-track structure consistently across:
    • Sliding Window
    • Two Pointers
    • Backtracking Exploration
  • Improved wording for a more professional and project-level tone

🎯 Why This Matters

This documentation structure reflects how strong problem solvers actually think:

  1. Recognize the pattern
  2. Understand why it works
  3. Then write code

It lowers the learning barrier for beginners while remaining valuable for experienced engineers who want clean, reusable implementations.

- Add comprehensive core concepts section in _header.md
- Expand _templates.md with detailed explanations for each template
- Include usage scenarios, complexity analysis, and LeetCode problems
- Add template variants (duplicates handling, constraints, etc.)
- Replace generic "variant" and "base" suffixes with problem-specific names
- Align naming convention with sliding_window pattern
- Update _config.toml to reference new filenames
- Improve readability: filenames now indicate problem content at a glance
Create intuition.md as a complementary document to templates.md that
focuses on building pattern-level understanding before code:
- Introduce Explorer/Gatekeeper mental model for window boundaries
- Frame invariants as "promises" the window must keep
- Describe maximize/minimize modes with vivid metaphors
- Add pattern recognition flowchart and problem mapping table
- Defer code until after conceptual understanding is established
Improve intuition.md with practical visualizations and examples:
- Add ASCII flowcharts for Maximize and Minimize window modes
  with color-coded R (Explorer) and L (Gatekeeper) movements
- Convert "Visualizing the Dance" to structured table format
  with Step, R, State, L move, Window, and Result columns
- Add concept-to-code comments linking Explorer/Gatekeeper
  roles to for-loop and while-loop in template
- Add Fixed Window (K=3) example trace after Shape 3
  demonstrating constant-size sliding behavior
…ion.md

- Add 5 runnable solutions: LC 3, 340, 76, 438, 209
- Include detailed time/space complexity analysis per problem
- Add verification code with test cases for each solution
- Add definitive O(n) complexity analysis section
- Use semantic, project-level variable naming throughout
Create comprehensive pattern intuition document with:
- Six two-pointer shapes with vivid mental models
- Invariant and irreversibility principles explained
- Visual traces for opposite, same-direction, fast-slow, and Dutch flag
- Pattern recognition flowchart for instant identification
- Templates derived from intuition, not as starting points
- Add "How to Use This Documentation" section explaining learning paths
- Update pattern table with direct links to intuition.md and templates.md
- Apply to sliding_window, two_pointers, and backtracking_exploration
Change "Copy-paste ready code" to "Production-ready implementations"
for a more professional tone.
- Add Intuition and Templates learning paths for each pattern
- Update BacktrackingExploration from "coming soon" to available
- Add LinkedListInPlaceReversal and MonotonicStack as upcoming patterns
- Update README.md and README_zh-TW.md with new table format
Copy link
Owner Author

@lufftw lufftw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update! I went through the implementation and didn’t find any issues. The changes are clear and well-structured.

@lufftw lufftw merged commit 3df08d1 into main Dec 14, 2025
@lufftw lufftw deleted the feat/pattern-dual-track-docs branch December 14, 2025 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants