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.
Find Unique Binary String (找到不同的二进制字符串)
Given an array of n unique binary strings each of length n, return a binary string of length n that does not appear in the array. ...
Split a String Into the Max Number of Unique Substrings (拆分字符串使唯一子字符串的数目最大)
Given a string s, return the maximum number of unique non-empty substrings into which s can be split. Constraints: 1 <= s.lengt...
Maximum Length of a Concatenated String with Unique Characters (串联字符串的最大长度)
You are given an array of strings arr. Concatenate a subsequence of them so that the concatenated string has all unique characters...
Partition to K Equal Sum Subsets (划分为 k 个相等的子集)
Given an integer array nums and an integer k, return whether it is possible to divide the array into k non-empty subsets with equa...
The Number of Beautiful Subsets (美丽子集的数目)
You are given an array nums of positive integers and a positive integer k. A subset is beautiful if it contains no two elements wh...
Different Ways to Add Parentheses (为运算表达式设计优先级)
Given a string expression of numbers and the operators +, -, *, return all possible results from computing all the different ways ...
Construct the Lexicographically Largest Valid Sequence (构建字典序最大的可行序列)
Given an integer n, construct the lexicographically largest sequence of length 2n - 1 containing two occurrences of each number fr...
Count Number of Maximum Bitwise-OR Subsets (统计按位或能得到最大值的子集数目)
Given an integer array nums, return the number of subsets whose bitwise OR equals the maximum possible OR. Constraints: 1 <= nu...
Strobogrammatic Number II (中心对称数 II)
Given an integer n, return all strobogrammatic numbers of length n in any order. A strobogrammatic number looks the same when rota...
Factor Combinations (因子的组合)
Numbers can be expressed as products of their factors. Given an integer n, return all possible factor combinations of n using fact...
Brace Expansion (花括号展开)
You are given a string expression representing a brace expansion, e.g. "{a,b}{c,{d,e}}". Return all words generated by the expansi...
Word Pattern II (单词规律 II)
Given a pattern string and a string s, return whether s matches the pattern, where each letter in the pattern maps bijectively to ...
Android Unlock Patterns (安卓系统手势解锁)
Android unlock patterns are drawn on a 3x3 grid of dots using 4 to 9 distinct dots. A move may skip over an already-visited dot, b...
N-Queens (N 皇后)
The n-queens puzzle places n queens on an n x n board so that no two attack each other. Given n, return all distinct solutions, ea...
N-Queens II (N 皇后 II)
The n-queens puzzle places n queens on an n x n board so that no two attack each other. Given n, return the number of distinct sol...
Maximum Score Words Formed by Letters (得分最高的单词集合)
You are given words, letters (available letters, each usable once) and score (the score of each letter a-z). Return the maximum sc...
Word Break II (单词拆分 II)
Given a string s and a dictionary wordDict, add spaces to construct sentences where every word is in the dictionary. Return all su...
Robot Room Cleaner (扫地机器人)
This is an interactive problem. A robot can move() (returns whether the move succeeded), turnLeft(), turnRight() and clean(). Give...
Kth Largest Element in a Stream (数据流中的第 K 大元素)
Design a class that finds the k-th largest element in a stream. KthLargest(k, nums) initialises with the initial numbers, and add(...
Last Stone Weight (最后一块石头的重量)
You are given an array stones of weights. Repeatedly pick the two heaviest stones: if they are equal both are destroyed, otherwise...
Take Gifts From the Richest Pile (从数量最多的堆取走礼物)
You are given an integer array gifts where gifts[i] is the number of gifts in the i-th pile, and an integer k. Each second you tak...
Final Array State After K Multiplication Operations I (K 次乘运算后的最终数组 I)
You are given an integer array nums, an integer k and a multiplier multiplier. Repeat k times: find the minimum value in nums (tie...
High Five (前五科的均分)
Given a list of [studentId, score] items, return each student's id with the floor of the average of their top five scores, sorted ...
Minimum Cost to Connect Sticks (连接棒材的最低费用)
You are given an array sticks of positive integers. Repeatedly connect two sticks into one, paying the cost of the combined length...