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.
Minimum Number of Arrows to Burst Balloons (用最少数量的箭引爆气球)
There are spherical balloons taped to a wall at points[i] = [xstart, xend]. An arrow shot vertically at x bursts every balloon who...
The Number of the Smallest Unoccupied Chair (最小未被占据椅子的编号)
There are infinitely many chairs numbered 0, 1, 2, .... Friends arrive at times[i][0] and leave at times[i][1], and each sits on t...
Check if Grid can be Cut into Sections (判断网格图能否被切割成块)
You are given an integer n and a 2D array rectangles where rectangles[i] = [x1, y1, x2, y2] is an axis-aligned rectangle inside an...
My Calendar I (我的日程安排表 I)
Design a calendar that stores non-overlapping half-open intervals [start, end). Implement book(start, end) which returns true and ...
My Calendar II (我的日程安排表 II)
Design a calendar that allows double bookings but never triple bookings. Implement book(start, end) which returns true and adds th...
Count Days Without Meetings (无需开会的工作日)
You are given a positive integer days representing a 1-indexed schedule of days days, and an array meetings where meetings[i] = [s...
Minimum Interval to Include Each Query (包含每个查询的最小区间)
You are given a 2D array intervals, where intervals[i] = [left, right], and an array queries. For each query q, find the length of...
Data Stream as Disjoint Intervals (将数据流变为多个不相交区间)
Given a data stream of non-negative integers, design a structure that summarises the numbers seen so far as a list of disjoint sor...
Employee Free Time (员工空闲时间)
You are given the working schedules of several employees as a list of lists of intervals schedule[i], each sorted and disjoint. Re...
Single Number (只出现一次的数字)
Every element of the array nums appears exactly twice except for one element that appears once. Return that single element. Constr...
Count Triplets with Even XOR Set Bits I (统计异或置位数均为偶数的三元组 I)
Given three integer arrays a, b and c, count the triplets (a[i], b[j], c[k]) whose bitwise XOR has an even number of set bits. Con...
Single Number III (只出现一次的数字 III)
Every element of the array nums appears exactly twice except for two elements that each appear once. Return those two unique eleme...
Number of 1 Bits (位 1 的个数)
Write a function that takes an unsigned integer n and returns the number of set bits in its binary representation (the Hamming wei...
Counting Bits (比特位计数)
Given an integer n, return an array ans of length n + 1 where ans[i] is the number of set bits in the binary representation of i, ...
Add Binary (二进制求和)
Given two binary strings a and b, return their sum as a binary string. Constraints: 1 <= a.length, b.length <= 10^4, and eac...
Minimum Bit Flips to Convert Number (转换数字的最少位翻转次数)
Given two integers start and goal, return the minimum number of bit flips required to turn start into goal. Constraints: 0 <= s...
Reverse Bits (颠倒二进制位)
Reverse the bits of a given 32-bit unsigned integer n and return the result. The input is treated as a fixed 32-bit value, so lead...
Missing Number (丢失的数字)
Given an array nums containing n distinct integers taken from the range [0, n], return the only number in that range that is missi...
Shuffle the Array (重新排列数组)
Given the array nums consisting of 2n elements arranged as [x1, x2, ..., xn, y1, y2, ..., yn], return the array [x1, y1, x2, y2, ....
Add to Array-Form of Integer (数组形式的整数加法)
The array num represents the digits of a non-negative integer in big-endian order. Given num and an integer k, return the array-fo...
Find the Difference (找不同)
You are given two strings s and t. String t is produced by shuffling s and then inserting one extra lowercase letter at a random p...
Power of Two (2 的幂)
Given an integer n, return true if it is a power of two, otherwise false. Constraints: -2^31 <= n <= 2^31 - 1. The follow-up...
Sum of Two Integers (两整数之和)
Given two integers a and b, return their sum without using the operators + and -. Constraints: -1000 <= a, b <= 1000.
Reverse Integer (整数反转)
Given a signed 32-bit integer x, return x with its digits reversed. If the reversed value falls outside the signed 32-bit range [-...