Loading...

Welcome to LeetCode Articles. Here is the only official editorials / solutions you will find.

Jan. 5, 2018

758. Bold Words in String

Average Rating: 2.85 (13 votes)

dot W_{\max})$ overall), we record only the right endpoint in a right array indexed by the start of the matc...

by awice 10.5K view

April 5, 2026

2078. Two Furthest Houses With Different Colors

Average Rating: 0 (0 votes)

s every pair, but the optimal pair always has one endpoint at house 0 or house $n-1$. Suppose the best pair ...

271 view

Aug. 9, 2026

3090. Maximum Length Substring With Two Occurrences

Average Rating: 0 (0 votes)

Approach 1: Enumerate the Left Endpoint Intuition We can enumerate all substrings and che...

69 view

May 24, 2026

3161. Block Placement Queries

Average Rating: 0 (0 votes)

an store the length of each interval at its right endpoint. Specifically, we store $d[r]$ at the right endpo...

195 view

July 20, 2026

3501. Maximize Active Section with Trade II

Average Rating: 0 (0 votes)

hin each group are sorted by non-decreasing right endpoint, the right endpoint $R$ only moves monotonically ...

155 view

Nov. 30, 2025

3578. Count Partitions With Max-Min Difference at Most K

Average Rating: 0 (0 votes)

t, consider the range of valid $j$. Fix the right endpoint $i$. As we extend the window leftward, the subarr...

495 view

July 10, 2026

3532. Path Existence Queries in a Graph I

Average Rating: 0 (0 votes)

rval. To do this efficiently, we record the right endpoint of every interval. Then, for each queried node, w...

125 view

July 10, 2026

3534. Path Existence Queries in a Graph II

Average Rating: 0 (0 votes)

a two-pointer algorithm, we can compute the left endpoint of the adjacent interval for every node. To facil...

141 view

June 4, 2026

3691. Maximum Total Subarray Value II

Average Rating: 0 (0 votes)

select $k$ different subarrays. For a fixed left endpoint $l$, as the right endpoint $r$ increases, the max...

193 view

Feb. 4, 2026

3713. Longest Balanced Substring I

Average Rating: 0 (0 votes)

is balanced. Specifically: We enumerate the left endpoint $i$ of the substring and then enumerate the right...

398 view