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.6K view

Sept. 9, 2026

1520. Maximum Number of Non-Overlapping Substrings

Average Rating: 0 (0 votes)

t the intervals in ascending order by their right endpoint (primary key) and ascending order by length (seco...

115 view

Sept. 7, 2026

1621. Number of Sets of K Non-Overlapping Line Segments

Average Rating: 0 (0 votes)

> 0$ and $j > 0$, there are two cases: The right endpoint of the last line segment is not $j$. This is equi...

113 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 ...

388 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...

198 view

Aug. 18, 2026

3116. Kth Smallest Amount With Single Denomination Combination

Average Rating: 0 (0 votes)

he subset. Details In the binary search, the left endpoint is $k$, and the right endpoint is $k \times \min{...

168 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...

380 view

Sept. 7, 2026

3414. Maximum Score of Non-overlapping Intervals

Average Rating: 0 (0 votes)

intervals in $\textit{intervals}$ by their right endpoints in ascending order. Define $\textit{dp}[i][j]$ a...

115 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 ...

277 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...

631 view