Hi, I'm Robin đź‘‹

Front-end Engineer & multi-passionate creator.

variable length sliding window

The Core Patterns of Variable-Length Sliding Window: Longest & Shortest Subarrays

Previously, we explored the fixed-length sliding window technique, which typically involves sliding a window of constant size by one element at a time. For a detailed explanation, refer to the article —— 📝How to Solve Fixed-Length Sliding Window Problems. Now, we encounter a new class of problems that also appear solvable with a sliding window approach, but with a crucial difference: the window size is variable. Find the Longest Subarray Given a string s, find the length of the longest substring without duplicate characters. ...

January 16, 2026 Â· 8 min Â· 1688 words Â· Robin Yang
An Image Slider

How to Integrate Swiper.js with Hugo Shortcodes

I’d like to add an image carousel / slider to my article. After some research, I found three common approaches: Hardcoding HTML directly into Markdown (tedious and hard to maintain). Using Hugo Modules (powerful but sometimes overkill for a simple slider). Creating a Custom Shortcode (the perfect balance of flexibility and performance). In this post, I’ll show you how I built a robust, reusable Swiper component using the Shortcode approach. This method keeps your Markdown clean while ensuring your site stays fast. ...

January 10, 2026 Â· 3 min Â· 561 words Â· Robin Yang
math typesetting

Reverse Thinking With Fixed-Length Sliding Window

We previously learned about the fixed-length sliding window technique, which typically involves sliding one element at a time. For a detailed explanation, refer to the article —— 📝How to Solve Fixed-Length Sliding Window Problems. Now, we encounter a new problem that also appears solvable with a sliding window, but with a slight twist🔗. A Tricky Problem There are several cards arranged in a row, and each card has an associated number of points. The points are given in the integer array cardPoints. ...

January 1, 2026 Â· 6 min Â· 1227 words Â· Robin Yang
math typesetting

Math Typesetting in Hugo

Hugo supports LaTeX math rendering via third-party JavaScript libraries, with MathJax and KaTeX being the two most popular options. This guide uses KaTeX for its speed and lightweight design. The implementation is simple: include the library in the <head> section. However, to optimize performance, we’ll load it conditionally—only on pages that actually need it. $$ \color{#c7c3c3} { \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} } $$ 1. Create a Partial for KaTeX Assets Create a new file at /layouts/partials/helpers/math.html and add the following: ...

December 29, 2025 Â· 3 min Â· 459 words Â· Robin Yang
fixed length sliding window

How to Solve Fixed-Length Sliding Window Problems!

One Classic Problem Given an integer array nums consisting of n elements, and an integer k, find the maximum sum of any contiguous subarray of size k. Example: Input: arr = [2, 1, 5, 1, 3, 2], k = 3 Output: 9 Explanation: Subarray [5, 1, 3] has the maximum sum 9 Constraints: $n == nums.length$ $1 <= k <= n <= 10^5$ $-10^4 <= nums[i] <= 10^4$ Brute Force Approach The simplest solution checks each subarray independently: ...

December 24, 2025 Â· 7 min Â· 1314 words Â· Robin Yang