443. String Compression

Problem Given an array of characters chars, compress it using the following algorithm: Begin with an empty string s. For each...

medium

3254. Find the Power of K-Size Subarrays I

Problem You are given an array of integers nums of length n and a positive integer k. The power of an array is defined as: I...

medium

3255. Find the Power of K-Size Subarrays II

跟 3254. Find the Power of K-Size Subarrays I 一模一样,只不过 n 的上限从 500 增加到 10⁵。 https://leetcode.cn/problems/find-the-power-of-k-si...

medium

633. Sum of Square Numbers

Problem Given a non-negative integer c, decide whether there’re two integers a and b such that a² + b² = c. https://leetcode....

medium

3208. Alternating Groups II

Problem There is a circle of red and blue tiles. You are given an array of integers colors and an integer k. The color of til...

medium

638. Shopping Offers

Problem In LeetCode Store, there are n items to sell. Each item has a price. However, there are some special offers, and a sp...

medium

3259. Maximum Energy Boost From Two Drinks

Problem You are given two integer arrays energyDrinkA and energyDrinkB of the same length n by a futuristic sports scientist....

medium

2924. Find Champion II

Problem There are n teams numbered from 0 to n - 1 in a tournament; each team is also a node in a DAG. You are given the inte...

medium

371. Sum of Two Integers

Problem Given two integers a and b, return the sum of the two integers without using the operators + and -. https://leetcode....

medium

743. Network Delay Time

Problem You are given a network of n nodes, labeled from 1 to n. You are also given times, a list of travel times as directed...

medium

238. Product of Array Except Self

Problem Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements o...

medium

235. Lowest Common Ancestor of a Binary Search Tree

Problem Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST. According...

medium

377. Combination Sum IV

Problem Given an array of distinct integers nums and a target integer target, return the number of possible combinations that...

medium

105. Construct Binary Tree from Preorder and Inorder Traversal

Problem Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder i...

medium

230. Kth Smallest Element in a BST

Problem Given the root of a binary search tree, and an integer k, return the kᵗʰ smallest value (1-indexed) of all the values...

medium

102. Binary Tree Level Order Traversal

Problem Given the root of a binary tree, return the level order traversal of its nodes’ values. (i.e., from left to right, le...

medium

1143. Longest Common Subsequence

Problem Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subse...

medium

98. Validate Binary Search Tree

Problem Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follo...

medium

347. Top K Frequent Elements

Problem Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any o...

medium

91. Decode Ways

Problem You have intercepted a secret message encoded as a string of numbers. The message is decoded via the following mappin...

medium

213. House Robber II

Problem You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed...

medium

211. Design Add and Search Words Data Structure

Problem Design a data structure that supports adding new words and finding if a string matches any previously added string. I...

medium

208. Implement Trie (Prefix Tree)

Problem A trie (pronounced as “try”) or prefix tree is a tree data structure used to efficiently store and retrieve keys in a...

medium

207. Course Schedule

Problem There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array pr...

medium

3233. Find the Count of Numbers Which Are Not Special

Problem You are given 2 positive integers l and r. For any number x, all positive divisors of x except x are called the prope...

medium

79. Word Search

Problem Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be co...

medium

73. Set Matrix Zeroes

Problem Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0’s. You must do it in pla...

medium

200. Number of Islands

Problem Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islan...

medium

198. House Robber

Problem You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed...

medium

322. Coin Change

Problem You are given an integer array coins representing coins of different denominations and an integer amount representing...

medium

3243. Shortest Distance After Road Addition Queries I

Problem You are given an integer n and a 2D integer array queries. There are n cities numbered from 0 to n - 1. Initially, th...

medium

62. Unique Paths

Problem There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robo...

medium
13456