Category Git

What is the Difference Between Git Pull and Git Fetch

Short answers to the question what is the difference between...

How to Revert a Git Repository to a Previous Commit

Short answers to the question how to revert a git...

How to Modify Existing Unpushed Commit Messages

Short answers to the question how to modify existing unpushed...

How to Undo a Git Add Before Commit

Short answers to the question how to undo a git...

How to Rename a Local Git Branch

Short answers to the question how to rename a local...

How to Delete a Git Branch Locally and Remotely

Short answers to the question how to delete a git...

How to Checkout a Remote Git Branch

Short answers to the question how to checkout a remote...

How to Undo the Most Recent Local Commit in Git

Short answers to the question how to undo the most...

Category MySQL

How To Specify Unique Constraint For Multiple Columns In MySQL

How to make multiple columns unique (together) in an existing...

How To Select One Row Per ID With Max Value On A Column

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 table in MySQL...

How To Get The Size Of A Database In MySQL

How to get the size of a database in MySQL...

How To Concatenate Multiple Rows Into One Field In MySQL

How to concatenate multiple rows into one field in MySQL...

How To Change The Data Type Of A Column In MySQL

Given a table EMPLOYEE, change the data type of the...

How To Set A Default Value For A MySQL Datetime Column

How to set a default value for a MySQL Datetime...

How To Output MySQL Query Results In CSV Format

This query writes results into a CSV file on the...

How To Get A List Of User Accounts In MySQL

MySQL stores the user information in its own database.

How To Find Duplicate Values In MySQL

Do a SELECT with a GROUP BY clause.

MySQL INNER JOIN Clause

The INNER JOIN keyword selects records that have matching values...

MySQL Aliases

Aliases are nicknames. They give us a shorthand way of...

MySQL OR Operator

The OR operator combines two Boolean expressions and returns true...

MySQL LIMIT Operator

The LIMIT clause is used in the SELECT statement to...

MySQL LIKE Operator

The LIKE operator is used in a WHERE clause to...

MySQL IS NULL Operator

To test whether a value is NULL or not, we...

MySQL IN Clause

The IN operator allows us to determine if a specified...

MySQL BETWEEN Operator

The BETWEEN operator selects values within a given range.

MySQL AND Operator

The AND operator is a logical operator that combines two...

MySQL WHERE Clause

The WHERE clause allows us to choose which rows are...

MySQL DISTINCT Clause

In order to remove duplicate rows, we use the DISTINCT...

MySQL ORDER BY Clause

The ORDER BY clause is used to sort the result-set...

MySQL SELECT Statement

The SELECT statement allows us to read data from one...

Category Database

Users That Actively Request Confirmation Messages Problem

LeetCode 1939. Write an SQL query to find the IDs...

Strong Friendship Problem

LeetCode 1949. Write an SQL query to find all the...

Leetcodify Similar Friends Problem

LeetCode 1919. Write an SQL query to report the similar...

Leetcodify Friends Recommendations Problem

LeetCode 1917. Write an SQL query to recommend friends to...

First and Last Call On the Same Day Problem

LeetCode 1972. Write an SQL query to report the IDs...

Find Cutoff Score for Each School Problem

LeetCode 1988. Write an SQL query to report the minimum...

Employees With Missing Information Problem

LeetCode 1965. Write an SQL query to report the IDs...

Employees Whose Manager Left the Company Problem

LeetCode 1978. Write an SQL query to report the IDs...

Count the Number of Experiments Problem

LeetCode 1990. Write an SQL query to report the number...

Count Salary Categories Problem

LeetCode 1907. Write an SQL query to report the number...

Confirmation Rate Problem

LeetCode 1934. Write an SQL query to find the confirmation...

All the Pairs With the Maximum Number of Common Followers Problem

LeetCode 1951. Write an SQL query to find all the...

The Latest Login in 2020 Problem

LeetCode 1890. Write an SQL query to report the latest...

Suspicious Bank Accounts Problem

LeetCode 1843. Write an SQL query to report the IDs...

Page Recommendations II Problem

LeetCode 1892. Write an SQL query to find all the...

Orders With Maximum Quantity Above Average Problem

LeetCode 1867. Write an SQL query to find the order_id...

Maximum Transaction Each Day Problem

LeetCode 1831. Write an SQL query to report the IDs...

League Statistics Problem

LeetCode 1841. Write an SQL query to report the statistics...

Group Employees of the Same Salary Problem

LeetCode 1875. Write an SQL query to report the IDs...

Find Customers With Positive Revenue this Year Problem

LeetCode 1821. Write an SQL query to report the customers...

Convert Date Format Problem

LeetCode 1853. Write an SQL query to convert each date...

Calculate Special Bonus Problem

LeetCode 1873. Write an SQL query to calculate the bonus...

Rearrange Products Table Problem

LeetCode 1795. Write an SQL query to rearrange the Products...

Find Interview Candidates Problem

LeetCode 1811. Write an SQL query to report the name...

Ad-Free Sessions Problem

LeetCode 1809. Write an SQL query to report all the...

Primary Department For Each Employee Problem

LeetCode 1789. Write an SQL query to report all the...

Grand Slam Titles Problem

LeetCode 1783. Write an SQL query to report the number...

Product's Price For Each Store Problem

LeetCode 1777. Write an SQL query to find the price...

Find The Subtasks That Did Not Execute Problem

LeetCode 1767. Write an SQL query to report the IDs...

Recyclable And Low Fat Products Problem

LeetCode 1757. Write an SQL query to find the ids...

Leetflex Banned Accounts Problem

LeetCode 1747. Write an SQL query to find the account_id...

Find Total Time Spent By Each Employee Problem

LeetCode 1741. Write an SQL query to calculate the total...

The Number Of Employees Which Report To Each Employee Problem

LeetCode 1731. Write an SQL query to report the ids...

Find Followers Count Problem

LeetCode 1729. Write an SQL query that will, for each...

Count Apples And Oranges Problem

LeetCode 1715. Write an SQL query to count the number...

Biggest Window Between Visits Problem

LeetCode 1709. Write an SQL query that will, for each...

Total Sales Amount By Year Problem

LeetCode 1384. Write an SQL query to report the Total...

Sales By Day Of The Week Problem

LeetCode 1479. Write an SQL query to report how many...

Hopper Company Queries III Problem

LeetCode 1651. Write an SQL query to compute the average_ride_distance...

Get The Second Most Recent Activity Problem

LeetCode 1369. Write an SQL query to show the second...

Find The Quiet Students In All Exams Problem

LeetCode 1412. Write an SQL query to report the students...

Tournament Winners Problem

LeetCode 1194. Write an SQL query to find the winner...

Students Report By Geography Problem

LeetCode 618. A U.S graduate school has students from Asia,...

Report Contiguous Dates Problem

LeetCode 1225. Write an SQL query to generate a report...

Median Employee Salary Problem

LeetCode 569. Write a SQL query to find the median...

Market Analysis II Problem

LeetCode 1159. Write an SQL query to find for each...

Hopper Company Queries I Problem

LeetCode 1635. Write an SQL query to report the following...

Game Play Analysis V Problem

LeetCode 1097. Write an SQL query that reports for each...

User Purchase Platform Problem

LeetCode 1127. Write an SQL query to find the total...

Trips And Users Problem

LeetCode 262. Write a SQL query to find the cancellation...

Number Of Transactions Per Visit Problem

LeetCode 1336. Write an SQL query to find how many...

Human Traffic Of Stadium Problem

LeetCode 601. Write an SQL query to display the records...

Hopper Company Queries II Problem

LeetCode 1645. Write an SQL query to report the percentage...

Find Median Given Frequency Of Numbers Problem

LeetCode 571. Write a query to find the median of...

Find Cumulative Salary Of An Employee Problem

LeetCode 579. Write a SQL to get the cumulative sum...

Department Top Three Salaries Problem

LeetCode 185. Write a SQL query to find employees who...

Average Salary: Departments VS Company Problem

LeetCode 615. Given two tables as below, write a query...

Unpopular Books Problem

LeetCode 1098. Write an SQL query that reports the books...

Second Degree Follower Problem

LeetCode 614. Please write a sql query to get the...

Reported Posts II Problem

LeetCode 1132. Write an SQL query to find the average...

Number Of Calls Between Two Persons Problem

LeetCode 1699. Write an SQL query to report the number...

Nth Highest Salary Problem

LeetCode 177. Write a SQL query to get the nth...

New Users Daily Count Problem

LeetCode 1107. Write an SQL query that reports for every...

Monthly Transactions II Problem

LeetCode 1205. Write an SQL query to find for each...

Get Highest Answer Rate Question Problem

LeetCode 578. Write a sql query to identify the question...

Department Highest Salary Problem

LeetCode 184. Write a SQL query to find employees who...

Article Views II Problem

LeetCode 1149. Write an SQL query to find all the...

Active Users Problem

LeetCode 1454. Write an SQL query to find the id...

Winning Candidate Problem

LeetCode 574. Write a sql to find the name of...

Team Scores In Football Tournament Problem

LeetCode 1212. Write an SQL query that selects the team_id,...

Rank Scores Problem

LeetCode 178. Write a SQL query to rank scores. If...

Product Sales Analysis III Problem

LeetCode 1070. Write an SQL query that selects the product...

Movie Rating Problem

LeetCode 1341. Write the following SQL query to find the...

Investments In 2016 Problem

LeetCode 585. Write a query to print the sum of...

Immediate Food Delivery II Problem

LeetCode 1174. Write an SQL query to find the percentage...

Friend Requests II: Who Has The Most Friends Problem

LeetCode 602. In social network like Facebook or Twitter, people...

Countries You Can Safely Invest In Problem

LeetCode 1501. Write an SQL query to find the countries...

Count Student Number In Departments Problem

LeetCode 580. A university uses 2 data tables, student and...

Bank Account Summary Problem

LeetCode 1555. Our bank records all transactions in the table...

Tree Node Problem

LeetCode 608. Given a table tree, id is identifier of...

The Most Recent Orders For Each Product Problem

LeetCode 1549. Write an SQL query to find the most...

Shortest Distance In A Plane Problem

LeetCode 612. Write a query to find the shortest distance...

Rectangles Area Problem

LeetCode 1459. Write an SQL query to report of all...

Product Price At A Given Date Problem

LeetCode 1164. Write an SQL query to find the prices...

Page Recommendations Problem

LeetCode 1264. Write an SQL query to recommend pages to...

Monthly Transactions I Problem

LeetCode 1193. Write an SQL query to find for each...

Market Analysis I Problem

LeetCode 1158. Write an SQL query to find for each...

Managers With At Least 5 Direct Reports Problem

LeetCode 570. Given the Employee table, write a SQL query...

Find The Missing IDs Problem

LeetCode 1613. Write an SQL query to find the missing...

Exchange Seats Problem

LeetCode 626. Mary is a teacher in a middle school...

Customers Who Bought All Products Problem

LeetCode 1045. Write an SQL query for a report that...

Active Business Problem

LeetCode 1126. Write an SQL query to find all active...

The Most Recent Three Orders Problem

LeetCode 1532. Write an SQL query to find the most...

Restaurant Growth Problem

LeetCode 1321. You are the restaurant owner and you want...

Project Employees III Problem

LeetCode 1077. Write an SQL query that reports the most...

Number Of Trusted Contacts Of A Customer Problem

LeetCode 1364. Write an SQL query to find the following...

NPV Queries Problem

LeetCode 1421. Write an SQL query to find the npv...

Last Person To Fit In The Elevator Problem

LeetCode 1204. Write an SQL query to find the person_name...

Highest Grade For Each Student Problem

LeetCode 1112. Write a SQL query to find the highest...

Evaluate Boolean Expression Problem

LeetCode 1440. Write an SQL query to evaluate the boolean...

Calculate Salaries Problem

LeetCode 1468. Write an SQL query to find the salaries...

Activity Participants Problem

LeetCode 1355. Write an SQL query to find the names...

User Activity For The Past 30 Days II Problem

LeetCode 1142. Write an SQL query to find the average...

The Most Frequently Ordered Products For Each Customer Problem

LeetCode 1596. Write an SQL query to find the most...

Running Total For Different Genders Problem

LeetCode 1308. Write an SQL query to find the total...

Friendly Movies Streamed Last Month Problem

LeetCode 1495. Write an SQL query to report the distinct...

Friend Requests I: Overall Acceptance Rate Problem

LeetCode 597. Write an SQL query to find the overall...

Find The Start And End Number Of Continuous Ranges Problem

LeetCode 1285. Write an SQL query to find the start...

Customers Who Bought Products A And B But Not C Problem

LeetCode 1398. Write an SQL query to report the customer_id...

Classes More Than 5 Students Problem

LeetCode 596. Please list out all classes which have more...

Capital Gain/Loss Problem

LeetCode 1393. Write an SQL query to report the Capital...

Biggest Single Number Problem

LeetCode 619. Table my_numbers contains many numbers in column num...

Apples & Oranges Problem

LeetCode 1445. Write an SQL query to report the difference...

All People Report To The Given Manager Problem

LeetCode 1270. Write an SQL query to find employee_id of...

Weather Type In Each Country Problem

LeetCode 1294. Write an SQL query to find the type...

User Activity For The Past 30 Days I Problem

LeetCode 1141. Write an SQL query to find the daily...

Triangle Judgement Problem

LeetCode 610. A pupil Tim gets homework to identify whether...

Students And Examinations Problem

LeetCode 1280. Write an SQL query to find the number...

Sales Person Problem

LeetCode 607. Given three tables, salesperson, company, orders.

Sales Analysis III Problem

LeetCode 1084. Write an SQL query that reports the products...

Sales Analysis II Problem

LeetCode 1083. Write an SQL query that reports the buyers...

Reported Posts Problem

LeetCode 1113. Write an SQL query that reports the number...

Queries Quality And Percentage Problem

LeetCode 1211. Write an SQL query to find each query_name,...

Project Employees II Problem

LeetCode 1076. Write an SQL query that reports all the...

Project Employees I Problem

LeetCode 1075. Write an SQL query that reports the average...

Number Of Comments Per Post Problem

LeetCode 1241. Write an SQL query to find number of...

Not Boring Movies Problem

LeetCode 620. X city opened a new cinema, many people...

Fix Product Name Format Problem

LeetCode 1543. Write an SQL query to report product_name in...

Consecutive Available Seats Problem

LeetCode 603. Several friends at a cinema ticket office would...

Ads Performance Problem

LeetCode 1322. A company is running Ads and wants to...

Top Travellers Problem

LeetCode 1407. Write an SQL query to report the distance...

Swap Salary Problem

LeetCode 627. Given a table salary, such as the one...

Shortest Distance Problem

LeetCode 613. Write a query to find the shortest distance...

Sales Analysis I Problem

LeetCode 1082. Write an SQL query that reports the best...

Reformat Department Table Problem

LeetCode 1179. Write an SQL query to reformat the table...

Product Sales Analysis II Problem

LeetCode 1069. Write an SQL query that reports the total...

Product Sales Analysis I Problem

LeetCode 1068. Write an SQL query that reports all product...

List The Products Ordered In A Period Problem

LeetCode 1327. Write an SQL query to get the names...

Immediate Food Delivery I Problem

LeetCode 1173. Write an SQL query to find the percentage...

Find Users With Valid Emails Problem

LeetCode 1517. Write an SQL query to find the users...

Find Customer Referee Problem

LeetCode 584. Given a table customer holding customers information and...

Customer Placing The Largest Number Of Orders Problem

LeetCode 586. Query the customer_number from the orders table for...

Customer Order Frequency Problem

LeetCode 1511. Write an SQL query to report the customer_id...

Create A Session Bar Chart Problem

LeetCode 1435. You want to know how long a user...

Big Countries Problem

LeetCode 595. Write a SQL solution to output big countries’...

Average Selling Price Problem

LeetCode 1251. Write an SQL query to find the average...

Article Views I Problem

LeetCode 1148. Write an SQL query to find all the...

Actors And Directors Who Cooperated At Least Three Times Problem

LeetCode 1050. Write a SQL query for a report that...

Unique Orders And Customers Per Month Problem

LeetCode 1565. Write an SQL query to find the number...

Sellers With No Sales Problem

LeetCode 1607. Write an SQL query to report the names...

Rising Temperature Problem

LeetCode 197. Write an SQL query to find all dates’...

Game Play Analysis IV Problem

LeetCode 550. Write an SQL query that reports the fraction...

Game Play Analysis III Problem

LeetCode 534. Write an SQL query that reports for each...

Game Play Analysis II Problem

LeetCode 512. Write a SQL query that reports the device...

Game Play Analysis I Problem

LeetCode 511. Write an SQL query that reports the first...

Employee Bonus Problem

LeetCode 577. Select all employee’s name and bonus whose bonus...

Delete Duplicate Emails Problem

LeetCode 196. Write a SQL query to delete all duplicate...

Daily Leads And Partners Problem

LeetCode 1693. Write an SQL query that will, for each...

Customer Who Visited But Did Not Make Any Transactions Problem

LeetCode 1581. Write an SQL query to find the IDs...

Product's Worth Over Invoices Problem

LeetCode 1677. Write an SQL query that will, for all...

Percentage Of Users Attended A Contest Problem

LeetCode 1633. Write an SQL query to find the percentage...

Fix Names In A Table Problem

LeetCode 1667. Write an SQL query to fix the names...

Duplicate Emails Problem

LeetCode 182. Write a SQL query to find all duplicate...

Customers Who Never Order Problem

LeetCode 183. Write a SQL query to find all customers...

Consecutive Numbers Problem

LeetCode 180. Write an SQL query to find all numbers...

Average Time Of Process Per Machine Problem

LeetCode 1661. There is a factory website that has several...

Second Highest Salary Problem

LeetCode 176. Given the Employee table, write a SQL query...

Employees Earning More Than Their Managers Problem

LeetCode 181. Given the Employee table, write a SQL query...

Bank Account Summary II Problem

LeetCode 1587. Write an SQL query to report the name...

Group Sold Products By The Date Problem

LeetCode 1484. Write an SQL query to find for each...

All Valid Triplets That Can Represent A Country Problem

LeetCode 1623. Write an SQL query to find all the...

Warehouse Manager Problem

LeetCode 1571. Write an SQL query to report how much...

Students With Invalid Departments Problem

LeetCode 1350. Write an SQL query to find the id...

Replace Employee ID With The Unique Identifier Problem

LeetCode 1378. Write an SQL query to show the unique...

Patients With A Condition Problem

LeetCode 1527. Write an SQL query to report the patient_id,...

Invalid Tweets Problem

LeetCode 1683. Write an SQL query to find the IDs...

Find The Team Size Problem

LeetCode 1303. Write an SQL query to find the team...

Combine Two Tables Problem

LeetCode 175. Write a SQL query for a report that...

Category List

Git Short Answers List

A growing list of Git questions and short answers.

MySQL Tutorial List

A growing list of MySQL tutorials.

LeetCode Database Solution List

A list of LeetCode database problems and solutions.

LeetCode Solution List

A growing list of LeetCode problems and solutions.

Operating System Topic List

A growing list of posts under the topic of Operating...

Object Oriented Design Topic List

A growing list of posts under the topic of Object...

C++ Concept List

A growing list of posts under the topic of C++...

Category Operating System

Concurrency II: Introduction Cont'd

Another important question is how threads interact when they access...

Concurrency I: Introduction

A thread is an abstraction for a single running process....

Process I: The Abstraction

