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