Category Git
Short answers to the question what is the difference between...
Short answers to the question how to revert a git...
Short answers to the question how to modify existing unpushed...
Short answers to the question how to undo a git...
Short answers to the question how to rename a local...
Short answers to the question how to delete a git...
Short answers to the question how to checkout a remote...
Short answers to the question how to undo the most...
Category MySQL
How to make multiple columns unique (together) in an existing...
Suppose we have the following REIMBURSEMENT table, find the max...
How to get the size of a table in MySQL...
How to get the size of a database in MySQL...
How to concatenate multiple rows into one field in MySQL...
Given a table EMPLOYEE, change the data type of the...
How to set a default value for a MySQL Datetime...
This query writes results into a CSV file on the...
MySQL stores the user information in its own database.
Do a SELECT with a GROUP BY clause.
The INNER JOIN keyword selects records that have matching values...
Aliases are nicknames. They give us a shorthand way of...
The OR operator combines two Boolean expressions and returns true...
The LIMIT clause is used in the SELECT statement to...
The LIKE operator is used in a WHERE clause to...
To test whether a value is NULL or not, we...
The IN operator allows us to determine if a specified...
The BETWEEN operator selects values within a given range.
The AND operator is a logical operator that combines two...
The WHERE clause allows us to choose which rows are...
In order to remove duplicate rows, we use the DISTINCT...
The ORDER BY clause is used to sort the result-set...
The SELECT statement allows us to read data from one...
Category Database
LeetCode 1939. Write an SQL query to find the IDs...
LeetCode 1949. Write an SQL query to find all the...
LeetCode 1919. Write an SQL query to report the similar...
LeetCode 1917. Write an SQL query to recommend friends to...
LeetCode 1972. Write an SQL query to report the IDs...
LeetCode 1988. Write an SQL query to report the minimum...
LeetCode 1965. Write an SQL query to report the IDs...
LeetCode 1978. Write an SQL query to report the IDs...
LeetCode 1990. Write an SQL query to report the number...
LeetCode 1907. Write an SQL query to report the number...
LeetCode 1934. Write an SQL query to find the confirmation...
LeetCode 1951. Write an SQL query to find all the...
LeetCode 1890. Write an SQL query to report the latest...
LeetCode 1843. Write an SQL query to report the IDs...
LeetCode 1892. Write an SQL query to find all the...
LeetCode 1867. Write an SQL query to find the order_id...
LeetCode 1831. Write an SQL query to report the IDs...
LeetCode 1841. Write an SQL query to report the statistics...
LeetCode 1875. Write an SQL query to report the IDs...
LeetCode 1821. Write an SQL query to report the customers...
LeetCode 1853. Write an SQL query to convert each date...
LeetCode 1873. Write an SQL query to calculate the bonus...
LeetCode 1795. Write an SQL query to rearrange the Products...
LeetCode 1811. Write an SQL query to report the name...
LeetCode 1809. Write an SQL query to report all the...
LeetCode 1789. Write an SQL query to report all the...
LeetCode 1783. Write an SQL query to report the number...
LeetCode 1777. Write an SQL query to find the price...
LeetCode 1767. Write an SQL query to report the IDs...
LeetCode 1757. Write an SQL query to find the ids...
LeetCode 1747. Write an SQL query to find the account_id...
LeetCode 1741. Write an SQL query to calculate the total...
LeetCode 1731. Write an SQL query to report the ids...
LeetCode 1729. Write an SQL query that will, for each...
LeetCode 1715. Write an SQL query to count the number...
LeetCode 1709. Write an SQL query that will, for each...
LeetCode 1384. Write an SQL query to report the Total...
LeetCode 1479. Write an SQL query to report how many...
LeetCode 1651. Write an SQL query to compute the average_ride_distance...
LeetCode 1369. Write an SQL query to show the second...
LeetCode 1412. Write an SQL query to report the students...
LeetCode 1194. Write an SQL query to find the winner...
LeetCode 618. A U.S graduate school has students from Asia,...
LeetCode 1225. Write an SQL query to generate a report...
LeetCode 569. Write a SQL query to find the median...
LeetCode 1159. Write an SQL query to find for each...
LeetCode 1635. Write an SQL query to report the following...
LeetCode 1097. Write an SQL query that reports for each...
LeetCode 1127. Write an SQL query to find the total...
LeetCode 262. Write a SQL query to find the cancellation...
LeetCode 1336. Write an SQL query to find how many...
LeetCode 601. Write an SQL query to display the records...
LeetCode 1645. Write an SQL query to report the percentage...
LeetCode 571. Write a query to find the median of...
LeetCode 579. Write a SQL to get the cumulative sum...
LeetCode 185. Write a SQL query to find employees who...
LeetCode 615. Given two tables as below, write a query...
LeetCode 1098. Write an SQL query that reports the books...
LeetCode 614. Please write a sql query to get the...
LeetCode 1132. Write an SQL query to find the average...
LeetCode 1699. Write an SQL query to report the number...
LeetCode 177. Write a SQL query to get the nth...
LeetCode 1107. Write an SQL query that reports for every...
LeetCode 1205. Write an SQL query to find for each...
LeetCode 578. Write a sql query to identify the question...
LeetCode 184. Write a SQL query to find employees who...
LeetCode 1149. Write an SQL query to find all the...
LeetCode 1454. Write an SQL query to find the id...
LeetCode 574. Write a sql to find the name of...
LeetCode 1212. Write an SQL query that selects the team_id,...
LeetCode 178. Write a SQL query to rank scores. If...
LeetCode 1070. Write an SQL query that selects the product...
LeetCode 1341. Write the following SQL query to find the...
LeetCode 585. Write a query to print the sum of...
LeetCode 1174. Write an SQL query to find the percentage...
LeetCode 602. In social network like Facebook or Twitter, people...
LeetCode 1501. Write an SQL query to find the countries...
LeetCode 580. A university uses 2 data tables, student and...
LeetCode 1555. Our bank records all transactions in the table...
LeetCode 608. Given a table tree, id is identifier of...
LeetCode 1549. Write an SQL query to find the most...
LeetCode 612. Write a query to find the shortest distance...
LeetCode 1459. Write an SQL query to report of all...
LeetCode 1164. Write an SQL query to find the prices...
LeetCode 1264. Write an SQL query to recommend pages to...
LeetCode 1193. Write an SQL query to find for each...
LeetCode 1158. Write an SQL query to find for each...
LeetCode 570. Given the Employee table, write a SQL query...
LeetCode 1613. Write an SQL query to find the missing...
LeetCode 626. Mary is a teacher in a middle school...
LeetCode 1045. Write an SQL query for a report that...
LeetCode 1126. Write an SQL query to find all active...
LeetCode 1532. Write an SQL query to find the most...
LeetCode 1321. You are the restaurant owner and you want...
LeetCode 1077. Write an SQL query that reports the most...
LeetCode 1364. Write an SQL query to find the following...
LeetCode 1421. Write an SQL query to find the npv...
LeetCode 1204. Write an SQL query to find the person_name...
LeetCode 1112. Write a SQL query to find the highest...
LeetCode 1440. Write an SQL query to evaluate the boolean...
LeetCode 1468. Write an SQL query to find the salaries...
LeetCode 1355. Write an SQL query to find the names...
LeetCode 1142. Write an SQL query to find the average...
LeetCode 1596. Write an SQL query to find the most...
LeetCode 1308. Write an SQL query to find the total...
LeetCode 1495. Write an SQL query to report the distinct...
LeetCode 597. Write an SQL query to find the overall...
LeetCode 1285. Write an SQL query to find the start...
LeetCode 1398. Write an SQL query to report the customer_id...
LeetCode 596. Please list out all classes which have more...
LeetCode 1393. Write an SQL query to report the Capital...
LeetCode 619. Table my_numbers contains many numbers in column num...
LeetCode 1445. Write an SQL query to report the difference...
LeetCode 1270. Write an SQL query to find employee_id of...
LeetCode 1294. Write an SQL query to find the type...
LeetCode 1141. Write an SQL query to find the daily...
LeetCode 610. A pupil Tim gets homework to identify whether...
LeetCode 1280. Write an SQL query to find the number...
LeetCode 607. Given three tables, salesperson, company, orders.
LeetCode 1084. Write an SQL query that reports the products...
LeetCode 1083. Write an SQL query that reports the buyers...
LeetCode 1113. Write an SQL query that reports the number...
LeetCode 1211. Write an SQL query to find each query_name,...
LeetCode 1076. Write an SQL query that reports all the...
LeetCode 1075. Write an SQL query that reports the average...
LeetCode 1241. Write an SQL query to find number of...
LeetCode 620. X city opened a new cinema, many people...
LeetCode 1543. Write an SQL query to report product_name in...
LeetCode 603. Several friends at a cinema ticket office would...
LeetCode 1322. A company is running Ads and wants to...
LeetCode 1407. Write an SQL query to report the distance...
LeetCode 627. Given a table salary, such as the one...
LeetCode 613. Write a query to find the shortest distance...
LeetCode 1082. Write an SQL query that reports the best...
LeetCode 1179. Write an SQL query to reformat the table...
LeetCode 1069. Write an SQL query that reports the total...
LeetCode 1068. Write an SQL query that reports all product...
LeetCode 1327. Write an SQL query to get the names...
LeetCode 1173. Write an SQL query to find the percentage...
LeetCode 1517. Write an SQL query to find the users...
LeetCode 584. Given a table customer holding customers information and...
LeetCode 586. Query the customer_number from the orders table for...
LeetCode 1511. Write an SQL query to report the customer_id...
LeetCode 1435. You want to know how long a user...
LeetCode 595. Write a SQL solution to output big countries’...
LeetCode 1251. Write an SQL query to find the average...
LeetCode 1148. Write an SQL query to find all the...
LeetCode 1050. Write a SQL query for a report that...
LeetCode 1565. Write an SQL query to find the number...
LeetCode 1607. Write an SQL query to report the names...
LeetCode 197. Write an SQL query to find all dates’...
LeetCode 550. Write an SQL query that reports the fraction...
LeetCode 534. Write an SQL query that reports for each...
LeetCode 512. Write a SQL query that reports the device...
LeetCode 511. Write an SQL query that reports the first...
LeetCode 577. Select all employee’s name and bonus whose bonus...
LeetCode 196. Write a SQL query to delete all duplicate...
LeetCode 1693. Write an SQL query that will, for each...
LeetCode 1581. Write an SQL query to find the IDs...
LeetCode 1677. Write an SQL query that will, for all...
LeetCode 1633. Write an SQL query to find the percentage...
LeetCode 1667. Write an SQL query to fix the names...
LeetCode 182. Write a SQL query to find all duplicate...
LeetCode 183. Write a SQL query to find all customers...
LeetCode 180. Write an SQL query to find all numbers...
LeetCode 1661. There is a factory website that has several...
LeetCode 176. Given the Employee table, write a SQL query...
LeetCode 181. Given the Employee table, write a SQL query...
LeetCode 1587. Write an SQL query to report the name...
LeetCode 1484. Write an SQL query to find for each...
LeetCode 1623. Write an SQL query to find all the...
LeetCode 1571. Write an SQL query to report how much...
LeetCode 1350. Write an SQL query to find the id...
LeetCode 1378. Write an SQL query to show the unique...
LeetCode 1527. Write an SQL query to report the patient_id,...
LeetCode 1683. Write an SQL query to find the IDs...
LeetCode 1303. Write an SQL query to find the team...
LeetCode 175. Write a SQL query for a report that...
Category List
A growing list of Git questions and short answers.
A growing list of MySQL tutorials.
A list of LeetCode database problems and solutions.
A growing list of LeetCode problems and solutions.
A growing list of posts under the topic of Operating...
A growing list of posts under the topic of Object...
A growing list of posts under the topic of C++...
Category Operating System
Another important question is how threads interact when they access...
A thread is an abstraction for a single running process....
How can the OS provide the illusion of nearly-endless supply...
How can the OS decide which page(s) to evict from...
How can the OS make use of a larger, slower...
How can we make page tables smaller.
How can we speed up address translation, and generally avoid...
How can we virtualize memory with pages, so as to...
How to support a large address space with (potentially) a...
How can we relocate the process in memory in a...
Virtual Memory is an abstraction that the Operating System provides...
Category Object-Oriented Design
Design the data structures for an online book reader system...
Design a parking lot using object-oriented principles. We will focus...
An object oriented design problem. Imagine you have a call...
Category Design Pattern
The singleton design pattern is a type of creational pattern...
The factory design pattern is a type of creational pattern...
Category C++ Concepts
Every C++ expression has a type and belongs to a...
Perfect forwarding reduces the need for overloaded functions and helps...
The rvalue references enable us to distinguish an lvalue from...
A reference is an alias of another object. It stores...
An lvalue reference is another name of an object. An...
A lambda expression is a convenient way of defining an...
A template specialization is a separate definition in which the...
C++ transforms the operands to a common type before performing...
An explicit conversion is also called as a cast. There...
The constructor that takes a single parameter that is a...
A function specified as inline is expanded everywhere it is...
A function pointer is a pointer that denotes a function...
Sometimes an object must store a way to access the...
A friend class can access private and protected members of...
A unique_ptr does not share its pointer. It cannot be...
In modern C++ programming, the Standard Library includes smart pointers,...
The shared_ptr type is a smart pointer that is designed...
A template is a blueprint or formula for creating a...
Polymorphism means having more than one function with the same...
An interface describes the behavior or capabilities of a C++...
Category Data Structure
LeetCode 914. In a deck of cards, each card has...
LeetCode 916. You are given two string arrays words1 and...
LeetCode 874. A robot on an infinite XY-plane starts at...
LeetCode 966. Given a wordlist, we want to implement a...
LeetCode 987. Given the root of a binary tree, calculate...
LeetCode 953. In an alien language, surprisingly, they also use...
LeetCode 946. Given two integer arrays pushed and popped each...
LeetCode 903. You are given a string s of length...
LeetCode 941. Given an array of integers arr, return true...
LeetCode 965. A binary tree is uni-valued if every node...
LeetCode 980. You are given an m x n integer...
LeetCode 804. International Morse Code defines a standard encoding where...
LeetCode 929. Every valid email consists of a local name...
LeetCode 884. A sentence is a string of single-space separated...
LeetCode 982. Given an integer array nums, return the number...
LeetCode 867. Given a 2D integer array matrix, return the...
LeetCode 981. Design a time-based key-value data structure that can...
LeetCode 927. You are given an array arr which consists...
LeetCode 956. You are installing a billboard and want it...
LeetCode 892. You are given an n x n grid...
LeetCode 906. Let’s say a positive integer is a super-palindrome...
LeetCode 887. You are given k identical eggs and you...
LeetCode 891. The width of a sequence is the difference...
LeetCode 907. Given an array of integers arr, find the...
LeetCode 985. You are given an integer array nums and...
LeetCode 834. There is an undirected connected tree with n...
LeetCode 811. A website domain “discuss.leetcode.com” consists of various subdomains....
LeetCode 992. Given an integer array nums and an integer...
LeetCode 984. Given two integers a and b, return any...
LeetCode 877. Alice and Bob play a game with piles...
LeetCode 936. You are given two strings stamp and target....
LeetCode 977. Given an integer array nums sorted in non-decreasing...
LeetCode 805. You are given an integer array nums.
LeetCode 842. You are given a string of digits num,...
LeetCode 885. You start at the cell (rStart, cStart) of...
LeetCode 808. There are two types of soup, type A...
LeetCode 905. Given an integer array nums, move all the...
LeetCode 922. Given an array of integers nums, half of...
LeetCode 912. Given an array of integers nums, sort the...
LeetCode 909. You are given an n x n integer...
LeetCode 865. Given the root of a binary tree, the...
LeetCode 988. You are given the root of a binary...
LeetCode 910. You are given an integer array nums and...
LeetCode 908. You are given an integer array nums and...
LeetCode 839. Two strings Xand Yare similar if we can...
LeetCode 862. Given an integer array nums and an integer...
LeetCode 847. You have an undirected, connected graph of n...
LeetCode 864. You are given an m x n grid...
LeetCode 821. Given a string s and a character c...
LeetCode 934. You are given an n x n binary...
LeetCode 820. A valid encoding of an array of words...
LeetCode 848. You are given a string s of lowercase...
LeetCode 856. Given a balanced parentheses string s, return the...
LeetCode 861. You are given an m x n binary...
LeetCode 990. You are given an array of strings equations...
LeetCode 994. You are given an m x n grid...
LeetCode 900. We can use run-length encoding (i.e., RLE) to...
LeetCode 917. Given a string s, reverse the string according...
LeetCode 950. You are given an integer array deck. There...
LeetCode 869. You are given an integer n. We reorder...
LeetCode 937. You are given an array of logs. Each...
LeetCode 959. An n x n grid is composed of...
LeetCode 836. An axis-aligned rectangle is represented as a list...
LeetCode 850. You are given a 2D array of axis-aligned...
LeetCode 882. You are given an undirected graph (the “original...
LeetCode 938. Given the root node of a binary search...
LeetCode 818. Your car starts at position 0 and speed...
LeetCode 838. There are n dominoes in a line, and...
LeetCode 883. You are given an n x n grid...
LeetCode 879. There is a group of n members, and...
LeetCode 957. There are 8 prison cells in a row...
LeetCode 866. Given an integer n, return the smallest prime...
LeetCode 970. Given three integers x, y, and bound, return...
LeetCode 886. We want to split a group of n...
LeetCode 830. In a string sof lowercase letters, these letters...
LeetCode 852. Let’s call an array arr a mountainif the...
LeetCode 915. Given an integer array nums, partition it into...
LeetCode 969. Given an array of integers arr, sort the...
LeetCode 899. You are given a string s and an...
LeetCode 901. Design an algorithm that collects daily price quotes...
LeetCode 911. You are given two integer arrays persons and...
LeetCode 975. You are given an integer array arr. From...
LeetCode 967. Return all non-negative integers of length n such...
LeetCode 902. Given an array of digits which is sorted...
LeetCode 996. An array is squareful if the sum of...
LeetCode 933. You have a RecentCounter class which counts the...
LeetCode 920. Your music player contains n different songs. You...
LeetCode 806. You are given a string s of lowercase...
LeetCode 878. A positive integer is magical if it is...
LeetCode 837. Alice plays the following game, loosely based on...
LeetCode 947. On a 2D plane, we place n stones...
LeetCode 826. You have n jobs and m workers. You...
LeetCode 819. Given a string paragraph and a string array...
LeetCode 896. An array is monotonic if it is either...
LeetCode 858. There is a special square room with mirrors...
LeetCode 801. You are given two integer arrays of the...
LeetCode 871. A car travels from a starting position to...
LeetCode 995. You are given a binary array nums and...
LeetCode 945. You are given an integer array nums. In...
LeetCode 931. Given an n x n array of integers...
LeetCode 1000. There are n piles of stones arranged in...
LeetCode 857. There are n workers. You are given two...
LeetCode 983. You have planned some train traveling one year...
LeetCode 939. You are given an array of points in...
LeetCode 963. You are given an array of points in...
LeetCode 921. A parentheses string is valid if and only...
LeetCode 924. You are given a network of n nodes...
LeetCode 928. You are given a network of n nodes...
LeetCode 876. Given the head of a singly linked list,...
LeetCode 962. A ramp in an integer array nums is...
LeetCode 918. Given a circular integer array nums of length...
LeetCode 895. Design a stack-like data structure to push elements...
LeetCode 998. A maximum tree is a tree where every...
LeetCode 849. You are given an array representing a row...
LeetCode 807. There is a city composed of n x...
LeetCode 831. You are given a personal information string s,...
LeetCode 827. You are given an n x n binary...
LeetCode 840. A 3 x 3 magic square is a...
LeetCode 851. There is a group of n people labeled...
LeetCode 978. Given an integer array arr, return the length...
LeetCode 845. Given an integer array arr, return the length...
LeetCode 925. Your friend is typing his name into a...
LeetCode 817. You are given the head of a linked...
LeetCode 873. Given a strictly increasing array arr of positive...
LeetCode 860. At a lemonade stand, each lemonade costs $5....
LeetCode 964. Given a single positive integer x, we will...
LeetCode 872. Consider all the leaves of a binary tree,...
LeetCode 812. Given an array of points on the X-Y...
LeetCode 949. Given an arrayarr of 4 digits, find the...
LeetCode 813. You are given an integer array nums and...
LeetCode 976. Given an integer array nums, return the largest...
LeetCode 952. You are given an integer array of unique...
LeetCode 875. Koko loves to eat bananas. There are n...
LeetCode 935. The chess knight has a unique movement, it...
LeetCode 841. There are n rooms labeled from 0 to...
LeetCode 854. Strings s1 and s2 are k-similar (for some...
LeetCode 973. Given an array of points where points[i] =...
LeetCode 986. You are given two lists of closed intervals,...
LeetCode 897. Given the root of a binary search tree,...
LeetCode 835. You are given two images, img1 and img2,...
LeetCode 846. Alice has some number of cards and she...
LeetCode 843. This is an interactive problem.
LeetCode 893. You are given an array of strings of...
LeetCode 824. You are given a string sentence that consist...
LeetCode 904. You are visiting a farm that has a...
LeetCode 825. There are n persons on a social media...
LeetCode 832. Given an n x n binary matrix image,...
LeetCode 926. A binary string is monotone increasing if it...
LeetCode 951. For a binary tree T, we can define...
LeetCode 971. You are given the root of a binary...
LeetCode 997. In a town, there are n people labeled...
LeetCode 943. Given an array of strings words, return the...
LeetCode 802. There is a directed graph of n nodes...
LeetCode 890. Given a list of strings words and a...
LeetCode 833. You are given a 0-indexed string s that...
LeetCode 888. Alice and Bob have a different total number...
LeetCode 809. Sometimes people repeat letters to represent extra feeling....
LeetCode 855. There is an exam room with n seats...
LeetCode 972. Given two strings s and t, each of...
LeetCode 979. You are given the root of a binary...
LeetCode 940. Given a string s, return the number of...
LeetCode 942. A permutation perm of n + 1 integers...
LeetCode 944. You are given an array of n strings...
LeetCode 960. You are given an array of n strings...
LeetCode 955. You are given an array of n strings...
LeetCode 880. You are given an encoded string s. To...
LeetCode 993. Given the root of a binary tree with...
LeetCode 828. Let’s define a function countUniqueChars(s) that returns the...
LeetCode 889. Given two integer arrays, preorder and postorder where...
LeetCode 829. Given an integer n, return the number of...
LeetCode 919. A complete binary tree is a binary tree...
LeetCode 958. Given the root of a binary tree, determine...
LeetCode 810. You are given an array of integers nums...
LeetCode 913. A game on an undirected graph is played...
LeetCode 822. You are given n cards, with a positive...
LeetCode 853. There are n cars going to the same...
LeetCode 815. You are given an array routes representing bus...
LeetCode 859. Given two strings s and goal, return true...
LeetCode 991. There is a broken calculator that has the...
LeetCode 803. You are given an m x n binary...
LeetCode 881. You are given an array people where people[i]...
LeetCode 898. We have an array arr of non-negative integers....
LeetCode 823. Given an array of unique integers, arr, where...
LeetCode 814. Given the root of a binary tree, return...
LeetCode 968. You are given the root of a binary...
LeetCode 930. Given a binary array nums and an integer...
LeetCode 868. Given a positive integer n, find and return...
LeetCode 932. Given the integer n, return any beautiful array...
LeetCode 948. You have an initial power of power, an...
LeetCode 844. Given two strings s and t, return true...
LeetCode 999. On an 8 x 8 chessboard, there is...
LeetCode 954. Given an integer array of even length arr,...
LeetCode 816. We had some 2-dimensional coordinates, like “(1, 3)”...
LeetCode 894. Given an integer n, return a list of...
LeetCode 863. Given the root of a binary tree, the...
LeetCode 870. You are given two integer arrays nums1 and...
LeetCode 989. The array-form of an integer num is an...
LeetCode 923. Given an integer array arr, and an integer...
LeetCode 611. Given an integer array nums, return the number...
LeetCode 794. Given a Tic-Tac-Toe board as a string array...
LeetCode 678. Given a string s containing only three types...
LeetCode 680. Given a string s, return true if the...
LeetCode 782. You are given an n x n binary...
LeetCode 692. Given an array of strings words and an...
LeetCode 766. Given an m x n matrix, returntrueif the...
LeetCode 621. Given a characters array tasks, representing the tasks...
LeetCode 778. You are given an n x n integer...
LeetCode 777. In a string composed of ‘L’, ‘R’, and...
LeetCode 664. There is a strange printer with the following...
LeetCode 691. We are given n different types of stickers....
LeetCode 725. Given the head of a singly linked list...
LeetCode 761. Special binary strings are binary strings with the...
LeetCode 640. Solve a given equation and return the value...
LeetCode 773. On an 2 x 3 board, there are...
LeetCode 638. In LeetCode Store, there are n items to...
LeetCode 645. You have a set of integers s, which...
LeetCode 757. You are given a 2D integer array intervals...
LeetCode 728. A self-dividing number is a number that is...
LeetCode 657. There is a robot starting at the position...
LeetCode 767. Given a string s, rearrange the characters of...
LeetCode 684. In this problem, a tree is an undirected...
LeetCode 685. In this problem, a rooted tree is a...
LeetCode 780. Given four integers sx, sy, tx, and ty,...
LeetCode 715. A Range Module is a module that tracks...
LeetCode 710. You are given an integer n and an...
LeetCode 781. There is a forest with an unknown number...
LeetCode 756. You are stacking blocks to form a pyramid....
LeetCode 793. Let f(x) be the number of zeroes at...
LeetCode 763. You are given a string s. We want...
LeetCode 736. You are given a string expression representing a...
LeetCode 752. You have a lock in front of you...
LeetCode 743. You are given a network of n nodes,...
LeetCode 732. A k-booking happens when k events have some...
LeetCode 731. You are implementing a program to use as...
LeetCode 729. You are implementing a program to use as...
LeetCode 688. On an n x n chessboard, a knight...
LeetCode 779. We build a table of n rows (1-indexed)....
LeetCode 724. Given an array of integers nums, calculate the...
LeetCode 636. On a single-threaded CPU, we execute a program...
LeetCode 789. You are playing a simplified PAC-MAN game on...
LeetCode 649. In the world of Dota2, there are two...
LeetCode 741. You are given an n x n grid...
LeetCode 650. There is only one character ‘A’ on the...
LeetCode 653. Given the root of a Binary Search Tree...
LeetCode 669. Given the root of a binary search tree...
LeetCode 709. Given a string s, return the string after...
LeetCode 633. Given a non-negative integer c, decide whether there’re...
LeetCode 659. You are given an integer array nums that...
LeetCode 798. You are given an array nums. You can...
LeetCode 632. You have k lists of sorted integers in...
LeetCode 748. Given a string licensePlate and an array of...
LeetCode 671. Given a non-empty special binary tree consisting of...
LeetCode 700. You are given the root of a binary...
LeetCode 788. An integer x is a good if after...
LeetCode 796. Given two strings s and goal, return true...
LeetCode 686. Given two string s a and b, return...
LeetCode 722. Given a C++ program, remove comments from it....
LeetCode 754. You are standing at position 0 on an...
LeetCode 655. Given the root of a binary tree, construct...
LeetCode 762. Given two integers left and right, return the...
LeetCode 745. Design a special dictionary with some words that...
LeetCode 698. Given an integer array nums and an integer...
LeetCode 795. Given an integer array nums and two integers...
LeetCode 792. Given a string s and an array of...
LeetCode 673. Given an integer arraynums, return the number of...
LeetCode 726. Given a string formula representing a chemical formula,return...
LeetCode 665. Given an array nums with n integers, your...
LeetCode 738. An integer has monotone increasing digits if and...
LeetCode 783. Given the root of a Binary Search Tree...
LeetCode 712. Given two strings s1 ands2, return the lowest...
LeetCode 746. You are given an integer array cost where...
LeetCode 617. You are given two binary trees root1 and...
LeetCode 662. Given the root of a binary tree, return...
LeetCode 689. Given an integer array nums and an integer...
LeetCode 628. Given an integer array nums, find three numbers...
LeetCode 718. Given two integer arrays nums1 and nums2, return...
LeetCode 646. You are given an array of n pairs...
LeetCode 769. You are given an integer array arr of...
LeetCode 768. You are given an integer array arr.
LeetCode 687. Given the root of a binary tree, return...
LeetCode 674. Given an unsorted array of integers nums, return...
LeetCode 784. Given a string s, we can transform every...
LeetCode 668. Nearly everyone has used the Multiplication Table. The...
LeetCode 785. There is an undirected graph with n nodes,...
LeetCode 661. An image smoother is a filter of the...
LeetCode 775. You are given an integer array nums of...
LeetCode 733. An image is represented by an m x...
LeetCode 744. Given a characters array letters that is sorted...
LeetCode 609. Given a list paths of directory info, including...
LeetCode 699. There are several squares being dropped onto the...
LeetCode 622. Design your implementation of the circular queue. The...
LeetCode 641. Design your implementation of the circular double-ended queue...
LeetCode 675. You are asked to cut off all the...
LeetCode 647. Given a string s, return the number of...
LeetCode 670. You are given an integer num. You can...
LeetCode 654. You are given an integer array nums with...
LeetCode 643. You are given an integer array nums consisting...
LeetCode 695. You are given an m x n binary...
LeetCode 677. Design a map that allows you to do...
LeetCode 764. You are given an integer n. You have...
LeetCode 747. You are given an integer array nums where...
LeetCode 703. Design a class to find the k^th largest...
LeetCode 786. You are given a sorted integer array arr...
LeetCode 629. For an integer array nums, an inverse pair...
LeetCode 701. You are given the root node of a...
LeetCode 676. Design a data structure that is initialized with...
LeetCode 719. The distance of a pair of integers a...
LeetCode 658. Given a sorted integer array arr, two integers...
LeetCode 652. Given the rootof a binary tree, return all...
LeetCode 690. You have a data structure of employee information,...
LeetCode 790. You have two types of tiles, a 2...
LeetCode 707. Design your implementation of the linked list. You...
LeetCode 705. Design a HashSet without using any built-in hash...
LeetCode 706. Design a HashMap without using any built-in hash...
LeetCode 740. You are given an integer array nums. You...
LeetCode 697. Given a non-empty array of non-negative integers nums,...
LeetCode 639. A message containing letters from A-Z can be...
LeetCode 739. Given an array of integers temperatures represents the...
LeetCode 791. You are given two strings order and s....
LeetCode 753. There is a safe protected by a password....
LeetCode 630. There are n different online courses numbered from...
LeetCode 765. There are n couples sitting in 2n seats...
LeetCode 730. Given a string s, return the number of...
LeetCode 696. Give a binary string s, return the number...
LeetCode 749. A virus is spreading rapidly, and your task...
LeetCode 606. Given the root of a binary tree, construct...
LeetCode 787. There are n cities connected by some number...
LeetCode 799. We stack glasses in a pyramid, where the...
LeetCode 605. You have a long flowerbed in which some...
LeetCode 672. There is a room with n bulbs labeled...
LeetCode 704. Given an array of integers nums which is...
LeetCode 693. Given a positive integer, check whether it has...
LeetCode 714. You are given an array prices where prices[i]...
LeetCode 667. Given two integers n and k, construct a...
LeetCode 770. Given an expression such as expression = “e...
LeetCode 682. You are keeping score for a baseball game...
LeetCode 637. Given the root of a binary tree, return...
LeetCode 735. We are given an array asteroids of integers...
LeetCode 797. Given a directed acyclic graph (DAG) of n...
LeetCode 623. Given the root of a binary tree and...
LeetCode 721. Given a list of accounts where each element...
LeetCode 679. You are given an integer array cards of...
LeetCode 717. We have two special characters, the first character...
LeetCode 488. You are playing a variation of the game...
LeetCode 468. Given a string queryIP, return “IPv4” if IP...
LeetCode 467. We define the string s to be the...
LeetCode 407. Given an m x n integer matrix heightMap...
LeetCode 477. The Hamming distance between two integers is the...
LeetCode 414. Given an integer array nums, return the third...
LeetCode 495. Our hero Teemo is attacking an enemy Ashe...
LeetCode 591. Given a string representing a code snippet, implement...
LeetCode 517. You have n super washing machines on a...
LeetCode 420. A password is considered strong if the below...
LeetCode 497. You are given an array of non-overlapping axis-aligned...
LeetCode 486. You are given an integer array nums. Two...
LeetCode 416. Given a non-empty array nums containing only positive...
LeetCode 417. There is an m x n rectangular island...
LeetCode 600. Given a positive integer n, return the number...
LeetCode 502. Suppose LeetCode will start its IPO soon. In...
LeetCode 403. A frog is crossing a river. The river...
LeetCode 514. In the video game Fallout 4, the quest...
LeetCode 564. Given a string n representing an integer, return...
LeetCode 587. You are given an array trees where trees[i]...
LeetCode 593. Given the coordinates of four points in 2D...
LeetCode 494. You are given an integer array nums and...
LeetCode 404. Given the root of a binary tree, return...
LeetCode 572. Given the roots of two binary trees root...
LeetCode 552. An attendance record for a student can be...
LeetCode 551. You are given a string s representing an...
LeetCode 443. Given an array of characters chars, compress it...
LeetCode 410. Given an array nums which consists of non-negative...
LeetCode 451. Given a string s, sort it in decreasing...
LeetCode 483. Given an integer n represented as a string,...
LeetCode 480. The median is the middle value in an...
LeetCode 540. You are given a sorted array consisting of...
LeetCode 581. Given an integer array nums, you need to...
LeetCode 449. Serialization is converting a data structure or object...
LeetCode 557. Given a string s, reverse the order of...
LeetCode 541. Given a string s and an integer k,...
LeetCode 493. Given an integer array nums, return the number...
LeetCode 566. In MATLAB, there is a handy function called...
LeetCode 459. Given a string s, check if it can...
LeetCode 402. Given string num representing a non-negative integer num,...
LeetCode 546. You are given several boxes with different colors...
LeetCode 506. You are given an integer array score of...
LeetCode 423. Given a string s containing an out-of-order English...
LeetCode 598. You are given an m x n matrix...
LeetCode 528. You are given a 0-indexed array of positive...
LeetCode 519. There is an m x n binary grid...
LeetCode 406. You are given an array of people, people,...
LeetCode 458. There are buckets buckets of liquid, where exactly...
LeetCode 567. Given two strings s1 and s2, return true...
LeetCode 507. A perfect number is a positive integer that...
LeetCode 437. Given the root of a binary tree and...
LeetCode 576. There is an m x n grid with...
LeetCode 553. You are given an integer array nums. The...
LeetCode 474. You are given an array of binary strings...
LeetCode 434. You are given a string s, return the...
LeetCode 547. There are n cities. Some of them are...
LeetCode 447. You are given n points in the plane...
LeetCode 476. The complement of an integer is the integer...
LeetCode 435. Given an array of intervals intervals where intervals[i]...
LeetCode 556. Given a positive integer n, find the smallest...
LeetCode 503. Given a circular integer array nums (i.e., the...
LeetCode 496. The next greater element of some element x...
LeetCode 589. Given the root of an n-ary tree, return...
LeetCode 590. Given the root of an n-ary tree, return...
LeetCode 429. Given an n-ary tree, return the level order...
LeetCode 508. Given the root of a binary tree, return...
LeetCode 539. Given a list of 24-hour clock time points...
LeetCode 452. There are some spherical balloons taped onto a...
LeetCode 433. A gene string can be represented by an...
LeetCode 453. Given an integer array nums of size n,...
LeetCode 462. Given an integer array nums of size n,...
LeetCode 599. Suppose Andy and Doris want to choose a...
LeetCode 530. Given the root of a Binary Search Tree...
LeetCode 529. Let’s play the minesweeper game!
LeetCode 559. Given a n-ary tree, find its maximum depth....
LeetCode 485. Given a binary array nums, return the maximum...
LeetCode 473. You are given an integer array matchsticks where...
LeetCode 481. A magical string s consists of only ‘1’...
LeetCode 524. Given a string s and a string array...
LeetCode 522. Given an array of strings strs, return the...
LeetCode 521. Given two strings a and b, return the...
LeetCode 424. You are given a string s and an...
LeetCode 516. Given a string s, find the longest palindromic...
LeetCode 409. Given a string s which consists of lowercase...
LeetCode 594. We define a harmonious array as an array...
LeetCode 558. A Binary Matrix is a matrix in which...
LeetCode 482. You are given a license key represented as...
LeetCode 460. Design and implement a data structure for a...
LeetCode 479. Given an integer n, return the largest palindromic...
LeetCode 500. Given an array of strings words, return the...
LeetCode 440. Given two integers n and k, return the...
LeetCode 532. Given an array of integers nums and an...
LeetCode 463. You are given row x col grid representing...
LeetCode 491. Given an integer array nums, return all the...
LeetCode 470. Given the API rand7() that generates a uniform...
LeetCode 475. Winter is coming! During the contest, your first...
LeetCode 461. The Hamming distance between two integers is the...
LeetCode 478. Given the radius and the position of the...
LeetCode 592. Given a string expression representing an expression of...
LeetCode 430. You are given a doubly linked list, which...
LeetCode 436. You are given an array of intervals, where...
LeetCode 501. Given the root of a binary search tree...
LeetCode 515. Given the root of a binary tree, return...
LeetCode 513. Given the root of a binary tree, return...
LeetCode 448. Given an array nums of n integers where...
LeetCode 442. Given an integer array nums of length n...
LeetCode 438. Given two strings s and p, return an...
LeetCode 509. The Fibonacci numbers, commonly denoted F(n) form a...
LeetCode 535. TinyURL is a URL shortening service where you...
LeetCode 575. Alice has n candies, where the i^th candy...
LeetCode 498. Given an m x n matrix mat, return...
LeetCode 520. We define the usage of capitals in a...
LeetCode 583. Given two strings word1 and word2, return the...
LeetCode 450. Given a root node reference of a BST...
LeetCode 538. Given the root of a Binary Search Tree...
LeetCode 405. Given an integer num, return a string representing...
LeetCode 525. Given a binary array nums, return the maximum...
LeetCode 492. A web developer needs to know how to...
LeetCode 427. Given a n * n matrix grid of...
LeetCode 537. A complex number can be represented as a...
LeetCode 365. You are given two jugs with capacities jug1Capacity...
LeetCode 393. Given an integer array data representing the data,...
LeetCode 412. Given an integer n, return a string array...
LeetCode 518. You are given an integer array coins representing...
LeetCode 457. You are playing a game involving a circular...
LeetCode 464. In the “100 game” two players take turns...
LeetCode 554. There is a rectangular brick wall in front...
LeetCode 401. A binary watch has 4 LEDs on the...
LeetCode 563. Given the root of a binary tree, return...
LeetCode 526. Suppose you have n integers labeled 1 through...
LeetCode 419. Given an m x n matrix board where...
LeetCode 504. Given an integer num, return a string of...
LeetCode 455. Assume you are an awesome parent and want...
LeetCode 561. Given an integer array nums of 2n integers,...
LeetCode 565. You are given an integer array nums of...
LeetCode 441. You have n coins and you want to...
LeetCode 413. An integer array is called arithmetic if it...
LeetCode 446. Given an integer array nums, return the number...
LeetCode 432. Design a data structure to store the strings...
LeetCode 445. You are given two non-empty linked lists representing...
LeetCode 415. Given two non-negative integers, num1 and num2 represented...
LeetCode 456. Given an arrayof n integers nums, a 132...
LeetCode 542. Given an m x n binary matrix mat,...
LeetCode 376. A wiggle sequence is a sequence where the...
LeetCode 331. One way to serialize a binary tree is...
LeetCode 242. Given two strings s and t, return true...
LeetCode 263. An ugly number is a positive integer whose...
LeetCode 264. An ugly number is a positive integer whose...
LeetCode 347. Given an integer array nums and an integer...
LeetCode 313. A super ugly number is a positive integer...
LeetCode 372. Your task is to calculate a^b mod 1337...
LeetCode 228. You are given a sorted unique integer array...
LeetCode 371. Given two integers a and b, return the...
LeetCode 239. You are given an array of integersnums, there...
LeetCode 260. Given an integer array nums, in which exactly...
LeetCode 384. Given an integer array nums, design an algorithm...
LeetCode 214. You are given a string s. You can...
LeetCode 297. Serialization is the process of converting a data...
LeetCode 335. You are given an array of integers distance....
LeetCode 240. Write an efficient algorithm that searches for a...
LeetCode 396. You are given an integer array nums of...
LeetCode 345. Given a string s, reverse only all the...
LeetCode 344. Write a function that reverses a string. The...
LeetCode 203. Given the head of a linked list and...
LeetCode 301. Given a string s that contains parentheses and...
LeetCode 316. Given a string s, remove duplicate letters so...
LeetCode 223. Given the coordinates of two rectilinear rectangles in...
LeetCode 290. Given a pattern and a string s, find...
LeetCode 383. Given two stings ransomNote and magazine, return true...
LeetCode 303. Given an integer array nums, handle multiple queries...
LeetCode 304. Given a 2D matrix matrix, handle multiple queries...
LeetCode 398. Given an integer array nums with possible duplicates,...
LeetCode 238. Given an integer array nums, return an array...
LeetCode 231. Given an integer n, return true if it...
LeetCode 326. Given an integer n, return true if it...
LeetCode 342. Given an integer n, return true if it...
LeetCode 279. Given an integer n, return the least number...
LeetCode 391. Given an array rectangles where rectangles[i] = [x_i,...
LeetCode 284. Design an iterator that supports the peek operation...
LeetCode 330. Given a sorted integer array nums and an...
LeetCode 336. Given a list of unique words, return all...
LeetCode 328. Given the head of a singly linked list,...
LeetCode 233. Given an integer n, count the total number...
LeetCode 400. Given an integer n, return the n^th digit...
LeetCode 292. You are playing the following Nim Game with...
LeetCode 283. Given an integer array nums, move all 0’s...
LeetCode 268. Given an array nums containing n distinct numbers...
LeetCode 209. Given an array of positive integers nums and...
LeetCode 310. A tree is an undirected graph in which...
LeetCode 385. Given a string s represents the serialization of...
LeetCode 318. Given a string array words, return the maximum...
LeetCode 221. Given an m x n binary matrix filled...
LeetCode 229. Given an integer array of size n, find...
LeetCode 236. Given a binary tree, find the lowest common...
LeetCode 235. Given a binary search tree (BST), find the...
LeetCode 395. Given a string s and an integer k,...
LeetCode 300. Given an integer array nums, return the length...
LeetCode 329. Given an m x n integers matrix, return...
LeetCode 388. Suppose we have a file system that stores...
LeetCode 382. Given a singly linked list, return a random...
LeetCode 386. Given an integer n, return all the numbers...
LeetCode 368. Given a set of distinct positive integers nums,...
LeetCode 378. Given an n x n matrix where each...
LeetCode 230. Given the root of a binary search tree,...
LeetCode 215. Given an integer array nums and an integer...
LeetCode 205. Given two strings s and t, determine if...
LeetCode 392. Given two strings s and t, return true...
LeetCode 226. Given the root of a binary tree, invert...
LeetCode 350. Given two integer arrays nums1 and nums2, return...
LeetCode 273. Convert a non-negative integer num to its English...
LeetCode 397. Given a positive integer n,you can apply one...
LeetCode 343. Given an integer n, break it into the...
LeetCode 381. RandomizedCollection is a data structure that contains a...
LeetCode 334. Given an integer array nums, return true if...
LeetCode 225. Implement a last-in-first-out (LIFO) stack using only two...
LeetCode 232. Implement a first in first out (FIFO) queue...
LeetCode 337. The thief has found himself a new place...
LeetCode 213. You are a professional robber planning to rob...
LeetCode 202. Write an algorithm to determine if a number...
LeetCode 274. Given an array of integers citations where citations[i]...
LeetCode 275. Given an array of integers citations where citations[i]...
LeetCode 374. We are playing the Guess Game. The game...
LeetCode 375. We are playing the Guessing Game. The game...
LeetCode 289. The Game of Life, also known simply as...
LeetCode 341. You are given a nested list of integers...
LeetCode 387. Given a string s, find the first non-repeating...
LeetCode 278. You are a product manager and currently leading...
LeetCode 287. Given an array of integers nums containingn +...
LeetCode 389. You are given two strings s and t....
LeetCode 295. The median is the middle value in an...
LeetCode 373. You are given two integer arrays nums1 and...
LeetCode 282. Given a string num that contains only digits...
LeetCode 399. You are given an array of variable pairs...
LeetCode 390. You have a list arr of all integers...
LeetCode 241. Given a string expression of numbers and operators,...
LeetCode 355. Design a simplified version of Twitter where users...
LeetCode 211. Design a data structure that supports adding new...
LeetCode 237. Write a function to delete a node in...
LeetCode 394. Given an encoded string, return its decoded string....
LeetCode 352. Given a data stream input of non-negative integers...
LeetCode 321. You are given two integer arrays nums1 and...
LeetCode 207. There are a total of numCourses courses you...
LeetCode 210. There are a total of numCourses courses you...
LeetCode 338. Given an integer n, return an array ans...
LeetCode 204. Given an integer n, return the number of...
LeetCode 315. You are given an integer array nums and...
LeetCode 327. Given an integer array nums and two integers...
LeetCode 357. Given an integer n, return the count of...
LeetCode 222. Given the root of a complete binary tree,...
LeetCode 217. Given an integer array nums, return true if...
LeetCode 220. Given an integer array nums and two integers...
LeetCode 219. Given an integer array nums and an integer...
LeetCode 377. Given an array of distinct integers nums and...
LeetCode 216. Find all valid combinations of k numbers that...
LeetCode 322. You are given an integer array coins representing...
LeetCode 312. You are given n balloons, indexed from 0...
LeetCode 299. You are playing the Bulls and Cows game...
LeetCode 319. There are n bulbs that are initially off....
LeetCode 201. Given two integers left and right that represent...
LeetCode 257. Given the root of a binary tree, return...
LeetCode 309. You are given an array prices where prices[i]...
LeetCode 224. Given a string s representing a valid expression,...
LeetCode 227. Given a string s which represents an expression,...
LeetCode 306. Additive number is a string whose digits can...
LeetCode 258. Given an integer num, repeatedly add all its...
LeetCode 189. Given an array, rotate the array to the...
LeetCode 151. Given an input string s, reverse the order...
LeetCode 190. Reverse bits of a given 32 bits unsigned...
LeetCode 187. The DNA sequence is composed of a series...
LeetCode 191. Write a function that takes an unsigned integer...
LeetCode 155. Design a stack that supports push, pop, top,...
LeetCode 152. Given an integer array nums, find a contiguous...
LeetCode 164. Given an integer array nums, return the maximum...
LeetCode 169. Given an array nums of size n, return...
LeetCode 179. Given a list of non-negative integers nums, arrange...
LeetCode 160. Given the heads of two singly linked-lists headA...
LeetCode 198. You are a professional robber planning to rob...
LeetCode 166. Given two integers representing the numerator and denominator...
LeetCode 162. A peak element is an element that is...
LeetCode 153. Suppose an array of length n sorted in...
LeetCode 154. Suppose an array of length n sorted in...
LeetCode 172. Given an integer n, return the number of...
LeetCode 168. Given an integer columnNumber, return its corresponding column...
LeetCode 171. Given a string columnTitle that represents the column...
LeetCode 174. The demons had captured the princess and imprisoned...
LeetCode 165. Given two version numbers,version1 and version2, compare them....
LeetCode 199. Given the root of a binary tree, imagine...
LeetCode 173. Implement the BSTIterator class that represents an iterator...
LeetCode 188. You are given an integer array prices where...
LeetCode 139. Given a string s and a dictionary of...
LeetCode 140. Given a string s and a dictionary of...
LeetCode 148. Given the head of a linked list, return...
LeetCode 136. Given a non-empty array of integers nums, every...
LeetCode 137. Given an integer array nums whereevery element appears...
LeetCode 143. You are given the head of a singly...
LeetCode 131. Given a string s, partition s such that...
LeetCode 132. Given a string s, partition s such that...
LeetCode 149. Given an array of points where points[i] =...
LeetCode 146. Design a data structure that follows the constraints...
LeetCode 141. Given head, the head of a linked list,...
LeetCode 142. Given the head of a linked list, return...
LeetCode 147. Given the head of a singly linked list,...
LeetCode 134. There are n gas stations along a circular...
LeetCode 150. Evaluate the value of an arithmetic expression in...
LeetCode 138. A linked list of length n is given...
LeetCode 133. Given a reference of a node in a...
LeetCode 135. There are n children standing in a line....
LeetCode 144. Given the root of a binary tree, return...
LeetCode 145. Given the root of abinary tree, return the...
LeetCode 127. Given two words, beginWord and endWord, and a...
LeetCode 126. Given two words, beginWord and endWord, and a...
LeetCode 125. A phrase is a palindrome if, after converting...
LeetCode 120. Given a triangle array, return the minimum path...
LeetCode 130. Given an m x n matrix board containing...
LeetCode 129. You are given the root of a binary...
LeetCode 116. You are given a perfect binary tree where...
LeetCode 117. Given a binary tree, populate each next pointer...
LeetCode 112. Given the root of a binary tree and...
LeetCode 113. Given the root of a binary tree and...
LeetCode 118. Given an integer numRows, return the first numRows...
LeetCode 119. Given an integer rowIndex, return the rowIndex^th (0-indexed)...
LeetCode 111. Given a binary tree, find its minimum depth....
LeetCode 128. Given an unsorted array of integers nums, return...
LeetCode 114. Given the root of a binary tree, flatten...
LeetCode 115. Given two strings s and t, return the...
LeetCode 109. Given the head of a singly linked list...
LeetCode 124. A path in a binary tree is a...
LeetCode 121. You are given an array prices where prices[i]...
LeetCode 123. You are given an array prices where prices[i]...
LeetCode 122. You are given an integer array prices where...
LeetCode 110. Given a binary tree, determine if it is...
LeetCode 101. Given the root of a binary tree, check...
LeetCode 104. Given the root of a binary tree, return...
LeetCode 108. Given an integer array nums where the elements...
LeetCode 105. Given two integer arrays preorder and inorder where...
LeetCode 106. Given two integer arrays inorder and postorder where...
LeetCode 103. Given the root of a binary tree, return...
LeetCode 102. Given the root of a binary tree, return...
LeetCode 107. Given the root of a binary tree, return...
LeetCode 98. Given the root of a binary tree, determine...
LeetCode 100. Given the roots of two binary trees p...
LeetCode 99. You are given the root of a binary...
LeetCode 83. Given the head of a sorted linked list,...
LeetCode 82. Given the head of a sorted linked list,...
LeetCode 94. Given an m x n grid of characters...
LeetCode 75. Given an array nums with n objects colored...
LeetCode 71. Given a string path, which is an absolute...
LeetCode 73. Given an m x n integer matrix matrix,...
LeetCode 76. Given two strings s and t of lengths...
LeetCode 72. Given two strings word1 and word2, return the...
LeetCode 77. Given two integers n and k, return all...
LeetCode 65. Given a string s, return true if s...
LeetCode 62. A robot is located at the top-left corner...
LeetCode 63. A robot is located at the top-left corner...
LeetCode 68. Given an array of strings words and a...
LeetCode 61. Given the head of a linked list, rotate...
LeetCode 66. You are given a large integer represented as...
LeetCode 64. Given a m x n grid filled with...
LeetCode 70. You are climbing a staircase. It takes n...
LeetCode 67. A robot is located at the top-left corner...
LeetCode 54. Given an m x n matrix, return all...
LeetCode 59. Given a positive integer n, generate an n...
LeetCode 58. Given a string s consisting of some words...
LeetCode 57. Insert newInterval into intervals such that intervals is...
LeetCode 6. Write the code that will take a string...
LeetCode 36. Determine if a 9 x 9 Sudoku board...
LeetCode 42. Given n non-negative integers representing an elevation map...
LeetCode 30. You are given a string s and an...
LeetCode 33. Given the array nums after the possible rotation...
LeetCode 48. Determine if a 9 x 9 Sudoku board...
LeetCode 25. Given a linked list, reverse the nodes of...
LeetCode 27. Given an integer array nums and an integer...
LeetCode 9. Given an integer x, return true if x...
LeetCode 31. Implement next permutation, which rearranges numbers into the...
LeetCode 43. Given two non-negative integers num1 and num2 represented...
LeetCode 32. Given a string containing just the characters ‘(‘...
LeetCode 45. Given an array of non-negative integers nums, you...
LeetCode 12. Given an integer, convert it to a roman...
LeetCode 28. Implement strStr().
LeetCode 49. Given an array of strings strs, group the...
LeetCode 29. Write the code that will take a string...
LeetCode 38. Write the code that will take a string...
LeetCode 16. Given an integer array nums of length n...
LeetCode 20. Given a string s containing just the characters...
LeetCode 24. Given a linked list, swap every two adjacent...
LeetCode 19. Given the head of a linked list, remove...
LeetCode 26. Given an integer array nums sorted in non-decreasing...
LeetCode 14. Write a function to find the longest common...
LeetCode 22. Given n pairs of parentheses, write a function...
LeetCode 1902. You are given a 0-indexed integer array order...
LeetCode 1999. Given three integers, k, digit1, and digit2, you...
LeetCode 2000. Given a 0-indexed string word and a character...
LeetCode 1812. You are given coordinates, a string that represents...
LeetCode 8. Implement the myAtoi(string s) function, which converts a...
LeetCode 3. Given a string s, find the length of...
LeetCode 2. You are given two non-empty linked lists representing...
LeetCode 1748. You are given an integer array nums. The...
LeetCode 380. Implement a RandomizedSet class.
LeetCode 961. In a array A of size 2N, there...
LeetCode 349. Given two arrays, write a function to compute...
LeetCode 1213. Given three integer arrays arr1, arr2 and arr3...
LeetCode 771. You’re given strings jewels representing the types of...
LeetCode 1512. Given an array of integers nums. Return the...
LeetCode 1539. Given an array arr of positive integers sorted...
LeetCode 1224. Given an array nums of positive integers, return...
LeetCode 206. Reverse a singly linked list.
LeetCode 92. Reverse a linked list from position m to...
LeetCode 234. Given a singly linked list, determine if it’s...
LeetCode 23. You are given an array of k linked-lists...
LeetCode 21. Merge two sorted linked lists and return a...
LeetCode 1032. Implement the StreamChecker class as follows. Constructor, initialize...
LeetCode 421. Given an integer array nums, return the maximum...
LeetCode 208. Implement a Trie with insert, search, and startsWith...
LeetCode 1023. A query word matches a given pattern if...
LeetCode 212. Given an m x n board of characters...
LeetCode 648. Given a dictionary consisting of many roots, and...
LeetCode 720. Given a list of strings words representing an...
LeetCode 472. Given a list of words (without duplicates), return...
Category Algorithm
LeetCode 914. In a deck of cards, each card has...
LeetCode 916. You are given two string arrays words1 and...
LeetCode 874. A robot on an infinite XY-plane starts at...
LeetCode 966. Given a wordlist, we want to implement a...
LeetCode 987. Given the root of a binary tree, calculate...
LeetCode 953. In an alien language, surprisingly, they also use...
LeetCode 946. Given two integer arrays pushed and popped each...
LeetCode 903. You are given a string s of length...
LeetCode 941. Given an array of integers arr, return true...
LeetCode 965. A binary tree is uni-valued if every node...
LeetCode 980. You are given an m x n integer...
LeetCode 804. International Morse Code defines a standard encoding where...
LeetCode 929. Every valid email consists of a local name...
LeetCode 884. A sentence is a string of single-space separated...
LeetCode 982. Given an integer array nums, return the number...
LeetCode 867. Given a 2D integer array matrix, return the...
LeetCode 981. Design a time-based key-value data structure that can...
LeetCode 927. You are given an array arr which consists...
LeetCode 956. You are installing a billboard and want it...
LeetCode 892. You are given an n x n grid...
LeetCode 906. Let’s say a positive integer is a super-palindrome...
LeetCode 887. You are given k identical eggs and you...
LeetCode 891. The width of a sequence is the difference...
LeetCode 907. Given an array of integers arr, find the...
LeetCode 985. You are given an integer array nums and...
LeetCode 834. There is an undirected connected tree with n...
LeetCode 811. A website domain “discuss.leetcode.com” consists of various subdomains....
LeetCode 992. Given an integer array nums and an integer...
LeetCode 984. Given two integers a and b, return any...
LeetCode 877. Alice and Bob play a game with piles...
LeetCode 936. You are given two strings stamp and target....
LeetCode 977. Given an integer array nums sorted in non-decreasing...
LeetCode 805. You are given an integer array nums.
LeetCode 842. You are given a string of digits num,...
LeetCode 885. You start at the cell (rStart, cStart) of...
LeetCode 808. There are two types of soup, type A...
LeetCode 905. Given an integer array nums, move all the...
LeetCode 922. Given an array of integers nums, half of...
LeetCode 912. Given an array of integers nums, sort the...
LeetCode 909. You are given an n x n integer...
LeetCode 865. Given the root of a binary tree, the...
LeetCode 988. You are given the root of a binary...
LeetCode 910. You are given an integer array nums and...
LeetCode 908. You are given an integer array nums and...
LeetCode 839. Two strings Xand Yare similar if we can...
LeetCode 862. Given an integer array nums and an integer...
LeetCode 847. You have an undirected, connected graph of n...
LeetCode 864. You are given an m x n grid...
LeetCode 821. Given a string s and a character c...
LeetCode 934. You are given an n x n binary...
LeetCode 820. A valid encoding of an array of words...
LeetCode 848. You are given a string s of lowercase...
LeetCode 856. Given a balanced parentheses string s, return the...
LeetCode 861. You are given an m x n binary...
LeetCode 990. You are given an array of strings equations...
LeetCode 994. You are given an m x n grid...
LeetCode 900. We can use run-length encoding (i.e., RLE) to...
LeetCode 917. Given a string s, reverse the string according...
LeetCode 950. You are given an integer array deck. There...
LeetCode 869. You are given an integer n. We reorder...
LeetCode 937. You are given an array of logs. Each...
LeetCode 959. An n x n grid is composed of...
LeetCode 836. An axis-aligned rectangle is represented as a list...
LeetCode 850. You are given a 2D array of axis-aligned...
LeetCode 882. You are given an undirected graph (the “original...
LeetCode 938. Given the root node of a binary search...
LeetCode 818. Your car starts at position 0 and speed...
LeetCode 838. There are n dominoes in a line, and...
LeetCode 883. You are given an n x n grid...
LeetCode 879. There is a group of n members, and...
LeetCode 957. There are 8 prison cells in a row...
LeetCode 866. Given an integer n, return the smallest prime...
LeetCode 970. Given three integers x, y, and bound, return...
LeetCode 886. We want to split a group of n...
LeetCode 830. In a string sof lowercase letters, these letters...
LeetCode 852. Let’s call an array arr a mountainif the...
LeetCode 915. Given an integer array nums, partition it into...
LeetCode 969. Given an array of integers arr, sort the...
LeetCode 899. You are given a string s and an...
LeetCode 901. Design an algorithm that collects daily price quotes...
LeetCode 911. You are given two integer arrays persons and...
LeetCode 975. You are given an integer array arr. From...
LeetCode 967. Return all non-negative integers of length n such...
LeetCode 902. Given an array of digits which is sorted...
LeetCode 996. An array is squareful if the sum of...
LeetCode 933. You have a RecentCounter class which counts the...
LeetCode 920. Your music player contains n different songs. You...
LeetCode 806. You are given a string s of lowercase...
LeetCode 878. A positive integer is magical if it is...
LeetCode 837. Alice plays the following game, loosely based on...
LeetCode 947. On a 2D plane, we place n stones...
LeetCode 826. You have n jobs and m workers. You...
LeetCode 819. Given a string paragraph and a string array...
LeetCode 896. An array is monotonic if it is either...
LeetCode 858. There is a special square room with mirrors...
LeetCode 801. You are given two integer arrays of the...
LeetCode 871. A car travels from a starting position to...
LeetCode 995. You are given a binary array nums and...
LeetCode 945. You are given an integer array nums. In...
LeetCode 931. Given an n x n array of integers...
LeetCode 1000. There are n piles of stones arranged in...
LeetCode 857. There are n workers. You are given two...
LeetCode 983. You have planned some train traveling one year...
LeetCode 939. You are given an array of points in...
LeetCode 963. You are given an array of points in...
LeetCode 921. A parentheses string is valid if and only...
LeetCode 924. You are given a network of n nodes...
LeetCode 928. You are given a network of n nodes...
LeetCode 876. Given the head of a singly linked list,...
LeetCode 962. A ramp in an integer array nums is...
LeetCode 918. Given a circular integer array nums of length...
LeetCode 895. Design a stack-like data structure to push elements...
LeetCode 998. A maximum tree is a tree where every...
LeetCode 849. You are given an array representing a row...
LeetCode 807. There is a city composed of n x...
LeetCode 831. You are given a personal information string s,...
LeetCode 827. You are given an n x n binary...
LeetCode 840. A 3 x 3 magic square is a...
LeetCode 851. There is a group of n people labeled...
LeetCode 978. Given an integer array arr, return the length...
LeetCode 845. Given an integer array arr, return the length...
LeetCode 925. Your friend is typing his name into a...
LeetCode 817. You are given the head of a linked...
LeetCode 873. Given a strictly increasing array arr of positive...
LeetCode 860. At a lemonade stand, each lemonade costs $5....
LeetCode 964. Given a single positive integer x, we will...
LeetCode 872. Consider all the leaves of a binary tree,...
LeetCode 812. Given an array of points on the X-Y...
LeetCode 949. Given an arrayarr of 4 digits, find the...
LeetCode 813. You are given an integer array nums and...
LeetCode 976. Given an integer array nums, return the largest...
LeetCode 952. You are given an integer array of unique...
LeetCode 875. Koko loves to eat bananas. There are n...
LeetCode 935. The chess knight has a unique movement, it...
LeetCode 841. There are n rooms labeled from 0 to...
LeetCode 854. Strings s1 and s2 are k-similar (for some...
LeetCode 973. Given an array of points where points[i] =...
LeetCode 986. You are given two lists of closed intervals,...
LeetCode 897. Given the root of a binary search tree,...
LeetCode 835. You are given two images, img1 and img2,...
LeetCode 846. Alice has some number of cards and she...
LeetCode 843. This is an interactive problem.
LeetCode 893. You are given an array of strings of...
LeetCode 824. You are given a string sentence that consist...
LeetCode 904. You are visiting a farm that has a...
LeetCode 825. There are n persons on a social media...
LeetCode 832. Given an n x n binary matrix image,...
LeetCode 926. A binary string is monotone increasing if it...
LeetCode 951. For a binary tree T, we can define...
LeetCode 971. You are given the root of a binary...
LeetCode 997. In a town, there are n people labeled...
LeetCode 943. Given an array of strings words, return the...
LeetCode 802. There is a directed graph of n nodes...
LeetCode 890. Given a list of strings words and a...
LeetCode 833. You are given a 0-indexed string s that...
LeetCode 888. Alice and Bob have a different total number...
LeetCode 809. Sometimes people repeat letters to represent extra feeling....
LeetCode 855. There is an exam room with n seats...
LeetCode 972. Given two strings s and t, each of...
LeetCode 979. You are given the root of a binary...
LeetCode 940. Given a string s, return the number of...
LeetCode 942. A permutation perm of n + 1 integers...
LeetCode 944. You are given an array of n strings...
LeetCode 960. You are given an array of n strings...
LeetCode 955. You are given an array of n strings...
LeetCode 880. You are given an encoded string s. To...
LeetCode 993. Given the root of a binary tree with...
LeetCode 828. Let’s define a function countUniqueChars(s) that returns the...
LeetCode 889. Given two integer arrays, preorder and postorder where...
LeetCode 829. Given an integer n, return the number of...
LeetCode 919. A complete binary tree is a binary tree...
LeetCode 958. Given the root of a binary tree, determine...
LeetCode 810. You are given an array of integers nums...
LeetCode 913. A game on an undirected graph is played...
LeetCode 822. You are given n cards, with a positive...
LeetCode 853. There are n cars going to the same...
LeetCode 815. You are given an array routes representing bus...
LeetCode 859. Given two strings s and goal, return true...
LeetCode 991. There is a broken calculator that has the...
LeetCode 803. You are given an m x n binary...
LeetCode 881. You are given an array people where people[i]...
LeetCode 898. We have an array arr of non-negative integers....
LeetCode 823. Given an array of unique integers, arr, where...
LeetCode 814. Given the root of a binary tree, return...
LeetCode 968. You are given the root of a binary...
LeetCode 930. Given a binary array nums and an integer...
LeetCode 868. Given a positive integer n, find and return...
LeetCode 932. Given the integer n, return any beautiful array...
LeetCode 948. You have an initial power of power, an...
LeetCode 844. Given two strings s and t, return true...
LeetCode 999. On an 8 x 8 chessboard, there is...
LeetCode 954. Given an integer array of even length arr,...
LeetCode 816. We had some 2-dimensional coordinates, like “(1, 3)”...
LeetCode 894. Given an integer n, return a list of...
LeetCode 863. Given the root of a binary tree, the...
LeetCode 870. You are given two integer arrays nums1 and...
LeetCode 989. The array-form of an integer num is an...
LeetCode 923. Given an integer array arr, and an integer...
LeetCode 611. Given an integer array nums, return the number...
LeetCode 794. Given a Tic-Tac-Toe board as a string array...
LeetCode 678. Given a string s containing only three types...
LeetCode 680. Given a string s, return true if the...
LeetCode 782. You are given an n x n binary...
LeetCode 692. Given an array of strings words and an...
LeetCode 766. Given an m x n matrix, returntrueif the...
LeetCode 621. Given a characters array tasks, representing the tasks...
LeetCode 778. You are given an n x n integer...
LeetCode 777. In a string composed of ‘L’, ‘R’, and...
LeetCode 664. There is a strange printer with the following...
LeetCode 691. We are given n different types of stickers....
LeetCode 725. Given the head of a singly linked list...
LeetCode 761. Special binary strings are binary strings with the...
LeetCode 640. Solve a given equation and return the value...
LeetCode 773. On an 2 x 3 board, there are...
LeetCode 638. In LeetCode Store, there are n items to...
LeetCode 645. You have a set of integers s, which...
LeetCode 757. You are given a 2D integer array intervals...
LeetCode 728. A self-dividing number is a number that is...
LeetCode 657. There is a robot starting at the position...
LeetCode 767. Given a string s, rearrange the characters of...
LeetCode 684. In this problem, a tree is an undirected...
LeetCode 685. In this problem, a rooted tree is a...
LeetCode 780. Given four integers sx, sy, tx, and ty,...
LeetCode 715. A Range Module is a module that tracks...
LeetCode 710. You are given an integer n and an...
LeetCode 781. There is a forest with an unknown number...
LeetCode 756. You are stacking blocks to form a pyramid....
LeetCode 793. Let f(x) be the number of zeroes at...
LeetCode 763. You are given a string s. We want...
LeetCode 736. You are given a string expression representing a...
LeetCode 752. You have a lock in front of you...
LeetCode 743. You are given a network of n nodes,...
LeetCode 732. A k-booking happens when k events have some...
LeetCode 731. You are implementing a program to use as...
LeetCode 729. You are implementing a program to use as...
LeetCode 688. On an n x n chessboard, a knight...
LeetCode 779. We build a table of n rows (1-indexed)....
LeetCode 724. Given an array of integers nums, calculate the...
LeetCode 636. On a single-threaded CPU, we execute a program...
LeetCode 789. You are playing a simplified PAC-MAN game on...
LeetCode 649. In the world of Dota2, there are two...
LeetCode 741. You are given an n x n grid...
LeetCode 650. There is only one character ‘A’ on the...
LeetCode 653. Given the root of a Binary Search Tree...
LeetCode 669. Given the root of a binary search tree...
LeetCode 709. Given a string s, return the string after...
LeetCode 633. Given a non-negative integer c, decide whether there’re...
LeetCode 659. You are given an integer array nums that...
LeetCode 798. You are given an array nums. You can...
LeetCode 632. You have k lists of sorted integers in...
LeetCode 748. Given a string licensePlate and an array of...
LeetCode 671. Given a non-empty special binary tree consisting of...
LeetCode 700. You are given the root of a binary...
LeetCode 788. An integer x is a good if after...
LeetCode 796. Given two strings s and goal, return true...
LeetCode 686. Given two string s a and b, return...
LeetCode 722. Given a C++ program, remove comments from it....
LeetCode 754. You are standing at position 0 on an...
LeetCode 655. Given the root of a binary tree, construct...
LeetCode 762. Given two integers left and right, return the...
LeetCode 745. Design a special dictionary with some words that...
LeetCode 698. Given an integer array nums and an integer...
LeetCode 795. Given an integer array nums and two integers...
LeetCode 792. Given a string s and an array of...
LeetCode 673. Given an integer arraynums, return the number of...
LeetCode 726. Given a string formula representing a chemical formula,return...
LeetCode 665. Given an array nums with n integers, your...
LeetCode 738. An integer has monotone increasing digits if and...
LeetCode 783. Given the root of a Binary Search Tree...
LeetCode 712. Given two strings s1 ands2, return the lowest...
LeetCode 746. You are given an integer array cost where...
LeetCode 617. You are given two binary trees root1 and...
LeetCode 662. Given the root of a binary tree, return...
LeetCode 689. Given an integer array nums and an integer...
LeetCode 628. Given an integer array nums, find three numbers...
LeetCode 718. Given two integer arrays nums1 and nums2, return...
LeetCode 646. You are given an array of n pairs...
LeetCode 769. You are given an integer array arr of...
LeetCode 768. You are given an integer array arr.
LeetCode 687. Given the root of a binary tree, return...
LeetCode 674. Given an unsorted array of integers nums, return...
LeetCode 784. Given a string s, we can transform every...
LeetCode 668. Nearly everyone has used the Multiplication Table. The...
LeetCode 785. There is an undirected graph with n nodes,...
LeetCode 661. An image smoother is a filter of the...
LeetCode 775. You are given an integer array nums of...
LeetCode 733. An image is represented by an m x...
LeetCode 744. Given a characters array letters that is sorted...
LeetCode 609. Given a list paths of directory info, including...
LeetCode 699. There are several squares being dropped onto the...
LeetCode 622. Design your implementation of the circular queue. The...
LeetCode 641. Design your implementation of the circular double-ended queue...
LeetCode 675. You are asked to cut off all the...
LeetCode 647. Given a string s, return the number of...
LeetCode 670. You are given an integer num. You can...
LeetCode 654. You are given an integer array nums with...
LeetCode 643. You are given an integer array nums consisting...
LeetCode 695. You are given an m x n binary...
LeetCode 677. Design a map that allows you to do...
LeetCode 764. You are given an integer n. You have...
LeetCode 747. You are given an integer array nums where...
LeetCode 703. Design a class to find the k^th largest...
LeetCode 786. You are given a sorted integer array arr...
LeetCode 629. For an integer array nums, an inverse pair...
LeetCode 701. You are given the root node of a...
LeetCode 676. Design a data structure that is initialized with...
LeetCode 719. The distance of a pair of integers a...
LeetCode 658. Given a sorted integer array arr, two integers...
LeetCode 652. Given the rootof a binary tree, return all...
LeetCode 690. You have a data structure of employee information,...
LeetCode 790. You have two types of tiles, a 2...
LeetCode 707. Design your implementation of the linked list. You...
LeetCode 705. Design a HashSet without using any built-in hash...
LeetCode 706. Design a HashMap without using any built-in hash...
LeetCode 740. You are given an integer array nums. You...
LeetCode 697. Given a non-empty array of non-negative integers nums,...
LeetCode 639. A message containing letters from A-Z can be...
LeetCode 739. Given an array of integers temperatures represents the...
LeetCode 791. You are given two strings order and s....
LeetCode 753. There is a safe protected by a password....
LeetCode 630. There are n different online courses numbered from...
LeetCode 765. There are n couples sitting in 2n seats...
LeetCode 730. Given a string s, return the number of...
LeetCode 696. Give a binary string s, return the number...
LeetCode 749. A virus is spreading rapidly, and your task...
LeetCode 606. Given the root of a binary tree, construct...
LeetCode 787. There are n cities connected by some number...
LeetCode 799. We stack glasses in a pyramid, where the...
LeetCode 605. You have a long flowerbed in which some...
LeetCode 672. There is a room with n bulbs labeled...
LeetCode 704. Given an array of integers nums which is...
LeetCode 693. Given a positive integer, check whether it has...
LeetCode 714. You are given an array prices where prices[i]...
LeetCode 667. Given two integers n and k, construct a...
LeetCode 770. Given an expression such as expression = “e...
LeetCode 682. You are keeping score for a baseball game...
LeetCode 637. Given the root of a binary tree, return...
LeetCode 735. We are given an array asteroids of integers...
LeetCode 797. Given a directed acyclic graph (DAG) of n...
LeetCode 623. Given the root of a binary tree and...
LeetCode 721. Given a list of accounts where each element...
LeetCode 679. You are given an integer array cards of...
LeetCode 717. We have two special characters, the first character...
LeetCode 488. You are playing a variation of the game...
LeetCode 468. Given a string queryIP, return “IPv4” if IP...
LeetCode 467. We define the string s to be the...
LeetCode 407. Given an m x n integer matrix heightMap...
LeetCode 477. The Hamming distance between two integers is the...
LeetCode 414. Given an integer array nums, return the third...
LeetCode 495. Our hero Teemo is attacking an enemy Ashe...
LeetCode 591. Given a string representing a code snippet, implement...
LeetCode 517. You have n super washing machines on a...
LeetCode 420. A password is considered strong if the below...
LeetCode 497. You are given an array of non-overlapping axis-aligned...
LeetCode 486. You are given an integer array nums. Two...
LeetCode 416. Given a non-empty array nums containing only positive...
LeetCode 417. There is an m x n rectangular island...
LeetCode 600. Given a positive integer n, return the number...
LeetCode 502. Suppose LeetCode will start its IPO soon. In...
LeetCode 403. A frog is crossing a river. The river...
LeetCode 514. In the video game Fallout 4, the quest...
LeetCode 564. Given a string n representing an integer, return...
LeetCode 587. You are given an array trees where trees[i]...
LeetCode 593. Given the coordinates of four points in 2D...
LeetCode 494. You are given an integer array nums and...
LeetCode 404. Given the root of a binary tree, return...
LeetCode 572. Given the roots of two binary trees root...
LeetCode 552. An attendance record for a student can be...
LeetCode 551. You are given a string s representing an...
LeetCode 443. Given an array of characters chars, compress it...
LeetCode 410. Given an array nums which consists of non-negative...
LeetCode 451. Given a string s, sort it in decreasing...
LeetCode 483. Given an integer n represented as a string,...
LeetCode 480. The median is the middle value in an...
LeetCode 540. You are given a sorted array consisting of...
LeetCode 581. Given an integer array nums, you need to...
LeetCode 449. Serialization is converting a data structure or object...
LeetCode 557. Given a string s, reverse the order of...
LeetCode 541. Given a string s and an integer k,...
LeetCode 493. Given an integer array nums, return the number...
LeetCode 566. In MATLAB, there is a handy function called...
LeetCode 459. Given a string s, check if it can...
LeetCode 402. Given string num representing a non-negative integer num,...
LeetCode 546. You are given several boxes with different colors...
LeetCode 506. You are given an integer array score of...
LeetCode 423. Given a string s containing an out-of-order English...
LeetCode 598. You are given an m x n matrix...
LeetCode 528. You are given a 0-indexed array of positive...
LeetCode 519. There is an m x n binary grid...
LeetCode 406. You are given an array of people, people,...
LeetCode 458. There are buckets buckets of liquid, where exactly...
LeetCode 567. Given two strings s1 and s2, return true...
LeetCode 507. A perfect number is a positive integer that...
LeetCode 437. Given the root of a binary tree and...
LeetCode 576. There is an m x n grid with...
LeetCode 553. You are given an integer array nums. The...
LeetCode 474. You are given an array of binary strings...
LeetCode 434. You are given a string s, return the...
LeetCode 547. There are n cities. Some of them are...
LeetCode 447. You are given n points in the plane...
LeetCode 476. The complement of an integer is the integer...
LeetCode 435. Given an array of intervals intervals where intervals[i]...
LeetCode 556. Given a positive integer n, find the smallest...
LeetCode 503. Given a circular integer array nums (i.e., the...
LeetCode 496. The next greater element of some element x...
LeetCode 589. Given the root of an n-ary tree, return...
LeetCode 590. Given the root of an n-ary tree, return...
LeetCode 429. Given an n-ary tree, return the level order...
LeetCode 508. Given the root of a binary tree, return...
LeetCode 539. Given a list of 24-hour clock time points...
LeetCode 452. There are some spherical balloons taped onto a...
LeetCode 433. A gene string can be represented by an...
LeetCode 453. Given an integer array nums of size n,...
LeetCode 462. Given an integer array nums of size n,...
LeetCode 599. Suppose Andy and Doris want to choose a...
LeetCode 530. Given the root of a Binary Search Tree...
LeetCode 529. Let’s play the minesweeper game!
LeetCode 559. Given a n-ary tree, find its maximum depth....
LeetCode 485. Given a binary array nums, return the maximum...
LeetCode 473. You are given an integer array matchsticks where...
LeetCode 481. A magical string s consists of only ‘1’...
LeetCode 524. Given a string s and a string array...
LeetCode 522. Given an array of strings strs, return the...
LeetCode 521. Given two strings a and b, return the...
LeetCode 424. You are given a string s and an...
LeetCode 516. Given a string s, find the longest palindromic...
LeetCode 409. Given a string s which consists of lowercase...
LeetCode 594. We define a harmonious array as an array...
LeetCode 558. A Binary Matrix is a matrix in which...
LeetCode 482. You are given a license key represented as...
LeetCode 460. Design and implement a data structure for a...
LeetCode 479. Given an integer n, return the largest palindromic...
LeetCode 500. Given an array of strings words, return the...
LeetCode 440. Given two integers n and k, return the...
LeetCode 532. Given an array of integers nums and an...
LeetCode 463. You are given row x col grid representing...
LeetCode 491. Given an integer array nums, return all the...
LeetCode 470. Given the API rand7() that generates a uniform...
LeetCode 475. Winter is coming! During the contest, your first...
LeetCode 461. The Hamming distance between two integers is the...
LeetCode 478. Given the radius and the position of the...
LeetCode 592. Given a string expression representing an expression of...
LeetCode 430. You are given a doubly linked list, which...
LeetCode 436. You are given an array of intervals, where...
LeetCode 501. Given the root of a binary search tree...
LeetCode 515. Given the root of a binary tree, return...
LeetCode 513. Given the root of a binary tree, return...
LeetCode 448. Given an array nums of n integers where...
LeetCode 442. Given an integer array nums of length n...
LeetCode 438. Given two strings s and p, return an...
LeetCode 509. The Fibonacci numbers, commonly denoted F(n) form a...
LeetCode 535. TinyURL is a URL shortening service where you...
LeetCode 575. Alice has n candies, where the i^th candy...
LeetCode 498. Given an m x n matrix mat, return...
LeetCode 520. We define the usage of capitals in a...
LeetCode 583. Given two strings word1 and word2, return the...
LeetCode 450. Given a root node reference of a BST...
LeetCode 538. Given the root of a Binary Search Tree...
LeetCode 405. Given an integer num, return a string representing...
LeetCode 525. Given a binary array nums, return the maximum...
LeetCode 492. A web developer needs to know how to...
LeetCode 427. Given a n * n matrix grid of...
LeetCode 537. A complex number can be represented as a...
LeetCode 365. You are given two jugs with capacities jug1Capacity...
LeetCode 393. Given an integer array data representing the data,...
LeetCode 412. Given an integer n, return a string array...
LeetCode 518. You are given an integer array coins representing...
LeetCode 457. You are playing a game involving a circular...
LeetCode 464. In the “100 game” two players take turns...
LeetCode 554. There is a rectangular brick wall in front...
LeetCode 401. A binary watch has 4 LEDs on the...
LeetCode 563. Given the root of a binary tree, return...
LeetCode 526. Suppose you have n integers labeled 1 through...
LeetCode 419. Given an m x n matrix board where...
LeetCode 504. Given an integer num, return a string of...
LeetCode 455. Assume you are an awesome parent and want...
LeetCode 561. Given an integer array nums of 2n integers,...
LeetCode 565. You are given an integer array nums of...
LeetCode 441. You have n coins and you want to...
LeetCode 413. An integer array is called arithmetic if it...
LeetCode 446. Given an integer array nums, return the number...
LeetCode 432. Design a data structure to store the strings...
LeetCode 445. You are given two non-empty linked lists representing...
LeetCode 415. Given two non-negative integers, num1 and num2 represented...
LeetCode 456. Given an arrayof n integers nums, a 132...
LeetCode 542. Given an m x n binary matrix mat,...
LeetCode 376. A wiggle sequence is a sequence where the...
LeetCode 331. One way to serialize a binary tree is...
LeetCode 242. Given two strings s and t, return true...
LeetCode 263. An ugly number is a positive integer whose...
LeetCode 264. An ugly number is a positive integer whose...
LeetCode 347. Given an integer array nums and an integer...
LeetCode 313. A super ugly number is a positive integer...
LeetCode 372. Your task is to calculate a^b mod 1337...
LeetCode 228. You are given a sorted unique integer array...
LeetCode 371. Given two integers a and b, return the...
LeetCode 239. You are given an array of integersnums, there...
LeetCode 260. Given an integer array nums, in which exactly...
LeetCode 384. Given an integer array nums, design an algorithm...
LeetCode 214. You are given a string s. You can...
LeetCode 297. Serialization is the process of converting a data...
LeetCode 335. You are given an array of integers distance....
LeetCode 240. Write an efficient algorithm that searches for a...
LeetCode 396. You are given an integer array nums of...
LeetCode 345. Given a string s, reverse only all the...
LeetCode 344. Write a function that reverses a string. The...
LeetCode 203. Given the head of a linked list and...
LeetCode 301. Given a string s that contains parentheses and...
LeetCode 316. Given a string s, remove duplicate letters so...
LeetCode 223. Given the coordinates of two rectilinear rectangles in...
LeetCode 290. Given a pattern and a string s, find...
LeetCode 383. Given two stings ransomNote and magazine, return true...
LeetCode 303. Given an integer array nums, handle multiple queries...
LeetCode 304. Given a 2D matrix matrix, handle multiple queries...
LeetCode 398. Given an integer array nums with possible duplicates,...
LeetCode 238. Given an integer array nums, return an array...
LeetCode 231. Given an integer n, return true if it...
LeetCode 326. Given an integer n, return true if it...
LeetCode 342. Given an integer n, return true if it...
LeetCode 279. Given an integer n, return the least number...
LeetCode 391. Given an array rectangles where rectangles[i] = [x_i,...
LeetCode 284. Design an iterator that supports the peek operation...
LeetCode 330. Given a sorted integer array nums and an...
LeetCode 336. Given a list of unique words, return all...
LeetCode 328. Given the head of a singly linked list,...
LeetCode 233. Given an integer n, count the total number...
LeetCode 400. Given an integer n, return the n^th digit...
LeetCode 292. You are playing the following Nim Game with...
LeetCode 283. Given an integer array nums, move all 0’s...
LeetCode 268. Given an array nums containing n distinct numbers...
LeetCode 209. Given an array of positive integers nums and...
LeetCode 310. A tree is an undirected graph in which...
LeetCode 385. Given a string s represents the serialization of...
LeetCode 318. Given a string array words, return the maximum...
LeetCode 221. Given an m x n binary matrix filled...
LeetCode 229. Given an integer array of size n, find...
LeetCode 236. Given a binary tree, find the lowest common...
LeetCode 235. Given a binary search tree (BST), find the...
LeetCode 395. Given a string s and an integer k,...
LeetCode 300. Given an integer array nums, return the length...
LeetCode 329. Given an m x n integers matrix, return...
LeetCode 388. Suppose we have a file system that stores...
LeetCode 382. Given a singly linked list, return a random...
LeetCode 386. Given an integer n, return all the numbers...
LeetCode 368. Given a set of distinct positive integers nums,...
LeetCode 378. Given an n x n matrix where each...
LeetCode 230. Given the root of a binary search tree,...
LeetCode 215. Given an integer array nums and an integer...
LeetCode 205. Given two strings s and t, determine if...
LeetCode 392. Given two strings s and t, return true...
LeetCode 226. Given the root of a binary tree, invert...
LeetCode 350. Given two integer arrays nums1 and nums2, return...
LeetCode 273. Convert a non-negative integer num to its English...
LeetCode 397. Given a positive integer n,you can apply one...
LeetCode 343. Given an integer n, break it into the...
LeetCode 381. RandomizedCollection is a data structure that contains a...
LeetCode 334. Given an integer array nums, return true if...
LeetCode 225. Implement a last-in-first-out (LIFO) stack using only two...
LeetCode 232. Implement a first in first out (FIFO) queue...
LeetCode 337. The thief has found himself a new place...
LeetCode 213. You are a professional robber planning to rob...
LeetCode 202. Write an algorithm to determine if a number...
LeetCode 274. Given an array of integers citations where citations[i]...
LeetCode 275. Given an array of integers citations where citations[i]...
LeetCode 374. We are playing the Guess Game. The game...
LeetCode 375. We are playing the Guessing Game. The game...
LeetCode 289. The Game of Life, also known simply as...
LeetCode 341. You are given a nested list of integers...
LeetCode 387. Given a string s, find the first non-repeating...
LeetCode 278. You are a product manager and currently leading...
LeetCode 287. Given an array of integers nums containingn +...
LeetCode 389. You are given two strings s and t....
LeetCode 295. The median is the middle value in an...
LeetCode 373. You are given two integer arrays nums1 and...
LeetCode 282. Given a string num that contains only digits...
LeetCode 399. You are given an array of variable pairs...
LeetCode 390. You have a list arr of all integers...
LeetCode 241. Given a string expression of numbers and operators,...
LeetCode 355. Design a simplified version of Twitter where users...
LeetCode 211. Design a data structure that supports adding new...
LeetCode 237. Write a function to delete a node in...
LeetCode 394. Given an encoded string, return its decoded string....
LeetCode 352. Given a data stream input of non-negative integers...
LeetCode 321. You are given two integer arrays nums1 and...
LeetCode 207. There are a total of numCourses courses you...
LeetCode 210. There are a total of numCourses courses you...
LeetCode 338. Given an integer n, return an array ans...
LeetCode 204. Given an integer n, return the number of...
LeetCode 315. You are given an integer array nums and...
LeetCode 327. Given an integer array nums and two integers...
LeetCode 357. Given an integer n, return the count of...
LeetCode 222. Given the root of a complete binary tree,...
LeetCode 217. Given an integer array nums, return true if...
LeetCode 220. Given an integer array nums and two integers...
LeetCode 219. Given an integer array nums and an integer...
LeetCode 377. Given an array of distinct integers nums and...
LeetCode 216. Find all valid combinations of k numbers that...
LeetCode 322. You are given an integer array coins representing...
LeetCode 312. You are given n balloons, indexed from 0...
LeetCode 299. You are playing the Bulls and Cows game...
LeetCode 319. There are n bulbs that are initially off....
LeetCode 201. Given two integers left and right that represent...
LeetCode 257. Given the root of a binary tree, return...
LeetCode 309. You are given an array prices where prices[i]...
LeetCode 224. Given a string s representing a valid expression,...
LeetCode 227. Given a string s which represents an expression,...
LeetCode 306. Additive number is a string whose digits can...
LeetCode 258. Given an integer num, repeatedly add all its...
LeetCode 189. Given an array, rotate the array to the...
LeetCode 151. Given an input string s, reverse the order...
LeetCode 190. Reverse bits of a given 32 bits unsigned...
LeetCode 187. The DNA sequence is composed of a series...
LeetCode 191. Write a function that takes an unsigned integer...
LeetCode 155. Design a stack that supports push, pop, top,...
LeetCode 152. Given an integer array nums, find a contiguous...
LeetCode 164. Given an integer array nums, return the maximum...
LeetCode 169. Given an array nums of size n, return...
LeetCode 179. Given a list of non-negative integers nums, arrange...
LeetCode 160. Given the heads of two singly linked-lists headA...
LeetCode 198. You are a professional robber planning to rob...
LeetCode 166. Given two integers representing the numerator and denominator...
LeetCode 162. A peak element is an element that is...
LeetCode 153. Suppose an array of length n sorted in...
LeetCode 154. Suppose an array of length n sorted in...
LeetCode 172. Given an integer n, return the number of...
LeetCode 168. Given an integer columnNumber, return its corresponding column...
LeetCode 171. Given a string columnTitle that represents the column...
LeetCode 174. The demons had captured the princess and imprisoned...
LeetCode 165. Given two version numbers,version1 and version2, compare them....
LeetCode 199. Given the root of a binary tree, imagine...
LeetCode 173. Implement the BSTIterator class that represents an iterator...
LeetCode 188. You are given an integer array prices where...
LeetCode 139. Given a string s and a dictionary of...
LeetCode 140. Given a string s and a dictionary of...
LeetCode 148. Given the head of a linked list, return...
LeetCode 136. Given a non-empty array of integers nums, every...
LeetCode 137. Given an integer array nums whereevery element appears...
LeetCode 143. You are given the head of a singly...
LeetCode 131. Given a string s, partition s such that...
LeetCode 132. Given a string s, partition s such that...
LeetCode 149. Given an array of points where points[i] =...
LeetCode 146. Design a data structure that follows the constraints...
LeetCode 141. Given head, the head of a linked list,...
LeetCode 142. Given the head of a linked list, return...
LeetCode 147. Given the head of a singly linked list,...
LeetCode 134. There are n gas stations along a circular...
LeetCode 150. Evaluate the value of an arithmetic expression in...
LeetCode 138. A linked list of length n is given...
LeetCode 133. Given a reference of a node in a...
LeetCode 135. There are n children standing in a line....
LeetCode 144. Given the root of a binary tree, return...
LeetCode 145. Given the root of abinary tree, return the...
LeetCode 127. Given two words, beginWord and endWord, and a...
LeetCode 126. Given two words, beginWord and endWord, and a...
LeetCode 125. A phrase is a palindrome if, after converting...
LeetCode 120. Given a triangle array, return the minimum path...
LeetCode 130. Given an m x n matrix board containing...
LeetCode 129. You are given the root of a binary...
LeetCode 116. You are given a perfect binary tree where...
LeetCode 117. Given a binary tree, populate each next pointer...
LeetCode 112. Given the root of a binary tree and...
LeetCode 113. Given the root of a binary tree and...
LeetCode 118. Given an integer numRows, return the first numRows...
LeetCode 119. Given an integer rowIndex, return the rowIndex^th (0-indexed)...
LeetCode 111. Given a binary tree, find its minimum depth....
LeetCode 128. Given an unsorted array of integers nums, return...
LeetCode 114. Given the root of a binary tree, flatten...
LeetCode 115. Given two strings s and t, return the...
LeetCode 109. Given the head of a singly linked list...
LeetCode 124. A path in a binary tree is a...
LeetCode 121. You are given an array prices where prices[i]...
LeetCode 123. You are given an array prices where prices[i]...
LeetCode 122. You are given an integer array prices where...
LeetCode 110. Given a binary tree, determine if it is...
LeetCode 97. Given strings s1, s2, and s3, find whether...
LeetCode 79. Given an m x n grid of characters...
LeetCode 96. Given an integer n, return the number of...
LeetCode 95. Given an integer n, return all the structurally...
LeetCode 78. Given an integer array nums of unique elements,...
LeetCode 90. Given an integer array nums that may contain...
LeetCode 81. There is an integer array nums sorted in...
LeetCode 87. Given two strings s1 and s2 of the...
LeetCode 93. Given a string s containing only digits, return...
LeetCode 80. Given an integer array nums sorted in non-decreasing...
LeetCode 86. Given the head of a linked list and...
LeetCode 88. You are given two integer arrays nums1 and...
LeetCode 85. Given a rows x cols binary matrix filled...
LeetCode 84. Given an array of integers heights representing the...
LeetCode 89. Given an integer n, return any valid n-bit...
LeetCode 91. Given a string s containing only digits, return...
LeetCode 74. Write an efficient algorithm that searches for a...
LeetCode 60. Given n and k, return the kth permutation...
LeetCode 51. Given an integer n, return all distinct solutions...
LeetCode 52. Given an integer n, return the number of...
LeetCode 53. Given an integer array nums, find the contiguous...
LeetCode 55. Given an m x n matrix, return all...
LeetCode 44. Write the code that will take a string...
LeetCode 37. Write a program to solve a Sudoku puzzle...
LeetCode 10. Given an input string s and a pattern...
LeetCode 50. Determine if a 9 x 9 Sudoku board...
LeetCode 46. Given an array nums of distinct integers, return...
LeetCode 47. Given a collection of numbers, nums, that might...
LeetCode 41. Given an unsorted integer array nums, return the...
LeetCode 34. Given the array nums after the possible rotation...
LeetCode 39. Given an array of distinct integers candidates and...
LeetCode 40. Given a collection of candidate numbers (candidates) and...
LeetCode 13. Given a roman numeral, convert it to an...
LeetCode 7. Given a signed 32-bit integer x, return x...
LeetCode 5. Given a string s, return the longest palindromic...
LeetCode 17. Given a string containing digits from 2-9 inclusive,...
LeetCode 11. Given n non-negative integers a_1, a_2, …, a_n...
LeetCode 200. Given an m x n 2d grid map...
LeetCode 56. Given an array of intervals, merge all overlapping...
LeetCode 1438. Given an array of integers nums and an...
LeetCode 543. Given a binary tree, compute the diameter of...
LeetCode 4. Given two sorted arrays nums1 and nums2 of...
LeetCode 367. Given a positive integer num, write a function...
LeetCode 69. Given a non-negative integer x, compute and return...
LeetCode 35. Given a sorted array of distinct integers and...
LeetCode 167. Given an array of integers nums sorted in...
LeetCode 974. Given an array of integers nums and an...
LeetCode 454. Given four lists A, B, C, D of...
LeetCode 523. Given an array of non-negative integers nums and...
LeetCode 1099. Given an array of integers nums and an...
LeetCode 560. Given an array of integers nums and an...
LeetCode 713. Given an array of positive integers nums and...
LeetCode 15. Given an array of integers nums, return all...
LeetCode 18. Given an array of integers nums and an...
LeetCode 1. Given an array of integers nums and an...
Category Tutorial
In this post, I will show how I write an...