How can the OS provide the illusion of nearly-endless supply...

Virtual Memory VIII: Page Replacement Policies

How can the OS decide which page(s) to evict from...

Virtual Memory VII: Page Replacement Mechanisms

How can the OS make use of a larger, slower...

Virtual Memory VI: Smaller Tables

How can we make page tables smaller.

Virtual Memory V: TLBs

How can we speed up address translation, and generally avoid...

Virtual Memory IV: Paging

How can we virtualize memory with pages, so as to...

Virtual Memory III: Segmentation

How to support a large address space with (potentially) a...

Virtual Memory II: Address Translation

How can we relocate the process in memory in a...

Virtual Memory I: Overview

Virtual Memory is an abstraction that the Operating System provides...

Category Object-Oriented Design

Online Book Reader System Problem

Design the data structures for an online book reader system...

Parking Lot Problem

Design a parking lot using object-oriented principles. We will focus...

Call Center Problem

An object oriented design problem. Imagine you have a call...

Category Design Pattern

Singleton Design Pattern

The singleton design pattern is a type of creational pattern...

Factory Design Pattern

The factory design pattern is a type of creational pattern...

Category C++ Concepts

Value Categories in C++

Every C++ expression has a type and belongs to a...

Rvalue References in C++: Perfect Forwarding

Perfect forwarding reduces the need for overloaded functions and helps...

Rvalue References in C++: Move Semantics

The rvalue references enable us to distinguish an lvalue from...

References in C++

A reference is an alias of another object. It stores...

Lvalue References in C++

An lvalue reference is another name of an object. An...

Lambda Expressions in C++

A lambda expression is a convenient way of defining an...

Template Specializations in C++

A template specialization is a separate definition in which the...

Implicit Type Conversions in C++

C++ transforms the operands to a common type before performing...

Explicit Type Conversions in C++

An explicit conversion is also called as a cast. There...

Copy Constructors in C++

The constructor that takes a single parameter that is a...

Inline Functions in C++

A function specified as inline is expanded everywhere it is...

Function Pointers in C++

A function pointer is a pointer that denotes a function...

Weak_Ptr in C++

Sometimes an object must store a way to access the...

Friend Class and Function in C++

A friend class can access private and protected members of...

Unique_Ptr in C++

A unique_ptr does not share its pointer. It cannot be...

Smart Pointers in C++

In modern C++ programming, the Standard Library includes smart pointers,...

Shared_Ptr in C++

The shared_ptr type is a smart pointer that is designed...

Templates in C++

A template is a blueprint or formula for creating a...

Polymorphism in C++

Polymorphism means having more than one function with the same...

Interfaces in C++

An interface describes the behavior or capabilities of a C++...

Category Data Structure

X Of A Kind In A Deck Of Cards Problem

LeetCode 914. In a deck of cards, each card has...

Word Subsets Problem

LeetCode 916. You are given two string arrays words1 and...

Walking Robot Simulation Problem

LeetCode 874. A robot on an infinite XY-plane starts at...

Vowel Spellchecker Problem

LeetCode 966. Given a wordlist, we want to implement a...

Vertical Order Traversal Of A Binary Tree Problem

LeetCode 987. Given the root of a binary tree, calculate...

Verifying An Alien Dictionary Problem

LeetCode 953. In an alien language, surprisingly, they also use...

Validate Stack Sequences Problem

LeetCode 946. Given two integer arrays pushed and popped each...

Valid Permutations For DI Sequence Problem

LeetCode 903. You are given a string s of length...

Valid Mountain Array Problem

LeetCode 941. Given an array of integers arr, return true...

Univalued Binary Tree Problem

LeetCode 965. A binary tree is uni-valued if every node...

Unique Paths III Problem

LeetCode 980. You are given an m x n integer...

Unique Morse Code Words Problem

LeetCode 804. International Morse Code defines a standard encoding where...

Unique Email Addresses Problem

LeetCode 929. Every valid email consists of a local name...

Uncommon Words From Two Sentences Problem

LeetCode 884. A sentence is a string of single-space separated...

Triples With Bitwise And Equal To Zero Problem

LeetCode 982. Given an integer array nums, return the number...

Transpose Matrix Problem

LeetCode 867. Given a 2D integer array matrix, return the...

Time Based Key-Value Store Problem

LeetCode 981. Design a time-based key-value data structure that can...

Three Equal Parts Problem

LeetCode 927. You are given an array arr which consists...

Tallest Billboard Problem

LeetCode 956. You are installing a billboard and want it...

Surface Area Of 3D Shapes Problem

LeetCode 892. You are given an n x n grid...

Super Palindromes Problem

LeetCode 906. Let’s say a positive integer is a super-palindrome...

Super Egg Drop Problem

LeetCode 887. You are given k identical eggs and you...

Sum Of Subsequence Widths Problem

LeetCode 891. The width of a sequence is the difference...

Sum Of Subarray Minimums Problem

LeetCode 907. Given an array of integers arr, find the...

Sum Of Even Numbers After Queries Problem

LeetCode 985. You are given an integer array nums and...

Sum Of Distances In Tree Problem

LeetCode 834. There is an undirected connected tree with n...

Subdomain Visit Count Problem

LeetCode 811. A website domain “discuss.leetcode.com” consists of various subdomains....

Subarrays With K Different Integers Problem

LeetCode 992. Given an integer array nums and an integer...

String Without Aaa Or Bbb Problem

LeetCode 984. Given two integers a and b, return any...

Stone Game Problem

LeetCode 877. Alice and Bob play a game with piles...

Stamping The Sequence Problem

LeetCode 936. You are given two strings stamp and target....

Squares Of A Sorted Array Problem

LeetCode 977. Given an integer array nums sorted in non-decreasing...

Split Array With Same Average Problem

LeetCode 805. You are given an integer array nums.

Split Array Into Fibonacci Sequence Problem

LeetCode 842. You are given a string of digits num,...

Spiral Matrix III Problem

LeetCode 885. You start at the cell (rStart, cStart) of...

Soup Servings Problem

LeetCode 808. There are two types of soup, type A...

Sort Array By Parity Problem

LeetCode 905. Given an integer array nums, move all the...

Sort Array By Parity II Problem

LeetCode 922. Given an array of integers nums, half of...

Sort An Array Problem

LeetCode 912. Given an array of integers nums, sort the...

Snakes And Ladders Problem

LeetCode 909. You are given an n x n integer...

Smallest Subtree With All The Deepest Nodes Problem

LeetCode 865. Given the root of a binary tree, the...

Smallest String Starting From Leaf Problem

LeetCode 988. You are given the root of a binary...

Smallest Range II Problem

LeetCode 910. You are given an integer array nums and...

Smallest Range I Problem

LeetCode 908. You are given an integer array nums and...

Similar String Groups Problem

LeetCode 839. Two strings Xand Yare similar if we can...

Shortest Subarray With Sum At Least K Problem

LeetCode 862. Given an integer array nums and an integer...

Shortest Path Visiting All Nodes Problem

LeetCode 847. You have an undirected, connected graph of n...

Shortest Path To Get All Keys Problem

LeetCode 864. You are given an m x n grid...

Shortest Distance To A Character Problem

LeetCode 821. Given a string s and a character c...

Shortest Bridge Problem

LeetCode 934. You are given an n x n binary...

Short Encoding Of Words Problem

LeetCode 820. A valid encoding of an array of words...

Shifting Letters Problem

LeetCode 848. You are given a string s of lowercase...

Score Of Parentheses Problem

LeetCode 856. Given a balanced parentheses string s, return the...

Score After Flipping Matrix Problem

LeetCode 861. You are given an m x n binary...

Satisfiability Of Equality Equations Problem

LeetCode 990. You are given an array of strings equations...

Rotting Oranges Problem

LeetCode 994. You are given an m x n grid...

Rle Iterator Problem

LeetCode 900. We can use run-length encoding (i.e., RLE) to...

Reverse Only Letters Problem

LeetCode 917. Given a string s, reverse the string according...

Reveal Cards In Increasing Order Problem

LeetCode 950. You are given an integer array deck. There...

Reordered Power Of 2 Problem

LeetCode 869. You are given an integer n. We reorder...

Reorder Data In Log Files Problem

LeetCode 937. You are given an array of logs. Each...

Regions Cut By Slashes Problem

LeetCode 959. An n x n grid is composed of...

Rectangle Overlap Problem

LeetCode 836. An axis-aligned rectangle is represented as a list...

Rectangle Area II Problem

LeetCode 850. You are given a 2D array of axis-aligned...

Reachable Nodes In Subdivided Graph Problem

