494. Target Sum
Problem You are given an integer array nums and an integer target. You want to build an expression out of nums by adding one ...
Problem You are given an integer array nums and an integer target. You want to build an expression out of nums by adding one ...
Problem Given a string s, find any substring of length 2 which is also present in the reverse of s. A substring is a contigu...
Problem Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed). https://le...
跟 3218. Minimum Cost for Cutting Cake I 一模一样,只不过 m 和 n 的量级从 20 增加到 10⁵,因此只能用 O(n log n) 贪心解法。 https://leetcode.cn/problems/mi...
Problem There is an m x n cake that needs to be cut into 1 x 1 pieces. You are given integers m, n, and two arrays: horizont...
Problem You are given a directed graph of n nodes numbered from 0 to n - 1, where each node has at most one outgoing edge. Th...
Problem There is a bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1. The edges in the graph...
Problem There exist two undirected trees with n and m nodes, numbered from 0 to n - 1 and from 0 to m - 1, respectively. You ...
Problem There is a special kind of apple tree that grows apples every day for n days. On the iᵗʰ day, the tree grows apples[i...
Problem A company is organizing a meeting and has a list of n employees, waiting to be invited. They have arranged for a larg...
Problem Given a list of accounts where each element accounts[i] is a list of strings, where the first element accounts[i][0] ...
Problem In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all othe...
Problem You are given the root of a binary tree with unique values. In one operation, you can choose any two nodes at the sam...
Problem There is an exam room with n seats in a single row labeled from 0 to n - 1. When a student enters the room, they must...
Problem In this problem, a tree is an undirected graph that is connected and has no cycles. You are given a graph that starte...
Problem There is a strange printer with the following two special requirements: On each turn, the printer will print a solid...
Problem You are given a 0-indexed array heights of positive integers, where heights[i] represents the height of the iᵗʰ build...
Problem There is a strange printer with the following two special properties: The printer can only print a sequence of the s...
Problem The power of an integer x is defined as the number of steps needed to transform x into 1 using the following steps: ...
Problem You are given an array points, an integer angle, and your location, where location = [pos_x, pos_y] and points[i] = [...
Problem Given the root of a binary tree, return the postorder traversal of its nodes’ values. https://leetcode.com/problems/b...
Problem There is an undirected tree with n nodes labeled from 0 to n - 1. You are given the integer n and a 2D integer array ...
Problem Given an integer n, return all the structurally unique BST’s (binary search trees), which has exactly n nodes of uniq...
Problem There is a class with m students and n exams. You are given a 0-indexed m x n integer matrix score, where each row re...
Problem Given an integer n, return the number of structurally unique BST’s (binary search trees) which has exactly n nodes of...
Problem An n-bit gray code sequence is a sequence of 2ⁿ integers where: Every integer is in the inclusive range [0, 2ⁿ - 1],...
Problem Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You ha...
Problem Implement pow(x, n), which calculates x raised to the power n (i.e., xⁿ). https://leetcode.com/problems/powx-n/ Examp...
Problem Given an expression such as expression = "e + 8 - a + 5" and an evaluation map such as {"e":...
Problem Given a string s which represents an expression, evaluate this expression and return its value. The integer division ...
Problem Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result ...
Problem Given the root of a perfect binary tree, reverse the node values at each odd level of the tree. For example, suppose...