382. Linked List Random Node

Problem Given a singly linked list, return a random node’s value from the linked list. Each node must have the same probabili...

medium

221. Maximal Square

Problem Given an m x n binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area...

medium

164. Maximum Gap

Problem Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the...

medium

983. Minimum Cost For Tickets

Problem You have planned some train traveling one year in advance. The days of the year in which you will travel are given as...

medium

2466. Count Ways To Build Good Strings

Problem Given the integers zero, one, low, and high, we can construct a string by starting with an empty string, and then at ...

medium

1367. Linked List in Binary Tree

Problem Given a binary tree root and a linked list with head as the first node. Return True if all the elements in the linked...

medium

1366. Rank Teams by Votes

Problem In a special ranking system, each voter gives a rank from highest to lowest to all teams participating in the competi...

medium

785. Is Graph Bipartite?

Problem There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array ...

medium

1014. Best Sightseeing Pair

Problem You are given an integer array values where values[i] represents the value of the iᵗʰ sightseeing spot. Two sightseei...

medium

3159. Find Occurrences of an Element in an Array

Problem You are given an integer array nums, an integer array queries, and an integer x. For each queries[i], you need to fin...

medium

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 ...

medium

515. Find Largest Value in Each Tree Row

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...

medium

3218. Minimum Cost for Cutting Cake I

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...

medium hard

1705. Maximum Number of Eaten Apples

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...

medium

721. Accounts Merge

Problem Given a list of accounts where each element accounts[i] is a list of strings, where the first element accounts[i][0] ...

medium

2471. Minimum Number of Operations to Sort a Binary Tree by Level

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...

medium

855. Exam Room

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...

medium

684. Redundant Connection

Problem In this problem, a tree is an undirected graph that is connected and has no cycles. You are given a graph that starte...

medium

1387. Sort Integers by The Power Value

Problem The power of an integer x is defined as the number of steps needed to transform x into 1 using the following steps: ...

medium

95. Unique Binary Search Trees II

Problem Given an integer n, return all the structurally unique BST’s (binary search trees), which has exactly n nodes of uniq...

medium

2545. Sort the Students by Their Kth Score

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...

medium

96. Unique Binary Search Trees

Problem Given an integer n, return the number of structurally unique BST’s (binary search trees) which has exactly n nodes of...

medium

89. Gray Code

Problem An n-bit gray code sequence is a sequence of 2ⁿ integers where: Every integer is in the inclusive range [0, 2ⁿ - 1],...

medium

72. Edit Distance

Problem Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You ha...

medium

50. Pow(x, n)

Problem Implement pow(x, n), which calculates x raised to the power n (i.e., xⁿ). https://leetcode.com/problems/powx-n/ Examp...

medium

227. Basic Calculator II

Problem Given a string s which represents an expression, evaluate this expression and return its value. The integer division ...

medium

2415. Reverse Odd Levels of Binary Tree

Problem Given the root of a perfect binary tree, reverse the node values at each odd level of the tree. For example, suppose...

medium

3138. Minimum Length of Anagram Concatenation

Problem You are given a string s, which is known to be a concatenation of anagrams of some string t. Return the minimum possi...

medium

337. House Robber III

Problem The thief has found himself a new place for his thievery again. There is only one entrance to this area, called root....

medium

43. Multiply Strings

Problem Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also repre...

medium

769. Max Chunks To Make Sorted

Problem You are given an integer array arr of length n that represents a permutation of the integers in the range [0, n - 1]....

medium

714. Best Time to Buy and Sell Stock with Transaction Fee

Problem You are given an array prices where prices[i] is the price of a given stock on the iᵗʰ day, and an integer fee repres...

medium
12345