LeetCode 882. You are given an undirected graph (the “original...

Range Sum Of BST Problem

LeetCode 938. Given the root node of a binary search...

Race Car Problem

LeetCode 818. Your car starts at position 0 and speed...

Push Dominoes Problem

LeetCode 838. There are n dominoes in a line, and...

Projection Area Of 3D Shapes Problem

LeetCode 883. You are given an n x n grid...

Profitable Schemes Problem

LeetCode 879. There is a group of n members, and...

Prison Cells After N Days Problem

LeetCode 957. There are 8 prison cells in a row...

Prime Palindrome Problem

LeetCode 866. Given an integer n, return the smallest prime...

Powerful Integers Problem

LeetCode 970. Given three integers x, y, and bound, return...

Possible Bipartition Problem

LeetCode 886. We want to split a group of n...

Positions Of Large Groups Problem

LeetCode 830. In a string sof lowercase letters, these letters...

Peak Index In A Mountain Array Problem

LeetCode 852. Let’s call an array arr a mountainif the...

Partition Array Into Disjoint Intervals Problem

LeetCode 915. Given an integer array nums, partition it into...

Pancake Sorting Problem

LeetCode 969. Given an array of integers arr, sort the...

Orderly Queue Problem

LeetCode 899. You are given a string s and an...

Online Stock Span Problem

LeetCode 901. Design an algorithm that collects daily price quotes...

Online Election Problem

LeetCode 911. You are given two integer arrays persons and...

Odd Even Jump Problem

LeetCode 975. You are given an integer array arr. From...

Numbers With Same Consecutive Differences Problem

LeetCode 967. Return all non-negative integers of length n such...

Numbers At Most N Given Digit Set Problem

LeetCode 902. Given an array of digits which is sorted...

Number Of Squareful Arrays Problem

LeetCode 996. An array is squareful if the sum of...

Number Of Recent Calls Problem

LeetCode 933. You have a RecentCounter class which counts the...

Number Of Music Playlists Problem

LeetCode 920. Your music player contains n different songs. You...

Number Of Lines To Write String Problem

LeetCode 806. You are given a string s of lowercase...

Nth Magical Number Problem

LeetCode 878. A positive integer is magical if it is...

New 21 Game Problem

LeetCode 837. Alice plays the following game, loosely based on...

Most Stones Removed With Same Row Or Column Problem

LeetCode 947. On a 2D plane, we place n stones...

Most Profit Assigning Work Problem

LeetCode 826. You have n jobs and m workers. You...

Most Common Word Problem

LeetCode 819. Given a string paragraph and a string array...

Monotonic Array Problem

LeetCode 896. An array is monotonic if it is either...

Mirror Reflection Problem

LeetCode 858. There is a special square room with mirrors...

Minimum Swaps To Make Sequences Increasing Problem

LeetCode 801. You are given two integer arrays of the...

Minimum Number Of Refueling Stops Problem

LeetCode 871. A car travels from a starting position to...

Minimum Number Of K Consecutive Bit Flips Problem

LeetCode 995. You are given a binary array nums and...

Minimum Increment To Make Array Unique Problem

LeetCode 945. You are given an integer array nums. In...

Minimum Falling Path Sum Problem

LeetCode 931. Given an n x n array of integers...

Minimum Cost To Merge Stones Problem

LeetCode 1000. There are n piles of stones arranged in...

Minimum Cost To Hire K Workers Problem

LeetCode 857. There are n workers. You are given two...

Minimum Cost For Tickets Problem

LeetCode 983. You have planned some train traveling one year...

Minimum Area Rectangle Problem

LeetCode 939. You are given an array of points in...

Minimum Area Rectangle II Problem

LeetCode 963. You are given an array of points in...

Minimum Add To Make Parentheses Valid Problem

LeetCode 921. A parentheses string is valid if and only...

Minimize Malware Spread Problem

LeetCode 924. You are given a network of n nodes...

Minimize Malware Spread II Problem

LeetCode 928. You are given a network of n nodes...

Middle Of The Linked List Problem

LeetCode 876. Given the head of a singly linked list,...

Maximum Width Ramp Problem

LeetCode 962. A ramp in an integer array nums is...

Maximum Sum Circular Subarray Problem

LeetCode 918. Given a circular integer array nums of length...

Maximum Frequency Stack Problem

LeetCode 895. Design a stack-like data structure to push elements...

Maximum Binary Tree II Problem

LeetCode 998. A maximum tree is a tree where every...

Maximize Distance To Closest Person Problem

LeetCode 849. You are given an array representing a row...

Max Increase To Keep City Skyline Problem

LeetCode 807. There is a city composed of n x...

Masking Personal Information Problem

LeetCode 831. You are given a personal information string s,...

Making A Large Island Problem

LeetCode 827. You are given an n x n binary...

Magic Squares In Grid Problem

LeetCode 840. A 3 x 3 magic square is a...

Loud And Rich Problem

LeetCode 851. There is a group of n people labeled...

Longest Turbulent Subarray Problem

LeetCode 978. Given an integer array arr, return the length...

Longest Mountain In Array Problem

LeetCode 845. Given an integer array arr, return the length...

Long Pressed Name Problem

LeetCode 925. Your friend is typing his name into a...

Linked List Components Problem

LeetCode 817. You are given the head of a linked...

Length Of Longest Fibonacci Subsequence Problem

LeetCode 873. Given a strictly increasing array arr of positive...

Lemonade Change Problem

LeetCode 860. At a lemonade stand, each lemonade costs $5....

Least Operators To Express Number Problem

LeetCode 964. Given a single positive integer x, we will...

Leaf-Similar Trees Problem

LeetCode 872. Consider all the leaves of a binary tree,...

Largest Triangle Area Problem

LeetCode 812. Given an array of points on the X-Y...

Largest Time For Given Digits Problem

LeetCode 949. Given an arrayarr of 4 digits, find the...

Largest Sum Of Averages Problem

LeetCode 813. You are given an integer array nums and...

Largest Perimeter Triangle Problem

LeetCode 976. Given an integer array nums, return the largest...

Largest Component Size By Common Factor Problem

LeetCode 952. You are given an integer array of unique...

Koko Eating Bananas Problem

LeetCode 875. Koko loves to eat bananas. There are n...

Knight Dialer Problem

LeetCode 935. The chess knight has a unique movement, it...

Keys And Rooms Problem

LeetCode 841. There are n rooms labeled from 0 to...

K-Similar Strings Problem

LeetCode 854. Strings s1 and s2 are k-similar (for some...

K Closest Points To Origin Problem

LeetCode 973. Given an array of points where points[i] =...

Interval List Intersections Problem

LeetCode 986. You are given two lists of closed intervals,...

Increasing Order Search Tree Problem

LeetCode 897. Given the root of a binary search tree,...

Image Overlap Problem

LeetCode 835. You are given two images, img1 and img2,...

Hand Of Straights Problem

LeetCode 846. Alice has some number of cards and she...

Guess The Word Problem

LeetCode 843. This is an interactive problem.

Groups Of Special-Equivalent Strings Problem

LeetCode 893. You are given an array of strings of...

Goat Latin Problem

LeetCode 824. You are given a string sentence that consist...

Fruit Into Baskets Problem

LeetCode 904. You are visiting a farm that has a...

Friends Of Appropriate Ages Problem

LeetCode 825. There are n persons on a social media...

Flipping An Image Problem

LeetCode 832. Given an n x n binary matrix image,...

Flip String To Monotone Increasing Problem

LeetCode 926. A binary string is monotone increasing if it...

Flip Equivalent Binary Trees Problem

LeetCode 951. For a binary tree T, we can define...

Flip Binary Tree To Match Preorder Traversal Problem

LeetCode 971. You are given the root of a binary...

Find The Town Judge Problem

LeetCode 997. In a town, there are n people labeled...

Find The Shortest Superstring Problem

LeetCode 943. Given an array of strings words, return the...

Find Eventual Safe States Problem

LeetCode 802. There is a directed graph of n nodes...

Find And Replace Pattern Problem

LeetCode 890. Given a list of strings words and a...

Find And Replace In String Problem

LeetCode 833. You are given a 0-indexed string s that...

Fair Candy Swap Problem

LeetCode 888. Alice and Bob have a different total number...

Expressive Words Problem

LeetCode 809. Sometimes people repeat letters to represent extra feeling....

Exam Room Problem

LeetCode 855. There is an exam room with n seats...

Equal Rational Numbers Problem

LeetCode 972. Given two strings s and t, each of...

Distribute Coins In Binary Tree Problem

LeetCode 979. You are given the root of a binary...

Distinct Subsequences II Problem

LeetCode 940. Given a string s, return the number of...

DI String Match Problem

LeetCode 942. A permutation perm of n + 1 integers...

Delete Columns To Make Sorted Problem

LeetCode 944. You are given an array of n strings...

Delete Columns To Make Sorted III Problem

LeetCode 960. You are given an array of n strings...

Delete Columns To Make Sorted II Problem

LeetCode 955. You are given an array of n strings...

Decoded String At Index Problem

LeetCode 880. You are given an encoded string s. To...

Cousins In Binary Tree Problem

LeetCode 993. Given the root of a binary tree with...

Count Unique Characters Of All Substrings Of A Given String Problem

LeetCode 828. Let’s define a function countUniqueChars(s) that returns the...

Construct Binary Tree From Preorder And Postorder Traversal Problem

LeetCode 889. Given two integer arrays, preorder and postorder where...

Consecutive Numbers Sum Problem

LeetCode 829. Given an integer n, return the number of...

Complete Binary Tree Inserter Problem

LeetCode 919. A complete binary tree is a binary tree...

Check Completeness Of A Binary Tree Problem

LeetCode 958. Given the root of a binary tree, determine...

Chalkboard Xor Game Problem

LeetCode 810. You are given an array of integers nums...

Cat And Mouse Problem

LeetCode 913. A game on an undirected graph is played...

Card Flipping Game Problem

LeetCode 822. You are given n cards, with a positive...

Car Fleet Problem

LeetCode 853. There are n cars going to the same...

Bus Routes Problem

LeetCode 815. You are given an array routes representing bus...

Buddy Strings Problem

LeetCode 859. Given two strings s and goal, return true...

Broken Calculator Problem

LeetCode 991. There is a broken calculator that has the...

Bricks Falling When Hit Problem

LeetCode 803. You are given an m x n binary...

Boats To Save People Problem

LeetCode 881. You are given an array people where people[i]...

Bitwise ORs Of Subarrays Problem

LeetCode 898. We have an array arr of non-negative integers....

Binary Trees With Factors Problem

LeetCode 823. Given an array of unique integers, arr, where...

Binary Tree Pruning Problem

LeetCode 814. Given the root of a binary tree, return...

Binary Tree Cameras Problem

LeetCode 968. You are given the root of a binary...

Binary Subarrays With Sum Problem

LeetCode 930. Given a binary array nums and an integer...

Binary Gap Problem

LeetCode 868. Given a positive integer n, find and return...

Beautiful Array Problem

LeetCode 932. Given the integer n, return any beautiful array...

Bag Of Tokens Problem

LeetCode 948. You have an initial power of power, an...

Backspace String Compare Problem

LeetCode 844. Given two strings s and t, return true...

Available Captures For Rook Problem

LeetCode 999. On an 8 x 8 chessboard, there is...

Array Of Doubled Pairs Problem

LeetCode 954. Given an integer array of even length arr,...

Ambiguous Coordinates Problem

LeetCode 816. We had some 2-dimensional coordinates, like “(1, 3)”...

All Possible Full Binary Trees Problem

LeetCode 894. Given an integer n, return a list of...

All Nodes Distance K In Binary Tree Problem

LeetCode 863. Given the root of a binary tree, the...

Advantage Shuffle Problem

LeetCode 870. You are given two integer arrays nums1 and...

Add To Array-Form Of Integer Problem

LeetCode 989. The array-form of an integer num is an...

3Sum With Multiplicity Problem

LeetCode 923. Given an integer array arr, and an integer...

Valid Triangle Number Problem

LeetCode 611. Given an integer array nums, return the number...

Valid Tic-Tac-Toe State Problem

LeetCode 794. Given a Tic-Tac-Toe board as a string array...

Valid Parenthesis String Problem

LeetCode 678. Given a string s containing only three types...

Valid Palindrome II Problem

LeetCode 680. Given a string s, return true if the...

Transform To Chessboard Problem

LeetCode 782. You are given an n x n binary...

Top K Frequent Words Problem

LeetCode 692. Given an array of strings words and an...

Toeplitz Matrix Problem

LeetCode 766. Given an m x n matrix, returntrueif the...

Task Scheduler Problem

LeetCode 621. Given a characters array tasks, representing the tasks...

Swim In Rising Water Problem

LeetCode 778. You are given an n x n integer...

Swap Adjacent In LR String Problem

LeetCode 777. In a string composed of ‘L’, ‘R’, and...

Strange Printer Problem

LeetCode 664. There is a strange printer with the following...

Stickers To Spell Word Problem

LeetCode 691. We are given n different types of stickers....

Split Linked List In Parts Problem

LeetCode 725. Given the head of a singly linked list...

Special Binary String Problem

LeetCode 761. Special binary strings are binary strings with the...

Solve The Equation Problem

LeetCode 640. Solve a given equation and return the value...

Sliding Puzzle Problem

LeetCode 773. On an 2 x 3 board, there are...

Shopping Offers Problem

LeetCode 638. In LeetCode Store, there are n items to...

Set Mismatch Problem

LeetCode 645. You have a set of integers s, which...

Set Intersection Size At Least Two Problem

LeetCode 757. You are given a 2D integer array intervals...

Self Dividing Numbers Problem

LeetCode 728. A self-dividing number is a number that is...

Robot Return To Origin Problem

LeetCode 657. There is a robot starting at the position...

Reorganize String Problem

LeetCode 767. Given a string s, rearrange the characters of...

Redundant Connection Problem

LeetCode 684. In this problem, a tree is an undirected...

Redundant Connection II Problem

LeetCode 685. In this problem, a rooted tree is a...

Reaching Points Problem

LeetCode 780. Given four integers sx, sy, tx, and ty,...

Range Module Problem

LeetCode 715. A Range Module is a module that tracks...

Random Pick With Blacklist Problem

LeetCode 710. You are given an integer n and an...

Rabbits In Forest Problem

LeetCode 781. There is a forest with an unknown number...

Pyramid Transition Matrix Problem

LeetCode 756. You are stacking blocks to form a pyramid....

Preimage Size Of Factorial Zeroes Function Problem

LeetCode 793. Let f(x) be the number of zeroes at...

Partition Labels Problem

LeetCode 763. You are given a string s. We want...

Parse Lisp Expression Problem

LeetCode 736. You are given a string expression representing a...

Open The Lock Problem

LeetCode 752. You have a lock in front of you...

Network Delay Time Problem

LeetCode 743. You are given a network of n nodes,...

My Calendar III Problem

LeetCode 732. A k-booking happens when k events have some...

My Calendar II Problem

LeetCode 731. You are implementing a program to use as...

My Calendar I Problem

LeetCode 729. You are implementing a program to use as...

Knight Probability In Chessboard Problem

LeetCode 688. On an n x n chessboard, a knight...

K-Th Symbol In Grammar Problem

LeetCode 779. We build a table of n rows (1-indexed)....

Find Pivot Index Problem

LeetCode 724. Given an array of integers nums, calculate the...

Exclusive Time Of Functions Problem

LeetCode 636. On a single-threaded CPU, we execute a program...

Escape The Ghosts Problem

LeetCode 789. You are playing a simplified PAC-MAN game on...

Dota2 Senate Problem

LeetCode 649. In the world of Dota2, there are two...

Cherry Pickup Problem

LeetCode 741. You are given an n x n grid...

2 Keys Keyboard Problem

LeetCode 650. There is only one character ‘A’ on the...

Two Sum IV - Input Is A BST Problem

LeetCode 653. Given the root of a Binary Search Tree...

Trim A Binary Search Tree Problem

LeetCode 669. Given the root of a binary search tree...

To Lower Case Problem

LeetCode 709. Given a string s, return the string after...

Sum Of Square Numbers Problem

LeetCode 633. Given a non-negative integer c, decide whether there’re...

Split Array Into Consecutive Subsequences Problem

LeetCode 659. You are given an integer array nums that...

Smallest Rotation With Highest Score Problem

LeetCode 798. You are given an array nums. You can...

Smallest Range Covering Elements From K Lists Problem

LeetCode 632. You have k lists of sorted integers in...

Shortest Completing Word Problem

LeetCode 748. Given a string licensePlate and an array of...

Second Minimum Node In A Binary Tree Problem

LeetCode 671. Given a non-empty special binary tree consisting of...

Search In A Binary Search Tree Problem

LeetCode 700. You are given the root of a binary...

Rotated Digits Problem

LeetCode 788. An integer x is a good if after...

Rotate String Problem

LeetCode 796. Given two strings s and goal, return true...

Repeated String Match Problem

LeetCode 686. Given two string s a and b, return...

Remove Comments Problem

LeetCode 722. Given a C++ program, remove comments from it....

Reach A Number Problem

LeetCode 754. You are standing at position 0 on an...

Print Binary Tree Problem

LeetCode 655. Given the root of a binary tree, construct...

Prime Number Of Set Bits In Binary Representation Problem

LeetCode 762. Given two integers left and right, return the...

Prefix And Suffix Search Problem

LeetCode 745. Design a special dictionary with some words that...

Partition To K Equal Sum Subsets Problem

LeetCode 698. Given an integer array nums and an integer...

Number Of Subarrays With Bounded Maximum Problem

LeetCode 795. Given an integer array nums and two integers...

Number Of Matching Subsequences Problem

LeetCode 792. Given a string s and an array of...

Number Of Longest Increasing Subsequence Problem

LeetCode 673. Given an integer arraynums, return the number of...

Number Of Atoms Problem

LeetCode 726. Given a string formula representing a chemical formula,return...

Non-Decreasing Array Problem

LeetCode 665. Given an array nums with n integers, your...

Monotone Increasing Digits Problem

LeetCode 738. An integer has monotone increasing digits if and...

Minimum Distance Between BST Nodes Problem

LeetCode 783. Given the root of a Binary Search Tree...

Minimum Ascii Delete Sum For Two Strings Problem

LeetCode 712. Given two strings s1 ands2, return the lowest...

Min Cost Climbing Stairs Problem

LeetCode 746. You are given an integer array cost where...

Merge Two Binary Trees Problem

LeetCode 617. You are given two binary trees root1 and...

Maximum Width Of Binary Tree Problem

LeetCode 662. Given the root of a binary tree, return...

Maximum Sum Of 3 Non-Overlapping Subarrays Problem

LeetCode 689. Given an integer array nums and an integer...

Maximum Product Of Three Numbers Problem

LeetCode 628. Given an integer array nums, find three numbers...

Maximum Length Of Repeated Subarray Problem

LeetCode 718. Given two integer arrays nums1 and nums2, return...

Maximum Length Of Pair Chain Problem

LeetCode 646. You are given an array of n pairs...

Max Chunks To Make Sorted Problem

LeetCode 769. You are given an integer array arr of...

Max Chunks To Make Sorted II Problem

LeetCode 768. You are given an integer array arr.

Longest Univalue Path Problem

LeetCode 687. Given the root of a binary tree, return...

Longest Continuous Increasing Subsequence Problem

LeetCode 674. Given an unsorted array of integers nums, return...

Letter Case Permutation Problem

LeetCode 784. Given a string s, we can transform every...

Kth Smallest Number In Multiplication Table Problem

LeetCode 668. Nearly everyone has used the Multiplication Table. The...

Is Graph Bipartite? Problem

LeetCode 785. There is an undirected graph with n nodes,...

Image Smoother Problem

LeetCode 661. An image smoother is a filter of the...

Global And Local Inversions Problem

LeetCode 775. You are given an integer array nums of...

Flood Fill Problem

LeetCode 733. An image is represented by an m x...

Find Smallest Letter Greater Than Target Problem

LeetCode 744. Given a characters array letters that is sorted...

Find Duplicate File In System Problem

LeetCode 609. Given a list paths of directory info, including...

Falling Squares Problem

LeetCode 699. There are several squares being dropped onto the...

Design Circular Queue Problem

LeetCode 622. Design your implementation of the circular queue. The...

Design Circular Deque Problem

LeetCode 641. Design your implementation of the circular double-ended queue...

Cut Off Trees For Golf Event Problem

LeetCode 675. You are asked to cut off all the...

Palindromic Substrings Problem

LeetCode 647. Given a string s, return the number of...

Maximum Swap Problem

LeetCode 670. You are given an integer num. You can...

Maximum Binary Tree Problem

LeetCode 654. You are given an integer array nums with...

Maximum Average Subarray I Problem

LeetCode 643. You are given an integer array nums consisting...

Max Area Of Island Problem

LeetCode 695. You are given an m x n binary...

Map Sum Pairs Problem

LeetCode 677. Design a map that allows you to do...

Largest Plus Sign Problem

LeetCode 764. You are given an integer n. You have...

Largest Number At Least Twice Of Others Problem

LeetCode 747. You are given an integer array nums where...

Kth Largest Element In A Stream Problem

LeetCode 703. Design a class to find the k^th largest...

K-Th Smallest Prime Fraction Problem

LeetCode 786. You are given a sorted integer array arr...

K Inverse Pairs Array Problem

LeetCode 629. For an integer array nums, an inverse pair...

Insert Into A Binary Search Tree Problem

LeetCode 701. You are given the root node of a...

Implement Magic Dictionary Problem

LeetCode 676. Design a data structure that is initialized with...

Find K-Th Smallest Pair Distance Problem

LeetCode 719. The distance of a pair of integers a...

Find K Closest Elements Problem

LeetCode 658. Given a sorted integer array arr, two integers...

Find Duplicate Subtrees Problem

LeetCode 652. Given the rootof a binary tree, return all...

Employee Importance Problem

LeetCode 690. You have a data structure of employee information,...

Domino And Tromino Tiling Problem

LeetCode 790. You have two types of tiles, a 2...

Design Linked List Problem

LeetCode 707. Design your implementation of the linked list. You...

Design Hashset Problem

LeetCode 705. Design a HashSet without using any built-in hash...

Design Hashmap Problem

LeetCode 706. Design a HashMap without using any built-in hash...

Delete And Earn Problem

LeetCode 740. You are given an integer array nums. You...

Degree Of An Array Problem

LeetCode 697. Given a non-empty array of non-negative integers nums,...

Decode Ways II Problem

LeetCode 639. A message containing letters from A-Z can be...

Daily Temperatures Problem

LeetCode 739. Given an array of integers temperatures represents the...

Custom Sort String Problem

LeetCode 791. You are given two strings order and s....

Cracking The Safe Problem

LeetCode 753. There is a safe protected by a password....

Course Schedule III Problem

LeetCode 630. There are n different online courses numbered from...

Couples Holding Hands Problem

LeetCode 765. There are n couples sitting in 2n seats...

Count Different Palindromic Subsequences Problem

LeetCode 730. Given a string s, return the number of...

Count Binary Substrings Problem

LeetCode 696. Give a binary string s, return the number...

Contain Virus Problem

LeetCode 749. A virus is spreading rapidly, and your task...

Construct String From Binary Tree Problem

LeetCode 606. Given the root of a binary tree, construct...

Cheapest Flights Within K Stops Problem

LeetCode 787. There are n cities connected by some number...

Champagne Tower Problem

LeetCode 799. We stack glasses in a pyramid, where the...

Can Place Flowers Problem

LeetCode 605. You have a long flowerbed in which some...

Bulb Switcher II Problem

LeetCode 672. There is a room with n bulbs labeled...

Binary Search Problem

LeetCode 704. Given an array of integers nums which is...

Binary Number With Alternating Bits Problem

LeetCode 693. Given a positive integer, check whether it has...

Best Time To Buy And Sell Stock With Transaction Fee Problem

LeetCode 714. You are given an array prices where prices[i]...

Beautiful Arrangement II Problem

LeetCode 667. Given two integers n and k, construct a...

Basic Calculator IV Problem

LeetCode 770. Given an expression such as expression = “e...

Baseball Game Problem

LeetCode 682. You are keeping score for a baseball game...

Average Of Levels In Binary Tree Problem

LeetCode 637. Given the root of a binary tree, return...

Asteroid Collision Problem

LeetCode 735. We are given an array asteroids of integers...

All Paths From Source To Target Problem

LeetCode 797. Given a directed acyclic graph (DAG) of n...

Add One Row To Tree Problem

LeetCode 623. Given the root of a binary tree and...

Accounts Merge Problem

LeetCode 721. Given a list of accounts where each element...

24 Game Problem

LeetCode 679. You are given an integer array cards of...

1-Bit And 2-Bit Characters Problem

LeetCode 717. We have two special characters, the first character...

Zuma Game Problem

LeetCode 488. You are playing a variation of the game...

Validate IP Address Problem

LeetCode 468. Given a string queryIP, return “IPv4” if IP...

Unique Substrings In Wraparound String Problem

LeetCode 467. We define the string s to be the...

Trapping Rain Water II Problem

LeetCode 407. Given an m x n integer matrix heightMap...

Total Hamming Distance Problem

LeetCode 477. The Hamming distance between two integers is the...

Third Maximum Number Problem

LeetCode 414. Given an integer array nums, return the third...

Teemo Attacking Problem

LeetCode 495. Our hero Teemo is attacking an enemy Ashe...

Tag Validator Problem

LeetCode 591. Given a string representing a code snippet, implement...

Super Washing Machines Problem

LeetCode 517. You have n super washing machines on a...

Strong Password Checker Problem

LeetCode 420. A password is considered strong if the below...

Random Point In Non-Overlapping Rectangles Problem

LeetCode 497. You are given an array of non-overlapping axis-aligned...

Predict The Winner Problem

LeetCode 486. You are given an integer array nums. Two...

Partition Equal Subset Sum Problem

LeetCode 416. Given a non-empty array nums containing only positive...

Pacific Atlantic Water Flow Problem

LeetCode 417. There is an m x n rectangular island...

Non-Negative Integers Without Consecutive Ones Problem

LeetCode 600. Given a positive integer n, return the number...

IPO Problem

LeetCode 502. Suppose LeetCode will start its IPO soon. In...

Frog Jump Problem

LeetCode 403. A frog is crossing a river. The river...

Freedom Trail Problem

LeetCode 514. In the video game Fallout 4, the quest...

Find The Closest Palindrome Problem

LeetCode 564. Given a string n representing an integer, return...

Erect The Fence Problem

LeetCode 587. You are given an array trees where trees[i]...

Valid Square Problem

LeetCode 593. Given the coordinates of four points in 2D...

Target Sum Problem

LeetCode 494. You are given an integer array nums and...

Sum Of Left Leaves Problem

LeetCode 404. Given the root of a binary tree, return...

Subtree Of Another Tree Problem

LeetCode 572. Given the roots of two binary trees root...

Student Attendance Record II Problem

LeetCode 552. An attendance record for a student can be...

Student Attendance Record I Problem

LeetCode 551. You are given a string s representing an...

String Compression Problem

LeetCode 443. Given an array of characters chars, compress it...

Split Array Largest Sum Problem

LeetCode 410. Given an array nums which consists of non-negative...

Sort Characters By Frequency Problem

LeetCode 451. Given a string s, sort it in decreasing...

Smallest Good Base Problem

LeetCode 483. Given an integer n represented as a string,...

Sliding Window Median Problem

LeetCode 480. The median is the middle value in an...

Single Element In A Sorted Array Problem

LeetCode 540. You are given a sorted array consisting of...

Shortest Unsorted Continuous Subarray Problem

LeetCode 581. Given an integer array nums, you need to...

Serialize And Deserialize BST Problem

LeetCode 449. Serialization is converting a data structure or object...

Reverse Words In A String III Problem

LeetCode 557. Given a string s, reverse the order of...

Reverse String II Problem

LeetCode 541. Given a string s and an integer k,...

Reverse Pairs Problem

LeetCode 493. Given an integer array nums, return the number...

Reshape The Matrix Problem

LeetCode 566. In MATLAB, there is a handy function called...

Repeated Substring Pattern Problem

LeetCode 459. Given a string s, check if it can...

Remove K Digits Problem

LeetCode 402. Given string num representing a non-negative integer num,...

Remove Boxes Problem

LeetCode 546. You are given several boxes with different colors...

Relative Ranks Problem

LeetCode 506. You are given an integer array score of...

Reconstruct Original Digits From English Problem

LeetCode 423. Given a string s containing an out-of-order English...

Range Addition II Problem

LeetCode 598. You are given an m x n matrix...

Random Pick With Weight Problem

LeetCode 528. You are given a 0-indexed array of positive...

Random Flip Matrix Problem

LeetCode 519. There is an m x n binary grid...

Queue Reconstruction By Height Problem

LeetCode 406. You are given an array of people, people,...

Poor Pigs Problem

LeetCode 458. There are buckets buckets of liquid, where exactly...

Permutation In String Problem

LeetCode 567. Given two strings s1 and s2, return true...

Perfect Number Problem

LeetCode 507. A perfect number is a positive integer that...

Path Sum III Problem

LeetCode 437. Given the root of a binary tree and...

Out Of Boundary Paths Problem

LeetCode 576. There is an m x n grid with...

Optimal Division Problem

LeetCode 553. You are given an integer array nums. The...

Ones And Zeroes Problem

LeetCode 474. You are given an array of binary strings...

Number Of Segments In A String Problem

LeetCode 434. You are given a string s, return the...

Number Of Provinces Problem

LeetCode 547. There are n cities. Some of them are...

Number Of Boomerangs Problem

LeetCode 447. You are given n points in the plane...

Number Complement Problem

LeetCode 476. The complement of an integer is the integer...

Non-Overlapping Intervals Problem

LeetCode 435. Given an array of intervals intervals where intervals[i]...

Next Greater Element III Problem

LeetCode 556. Given a positive integer n, find the smallest...

Next Greater Element II Problem

LeetCode 503. Given a circular integer array nums (i.e., the...

Next Greater Element I Problem

LeetCode 496. The next greater element of some element x...

N-Ary Tree Preorder Traversal Problem

LeetCode 589. Given the root of an n-ary tree, return...

N-Ary Tree Postorder Traversal Problem

LeetCode 590. Given the root of an n-ary tree, return...

N-Ary Tree Level Order Traversal Problem

LeetCode 429. Given an n-ary tree, return the level order...

Most Frequent Subtree Sum Problem

LeetCode 508. Given the root of a binary tree, return...

Minimum Time Difference Problem

LeetCode 539. Given a list of 24-hour clock time points...

Minimum Number Of Arrows To Burst Balloons Problem

LeetCode 452. There are some spherical balloons taped onto a...

Minimum Genetic Mutation Problem

LeetCode 433. A gene string can be represented by an...

Minimum Moves To Equal Array Elements Problem

LeetCode 453. Given an integer array nums of size n,...

Minimum Moves To Equal Array Elements II Problem

LeetCode 462. Given an integer array nums of size n,...

Minimum Index Sum Of Two Lists Problem

LeetCode 599. Suppose Andy and Doris want to choose a...

Minimum Absolute Difference In BST Problem

LeetCode 530. Given the root of a Binary Search Tree...

Minesweeper Problem

LeetCode 529. Let’s play the minesweeper game!

Maximum Depth Of N-Ary Tree Problem

LeetCode 559. Given a n-ary tree, find its maximum depth....

Max Consecutive Ones Problem

LeetCode 485. Given a binary array nums, return the maximum...

Matchsticks To Square Problem

LeetCode 473. You are given an integer array matchsticks where...

Magical String Problem

LeetCode 481. A magical string s consists of only ‘1’...

Longest Word In Dictionary Through Deleting Problem

LeetCode 524. Given a string s and a string array...

Longest Uncommon Subsequence II Problem

LeetCode 522. Given an array of strings strs, return the...

Longest Uncommon Subsequence I Problem

LeetCode 521. Given two strings a and b, return the...

Longest Repeating Character Replacement Problem

LeetCode 424. You are given a string s and an...

Longest Palindromic Subsequence Problem

LeetCode 516. Given a string s, find the longest palindromic...

Longest Palindrome Problem

LeetCode 409. Given a string s which consists of lowercase...

Longest Harmonious Subsequence Problem

LeetCode 594. We define a harmonious array as an array...

Logical Or Of Two Binary Grids Represented As Quad-Trees Problem

LeetCode 558. A Binary Matrix is a matrix in which...

License Key Formatting Problem

LeetCode 482. You are given a license key represented as...

LFU Cache Problem

LeetCode 460. Design and implement a data structure for a...

Largest Palindrome Product Problem

LeetCode 479. Given an integer n, return the largest palindromic...

Keyboard Row Problem

LeetCode 500. Given an array of strings words, return the...

K-Th Smallest In Lexicographical Order Problem

LeetCode 440. Given two integers n and k, return the...

K-Diff Pairs In An Array Problem

LeetCode 532. Given an array of integers nums and an...

Island Perimeter Problem

LeetCode 463. You are given row x col grid representing...

Increasing Subsequences Problem

LeetCode 491. Given an integer array nums, return all the...

Implement Rand10() Using Rand7() Problem

LeetCode 470. Given the API rand7() that generates a uniform...

Heaters Problem

LeetCode 475. Winter is coming! During the contest, your first...

Hamming Distance Problem

LeetCode 461. The Hamming distance between two integers is the...

Generate Random Point In A Circle Problem

LeetCode 478. Given the radius and the position of the...

Fraction Addition And Subtraction Problem

LeetCode 592. Given a string expression representing an expression of...

Flatten A Multilevel Doubly Linked List Problem

LeetCode 430. You are given a doubly linked list, which...

Find Right Interval Problem

LeetCode 436. You are given an array of intervals, where...

Find Mode In Binary Search Tree Problem

LeetCode 501. Given the root of a binary search tree...

Find Largest Value In Each Tree Row Problem

LeetCode 515. Given the root of a binary tree, return...

Find Bottom Left Tree Value Problem

LeetCode 513. Given the root of a binary tree, return...

Find All Numbers Disappeared In An Array Problem

LeetCode 448. Given an array nums of n integers where...

Find All Duplicates In An Array Problem

LeetCode 442. Given an integer array nums of length n...

Find All Anagrams In A String Problem

LeetCode 438. Given two strings s and p, return an...

Fibonacci Number Problem

LeetCode 509. The Fibonacci numbers, commonly denoted F(n) form a...

Encode And Decode TinyURL Problem

LeetCode 535. TinyURL is a URL shortening service where you...

Distribute Candies Problem

LeetCode 575. Alice has n candies, where the i^th candy...

Diagonal Traverse Problem

LeetCode 498. Given an m x n matrix mat, return...

Detect Capital Problem

LeetCode 520. We define the usage of capitals in a...

Delete Operation For Two Strings Problem

LeetCode 583. Given two strings word1 and word2, return the...

Delete Node In A BST Problem

LeetCode 450. Given a root node reference of a BST...

Convert BST To Greater Tree Problem

LeetCode 538. Given the root of a Binary Search Tree...

Convert A Number To Hexadecimal Problem

LeetCode 405. Given an integer num, return a string representing...

Contiguous Array Problem

LeetCode 525. Given a binary array nums, return the maximum...

Construct The Rectangle Problem

LeetCode 492. A web developer needs to know how to...

Construct Quad Tree Problem

LeetCode 427. Given a n * n matrix grid of...

Complex Number Multiplication Problem

LeetCode 537. A complex number can be represented as a...

Water And Jug Problem Problem

LeetCode 365. You are given two jugs with capacities jug1Capacity...

UTF-8 Validation Problem

LeetCode 393. Given an integer array data representing the data,...

Fizz Buzz Problem

LeetCode 412. Given an integer n, return a string array...

Coin Change II Problem

LeetCode 518. You are given an integer array coins representing...

Circular Array Loop Problem

LeetCode 457. You are playing a game involving a circular...

Can I Win Problem

LeetCode 464. In the “100 game” two players take turns...

Brick Wall Problem

LeetCode 554. There is a rectangular brick wall in front...

Binary Watch Problem

LeetCode 401. A binary watch has 4 LEDs on the...

Binary Tree Tilt Problem

LeetCode 563. Given the root of a binary tree, return...

Beautiful Arrangement Problem

LeetCode 526. Suppose you have n integers labeled 1 through...

Battleships In A Board Problem

LeetCode 419. Given an m x n matrix board where...

Base 7 Problem

LeetCode 504. Given an integer num, return a string of...

Assign Cookies Problem

LeetCode 455. Assume you are an awesome parent and want...

Array Partition I Problem

LeetCode 561. Given an integer array nums of 2n integers,...

Array Nesting Problem

LeetCode 565. You are given an integer array nums of...

Arranging Coins Problem

LeetCode 441. You have n coins and you want to...

Arithmetic Slices Problem

LeetCode 413. An integer array is called arithmetic if it...

Arithmetic Slices II - Subsequence Problem

LeetCode 446. Given an integer array nums, return the number...

All O'One Data Structure Problem

LeetCode 432. Design a data structure to store the strings...

Add Two Numbers II Problem

LeetCode 445. You are given two non-empty linked lists representing...

Add Strings Problem

LeetCode 415. Given two non-negative integers, num1 and num2 represented...

132 Pattern Problem

LeetCode 456. Given an arrayof n integers nums, a 132...

01 Matrix Problem

LeetCode 542. Given an m x n binary matrix mat,...

Wiggle Subsequence Problem

LeetCode 376. A wiggle sequence is a sequence where the...

Verify Preorder Serialization Of A Binary Tree Problem

LeetCode 331. One way to serialize a binary tree is...

Valid Anagram Problem

LeetCode 242. Given two strings s and t, return true...

Ugly Number Problem

LeetCode 263. An ugly number is a positive integer whose...

Ugly Number II Problem

LeetCode 264. An ugly number is a positive integer whose...

Top K Frequent Elements Problem

LeetCode 347. Given an integer array nums and an integer...

Super Ugly Number Problem

LeetCode 313. A super ugly number is a positive integer...

Super Pow Problem

LeetCode 372. Your task is to calculate a^b mod 1337...

Summary Ranges Problem

LeetCode 228. You are given a sorted unique integer array...

Sum Of Two Integers Problem

LeetCode 371. Given two integers a and b, return the...

Sliding Window Maximum Problem

LeetCode 239. You are given an array of integersnums, there...

Single Number III Problem

LeetCode 260. Given an integer array nums, in which exactly...

Shuffle An Array Problem

LeetCode 384. Given an integer array nums, design an algorithm...

Shortest Palindrome Problem

LeetCode 214. You are given a string s. You can...

Serialize And Deserialize Binary Tree Problem

LeetCode 297. Serialization is the process of converting a data...

Self Crossing Problem

LeetCode 335. You are given an array of integers distance....

Search A 2D Matrix II Problem

LeetCode 240. Write an efficient algorithm that searches for a...

Rotate Function Problem

LeetCode 396. You are given an integer array nums of...

Reverse Vowels Of A String Problem

LeetCode 345. Given a string s, reverse only all the...

Reverse String Problem

LeetCode 344. Write a function that reverses a string. The...

Remove Linked List Elements Problem

LeetCode 203. Given the head of a linked list and...

Remove Invalid Parentheses Problem

LeetCode 301. Given a string s that contains parentheses and...

Remove Duplicate Letters Problem

LeetCode 316. Given a string s, remove duplicate letters so...

Rectangle Area Problem

LeetCode 223. Given the coordinates of two rectilinear rectangles in...

Word Pattern Problem

LeetCode 290. Given a pattern and a string s, find...

Ransom Note Problem

LeetCode 383. Given two stings ransomNote and magazine, return true...

Range Sum Query - Immutable Problem

LeetCode 303. Given an integer array nums, handle multiple queries...

Range Sum Query 2D - Immutable Problem

LeetCode 304. Given a 2D matrix matrix, handle multiple queries...

Random Pick Index Problem

LeetCode 398. Given an integer array nums with possible duplicates,...

Product Of Array Except Self Problem

LeetCode 238. Given an integer array nums, return an array...

Power Of Two Problem

LeetCode 231. Given an integer n, return true if it...

Power Of Three Problem

LeetCode 326. Given an integer n, return true if it...

Power Of Four Problem

LeetCode 342. Given an integer n, return true if it...

Perfect Squares Problem

LeetCode 279. Given an integer n, return the least number...

Perfect Rectangle Problem

LeetCode 391. Given an array rectangles where rectangles[i] = [x_i,...

Peeking Iterator Problem

LeetCode 284. Design an iterator that supports the peek operation...

Patching Array Problem

LeetCode 330. Given a sorted integer array nums and an...

Palindrome Pairs Problem

LeetCode 336. Given a list of unique words, return all...

Odd Even Linked List Problem

LeetCode 328. Given the head of a singly linked list,...

Number Of Digit One Problem

LeetCode 233. Given an integer n, count the total number...

Nth Digit Problem

LeetCode 400. Given an integer n, return the n^th digit...

Nim Game Problem

LeetCode 292. You are playing the following Nim Game with...

Move Zeroes Problem

LeetCode 283. Given an integer array nums, move all 0’s...

Missing Number Problem

LeetCode 268. Given an array nums containing n distinct numbers...

Minimum Size Subarray Sum Problem

LeetCode 209. Given an array of positive integers nums and...

Minimum Height Trees Problem

LeetCode 310. A tree is an undirected graph in which...

Mini Parser Problem

LeetCode 385. Given a string s represents the serialization of...

Maximum Product Of Word Lengths Problem

LeetCode 318. Given a string array words, return the maximum...

Maximal Square Problem

LeetCode 221. Given an m x n binary matrix filled...

Majority Element II Problem

LeetCode 229. Given an integer array of size n, find...

Lowest Common Ancestor Of A Binary Tree Problem

LeetCode 236. Given a binary tree, find the lowest common...

Lowest Common Ancestor Of A Binary Search Tree Problem

LeetCode 235. Given a binary search tree (BST), find the...

Longest Substring With At Least K Repeating Characters Problem

LeetCode 395. Given a string s and an integer k,...

Longest Increasing Subsequence Problem

LeetCode 300. Given an integer array nums, return the length...

Longest Increasing Path In A Matrix Problem

LeetCode 329. Given an m x n integers matrix, return...

Longest Absolute File Path Problem

LeetCode 388. Suppose we have a file system that stores...

Linked List Random Node Problem

LeetCode 382. Given a singly linked list, return a random...

Lexicographical Numbers Problem

LeetCode 386. Given an integer n, return all the numbers...

Largest Divisible Subset Problem

LeetCode 368. Given a set of distinct positive integers nums,...

Kth Smallest Element In A Sorted Matrix Problem

LeetCode 378. Given an n x n matrix where each...

Kth Smallest Element In A BST Problem

LeetCode 230. Given the root of a binary search tree,...

Kth Largest Element In An Array Problem

LeetCode 215. Given an integer array nums and an integer...

Isomorphic Strings Problem

LeetCode 205. Given two strings s and t, determine if...

Is Subsequence Problem

LeetCode 392. Given two strings s and t, return true...

Invert Binary Tree Problem

LeetCode 226. Given the root of a binary tree, invert...

Intersection Of Two Arrays II Problem

LeetCode 350. Given two integer arrays nums1 and nums2, return...

Integer To English Words Problem

LeetCode 273. Convert a non-negative integer num to its English...

Integer Replacement Problem

LeetCode 397. Given a positive integer n,you can apply one...

Integer Break Problem

LeetCode 343. Given an integer n, break it into the...

Insert Delete Getrandom O(1) - Duplicates Allowed Problem

LeetCode 381. RandomizedCollection is a data structure that contains a...

Increasing Triplet Subsequence Problem

LeetCode 334. Given an integer array nums, return true if...

Implement Stack Using Queues Problem

LeetCode 225. Implement a last-in-first-out (LIFO) stack using only two...

Implement Queue Using Stacks Problem

LeetCode 232. Implement a first in first out (FIFO) queue...

House Robber III Problem

LeetCode 337. The thief has found himself a new place...

House Robber II Problem

LeetCode 213. You are a professional robber planning to rob...

Happy Number Problem

LeetCode 202. Write an algorithm to determine if a number...

H-Index Problem

LeetCode 274. Given an array of integers citations where citations[i]...

H-Index II Problem

LeetCode 275. Given an array of integers citations where citations[i]...

Guess Number Higher Or Lower Problem

LeetCode 374. We are playing the Guess Game. The game...

Guess Number Higher Or Lower II Problem

LeetCode 375. We are playing the Guessing Game. The game...

Game Of Life Problem

LeetCode 289. The Game of Life, also known simply as...

Flatten Nested List Iterator Problem

LeetCode 341. You are given a nested list of integers...

First Unique Character In A String Problem

LeetCode 387. Given a string s, find the first non-repeating...

First Bad Version Problem

LeetCode 278. You are a product manager and currently leading...

Find The Duplicate Number Problem

LeetCode 287. Given an array of integers nums containingn +...

Find The Difference Problem

LeetCode 389. You are given two strings s and t....

Find Median From Data Stream Problem

LeetCode 295. The median is the middle value in an...

Find K Pairs With Smallest Sums Problem

LeetCode 373. You are given two integer arrays nums1 and...

Expression Add Operators Problem

LeetCode 282. Given a string num that contains only digits...

Evaluate Division Problem

LeetCode 399. You are given an array of variable pairs...

Elimination Game Problem

LeetCode 390. You have a list arr of all integers...

Different Ways To Add Parentheses Problem

LeetCode 241. Given a string expression of numbers and operators,...

Design Twitter Problem

LeetCode 355. Design a simplified version of Twitter where users...

Design Add And Search Words Data Structure Problem

LeetCode 211. Design a data structure that supports adding new...

Delete Node In A Linked List Problem

LeetCode 237. Write a function to delete a node in...

Decode String Problem

LeetCode 394. Given an encoded string, return its decoded string....

Data Stream As Disjoint Intervals Problem

LeetCode 352. Given a data stream input of non-negative integers...

Create Maximum Number Problem

LeetCode 321. You are given two integer arrays nums1 and...

Course Schedule Problem

LeetCode 207. There are a total of numCourses courses you...

Course Schedule II Problem

LeetCode 210. There are a total of numCourses courses you...

Counting Bits Problem

LeetCode 338. Given an integer n, return an array ans...

Count Primes Problem

LeetCode 204. Given an integer n, return the number of...

Count Of Smaller Numbers After Self Problem

LeetCode 315. You are given an integer array nums and...

Count Of Range Sum Problem

LeetCode 327. Given an integer array nums and two integers...

Count Numbers With Unique Digits Problem

LeetCode 357. Given an integer n, return the count of...

Count Complete Tree Nodes Problem

LeetCode 222. Given the root of a complete binary tree,...

Contains Duplicate Problem

LeetCode 217. Given an integer array nums, return true if...

Contains Duplicate III Problem

LeetCode 220. Given an integer array nums and two integers...

Contains Duplicate II Problem

LeetCode 219. Given an integer array nums and an integer...

Combination Sum IV Problem

LeetCode 377. Given an array of distinct integers nums and...

Combination Sum III Problem

LeetCode 216. Find all valid combinations of k numbers that...

Coin Change Problem

LeetCode 322. You are given an integer array coins representing...

Burst Balloons Problem

LeetCode 312. You are given n balloons, indexed from 0...

Bulls And Cows Problem

LeetCode 299. You are playing the Bulls and Cows game...

Bulb Switcher Problem

LeetCode 319. There are n bulbs that are initially off....

Bitwise And Of Numbers Range Problem

LeetCode 201. Given two integers left and right that represent...

Binary Tree Paths Problem

LeetCode 257. Given the root of a binary tree, return...

Best Time To Buy And Sell Stock With Cooldown Problem

LeetCode 309. You are given an array prices where prices[i]...

Basic Calculator Problem

LeetCode 224. Given a string s representing a valid expression,...

Basic Calculator II Problem

LeetCode 227. Given a string s which represents an expression,...

Additive Number Problem

LeetCode 306. Additive number is a string whose digits can...

Add Digits Problem

LeetCode 258. Given an integer num, repeatedly add all its...

Rotate Array Problem

LeetCode 189. Given an array, rotate the array to the...

Reverse Words In A String Problem

LeetCode 151. Given an input string s, reverse the order...

Reverse Bits Problem

LeetCode 190. Reverse bits of a given 32 bits unsigned...

Repeated DNA Sequences Problem

LeetCode 187. The DNA sequence is composed of a series...

Number Of 1 Bits Problem

LeetCode 191. Write a function that takes an unsigned integer...

Min Stack Problem

LeetCode 155. Design a stack that supports push, pop, top,...

Maximum Product Subarray Problem

LeetCode 152. Given an integer array nums, find a contiguous...

Maximum Gap Problem

LeetCode 164. Given an integer array nums, return the maximum...

Majority Element Problem

LeetCode 169. Given an array nums of size n, return...

Largest Number Problem

LeetCode 179. Given a list of non-negative integers nums, arrange...

Intersection Of Two Linked Lists Problem

LeetCode 160. Given the heads of two singly linked-lists headA...

House Robber Problem

LeetCode 198. You are a professional robber planning to rob...

Fraction To Recurring Decimal Problem

LeetCode 166. Given two integers representing the numerator and denominator...

Find Peak Element Problem

LeetCode 162. A peak element is an element that is...

Find Minimum In Rotated Sorted Array Problem

LeetCode 153. Suppose an array of length n sorted in...

Find Minimum In Rotated Sorted Array II Problem

LeetCode 154. Suppose an array of length n sorted in...

Factorial Trailing Zeroes Problem

LeetCode 172. Given an integer n, return the number of...

Excel Sheet Column Title Problem

LeetCode 168. Given an integer columnNumber, return its corresponding column...

Excel Sheet Column Number Problem

LeetCode 171. Given a string columnTitle that represents the column...

Dungeon Game Problem

LeetCode 174. The demons had captured the princess and imprisoned...

Compare Version Numbers Problem

LeetCode 165. Given two version numbers,version1 and version2, compare them....

Binary Tree Right Side View Problem

LeetCode 199. Given the root of a binary tree, imagine...

Binary Search Tree Iterator Problem

LeetCode 173. Implement the BSTIterator class that represents an iterator...

Best Time To Buy And Sell Stock IV Problem

LeetCode 188. You are given an integer array prices where...

Word Break Problem

LeetCode 139. Given a string s and a dictionary of...

Word Break II Problem

LeetCode 140. Given a string s and a dictionary of...

Sort List Problem

LeetCode 148. Given the head of a linked list, return...

Single Number Problem

LeetCode 136. Given a non-empty array of integers nums, every...

Single Number II Problem

LeetCode 137. Given an integer array nums whereevery element appears...

Reorder List Problem

LeetCode 143. You are given the head of a singly...

Palindrome Partitioning Problem

LeetCode 131. Given a string s, partition s such that...

Palindrome Partitioning II Problem

LeetCode 132. Given a string s, partition s such that...

Max Points On A Line Problem

LeetCode 149. Given an array of points where points[i] =...

Lru Cache Problem

LeetCode 146. Design a data structure that follows the constraints...

Linked List Cycle Problem

LeetCode 141. Given head, the head of a linked list,...

Linked List Cycle II Problem

LeetCode 142. Given the head of a linked list, return...

Insertion Sort List Problem

LeetCode 147. Given the head of a singly linked list,...

Gas Station Problem

LeetCode 134. There are n gas stations along a circular...

Evaluate Reverse Polish Notation Problem

LeetCode 150. Evaluate the value of an arithmetic expression in...

Copy List With Random Pointer Problem

LeetCode 138. A linked list of length n is given...

Clone Graph Problem

LeetCode 133. Given a reference of a node in a...

Candy Problem

LeetCode 135. There are n children standing in a line....

Binary Tree Preorder Traversal Problem

LeetCode 144. Given the root of a binary tree, return...

Binary Tree Postorder Traversal Problem

LeetCode 145. Given the root of abinary tree, return the...

Word Ladder Problem

LeetCode 127. Given two words, beginWord and endWord, and a...

Word Ladder II Problem

LeetCode 126. Given two words, beginWord and endWord, and a...

Valid Palindrome Problem

LeetCode 125. A phrase is a palindrome if, after converting...

Triangle Problem

LeetCode 120. Given a triangle array, return the minimum path...

Surrounded Regions Problem

LeetCode 130. Given an m x n matrix board containing...

Sum Root To Leaf Numbers Problem

LeetCode 129. You are given the root of a binary...

Populating Next Right Pointers In Each Node Problem

LeetCode 116. You are given a perfect binary tree where...

Populating Next Right Pointers In Each Node II Problem

LeetCode 117. Given a binary tree, populate each next pointer...

Path Sum Problem

LeetCode 112. Given the root of a binary tree and...

Path Sum II Problem

LeetCode 113. Given the root of a binary tree and...

Pascal's Triangle Problem

LeetCode 118. Given an integer numRows, return the first numRows...

Pascal's Triangle II Problem

LeetCode 119. Given an integer rowIndex, return the rowIndex^th (0-indexed)...

Minimum Depth Of Binary Tree Problem

LeetCode 111. Given a binary tree, find its minimum depth....

Longest Consecutive Sequence Problem

LeetCode 128. Given an unsorted array of integers nums, return...

Flatten Binary Tree To Linked List Problem

LeetCode 114. Given the root of a binary tree, flatten...

Distinct Subsequences Problem

LeetCode 115. Given two strings s and t, return the...

Convert Sorted List To Binary Search Tree Problem

LeetCode 109. Given the head of a singly linked list...

Binary Tree Maximum Path Sum Problem

LeetCode 124. A path in a binary tree is a...

Best Time To Buy And Sell Stock Problem

LeetCode 121. You are given an array prices where prices[i]...

Best Time To Buy And Sell Stock Iii Problem

LeetCode 123. You are given an array prices where prices[i]...

Best Time To Buy And Sell Stock Ii Problem

LeetCode 122. You are given an integer array prices where...

Balanced Binary Tree Problem

LeetCode 110. Given a binary tree, determine if it is...

Symmetric Tree Problem

LeetCode 101. Given the root of a binary tree, check...

Maximum Depth of Binary Tree Problem

LeetCode 104. Given the root of a binary tree, return...

Convert Sorted Array to Binary Search Tree Problem

LeetCode 108. Given an integer array nums where the elements...

Construct Binary Tree from Preorder and Inorder Traversal Problem

LeetCode 105. Given two integer arrays preorder and inorder where...

Construct Binary Tree From Inorder And Postorder Traversal Problem

LeetCode 106. Given two integer arrays inorder and postorder where...

Binary Tree Zigzag Level Order Traversal Problem

LeetCode 103. Given the root of a binary tree, return...

Binary Tree Level Order Traversal Problem

LeetCode 102. Given the root of a binary tree, return...

Binary Tree Level Order Traversal II Problem

LeetCode 107. Given the root of a binary tree, return...

Validate Binary Search Tree Problem

LeetCode 98. Given the root of a binary tree, determine...

Same Tree Problem

LeetCode 100. Given the roots of two binary trees p...

Recover Binary Search Tree Problem

LeetCode 99. You are given the root of a binary...

Remove Duplicates from Sorted List Problem

LeetCode 83. Given the head of a sorted linked list,...

Remove Duplicates from Sorted List II Problem

LeetCode 82. Given the head of a sorted linked list,...

Binary Tree Inorder Traversal Problem

LeetCode 94. Given an m x n grid of characters...

Sort Colors Problem

LeetCode 75. Given an array nums with n objects colored...

Simplify Path Problem

LeetCode 71. Given a string path, which is an absolute...

Set Matrix Zeroes Problem

LeetCode 73. Given an m x n integer matrix matrix,...

Minimum Window Substring Problem

LeetCode 76. Given two strings s and t of lengths...

Edit Distance Problem

LeetCode 72. Given two strings word1 and word2, return the...

Combinations Problem

LeetCode 77. Given two integers n and k, return all...

Valid Number Problem

LeetCode 65. Given a string s, return true if s...

Unique Paths Problem

LeetCode 62. A robot is located at the top-left corner...

Unique Paths II Problem

LeetCode 63. A robot is located at the top-left corner...

Text Justification Problem

LeetCode 68. Given an array of strings words and a...

Rotate List Problem

LeetCode 61. Given the head of a linked list, rotate...

Plus One Problem

LeetCode 66. You are given a large integer represented as...

Minimum Path Sum Problem

LeetCode 64. Given a m x n grid filled with...

Climbing Stairs Problem

LeetCode 70. You are climbing a staircase. It takes n...

Valid Number Problem

LeetCode 67. A robot is located at the top-left corner...

Spiral Matrix Problem

LeetCode 54. Given an m x n matrix, return all...

Spiral Matrix II Problem

LeetCode 59. Given a positive integer n, generate an n...

Length Of Last Word Problem

LeetCode 58. Given a string s consisting of some words...

Insert Interval Problem

LeetCode 57. Insert newInterval into intervals such that intervals is...

Zigzag Conversion Problem

LeetCode 6. Write the code that will take a string...

Search in Rotated Sorted Array Problem

LeetCode 36. Determine if a 9 x 9 Sudoku board...

Trapping Rain Water Problem

LeetCode 42. Given n non-negative integers representing an elevation map...

Substring with Concatenation of All Words Problem

LeetCode 30. You are given a string s and an...

Search in Rotated Sorted Array Problem

LeetCode 33. Given the array nums after the possible rotation...

Rotate Image Problem

LeetCode 48. Determine if a 9 x 9 Sudoku board...

Reverse Nodes in k-Group Problem

LeetCode 25. Given a linked list, reverse the nodes of...

Remove Element Problem

LeetCode 27. Given an integer array nums and an integer...

Palindrome Number Problem

LeetCode 9. Given an integer x, return true if x...

Next Permutation Problem

LeetCode 31. Implement next permutation, which rearranges numbers into the...

Multiply Strings Problem

LeetCode 43. Given two non-negative integers num1 and num2 represented...

Longest Valid Parentheses Problem

LeetCode 32. Given a string containing just the characters ‘(‘...

Jump Game II Problem

LeetCode 45. Given an array of non-negative integers nums, you...

Integer to Roman Problem

LeetCode 12. Given an integer, convert it to a roman...

Implement strStr() Problem

LeetCode 28. Implement strStr().

Group Anagrams Problem

LeetCode 49. Given an array of strings strs, group the...

Divide Two Integers Problem

LeetCode 29. Write the code that will take a string...

Count and Say Problem

LeetCode 38. Write the code that will take a string...

3Sum Closest Problem

LeetCode 16. Given an integer array nums of length n...

Valid Parentheses Problem

LeetCode 20. Given a string s containing just the characters...

Swap Nodes in Pairs Problem

LeetCode 24. Given a linked list, swap every two adjacent...

Remove Nth Node From End of List Problem

LeetCode 19. Given the head of a linked list, remove...

Remove Duplicates from Sorted Array Problem

LeetCode 26. Given an integer array nums sorted in non-decreasing...

Longest Common Prefix Problem

LeetCode 14. Write a function to find the longest common...

Generate Parentheses Problem

LeetCode 22. Given n pairs of parentheses, write a function...

Depth of BST Given Insertion Order Problem

LeetCode 1902. You are given a 0-indexed integer array order...

Smallest Greater Multiple Made of Two Digits Problem

LeetCode 1999. Given three integers, k, digit1, and digit2, you...

Reverse Prefix of Word Problem

LeetCode 2000. Given a 0-indexed string word and a character...

Determine Color Of A Chessboard Square Problem

LeetCode 1812. You are given coordinates, a string that represents...

String To Interger (atoi) Problem

LeetCode 8. Implement the myAtoi(string s) function, which converts a...

Longest Substring Without Repeating Characters Problem

LeetCode 3. Given a string s, find the length of...

Add Two Numbers Problem

LeetCode 2. You are given two non-empty linked lists representing...

Sum Of Unique Elements Problem

LeetCode 1748. You are given an integer array nums. The...

Insert Delete GetRandom O(1) Problem

LeetCode 380. Implement a RandomizedSet class.

N-Repeated Element In Size 2N Array Problem

LeetCode 961. In a array A of size 2N, there...

Intersection Of Two Arrays Problem

LeetCode 349. Given two arrays, write a function to compute...

Intersection Of Three Sorted Arrays Problem

LeetCode 1213. Given three integer arrays arr1, arr2 and arr3...

Jewels And Stones Problem

LeetCode 771. You’re given strings jewels representing the types of...

Number Of Good Pairs Problem

LeetCode 1512. Given an array of integers nums. Return the...

Kth Missing Positive Number Problem

LeetCode 1539. Given an array arr of positive integers sorted...

Maximum Equal Frequency Problem

LeetCode 1224. Given an array nums of positive integers, return...

Reverse Linked List Problem

LeetCode 206. Reverse a singly linked list.

Reverse Linked List II Problem

LeetCode 92. Reverse a linked list from position m to...

Palindrome Linked List Problem

LeetCode 234. Given a singly linked list, determine if it’s...

Merge K Sorted Lists Problem

LeetCode 23. You are given an array of k linked-lists...

Merge Two Sorted Lists Problem

LeetCode 21. Merge two sorted linked lists and return a...

Stream of Characters Problem

LeetCode 1032. Implement the StreamChecker class as follows. Constructor, initialize...

Maximum XOR of Two Numbers in an Array Problem

LeetCode 421. Given an integer array nums, return the maximum...

Implement Trie (Prefix Tree) Problem

LeetCode 208. Implement a Trie with insert, search, and startsWith...

Camelcase Matching Problem

LeetCode 1023. A query word matches a given pattern if...

Word Search II Problem

LeetCode 212. Given an m x n board of characters...

Replace Words Problem

LeetCode 648. Given a dictionary consisting of many roots, and...

Longest Word In Dictionary Problem

LeetCode 720. Given a list of strings words representing an...

Concatenate Words Problem

LeetCode 472. Given a list of words (without duplicates), return...

Category Algorithm

X Of A Kind In A Deck Of Cards Problem

LeetCode 914. In a deck of cards, each card has...

Word Subsets Problem

LeetCode 916. You are given two string arrays words1 and...

Walking Robot Simulation Problem

LeetCode 874. A robot on an infinite XY-plane starts at...

Vowel Spellchecker Problem

LeetCode 966. Given a wordlist, we want to implement a...

Vertical Order Traversal Of A Binary Tree Problem

LeetCode 987. Given the root of a binary tree, calculate...

Verifying An Alien Dictionary Problem

LeetCode 953. In an alien language, surprisingly, they also use...

Validate Stack Sequences Problem

LeetCode 946. Given two integer arrays pushed and popped each...

Valid Permutations For DI Sequence Problem

LeetCode 903. You are given a string s of length...

Valid Mountain Array Problem

LeetCode 941. Given an array of integers arr, return true...

Univalued Binary Tree Problem

LeetCode 965. A binary tree is uni-valued if every node...

Unique Paths III Problem

LeetCode 980. You are given an m x n integer...

Unique Morse Code Words Problem

LeetCode 804. International Morse Code defines a standard encoding where...

Unique Email Addresses Problem

LeetCode 929. Every valid email consists of a local name...

Uncommon Words From Two Sentences Problem

LeetCode 884. A sentence is a string of single-space separated...

Triples With Bitwise And Equal To Zero Problem

LeetCode 982. Given an integer array nums, return the number...

Transpose Matrix Problem

LeetCode 867. Given a 2D integer array matrix, return the...

Time Based Key-Value Store Problem

LeetCode 981. Design a time-based key-value data structure that can...

Three Equal Parts Problem

LeetCode 927. You are given an array arr which consists...

Tallest Billboard Problem

LeetCode 956. You are installing a billboard and want it...

Surface Area Of 3D Shapes Problem

LeetCode 892. You are given an n x n grid...

Super Palindromes Problem

LeetCode 906. Let’s say a positive integer is a super-palindrome...

Super Egg Drop Problem

LeetCode 887. You are given k identical eggs and you...

Sum Of Subsequence Widths Problem

LeetCode 891. The width of a sequence is the difference...

Sum Of Subarray Minimums Problem

LeetCode 907. Given an array of integers arr, find the...

Sum Of Even Numbers After Queries Problem

LeetCode 985. You are given an integer array nums and...

Sum Of Distances In Tree Problem

LeetCode 834. There is an undirected connected tree with n...

Subdomain Visit Count Problem

LeetCode 811. A website domain “discuss.leetcode.com” consists of various subdomains....

Subarrays With K Different Integers Problem

LeetCode 992. Given an integer array nums and an integer...

String Without Aaa Or Bbb Problem

LeetCode 984. Given two integers a and b, return any...

Stone Game Problem

LeetCode 877. Alice and Bob play a game with piles...

Stamping The Sequence Problem

LeetCode 936. You are given two strings stamp and target....

Squares Of A Sorted Array Problem

LeetCode 977. Given an integer array nums sorted in non-decreasing...

Split Array With Same Average Problem

LeetCode 805. You are given an integer array nums.

Split Array Into Fibonacci Sequence Problem

LeetCode 842. You are given a string of digits num,...

Spiral Matrix III Problem

LeetCode 885. You start at the cell (rStart, cStart) of...

Soup Servings Problem

LeetCode 808. There are two types of soup, type A...

Sort Array By Parity Problem

LeetCode 905. Given an integer array nums, move all the...

Sort Array By Parity II Problem

LeetCode 922. Given an array of integers nums, half of...

Sort An Array Problem

LeetCode 912. Given an array of integers nums, sort the...

Snakes And Ladders Problem

LeetCode 909. You are given an n x n integer...

Smallest Subtree With All The Deepest Nodes Problem

LeetCode 865. Given the root of a binary tree, the...

Smallest String Starting From Leaf Problem

LeetCode 988. You are given the root of a binary...

Smallest Range II Problem

LeetCode 910. You are given an integer array nums and...

Smallest Range I Problem

LeetCode 908. You are given an integer array nums and...

Similar String Groups Problem

LeetCode 839. Two strings Xand Yare similar if we can...

Shortest Subarray With Sum At Least K Problem

LeetCode 862. Given an integer array nums and an integer...

Shortest Path Visiting All Nodes Problem

LeetCode 847. You have an undirected, connected graph of n...

Shortest Path To Get All Keys Problem

LeetCode 864. You are given an m x n grid...

Shortest Distance To A Character Problem

LeetCode 821. Given a string s and a character c...

Shortest Bridge Problem

LeetCode 934. You are given an n x n binary...

Short Encoding Of Words Problem

LeetCode 820. A valid encoding of an array of words...

Shifting Letters Problem

LeetCode 848. You are given a string s of lowercase...

Score Of Parentheses Problem

LeetCode 856. Given a balanced parentheses string s, return the...

Score After Flipping Matrix Problem

LeetCode 861. You are given an m x n binary...

Satisfiability Of Equality Equations Problem

LeetCode 990. You are given an array of strings equations...

Rotting Oranges Problem

LeetCode 994. You are given an m x n grid...

Rle Iterator Problem

LeetCode 900. We can use run-length encoding (i.e., RLE) to...

Reverse Only Letters Problem

LeetCode 917. Given a string s, reverse the string according...

Reveal Cards In Increasing Order Problem

LeetCode 950. You are given an integer array deck. There...

Reordered Power Of 2 Problem

LeetCode 869. You are given an integer n. We reorder...

Reorder Data In Log Files Problem

LeetCode 937. You are given an array of logs. Each...

Regions Cut By Slashes Problem

LeetCode 959. An n x n grid is composed of...

Rectangle Overlap Problem

LeetCode 836. An axis-aligned rectangle is represented as a list...

Rectangle Area II Problem

LeetCode 850. You are given a 2D array of axis-aligned...

Reachable Nodes In Subdivided Graph Problem

LeetCode 882. You are given an undirected graph (the “original...

Range Sum Of BST Problem

LeetCode 938. Given the root node of a binary search...

Race Car Problem

LeetCode 818. Your car starts at position 0 and speed...

Push Dominoes Problem

LeetCode 838. There are n dominoes in a line, and...

Projection Area Of 3D Shapes Problem

LeetCode 883. You are given an n x n grid...

Profitable Schemes Problem

LeetCode 879. There is a group of n members, and...

Prison Cells After N Days Problem

LeetCode 957. There are 8 prison cells in a row...

Prime Palindrome Problem

LeetCode 866. Given an integer n, return the smallest prime...

Powerful Integers Problem

LeetCode 970. Given three integers x, y, and bound, return...

Possible Bipartition Problem

LeetCode 886. We want to split a group of n...

Positions Of Large Groups Problem

LeetCode 830. In a string sof lowercase letters, these letters...

Peak Index In A Mountain Array Problem

LeetCode 852. Let’s call an array arr a mountainif the...

Partition Array Into Disjoint Intervals Problem

LeetCode 915. Given an integer array nums, partition it into...

Pancake Sorting Problem

LeetCode 969. Given an array of integers arr, sort the...

Orderly Queue Problem

LeetCode 899. You are given a string s and an...

Online Stock Span Problem

LeetCode 901. Design an algorithm that collects daily price quotes...

Online Election Problem

LeetCode 911. You are given two integer arrays persons and...

Odd Even Jump Problem

LeetCode 975. You are given an integer array arr. From...

Numbers With Same Consecutive Differences Problem

LeetCode 967. Return all non-negative integers of length n such...

Numbers At Most N Given Digit Set Problem

LeetCode 902. Given an array of digits which is sorted...

Number Of Squareful Arrays Problem

LeetCode 996. An array is squareful if the sum of...

Number Of Recent Calls Problem

LeetCode 933. You have a RecentCounter class which counts the...

Number Of Music Playlists Problem

LeetCode 920. Your music player contains n different songs. You...

Number Of Lines To Write String Problem

LeetCode 806. You are given a string s of lowercase...

Nth Magical Number Problem

LeetCode 878. A positive integer is magical if it is...

New 21 Game Problem

LeetCode 837. Alice plays the following game, loosely based on...

Most Stones Removed With Same Row Or Column Problem

LeetCode 947. On a 2D plane, we place n stones...

Most Profit Assigning Work Problem

LeetCode 826. You have n jobs and m workers. You...

Most Common Word Problem

LeetCode 819. Given a string paragraph and a string array...

Monotonic Array Problem

LeetCode 896. An array is monotonic if it is either...

Mirror Reflection Problem

LeetCode 858. There is a special square room with mirrors...

Minimum Swaps To Make Sequences Increasing Problem

LeetCode 801. You are given two integer arrays of the...

Minimum Number Of Refueling Stops Problem

LeetCode 871. A car travels from a starting position to...

Minimum Number Of K Consecutive Bit Flips Problem

LeetCode 995. You are given a binary array nums and...

Minimum Increment To Make Array Unique Problem

LeetCode 945. You are given an integer array nums. In...

Minimum Falling Path Sum Problem

LeetCode 931. Given an n x n array of integers...

Minimum Cost To Merge Stones Problem

LeetCode 1000. There are n piles of stones arranged in...

Minimum Cost To Hire K Workers Problem

LeetCode 857. There are n workers. You are given two...

Minimum Cost For Tickets Problem

LeetCode 983. You have planned some train traveling one year...

Minimum Area Rectangle Problem

LeetCode 939. You are given an array of points in...

Minimum Area Rectangle II Problem

LeetCode 963. You are given an array of points in...

Minimum Add To Make Parentheses Valid Problem

LeetCode 921. A parentheses string is valid if and only...

Minimize Malware Spread Problem

LeetCode 924. You are given a network of n nodes...

Minimize Malware Spread II Problem

LeetCode 928. You are given a network of n nodes...

Middle Of The Linked List Problem

LeetCode 876. Given the head of a singly linked list,...

Maximum Width Ramp Problem

LeetCode 962. A ramp in an integer array nums is...

Maximum Sum Circular Subarray Problem

LeetCode 918. Given a circular integer array nums of length...

Maximum Frequency Stack Problem

LeetCode 895. Design a stack-like data structure to push elements...

Maximum Binary Tree II Problem

LeetCode 998. A maximum tree is a tree where every...

Maximize Distance To Closest Person Problem

LeetCode 849. You are given an array representing a row...

Max Increase To Keep City Skyline Problem

LeetCode 807. There is a city composed of n x...

Masking Personal Information Problem

LeetCode 831. You are given a personal information string s,...

Making A Large Island Problem

LeetCode 827. You are given an n x n binary...

Magic Squares In Grid Problem

LeetCode 840. A 3 x 3 magic square is a...

Loud And Rich Problem

LeetCode 851. There is a group of n people labeled...

Longest Turbulent Subarray Problem

LeetCode 978. Given an integer array arr, return the length...

Longest Mountain In Array Problem

LeetCode 845. Given an integer array arr, return the length...

Long Pressed Name Problem

LeetCode 925. Your friend is typing his name into a...

Linked List Components Problem

LeetCode 817. You are given the head of a linked...

Length Of Longest Fibonacci Subsequence Problem

LeetCode 873. Given a strictly increasing array arr of positive...

Lemonade Change Problem

LeetCode 860. At a lemonade stand, each lemonade costs $5....

Least Operators To Express Number Problem

LeetCode 964. Given a single positive integer x, we will...

Leaf-Similar Trees Problem

LeetCode 872. Consider all the leaves of a binary tree,...

Largest Triangle Area Problem

LeetCode 812. Given an array of points on the X-Y...

Largest Time For Given Digits Problem

LeetCode 949. Given an arrayarr of 4 digits, find the...

Largest Sum Of Averages Problem

LeetCode 813. You are given an integer array nums and...

Largest Perimeter Triangle Problem

LeetCode 976. Given an integer array nums, return the largest...

Largest Component Size By Common Factor Problem

LeetCode 952. You are given an integer array of unique...

Koko Eating Bananas Problem

LeetCode 875. Koko loves to eat bananas. There are n...

Knight Dialer Problem

LeetCode 935. The chess knight has a unique movement, it...

Keys And Rooms Problem

LeetCode 841. There are n rooms labeled from 0 to...

K-Similar Strings Problem

LeetCode 854. Strings s1 and s2 are k-similar (for some...

K Closest Points To Origin Problem

LeetCode 973. Given an array of points where points[i] =...

Interval List Intersections Problem

LeetCode 986. You are given two lists of closed intervals,...

Increasing Order Search Tree Problem

LeetCode 897. Given the root of a binary search tree,...

Image Overlap Problem

LeetCode 835. You are given two images, img1 and img2,...

Hand Of Straights Problem

LeetCode 846. Alice has some number of cards and she...

Guess The Word Problem

LeetCode 843. This is an interactive problem.

Groups Of Special-Equivalent Strings Problem

LeetCode 893. You are given an array of strings of...

Goat Latin Problem

LeetCode 824. You are given a string sentence that consist...

Fruit Into Baskets Problem

LeetCode 904. You are visiting a farm that has a...

Friends Of Appropriate Ages Problem

LeetCode 825. There are n persons on a social media...

Flipping An Image Problem

LeetCode 832. Given an n x n binary matrix image,...

Flip String To Monotone Increasing Problem

LeetCode 926. A binary string is monotone increasing if it...

Flip Equivalent Binary Trees Problem

LeetCode 951. For a binary tree T, we can define...

Flip Binary Tree To Match Preorder Traversal Problem

LeetCode 971. You are given the root of a binary...

Find The Town Judge Problem

LeetCode 997. In a town, there are n people labeled...

Find The Shortest Superstring Problem

LeetCode 943. Given an array of strings words, return the...

Find Eventual Safe States Problem

LeetCode 802. There is a directed graph of n nodes...

Find And Replace Pattern Problem

LeetCode 890. Given a list of strings words and a...

Find And Replace In String Problem

LeetCode 833. You are given a 0-indexed string s that...

Fair Candy Swap Problem

LeetCode 888. Alice and Bob have a different total number...

Expressive Words Problem

LeetCode 809. Sometimes people repeat letters to represent extra feeling....

Exam Room Problem

LeetCode 855. There is an exam room with n seats...

Equal Rational Numbers Problem

LeetCode 972. Given two strings s and t, each of...

Distribute Coins In Binary Tree Problem

LeetCode 979. You are given the root of a binary...

Distinct Subsequences II Problem

LeetCode 940. Given a string s, return the number of...

DI String Match Problem

LeetCode 942. A permutation perm of n + 1 integers...

Delete Columns To Make Sorted Problem

LeetCode 944. You are given an array of n strings...

Delete Columns To Make Sorted III Problem

LeetCode 960. You are given an array of n strings...

Delete Columns To Make Sorted II Problem

LeetCode 955. You are given an array of n strings...

Decoded String At Index Problem

LeetCode 880. You are given an encoded string s. To...

Cousins In Binary Tree Problem

LeetCode 993. Given the root of a binary tree with...

Count Unique Characters Of All Substrings Of A Given String Problem

LeetCode 828. Let’s define a function countUniqueChars(s) that returns the...

Construct Binary Tree From Preorder And Postorder Traversal Problem

LeetCode 889. Given two integer arrays, preorder and postorder where...

Consecutive Numbers Sum Problem

LeetCode 829. Given an integer n, return the number of...

Complete Binary Tree Inserter Problem

LeetCode 919. A complete binary tree is a binary tree...

Check Completeness Of A Binary Tree Problem

LeetCode 958. Given the root of a binary tree, determine...

Chalkboard Xor Game Problem

LeetCode 810. You are given an array of integers nums...

Cat And Mouse Problem

LeetCode 913. A game on an undirected graph is played...

Card Flipping Game Problem

LeetCode 822. You are given n cards, with a positive...

Car Fleet Problem

LeetCode 853. There are n cars going to the same...

Bus Routes Problem

LeetCode 815. You are given an array routes representing bus...

Buddy Strings Problem

LeetCode 859. Given two strings s and goal, return true...

Broken Calculator Problem

LeetCode 991. There is a broken calculator that has the...

Bricks Falling When Hit Problem

LeetCode 803. You are given an m x n binary...

Boats To Save People Problem

LeetCode 881. You are given an array people where people[i]...

Bitwise ORs Of Subarrays Problem

LeetCode 898. We have an array arr of non-negative integers....

Binary Trees With Factors Problem

LeetCode 823. Given an array of unique integers, arr, where...

Binary Tree Pruning Problem

LeetCode 814. Given the root of a binary tree, return...

Binary Tree Cameras Problem

LeetCode 968. You are given the root of a binary...

Binary Subarrays With Sum Problem

LeetCode 930. Given a binary array nums and an integer...

Binary Gap Problem

LeetCode 868. Given a positive integer n, find and return...

Beautiful Array Problem

LeetCode 932. Given the integer n, return any beautiful array...

Bag Of Tokens Problem

LeetCode 948. You have an initial power of power, an...

Backspace String Compare Problem

LeetCode 844. Given two strings s and t, return true...

Available Captures For Rook Problem

LeetCode 999. On an 8 x 8 chessboard, there is...

Array Of Doubled Pairs Problem

LeetCode 954. Given an integer array of even length arr,...

Ambiguous Coordinates Problem

LeetCode 816. We had some 2-dimensional coordinates, like “(1, 3)”...

All Possible Full Binary Trees Problem

LeetCode 894. Given an integer n, return a list of...

All Nodes Distance K In Binary Tree Problem

LeetCode 863. Given the root of a binary tree, the...

Advantage Shuffle Problem

LeetCode 870. You are given two integer arrays nums1 and...

Add To Array-Form Of Integer Problem

LeetCode 989. The array-form of an integer num is an...

3Sum With Multiplicity Problem

LeetCode 923. Given an integer array arr, and an integer...

Valid Triangle Number Problem

LeetCode 611. Given an integer array nums, return the number...

Valid Tic-Tac-Toe State Problem

LeetCode 794. Given a Tic-Tac-Toe board as a string array...

Valid Parenthesis String Problem

LeetCode 678. Given a string s containing only three types...

Valid Palindrome II Problem

LeetCode 680. Given a string s, return true if the...

Transform To Chessboard Problem

LeetCode 782. You are given an n x n binary...

Top K Frequent Words Problem

LeetCode 692. Given an array of strings words and an...

Toeplitz Matrix Problem

LeetCode 766. Given an m x n matrix, returntrueif the...

Task Scheduler Problem

LeetCode 621. Given a characters array tasks, representing the tasks...

Swim In Rising Water Problem

LeetCode 778. You are given an n x n integer...

Swap Adjacent In LR String Problem

LeetCode 777. In a string composed of ‘L’, ‘R’, and...

Strange Printer Problem

LeetCode 664. There is a strange printer with the following...

Stickers To Spell Word Problem

LeetCode 691. We are given n different types of stickers....

Split Linked List In Parts Problem

LeetCode 725. Given the head of a singly linked list...

Special Binary String Problem

LeetCode 761. Special binary strings are binary strings with the...

Solve The Equation Problem

LeetCode 640. Solve a given equation and return the value...

Sliding Puzzle Problem

LeetCode 773. On an 2 x 3 board, there are...

Shopping Offers Problem

LeetCode 638. In LeetCode Store, there are n items to...

Set Mismatch Problem

LeetCode 645. You have a set of integers s, which...

Set Intersection Size At Least Two Problem

LeetCode 757. You are given a 2D integer array intervals...

Self Dividing Numbers Problem

LeetCode 728. A self-dividing number is a number that is...

Robot Return To Origin Problem

LeetCode 657. There is a robot starting at the position...

Reorganize String Problem

LeetCode 767. Given a string s, rearrange the characters of...

Redundant Connection Problem

LeetCode 684. In this problem, a tree is an undirected...

Redundant Connection II Problem

LeetCode 685. In this problem, a rooted tree is a...

Reaching Points Problem

LeetCode 780. Given four integers sx, sy, tx, and ty,...

Range Module Problem

LeetCode 715. A Range Module is a module that tracks...

Random Pick With Blacklist Problem

LeetCode 710. You are given an integer n and an...

Rabbits In Forest Problem

LeetCode 781. There is a forest with an unknown number...

Pyramid Transition Matrix Problem

LeetCode 756. You are stacking blocks to form a pyramid....

Preimage Size Of Factorial Zeroes Function Problem

LeetCode 793. Let f(x) be the number of zeroes at...

Partition Labels Problem

LeetCode 763. You are given a string s. We want...

Parse Lisp Expression Problem

LeetCode 736. You are given a string expression representing a...

Open The Lock Problem

LeetCode 752. You have a lock in front of you...

Network Delay Time Problem

LeetCode 743. You are given a network of n nodes,...

My Calendar III Problem

LeetCode 732. A k-booking happens when k events have some...

My Calendar II Problem

LeetCode 731. You are implementing a program to use as...

My Calendar I Problem

LeetCode 729. You are implementing a program to use as...

Knight Probability In Chessboard Problem

LeetCode 688. On an n x n chessboard, a knight...

K-Th Symbol In Grammar Problem

LeetCode 779. We build a table of n rows (1-indexed)....

Find Pivot Index Problem

LeetCode 724. Given an array of integers nums, calculate the...

Exclusive Time Of Functions Problem

LeetCode 636. On a single-threaded CPU, we execute a program...

Escape The Ghosts Problem

LeetCode 789. You are playing a simplified PAC-MAN game on...

Dota2 Senate Problem

LeetCode 649. In the world of Dota2, there are two...

Cherry Pickup Problem

LeetCode 741. You are given an n x n grid...

2 Keys Keyboard Problem

LeetCode 650. There is only one character ‘A’ on the...

Two Sum IV - Input Is A BST Problem

LeetCode 653. Given the root of a Binary Search Tree...

Trim A Binary Search Tree Problem

LeetCode 669. Given the root of a binary search tree...

To Lower Case Problem

LeetCode 709. Given a string s, return the string after...

Sum Of Square Numbers Problem

LeetCode 633. Given a non-negative integer c, decide whether there’re...

Split Array Into Consecutive Subsequences Problem

LeetCode 659. You are given an integer array nums that...

Smallest Rotation With Highest Score Problem

LeetCode 798. You are given an array nums. You can...

Smallest Range Covering Elements From K Lists Problem

LeetCode 632. You have k lists of sorted integers in...

Shortest Completing Word Problem

LeetCode 748. Given a string licensePlate and an array of...

Second Minimum Node In A Binary Tree Problem

LeetCode 671. Given a non-empty special binary tree consisting of...

Search In A Binary Search Tree Problem

LeetCode 700. You are given the root of a binary...

Rotated Digits Problem

LeetCode 788. An integer x is a good if after...

Rotate String Problem

LeetCode 796. Given two strings s and goal, return true...

Repeated String Match Problem

LeetCode 686. Given two string s a and b, return...

Remove Comments Problem

LeetCode 722. Given a C++ program, remove comments from it....

Reach A Number Problem

LeetCode 754. You are standing at position 0 on an...

Print Binary Tree Problem

LeetCode 655. Given the root of a binary tree, construct...

Prime Number Of Set Bits In Binary Representation Problem

LeetCode 762. Given two integers left and right, return the...

Prefix And Suffix Search Problem

LeetCode 745. Design a special dictionary with some words that...

Partition To K Equal Sum Subsets Problem

LeetCode 698. Given an integer array nums and an integer...

Number Of Subarrays With Bounded Maximum Problem

LeetCode 795. Given an integer array nums and two integers...

Number Of Matching Subsequences Problem

LeetCode 792. Given a string s and an array of...

Number Of Longest Increasing Subsequence Problem

LeetCode 673. Given an integer arraynums, return the number of...

Number Of Atoms Problem

LeetCode 726. Given a string formula representing a chemical formula,return...

Non-Decreasing Array Problem

LeetCode 665. Given an array nums with n integers, your...

Monotone Increasing Digits Problem

LeetCode 738. An integer has monotone increasing digits if and...

Minimum Distance Between BST Nodes Problem

LeetCode 783. Given the root of a Binary Search Tree...

Minimum Ascii Delete Sum For Two Strings Problem

LeetCode 712. Given two strings s1 ands2, return the lowest...

Min Cost Climbing Stairs Problem

LeetCode 746. You are given an integer array cost where...

Merge Two Binary Trees Problem

LeetCode 617. You are given two binary trees root1 and...

Maximum Width Of Binary Tree Problem

LeetCode 662. Given the root of a binary tree, return...

Maximum Sum Of 3 Non-Overlapping Subarrays Problem

LeetCode 689. Given an integer array nums and an integer...

Maximum Product Of Three Numbers Problem

LeetCode 628. Given an integer array nums, find three numbers...

Maximum Length Of Repeated Subarray Problem

LeetCode 718. Given two integer arrays nums1 and nums2, return...

Maximum Length Of Pair Chain Problem

LeetCode 646. You are given an array of n pairs...

Max Chunks To Make Sorted Problem

LeetCode 769. You are given an integer array arr of...

Max Chunks To Make Sorted II Problem

LeetCode 768. You are given an integer array arr.

Longest Univalue Path Problem

LeetCode 687. Given the root of a binary tree, return...

Longest Continuous Increasing Subsequence Problem

LeetCode 674. Given an unsorted array of integers nums, return...

Letter Case Permutation Problem

LeetCode 784. Given a string s, we can transform every...

Kth Smallest Number In Multiplication Table Problem

LeetCode 668. Nearly everyone has used the Multiplication Table. The...

Is Graph Bipartite? Problem

LeetCode 785. There is an undirected graph with n nodes,...

Image Smoother Problem

LeetCode 661. An image smoother is a filter of the...

Global And Local Inversions Problem

LeetCode 775. You are given an integer array nums of...

Flood Fill Problem

LeetCode 733. An image is represented by an m x...

Find Smallest Letter Greater Than Target Problem

LeetCode 744. Given a characters array letters that is sorted...

Find Duplicate File In System Problem

LeetCode 609. Given a list paths of directory info, including...

Falling Squares Problem

LeetCode 699. There are several squares being dropped onto the...

Design Circular Queue Problem

LeetCode 622. Design your implementation of the circular queue. The...

Design Circular Deque Problem

LeetCode 641. Design your implementation of the circular double-ended queue...

Cut Off Trees For Golf Event Problem

LeetCode 675. You are asked to cut off all the...

Palindromic Substrings Problem

LeetCode 647. Given a string s, return the number of...

Maximum Swap Problem

LeetCode 670. You are given an integer num. You can...

Maximum Binary Tree Problem

LeetCode 654. You are given an integer array nums with...

Maximum Average Subarray I Problem

LeetCode 643. You are given an integer array nums consisting...

Max Area Of Island Problem

LeetCode 695. You are given an m x n binary...

Map Sum Pairs Problem

LeetCode 677. Design a map that allows you to do...

Largest Plus Sign Problem

LeetCode 764. You are given an integer n. You have...

Largest Number At Least Twice Of Others Problem

LeetCode 747. You are given an integer array nums where...

Kth Largest Element In A Stream Problem

LeetCode 703. Design a class to find the k^th largest...

K-Th Smallest Prime Fraction Problem

LeetCode 786. You are given a sorted integer array arr...

K Inverse Pairs Array Problem

LeetCode 629. For an integer array nums, an inverse pair...

Insert Into A Binary Search Tree Problem

LeetCode 701. You are given the root node of a...

Implement Magic Dictionary Problem

LeetCode 676. Design a data structure that is initialized with...

Find K-Th Smallest Pair Distance Problem

LeetCode 719. The distance of a pair of integers a...

Find K Closest Elements Problem

LeetCode 658. Given a sorted integer array arr, two integers...

Find Duplicate Subtrees Problem

LeetCode 652. Given the rootof a binary tree, return all...

Employee Importance Problem

LeetCode 690. You have a data structure of employee information,...

Domino And Tromino Tiling Problem

LeetCode 790. You have two types of tiles, a 2...

Design Linked List Problem

LeetCode 707. Design your implementation of the linked list. You...

Design Hashset Problem

LeetCode 705. Design a HashSet without using any built-in hash...

Design Hashmap Problem

LeetCode 706. Design a HashMap without using any built-in hash...

Delete And Earn Problem

LeetCode 740. You are given an integer array nums. You...

Degree Of An Array Problem

LeetCode 697. Given a non-empty array of non-negative integers nums,...

Decode Ways II Problem

LeetCode 639. A message containing letters from A-Z can be...

Daily Temperatures Problem

LeetCode 739. Given an array of integers temperatures represents the...

Custom Sort String Problem

LeetCode 791. You are given two strings order and s....

Cracking The Safe Problem

LeetCode 753. There is a safe protected by a password....

Course Schedule III Problem

LeetCode 630. There are n different online courses numbered from...

Couples Holding Hands Problem

LeetCode 765. There are n couples sitting in 2n seats...

Count Different Palindromic Subsequences Problem

LeetCode 730. Given a string s, return the number of...

Count Binary Substrings Problem

LeetCode 696. Give a binary string s, return the number...

Contain Virus Problem

LeetCode 749. A virus is spreading rapidly, and your task...

Construct String From Binary Tree Problem

LeetCode 606. Given the root of a binary tree, construct...

Cheapest Flights Within K Stops Problem

LeetCode 787. There are n cities connected by some number...

Champagne Tower Problem

LeetCode 799. We stack glasses in a pyramid, where the...

Can Place Flowers Problem

LeetCode 605. You have a long flowerbed in which some...

Bulb Switcher II Problem

LeetCode 672. There is a room with n bulbs labeled...

Binary Search Problem

LeetCode 704. Given an array of integers nums which is...

Binary Number With Alternating Bits Problem

LeetCode 693. Given a positive integer, check whether it has...

Best Time To Buy And Sell Stock With Transaction Fee Problem

LeetCode 714. You are given an array prices where prices[i]...

Beautiful Arrangement II Problem

LeetCode 667. Given two integers n and k, construct a...

Basic Calculator IV Problem

LeetCode 770. Given an expression such as expression = “e...

Baseball Game Problem

LeetCode 682. You are keeping score for a baseball game...

Average Of Levels In Binary Tree Problem

LeetCode 637. Given the root of a binary tree, return...

Asteroid Collision Problem

LeetCode 735. We are given an array asteroids of integers...

All Paths From Source To Target Problem

LeetCode 797. Given a directed acyclic graph (DAG) of n...

Add One Row To Tree Problem

LeetCode 623. Given the root of a binary tree and...

Accounts Merge Problem

LeetCode 721. Given a list of accounts where each element...

24 Game Problem

LeetCode 679. You are given an integer array cards of...

1-Bit And 2-Bit Characters Problem

LeetCode 717. We have two special characters, the first character...

Zuma Game Problem

LeetCode 488. You are playing a variation of the game...

Validate IP Address Problem

LeetCode 468. Given a string queryIP, return “IPv4” if IP...

Unique Substrings In Wraparound String Problem

LeetCode 467. We define the string s to be the...

Trapping Rain Water II Problem

LeetCode 407. Given an m x n integer matrix heightMap...

Total Hamming Distance Problem

LeetCode 477. The Hamming distance between two integers is the...

Third Maximum Number Problem

LeetCode 414. Given an integer array nums, return the third...

Teemo Attacking Problem

LeetCode 495. Our hero Teemo is attacking an enemy Ashe...

Tag Validator Problem

LeetCode 591. Given a string representing a code snippet, implement...

Super Washing Machines Problem

LeetCode 517. You have n super washing machines on a...

Strong Password Checker Problem

LeetCode 420. A password is considered strong if the below...

Random Point In Non-Overlapping Rectangles Problem

LeetCode 497. You are given an array of non-overlapping axis-aligned...

Predict The Winner Problem

LeetCode 486. You are given an integer array nums. Two...

Partition Equal Subset Sum Problem

LeetCode 416. Given a non-empty array nums containing only positive...

Pacific Atlantic Water Flow Problem

LeetCode 417. There is an m x n rectangular island...

Non-Negative Integers Without Consecutive Ones Problem

LeetCode 600. Given a positive integer n, return the number...

IPO Problem

LeetCode 502. Suppose LeetCode will start its IPO soon. In...

Frog Jump Problem

LeetCode 403. A frog is crossing a river. The river...

Freedom Trail Problem

LeetCode 514. In the video game Fallout 4, the quest...

Find The Closest Palindrome Problem

LeetCode 564. Given a string n representing an integer, return...

Erect The Fence Problem

LeetCode 587. You are given an array trees where trees[i]...

Valid Square Problem

LeetCode 593. Given the coordinates of four points in 2D...

Target Sum Problem

LeetCode 494. You are given an integer array nums and...

Sum Of Left Leaves Problem

LeetCode 404. Given the root of a binary tree, return...

Subtree Of Another Tree Problem

LeetCode 572. Given the roots of two binary trees root...

Student Attendance Record II Problem

LeetCode 552. An attendance record for a student can be...

Student Attendance Record I Problem

LeetCode 551. You are given a string s representing an...

String Compression Problem

LeetCode 443. Given an array of characters chars, compress it...

Split Array Largest Sum Problem

LeetCode 410. Given an array nums which consists of non-negative...

Sort Characters By Frequency Problem

LeetCode 451. Given a string s, sort it in decreasing...

Smallest Good Base Problem

LeetCode 483. Given an integer n represented as a string,...

Sliding Window Median Problem

LeetCode 480. The median is the middle value in an...

Single Element In A Sorted Array Problem

LeetCode 540. You are given a sorted array consisting of...

Shortest Unsorted Continuous Subarray Problem

LeetCode 581. Given an integer array nums, you need to...

Serialize And Deserialize BST Problem

LeetCode 449. Serialization is converting a data structure or object...

Reverse Words In A String III Problem

LeetCode 557. Given a string s, reverse the order of...

Reverse String II Problem

LeetCode 541. Given a string s and an integer k,...

Reverse Pairs Problem

LeetCode 493. Given an integer array nums, return the number...

Reshape The Matrix Problem

LeetCode 566. In MATLAB, there is a handy function called...

Repeated Substring Pattern Problem

LeetCode 459. Given a string s, check if it can...

Remove K Digits Problem

LeetCode 402. Given string num representing a non-negative integer num,...

Remove Boxes Problem

LeetCode 546. You are given several boxes with different colors...

Relative Ranks Problem

LeetCode 506. You are given an integer array score of...

Reconstruct Original Digits From English Problem

LeetCode 423. Given a string s containing an out-of-order English...

Range Addition II Problem

LeetCode 598. You are given an m x n matrix...

Random Pick With Weight Problem

LeetCode 528. You are given a 0-indexed array of positive...

Random Flip Matrix Problem

LeetCode 519. There is an m x n binary grid...

Queue Reconstruction By Height Problem

LeetCode 406. You are given an array of people, people,...

Poor Pigs Problem

LeetCode 458. There are buckets buckets of liquid, where exactly...

Permutation In String Problem

LeetCode 567. Given two strings s1 and s2, return true...

Perfect Number Problem

LeetCode 507. A perfect number is a positive integer that...

Path Sum III Problem

LeetCode 437. Given the root of a binary tree and...

Out Of Boundary Paths Problem

LeetCode 576. There is an m x n grid with...

Optimal Division Problem

LeetCode 553. You are given an integer array nums. The...

Ones And Zeroes Problem

LeetCode 474. You are given an array of binary strings...

Number Of Segments In A String Problem

LeetCode 434. You are given a string s, return the...

Number Of Provinces Problem

LeetCode 547. There are n cities. Some of them are...

Number Of Boomerangs Problem

LeetCode 447. You are given n points in the plane...

Number Complement Problem

LeetCode 476. The complement of an integer is the integer...

Non-Overlapping Intervals Problem

LeetCode 435. Given an array of intervals intervals where intervals[i]...

Next Greater Element III Problem

LeetCode 556. Given a positive integer n, find the smallest...

Next Greater Element II Problem

LeetCode 503. Given a circular integer array nums (i.e., the...

Next Greater Element I Problem

LeetCode 496. The next greater element of some element x...

N-Ary Tree Preorder Traversal Problem

LeetCode 589. Given the root of an n-ary tree, return...

N-Ary Tree Postorder Traversal Problem

LeetCode 590. Given the root of an n-ary tree, return...

N-Ary Tree Level Order Traversal Problem

LeetCode 429. Given an n-ary tree, return the level order...

Most Frequent Subtree Sum Problem

LeetCode 508. Given the root of a binary tree, return...

Minimum Time Difference Problem

LeetCode 539. Given a list of 24-hour clock time points...

Minimum Number Of Arrows To Burst Balloons Problem

LeetCode 452. There are some spherical balloons taped onto a...

Minimum Genetic Mutation Problem

LeetCode 433. A gene string can be represented by an...

Minimum Moves To Equal Array Elements Problem

LeetCode 453. Given an integer array nums of size n,...

Minimum Moves To Equal Array Elements II Problem

LeetCode 462. Given an integer array nums of size n,...

Minimum Index Sum Of Two Lists Problem

LeetCode 599. Suppose Andy and Doris want to choose a...

Minimum Absolute Difference In BST Problem

LeetCode 530. Given the root of a Binary Search Tree...

Minesweeper Problem

LeetCode 529. Let’s play the minesweeper game!

Maximum Depth Of N-Ary Tree Problem

LeetCode 559. Given a n-ary tree, find its maximum depth....

Max Consecutive Ones Problem

LeetCode 485. Given a binary array nums, return the maximum...

Matchsticks To Square Problem

LeetCode 473. You are given an integer array matchsticks where...

Magical String Problem

LeetCode 481. A magical string s consists of only ‘1’...

Longest Word In Dictionary Through Deleting Problem

LeetCode 524. Given a string s and a string array...

Longest Uncommon Subsequence II Problem

LeetCode 522. Given an array of strings strs, return the...

Longest Uncommon Subsequence I Problem

LeetCode 521. Given two strings a and b, return the...

Longest Repeating Character Replacement Problem

LeetCode 424. You are given a string s and an...

Longest Palindromic Subsequence Problem

LeetCode 516. Given a string s, find the longest palindromic...

Longest Palindrome Problem

LeetCode 409. Given a string s which consists of lowercase...

Longest Harmonious Subsequence Problem

LeetCode 594. We define a harmonious array as an array...

Logical Or Of Two Binary Grids Represented As Quad-Trees Problem

LeetCode 558. A Binary Matrix is a matrix in which...

License Key Formatting Problem

LeetCode 482. You are given a license key represented as...

LFU Cache Problem

LeetCode 460. Design and implement a data structure for a...

Largest Palindrome Product Problem

LeetCode 479. Given an integer n, return the largest palindromic...

Keyboard Row Problem

LeetCode 500. Given an array of strings words, return the...

K-Th Smallest In Lexicographical Order Problem

LeetCode 440. Given two integers n and k, return the...

K-Diff Pairs In An Array Problem

LeetCode 532. Given an array of integers nums and an...

Island Perimeter Problem

LeetCode 463. You are given row x col grid representing...

Increasing Subsequences Problem

LeetCode 491. Given an integer array nums, return all the...

Implement Rand10() Using Rand7() Problem

LeetCode 470. Given the API rand7() that generates a uniform...

Heaters Problem

LeetCode 475. Winter is coming! During the contest, your first...

Hamming Distance Problem

LeetCode 461. The Hamming distance between two integers is the...

Generate Random Point In A Circle Problem

LeetCode 478. Given the radius and the position of the...

Fraction Addition And Subtraction Problem

LeetCode 592. Given a string expression representing an expression of...

Flatten A Multilevel Doubly Linked List Problem

LeetCode 430. You are given a doubly linked list, which...

Find Right Interval Problem

LeetCode 436. You are given an array of intervals, where...

Find Mode In Binary Search Tree Problem

LeetCode 501. Given the root of a binary search tree...

Find Largest Value In Each Tree Row Problem

LeetCode 515. Given the root of a binary tree, return...

Find Bottom Left Tree Value Problem

LeetCode 513. Given the root of a binary tree, return...

Find All Numbers Disappeared In An Array Problem

LeetCode 448. Given an array nums of n integers where...

Find All Duplicates In An Array Problem

LeetCode 442. Given an integer array nums of length n...

Find All Anagrams In A String Problem

LeetCode 438. Given two strings s and p, return an...

Fibonacci Number Problem

LeetCode 509. The Fibonacci numbers, commonly denoted F(n) form a...

Encode And Decode TinyURL Problem

LeetCode 535. TinyURL is a URL shortening service where you...

Distribute Candies Problem

LeetCode 575. Alice has n candies, where the i^th candy...

Diagonal Traverse Problem

LeetCode 498. Given an m x n matrix mat, return...

Detect Capital Problem

LeetCode 520. We define the usage of capitals in a...

Delete Operation For Two Strings Problem

LeetCode 583. Given two strings word1 and word2, return the...

Delete Node In A BST Problem

LeetCode 450. Given a root node reference of a BST...

Convert BST To Greater Tree Problem

LeetCode 538. Given the root of a Binary Search Tree...

Convert A Number To Hexadecimal Problem

LeetCode 405. Given an integer num, return a string representing...

Contiguous Array Problem

LeetCode 525. Given a binary array nums, return the maximum...

Construct The Rectangle Problem

LeetCode 492. A web developer needs to know how to...

Construct Quad Tree Problem

LeetCode 427. Given a n * n matrix grid of...

Complex Number Multiplication Problem

LeetCode 537. A complex number can be represented as a...

Water And Jug Problem Problem

LeetCode 365. You are given two jugs with capacities jug1Capacity...

UTF-8 Validation Problem

LeetCode 393. Given an integer array data representing the data,...

Fizz Buzz Problem

LeetCode 412. Given an integer n, return a string array...

Coin Change II Problem

LeetCode 518. You are given an integer array coins representing...

Circular Array Loop Problem

LeetCode 457. You are playing a game involving a circular...

Can I Win Problem

LeetCode 464. In the “100 game” two players take turns...

Brick Wall Problem

LeetCode 554. There is a rectangular brick wall in front...

Binary Watch Problem

LeetCode 401. A binary watch has 4 LEDs on the...

Binary Tree Tilt Problem

LeetCode 563. Given the root of a binary tree, return...

Beautiful Arrangement Problem

LeetCode 526. Suppose you have n integers labeled 1 through...

Battleships In A Board Problem

LeetCode 419. Given an m x n matrix board where...

Base 7 Problem

LeetCode 504. Given an integer num, return a string of...

Assign Cookies Problem

LeetCode 455. Assume you are an awesome parent and want...

Array Partition I Problem

LeetCode 561. Given an integer array nums of 2n integers,...

Array Nesting Problem

LeetCode 565. You are given an integer array nums of...

Arranging Coins Problem

LeetCode 441. You have n coins and you want to...

Arithmetic Slices Problem

LeetCode 413. An integer array is called arithmetic if it...

Arithmetic Slices II - Subsequence Problem

LeetCode 446. Given an integer array nums, return the number...

All O'One Data Structure Problem

LeetCode 432. Design a data structure to store the strings...

Add Two Numbers II Problem

LeetCode 445. You are given two non-empty linked lists representing...

Add Strings Problem

LeetCode 415. Given two non-negative integers, num1 and num2 represented...

132 Pattern Problem

LeetCode 456. Given an arrayof n integers nums, a 132...

01 Matrix Problem

LeetCode 542. Given an m x n binary matrix mat,...

Wiggle Subsequence Problem

LeetCode 376. A wiggle sequence is a sequence where the...

Verify Preorder Serialization Of A Binary Tree Problem

LeetCode 331. One way to serialize a binary tree is...

Valid Anagram Problem

LeetCode 242. Given two strings s and t, return true...

Ugly Number Problem

LeetCode 263. An ugly number is a positive integer whose...

Ugly Number II Problem

LeetCode 264. An ugly number is a positive integer whose...

Top K Frequent Elements Problem

LeetCode 347. Given an integer array nums and an integer...

Super Ugly Number Problem

LeetCode 313. A super ugly number is a positive integer...

Super Pow Problem

LeetCode 372. Your task is to calculate a^b mod 1337...

Summary Ranges Problem

LeetCode 228. You are given a sorted unique integer array...

Sum Of Two Integers Problem

LeetCode 371. Given two integers a and b, return the...

Sliding Window Maximum Problem

LeetCode 239. You are given an array of integersnums, there...

Single Number III Problem

LeetCode 260. Given an integer array nums, in which exactly...

Shuffle An Array Problem

LeetCode 384. Given an integer array nums, design an algorithm...

Shortest Palindrome Problem

LeetCode 214. You are given a string s. You can...

Serialize And Deserialize Binary Tree Problem

LeetCode 297. Serialization is the process of converting a data...

Self Crossing Problem

LeetCode 335. You are given an array of integers distance....

Search A 2D Matrix II Problem

LeetCode 240. Write an efficient algorithm that searches for a...

Rotate Function Problem

LeetCode 396. You are given an integer array nums of...

Reverse Vowels Of A String Problem

LeetCode 345. Given a string s, reverse only all the...

Reverse String Problem

LeetCode 344. Write a function that reverses a string. The...

Remove Linked List Elements Problem

LeetCode 203. Given the head of a linked list and...

Remove Invalid Parentheses Problem

LeetCode 301. Given a string s that contains parentheses and...

Remove Duplicate Letters Problem

LeetCode 316. Given a string s, remove duplicate letters so...

Rectangle Area Problem

LeetCode 223. Given the coordinates of two rectilinear rectangles in...

Word Pattern Problem

LeetCode 290. Given a pattern and a string s, find...

Ransom Note Problem

LeetCode 383. Given two stings ransomNote and magazine, return true...

Range Sum Query - Immutable Problem

LeetCode 303. Given an integer array nums, handle multiple queries...

Range Sum Query 2D - Immutable Problem

LeetCode 304. Given a 2D matrix matrix, handle multiple queries...

Random Pick Index Problem

LeetCode 398. Given an integer array nums with possible duplicates,...

Product Of Array Except Self Problem

LeetCode 238. Given an integer array nums, return an array...

Power Of Two Problem

LeetCode 231. Given an integer n, return true if it...

Power Of Three Problem

LeetCode 326. Given an integer n, return true if it...

Power Of Four Problem

LeetCode 342. Given an integer n, return true if it...

Perfect Squares Problem

LeetCode 279. Given an integer n, return the least number...

Perfect Rectangle Problem

LeetCode 391. Given an array rectangles where rectangles[i] = [x_i,...

Peeking Iterator Problem

LeetCode 284. Design an iterator that supports the peek operation...

Patching Array Problem

LeetCode 330. Given a sorted integer array nums and an...

Palindrome Pairs Problem

LeetCode 336. Given a list of unique words, return all...

Odd Even Linked List Problem

LeetCode 328. Given the head of a singly linked list,...

Number Of Digit One Problem

LeetCode 233. Given an integer n, count the total number...

Nth Digit Problem

LeetCode 400. Given an integer n, return the n^th digit...

Nim Game Problem

LeetCode 292. You are playing the following Nim Game with...

Move Zeroes Problem

LeetCode 283. Given an integer array nums, move all 0’s...

Missing Number Problem

LeetCode 268. Given an array nums containing n distinct numbers...

Minimum Size Subarray Sum Problem

LeetCode 209. Given an array of positive integers nums and...

Minimum Height Trees Problem

LeetCode 310. A tree is an undirected graph in which...

Mini Parser Problem

LeetCode 385. Given a string s represents the serialization of...

Maximum Product Of Word Lengths Problem

LeetCode 318. Given a string array words, return the maximum...

Maximal Square Problem

LeetCode 221. Given an m x n binary matrix filled...

Majority Element II Problem

LeetCode 229. Given an integer array of size n, find...

Lowest Common Ancestor Of A Binary Tree Problem

LeetCode 236. Given a binary tree, find the lowest common...

Lowest Common Ancestor Of A Binary Search Tree Problem

LeetCode 235. Given a binary search tree (BST), find the...

Longest Substring With At Least K Repeating Characters Problem

LeetCode 395. Given a string s and an integer k,...

Longest Increasing Subsequence Problem

LeetCode 300. Given an integer array nums, return the length...

Longest Increasing Path In A Matrix Problem

LeetCode 329. Given an m x n integers matrix, return...

Longest Absolute File Path Problem

LeetCode 388. Suppose we have a file system that stores...

Linked List Random Node Problem

LeetCode 382. Given a singly linked list, return a random...

Lexicographical Numbers Problem

LeetCode 386. Given an integer n, return all the numbers...

Largest Divisible Subset Problem

LeetCode 368. Given a set of distinct positive integers nums,...

Kth Smallest Element In A Sorted Matrix Problem

LeetCode 378. Given an n x n matrix where each...

Kth Smallest Element In A BST Problem

LeetCode 230. Given the root of a binary search tree,...

Kth Largest Element In An Array Problem

LeetCode 215. Given an integer array nums and an integer...

Isomorphic Strings Problem

LeetCode 205. Given two strings s and t, determine if...

Is Subsequence Problem

LeetCode 392. Given two strings s and t, return true...

Invert Binary Tree Problem

LeetCode 226. Given the root of a binary tree, invert...

Intersection Of Two Arrays II Problem

LeetCode 350. Given two integer arrays nums1 and nums2, return...

Integer To English Words Problem

LeetCode 273. Convert a non-negative integer num to its English...

Integer Replacement Problem

LeetCode 397. Given a positive integer n,you can apply one...

Integer Break Problem

LeetCode 343. Given an integer n, break it into the...

Insert Delete Getrandom O(1) - Duplicates Allowed Problem

LeetCode 381. RandomizedCollection is a data structure that contains a...

Increasing Triplet Subsequence Problem

LeetCode 334. Given an integer array nums, return true if...

Implement Stack Using Queues Problem

LeetCode 225. Implement a last-in-first-out (LIFO) stack using only two...

Implement Queue Using Stacks Problem

LeetCode 232. Implement a first in first out (FIFO) queue...

House Robber III Problem

LeetCode 337. The thief has found himself a new place...

House Robber II Problem

LeetCode 213. You are a professional robber planning to rob...

Happy Number Problem

LeetCode 202. Write an algorithm to determine if a number...

H-Index Problem

LeetCode 274. Given an array of integers citations where citations[i]...

H-Index II Problem

LeetCode 275. Given an array of integers citations where citations[i]...

Guess Number Higher Or Lower Problem

LeetCode 374. We are playing the Guess Game. The game...

Guess Number Higher Or Lower II Problem

LeetCode 375. We are playing the Guessing Game. The game...

Game Of Life Problem

LeetCode 289. The Game of Life, also known simply as...

Flatten Nested List Iterator Problem

LeetCode 341. You are given a nested list of integers...

First Unique Character In A String Problem

LeetCode 387. Given a string s, find the first non-repeating...

First Bad Version Problem

LeetCode 278. You are a product manager and currently leading...

Find The Duplicate Number Problem

LeetCode 287. Given an array of integers nums containingn +...

Find The Difference Problem

LeetCode 389. You are given two strings s and t....

Find Median From Data Stream Problem

LeetCode 295. The median is the middle value in an...

Find K Pairs With Smallest Sums Problem

LeetCode 373. You are given two integer arrays nums1 and...

Expression Add Operators Problem

LeetCode 282. Given a string num that contains only digits...

Evaluate Division Problem

LeetCode 399. You are given an array of variable pairs...

Elimination Game Problem

LeetCode 390. You have a list arr of all integers...

Different Ways To Add Parentheses Problem

LeetCode 241. Given a string expression of numbers and operators,...

Design Twitter Problem

LeetCode 355. Design a simplified version of Twitter where users...

Design Add And Search Words Data Structure Problem

LeetCode 211. Design a data structure that supports adding new...

Delete Node In A Linked List Problem

LeetCode 237. Write a function to delete a node in...

Decode String Problem

LeetCode 394. Given an encoded string, return its decoded string....

Data Stream As Disjoint Intervals Problem

LeetCode 352. Given a data stream input of non-negative integers...

Create Maximum Number Problem

LeetCode 321. You are given two integer arrays nums1 and...

Course Schedule Problem

LeetCode 207. There are a total of numCourses courses you...

Course Schedule II Problem

LeetCode 210. There are a total of numCourses courses you...

Counting Bits Problem

LeetCode 338. Given an integer n, return an array ans...

Count Primes Problem

LeetCode 204. Given an integer n, return the number of...

Count Of Smaller Numbers After Self Problem

LeetCode 315. You are given an integer array nums and...

Count Of Range Sum Problem

LeetCode 327. Given an integer array nums and two integers...

Count Numbers With Unique Digits Problem

LeetCode 357. Given an integer n, return the count of...

Count Complete Tree Nodes Problem

LeetCode 222. Given the root of a complete binary tree,...

Contains Duplicate Problem

LeetCode 217. Given an integer array nums, return true if...

Contains Duplicate III Problem

LeetCode 220. Given an integer array nums and two integers...

Contains Duplicate II Problem

LeetCode 219. Given an integer array nums and an integer...

Combination Sum IV Problem

LeetCode 377. Given an array of distinct integers nums and...

Combination Sum III Problem

LeetCode 216. Find all valid combinations of k numbers that...

Coin Change Problem

LeetCode 322. You are given an integer array coins representing...

Burst Balloons Problem

LeetCode 312. You are given n balloons, indexed from 0...

Bulls And Cows Problem

LeetCode 299. You are playing the Bulls and Cows game...

Bulb Switcher Problem

LeetCode 319. There are n bulbs that are initially off....

Bitwise And Of Numbers Range Problem

LeetCode 201. Given two integers left and right that represent...

Binary Tree Paths Problem

LeetCode 257. Given the root of a binary tree, return...

Best Time To Buy And Sell Stock With Cooldown Problem

LeetCode 309. You are given an array prices where prices[i]...

Basic Calculator Problem

LeetCode 224. Given a string s representing a valid expression,...

Basic Calculator II Problem

LeetCode 227. Given a string s which represents an expression,...

Additive Number Problem

LeetCode 306. Additive number is a string whose digits can...

Add Digits Problem

LeetCode 258. Given an integer num, repeatedly add all its...

Rotate Array Problem

LeetCode 189. Given an array, rotate the array to the...

Reverse Words In A String Problem

LeetCode 151. Given an input string s, reverse the order...

Reverse Bits Problem

LeetCode 190. Reverse bits of a given 32 bits unsigned...

Repeated DNA Sequences Problem

LeetCode 187. The DNA sequence is composed of a series...

Number Of 1 Bits Problem

LeetCode 191. Write a function that takes an unsigned integer...

Min Stack Problem

LeetCode 155. Design a stack that supports push, pop, top,...

Maximum Product Subarray Problem

LeetCode 152. Given an integer array nums, find a contiguous...

Maximum Gap Problem

LeetCode 164. Given an integer array nums, return the maximum...

Majority Element Problem

LeetCode 169. Given an array nums of size n, return...

Largest Number Problem

LeetCode 179. Given a list of non-negative integers nums, arrange...

Intersection Of Two Linked Lists Problem

LeetCode 160. Given the heads of two singly linked-lists headA...

House Robber Problem

LeetCode 198. You are a professional robber planning to rob...

Fraction To Recurring Decimal Problem

LeetCode 166. Given two integers representing the numerator and denominator...

Find Peak Element Problem

LeetCode 162. A peak element is an element that is...

Find Minimum In Rotated Sorted Array Problem

LeetCode 153. Suppose an array of length n sorted in...

Find Minimum In Rotated Sorted Array II Problem

LeetCode 154. Suppose an array of length n sorted in...

Factorial Trailing Zeroes Problem

LeetCode 172. Given an integer n, return the number of...

Excel Sheet Column Title Problem

LeetCode 168. Given an integer columnNumber, return its corresponding column...

Excel Sheet Column Number Problem

LeetCode 171. Given a string columnTitle that represents the column...

Dungeon Game Problem

LeetCode 174. The demons had captured the princess and imprisoned...

Compare Version Numbers Problem

LeetCode 165. Given two version numbers,version1 and version2, compare them....

Binary Tree Right Side View Problem

LeetCode 199. Given the root of a binary tree, imagine...

Binary Search Tree Iterator Problem

LeetCode 173. Implement the BSTIterator class that represents an iterator...

Best Time To Buy And Sell Stock IV Problem

LeetCode 188. You are given an integer array prices where...

Word Break Problem

LeetCode 139. Given a string s and a dictionary of...

Word Break II Problem

LeetCode 140. Given a string s and a dictionary of...

Sort List Problem

LeetCode 148. Given the head of a linked list, return...

Single Number Problem

LeetCode 136. Given a non-empty array of integers nums, every...

Single Number II Problem

LeetCode 137. Given an integer array nums whereevery element appears...

Reorder List Problem

LeetCode 143. You are given the head of a singly...

Palindrome Partitioning Problem

LeetCode 131. Given a string s, partition s such that...

Palindrome Partitioning II Problem

LeetCode 132. Given a string s, partition s such that...

Max Points On A Line Problem

LeetCode 149. Given an array of points where points[i] =...

Lru Cache Problem

LeetCode 146. Design a data structure that follows the constraints...

Linked List Cycle Problem

LeetCode 141. Given head, the head of a linked list,...

Linked List Cycle II Problem

LeetCode 142. Given the head of a linked list, return...

Insertion Sort List Problem

LeetCode 147. Given the head of a singly linked list,...

Gas Station Problem

LeetCode 134. There are n gas stations along a circular...

Evaluate Reverse Polish Notation Problem

LeetCode 150. Evaluate the value of an arithmetic expression in...

Copy List With Random Pointer Problem

LeetCode 138. A linked list of length n is given...

Clone Graph Problem

LeetCode 133. Given a reference of a node in a...

Candy Problem

LeetCode 135. There are n children standing in a line....

Binary Tree Preorder Traversal Problem

LeetCode 144. Given the root of a binary tree, return...

Binary Tree Postorder Traversal Problem

LeetCode 145. Given the root of abinary tree, return the...

Word Ladder Problem

LeetCode 127. Given two words, beginWord and endWord, and a...

Word Ladder II Problem

LeetCode 126. Given two words, beginWord and endWord, and a...

Valid Palindrome Problem

LeetCode 125. A phrase is a palindrome if, after converting...

Triangle Problem

LeetCode 120. Given a triangle array, return the minimum path...

Surrounded Regions Problem

LeetCode 130. Given an m x n matrix board containing...

Sum Root To Leaf Numbers Problem

LeetCode 129. You are given the root of a binary...

Populating Next Right Pointers In Each Node Problem

LeetCode 116. You are given a perfect binary tree where...

Populating Next Right Pointers In Each Node II Problem

LeetCode 117. Given a binary tree, populate each next pointer...

Path Sum Problem

LeetCode 112. Given the root of a binary tree and...

Path Sum II Problem

LeetCode 113. Given the root of a binary tree and...

Pascal's Triangle Problem

LeetCode 118. Given an integer numRows, return the first numRows...

Pascal's Triangle II Problem

LeetCode 119. Given an integer rowIndex, return the rowIndex^th (0-indexed)...

Minimum Depth Of Binary Tree Problem

LeetCode 111. Given a binary tree, find its minimum depth....

Longest Consecutive Sequence Problem

LeetCode 128. Given an unsorted array of integers nums, return...

Flatten Binary Tree To Linked List Problem

LeetCode 114. Given the root of a binary tree, flatten...

Distinct Subsequences Problem

LeetCode 115. Given two strings s and t, return the...

Convert Sorted List To Binary Search Tree Problem

LeetCode 109. Given the head of a singly linked list...

Binary Tree Maximum Path Sum Problem

LeetCode 124. A path in a binary tree is a...

Best Time To Buy And Sell Stock Problem

LeetCode 121. You are given an array prices where prices[i]...

Best Time To Buy And Sell Stock Iii Problem

LeetCode 123. You are given an array prices where prices[i]...

Best Time To Buy And Sell Stock Ii Problem

LeetCode 122. You are given an integer array prices where...

Balanced Binary Tree Problem

LeetCode 110. Given a binary tree, determine if it is...

Interleaving String Problem

LeetCode 97. Given strings s1, s2, and s3, find whether...

Word Search Problem

LeetCode 79. Given an m x n grid of characters...

Unique Binary Search Trees Problem

LeetCode 96. Given an integer n, return the number of...

Unique Binary Search Trees II Problem

LeetCode 95. Given an integer n, return all the structurally...

Subsets Problem

LeetCode 78. Given an integer array nums of unique elements,...

Subsets II Problem

LeetCode 90. Given an integer array nums that may contain...

Search in Rotated Sorted Array II Problem

LeetCode 81. There is an integer array nums sorted in...

Scramble String Problem

LeetCode 87. Given two strings s1 and s2 of the...

Restore IP Addresses Problem

LeetCode 93. Given a string s containing only digits, return...

Remove Duplicates from Sorted Array II Problem

LeetCode 80. Given an integer array nums sorted in non-decreasing...

Partition List Problem

LeetCode 86. Given the head of a linked list and...

Merge Sorted Array Problem

LeetCode 88. You are given two integer arrays nums1 and...

Maximal Rectangle Problem

LeetCode 85. Given a rows x cols binary matrix filled...

Largest Rectangle in Histogram Problem

LeetCode 84. Given an array of integers heights representing the...

Gray Code Problem

LeetCode 89. Given an integer n, return any valid n-bit...

Decode Ways Problem

LeetCode 91. Given a string s containing only digits, return...

Search A 2D Matrix Problem

LeetCode 74. Write an efficient algorithm that searches for a...

Permutation Sequence Problem

LeetCode 60. Given n and k, return the kth permutation...

N-Queens Problem

LeetCode 51. Given an integer n, return all distinct solutions...

N-Queens II Problem

LeetCode 52. Given an integer n, return the number of...

Maximum Subarray Problem

LeetCode 53. Given an integer array nums, find the contiguous...

Jump Game Problem

LeetCode 55. Given an m x n matrix, return all...

Wildcard Matching Problem

LeetCode 44. Write the code that will take a string...

Sudoku Solver Problem

LeetCode 37. Write a program to solve a Sudoku puzzle...

Regular Expression Matching Problem

LeetCode 10. Given an input string s and a pattern...

Pow(x,n) Problem

LeetCode 50. Determine if a 9 x 9 Sudoku board...

Permutations Problem

LeetCode 46. Given an array nums of distinct integers, return...

Permutations II Problem

LeetCode 47. Given a collection of numbers, nums, that might...

First Missing Positive Problem

LeetCode 41. Given an unsorted integer array nums, return the...

Find First and Last Position of Element in Sorted Array Problem

LeetCode 34. Given the array nums after the possible rotation...

Combination Sum Problem

LeetCode 39. Given an array of distinct integers candidates and...

Combination Sum II Problem

LeetCode 40. Given a collection of candidate numbers (candidates) and...

Roman to Integer Problem

LeetCode 13. Given a roman numeral, convert it to an...

Reverse Integer Problem

LeetCode 7. Given a signed 32-bit integer x, return x...

Longest Palindromic Substring Problem

LeetCode 5. Given a string s, return the longest palindromic...

Letter Combinations of a Phone Number Problem

LeetCode 17. Given a string containing digits from 2-9 inclusive,...

Container With Most Water Problem

LeetCode 11. Given n non-negative integers a_1, a_2, …, a_n...

Number of Islands Problem

LeetCode 200. Given an m x n 2d grid map...

Merge Intervals Problem

LeetCode 56. Given an array of intervals, merge all overlapping...

Diameter of Binary Tree Problem

LeetCode 543. Given a binary tree, compute the diameter of...

Median of Two Sorted Arrays Problem

LeetCode 4. Given two sorted arrays nums1 and nums2 of...

Valid Perfect Square Problem

LeetCode 367. Given a positive integer num, write a function...

Sqrt(x) Problem

LeetCode 69. Given a non-negative integer x, compute and return...

Search Insert Position Problem

LeetCode 35. Given a sorted array of distinct integers and...

Two Sum Input Array Is Sorted Problem

LeetCode 167. Given an array of integers nums sorted in...

Subarray Sum Divisible By K Problem

LeetCode 974. Given an array of integers nums and an...

Four Sum II Problem

LeetCode 454. Given four lists A, B, C, D of...

Continuous Subarray Sum Problem

LeetCode 523. Given an array of non-negative integers nums and...

Two Sum Less Than K Problem

LeetCode 1099. Given an array of integers nums and an...

Subarray Sum Equals K Problem

LeetCode 560. Given an array of integers nums and an...

Subarray Product Less Than K Problem

LeetCode 713. Given an array of positive integers nums and...

Three Sum Problem

LeetCode 15. Given an array of integers nums, return all...

Four Sum Problem

LeetCode 18. Given an array of integers nums and an...

Two Sum Problem

LeetCode 1. Given an array of integers nums and an...

Category Tutorial

Write an LLVM Pass

In this post, I will show how I write an...