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.
Design File System (设计文件系统)
Design a file system with createPath(path, value) (returns false if the path exists or its parent does not) and get(path) (returns...
Word Search II (单词搜索 II)
Given an m x n board of characters and a list of strings words, return all words that can be formed by sequentially adjacent cells...
Sum of Prefix Scores of Strings (字符串的前缀分数和)
You are given an array of strings words. For each word, the score is the sum over all its prefixes p of the number of words in the...
Count Prefix and Suffix Pairs II (统计前后缀下标对 II)
You are given an array of strings words. Return the number of pairs (i, j) with i < j such that words[i] is both a prefix and a...
Design In-Memory File System (设计内存文件系统)
Design an in-memory file system with ls(path), mkdir(path), addContentToFile(filePath, content) and readContentFromFile(filePath)....
Design Search Autocomplete System (设计搜索自动补全系统)
Design a search autocomplete system. AutocompleteSystem(sentences, times) initialises with historical sentences and their frequenc...
Sum of All Subset XOR Totals (找出所有子集的异或总和再求和)
The XOR total of an array is the XOR of all its elements, or 0 for an empty array. Given nums, return the sum of the XOR totals ov...
Subsets (子集)
Given an integer array nums of unique elements, return all possible subsets (the power set) in any order. Constraints: 1 <= num...
Combination Sum (组合总和)
Given an array of distinct integers candidates and a target, return all unique combinations that sum to the target. Each candidate...
Combination Sum II (组合总和 II)
Given a collection of candidate numbers candidates (which may contain duplicates) and a target, return all unique combinations sum...
Combinations (组合)
Given two integers n and k, return all possible combinations of k numbers chosen from the range 1..n. Constraints: 1 <= n <=...
Permutations (全排列)
Given an array nums of distinct integers, return all possible permutations in any order. Constraints: 1 <= nums.length <= 6,...
Subsets II (子集 II)
Given an integer array nums that may contain duplicates, return all possible subsets (the power set) without duplicate subsets. Co...
Permutations II (全排列 II)
Given a collection of numbers nums that may contain duplicates, return all unique permutations in any order. Constraints: 1 <= ...
Generate Parentheses (括号生成)
Given n pairs of parentheses, generate all combinations of well-formed parentheses. Constraints: 1 <= n <= 8.
Letter Tile Possibilities (活字印刷)
You have n tiles, each with one letter given in tiles. Return the number of possible non-empty sequences of letters you can make. ...
Word Search (单词搜索)
Given an m x n board of characters and a string word, return true if the word exists in the board via sequentially adjacent cells ...
Palindrome Partitioning (分割回文串)
Given a string s, partition it so that every substring is a palindrome. Return all possible partitionings. Constraints: 1 <= s....
Restore IP Addresses (复原 IP 地址)
A valid IP address consists of exactly four integers separated by dots, each between 0 and 255 with no leading zeros. Given a stri...
Letter Combinations of a Phone Number (电话号码的字母组合)
Given a string digits containing digits from 2 to 9, return all possible letter combinations that the number could represent, usin...
The k-th Lexicographical String of All Happy Strings of Length n (长度为 n 的开心字符串中字典序第 k 小的字符串)
A happy string consists only of a, b, c and has no two adjacent characters equal. Given n and k, return the k-th lexicographically...
Matchsticks to Square (火柴拼正方形)
You are given an array matchsticks where matchsticks[i] is the length of the i-th matchstick. You want to use all the matchsticks ...
Splitting a String Into Descending Consecutive Values (将字符串拆分为递减的连续值)
Given a string s of digits, return true if it can be split into two or more non-empty substrings whose integer values form a stric...
Construct Smallest Number From DI String (根据模式串构造最小数字)
You are given a string pattern of 'I' (increase) and 'D' (decrease). Return the lexicographically smallest permutation of 1..n+1 t...