🚀 NeetCode 973 Algorithm HandbookBlind 75 · NC 150 · NC 25019 Core Categories

NeetCode Comprehensive Algorithm Bank & Offline Handbook

Synchronized bilingual toggle with dual NeetCode & LeetCode problem numbering and direct links. Features step-by-step logic, benchmark Python3 code, complexity analysis, interview pitfalls, and standalone offline exports.

Mastery Progress
0.0%(0/973)
● Mastered: 0
◐ Reviewing: 0
○ Unstarted: 973
🔍
🎯 Featured Lists
📂 Categories (19 Core Topics)
Diff:
Mastery:
Showing 24 problems
NeetCode #217LC-259Two Pointers
Medium

3Sum Smaller (较小的三数之和)

Given an array of integers nums and an integer target, return the number of index triplets i < j < k such that nums[i] + num...

View Solution→
NeetCode #218LC-42Two PointersNC 150NC 250
Hard

Trapping Rain Water (接雨水)

Given n non-negative integers representing an elevation map where each bar has width 1, compute how much water it can trap after r...

View Solution→
NeetCode #219LC-219Sliding WindowNC 250
Easy

Contains Duplicate II (存在重复元素 II)

Given an integer array nums and an integer k, return true if there are two distinct indices i < j such that nums[i] == nums[j] ...

View Solution→
NeetCode #220LC-121Sliding WindowBlind 75NC 150NC 250
Easy

Best Time to Buy and Sell Stock (买卖股票的最佳时机)

You are given an array prices where prices[i] is the price of a stock on day i. You want to maximise profit by choosing a single d...

View Solution→
NeetCode #221LC-2379Sliding Window
Easy

Minimum Recolors to Get K Consecutive Black Blocks (得到 K 个黑块的最少涂色次数)

You are given a string blocks of 'W' and 'B' and an integer k. You want k consecutive black blocks; one operation recolours a whit...

View Solution→
NeetCode #222LC-1984Sliding Window
Easy

Minimum Difference Between Highest and Lowest of K Scores (学生分数的最小差值)

You are given a 0-indexed integer array scores and an integer k. Choose k scores so that the difference between the highest and lo...

View Solution→
NeetCode #223LC-1343Sliding Window
Medium

Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold (大小为 K 且平均值大于等于阈值的子数组数目)

Given an array of integers arr and two integers k and threshold, return the number of sub-arrays of size k whose average is greate...

View Solution→
NeetCode #224LC-1052Sliding Window
Medium

Grumpy Bookstore Owner (爱生气的书店老板)

A bookstore owner has customers[i] customers at minute i and a grumpy[i] flag that is 1 when they are grumpy (in which case those ...

View Solution→
NeetCode #225LC-487Sliding WindowNC Algo100
Medium

Max Consecutive Ones II (最大连续 1 的个数 II)

Given a binary array nums, return the maximum number of consecutive 1s obtainable if you can flip at most one 0. Constraints: 1 &l...

View Solution→
NeetCode #226LC-159Sliding WindowNC Algo100
Medium

Longest Substring with At Most Two Distinct Characters (至多包含两个不同字符的最长子串)

Given a string s, find the length of the longest substring that contains at most two distinct characters. Constraints: 1 <= s.l...

View Solution→
NeetCode #227LC-340Sliding WindowNC Algo100
Medium

Longest Substring with At Most K Distinct Characters (至多包含 K 个不同字符的最长子串)

Given a string s and an integer k, return the length of the longest substring that contains at most k distinct characters. Constra...

View Solution→
NeetCode #228LC-1100Sliding WindowNC Algo100
Medium

Find K-Length Substrings With No Repeated Characters (长度为 K 的无重复字符子串)

Given a string s and an integer k, return the number of substrings of length k with no repeated characters. Constraints: 1 <= s...

View Solution→
NeetCode #229LC-3208Sliding Window
Medium

Alternating Groups II (交替组 II)

There is a circle of colors[i] (0 or 1) and an integer k. An alternating group of size k is k consecutive tiles on the circle whos...

View Solution→
NeetCode #230LC-3Sliding WindowBlind 75NC 150NC 250
Medium

Longest Substring Without Repeating Characters (无重复字符的最长子串)

Given a string s, find the length of the longest substring without repeating characters. Constraints: 0 <= s.length <= 5 * 1...

View Solution→
NeetCode #231LC-424Sliding WindowBlind 75NC 150NC 250
Medium

Longest Repeating Character Replacement (替换后的最长重复字符)

You are given a string s and an integer k. You may replace at most k characters with any uppercase letter. Return the length of th...

View Solution→
NeetCode #232LC-567Sliding WindowNC 150NC 250
Medium

Permutation in String (字符串的排列)

Given two strings s1 and s2, return true if s2 contains a permutation of s1 as a substring. Constraints: 1 <= s1.length, s2.len...

View Solution→
NeetCode #233LC-1838Sliding Window
Medium

Frequency of the Most Frequent Element (最高频元素的频数)

The frequency of an element is the number of times it occurs. You can perform at most k operations, each incrementing one element ...

View Solution→
NeetCode #234LC-904Sliding Window
Medium

Fruit Into Baskets (水果成篮)

You are given an array fruits where fruits[i] is the type of fruit on tree i. You have two baskets, each of which can hold only on...

View Solution→
NeetCode #235LC-1456Sliding Window
Medium

Maximum Number of Vowels in a Substring of Given Length (定长子串中元音的最大数目)

Given a string s and an integer k, return the maximum number of vowel letters in any substring of s with length exactly k. Constra...

View Solution→
NeetCode #236LC-1888Sliding Window
Medium

Minimum Number of Flips to Make the Binary String Alternating (使二进制字符串字符交替的最少反转次数)

You are given a binary string s. In one step you may either remove the first character and append it to the end, or flip any chara...

View Solution→
NeetCode #237LC-1652Sliding Window
Easy

Defuse the Bomb (拆炸弹)

You have a bomb with a circular code array nums and a key k. If k > 0, replace each element with the sum of the next k elements...

View Solution→
NeetCode #238LC-209Sliding WindowNC 250
Medium

Minimum Size Subarray Sum (长度最小的子数组)

Given an array of positive integers nums and a positive integer target, return the minimal length of a contiguous subarray whose s...

View Solution→
NeetCode #239LC-658Sliding WindowNC 250
Medium

Find K Closest Elements (找到 K 个最接近的元素)

Given a sorted integer array arr, an integer k and an integer x, return the k closest integers to x in ascending order. Ties are b...

View Solution→
NeetCode #240LC-1658Sliding Window
Medium

Minimum Operations to Reduce X to Zero (将 x 减到 0 的最小操作数)

You are given an array nums and an integer x. In one operation you may remove either the leftmost or the rightmost element and sub...

View Solution→