Tag LLVM

Write an LLVM Pass

In this post, I will show how I write an...


Tag Hash Table

Word Ladder Problem

LeetCode 127. Given two words, beginWord and endWord, and a...

Word Ladder II Problem

LeetCode 126. Given two words, beginWord and endWord, and a...

Longest Consecutive Sequence Problem

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

Construct Binary Tree from Preorder and Inorder Traversal Problem

LeetCode 105. Given two integer arrays preorder and inorder where...

Set Matrix Zeroes Problem

LeetCode 73. Given an m x n integer matrix matrix,...

Search in Rotated Sorted Array Problem

LeetCode 36. Determine if a 9 x 9 Sudoku board...

Integer to Roman Problem

LeetCode 12. Given an integer, convert it to a roman...

Group Anagrams Problem

LeetCode 49. Given an array of strings strs, group the...

First Missing Positive Problem

LeetCode 41. Given an unsorted integer array nums, return the...

Roman to Integer Problem

LeetCode 13. Given a roman numeral, convert it to an...

Letter Combinations of a Phone Number Problem

LeetCode 17. Given a string containing digits from 2-9 inclusive,...

Sum Of Unique Elements Problem

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

Insert Delete GetRandom O(1) Problem

LeetCode 380. Implement a RandomizedSet class.

N-Repeated Element In Size 2N Array Problem

LeetCode 961. In a array A of size 2N, there...

Intersection Of Two Arrays Problem

LeetCode 349. Given two arrays, write a function to compute...

Intersection Of Three Sorted Arrays Problem

LeetCode 1213. Given three integer arrays arr1, arr2 and arr3...

Jewels And Stones Problem

LeetCode 771. You’re given strings jewels representing the types of...

Number Of Good Pairs Problem

LeetCode 1512. Given an array of integers nums. Return the...

Kth Missing Positive Number Problem

LeetCode 1539. Given an array arr of positive integers sorted...

Maximum Equal Frequency Problem

LeetCode 1224. Given an array nums of positive integers, return...

Subarray Sum Divisible By K Problem

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

Four Sum II Problem

LeetCode 454. Given four lists A, B, C, D of...

Continuous Subarray Sum Problem

LeetCode 523. Given an array of non-negative integers nums and...

Subarray Sum Equals K Problem

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

Two Sum Problem

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

Tag Leetcode

Symmetric Tree Problem

LeetCode 101. Given the root of a binary tree, check...

Maximum Depth of Binary Tree Problem

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

Construct Binary Tree from Preorder and Inorder Traversal Problem

LeetCode 105. Given two integer arrays preorder and inorder where...

Construct Binary Tree From Inorder And Postorder Traversal Problem

LeetCode 106. Given two integer arrays inorder and postorder where...

Binary Tree Zigzag Level Order Traversal Problem

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

Binary Tree Level Order Traversal Problem

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

Binary Tree Level Order Traversal II Problem

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

Validate Binary Search Tree Problem

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

Same Tree Problem

LeetCode 100. Given the roots of two binary trees p...

Recover Binary Search Tree Problem

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

Interleaving String Problem

LeetCode 97. Given strings s1, s2, and s3, find whether...

Word Search Problem

LeetCode 79. Given an m x n grid of characters...

Unique Binary Search Trees Problem

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

Unique Binary Search Trees II Problem

LeetCode 95. Given an integer n, return all the structurally...

Subsets Problem

LeetCode 78. Given an integer array nums of unique elements,...

Subsets II Problem

LeetCode 90. Given an integer array nums that may contain...

Search in Rotated Sorted Array II Problem

LeetCode 81. There is an integer array nums sorted in...

Scramble String Problem

LeetCode 87. Given two strings s1 and s2 of the...

Restore IP Addresses Problem

LeetCode 93. Given a string s containing only digits, return...

Remove Duplicates from Sorted List Problem

LeetCode 83. Given the head of a sorted linked list,...

Remove Duplicates from Sorted List II Problem

LeetCode 82. Given the head of a sorted linked list,...

Remove Duplicates from Sorted Array II Problem

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

Partition List Problem

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

Merge Sorted Array Problem

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

Maximal Rectangle Problem

LeetCode 85. Given a rows x cols binary matrix filled...

Largest Rectangle in Histogram Problem

LeetCode 84. Given an array of integers heights representing the...

Gray Code Problem

LeetCode 89. Given an integer n, return any valid n-bit...

Decode Ways Problem

LeetCode 91. Given a string s containing only digits, return...

Binary Tree Inorder Traversal Problem

LeetCode 94. Given an m x n grid of characters...

Sort Colors Problem

LeetCode 75. Given an array nums with n objects colored...

Simplify Path Problem

LeetCode 71. Given a string path, which is an absolute...

Set Matrix Zeroes Problem

LeetCode 73. Given an m x n integer matrix matrix,...

Search A 2D Matrix Problem

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

Minimum Window Substring Problem

LeetCode 76. Given two strings s and t of lengths...

Edit Distance Problem

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

Combinations Problem

LeetCode 77. Given two integers n and k, return all...

Valid Number Problem

LeetCode 65. Given a string s, return true if s...

Unique Paths Problem

LeetCode 62. A robot is located at the top-left corner...

Unique Paths II Problem

LeetCode 63. A robot is located at the top-left corner...

Text Justification Problem

LeetCode 68. Given an array of strings words and a...

Rotate List Problem

LeetCode 61. Given the head of a linked list, rotate...

Plus One Problem

LeetCode 66. You are given a large integer represented as...

Minimum Path Sum Problem

LeetCode 64. Given a m x n grid filled with...

Climbing Stairs Problem

LeetCode 70. You are climbing a staircase. It takes n...

Valid Number Problem

LeetCode 67. A robot is located at the top-left corner...

Spiral Matrix Problem

LeetCode 54. Given an m x n matrix, return all...

Spiral Matrix II Problem

LeetCode 59. Given a positive integer n, generate an n...

Permutation Sequence Problem

LeetCode 60. Given n and k, return the kth permutation...

N-Queens Problem

LeetCode 51. Given an integer n, return all distinct solutions...

N-Queens II Problem

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

Maximum Subarray Problem

LeetCode 53. Given an integer array nums, find the contiguous...

Length Of Last Word Problem

LeetCode 58. Given a string s consisting of some words...

Jump Game Problem

LeetCode 55. Given an m x n matrix, return all...

Insert Interval Problem

LeetCode 57. Insert newInterval into intervals such that intervals is...

Zigzag Conversion Problem

LeetCode 6. Write the code that will take a string...

Wildcard Matching Problem

LeetCode 44. Write the code that will take a string...

Search in Rotated Sorted Array Problem

LeetCode 36. Determine if a 9 x 9 Sudoku board...

Trapping Rain Water Problem

LeetCode 42. Given n non-negative integers representing an elevation map...

Sudoku Solver Problem

LeetCode 37. Write a program to solve a Sudoku puzzle...

Search in Rotated Sorted Array Problem

LeetCode 33. Given the array nums after the possible rotation...

Rotate Image Problem

LeetCode 48. Determine if a 9 x 9 Sudoku board...

Reverse Nodes in k-Group Problem

LeetCode 25. Given a linked list, reverse the nodes of...

Remove Element Problem

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

Regular Expression Matching Problem

LeetCode 10. Given an input string s and a pattern...

Pow(x,n) Problem

LeetCode 50. Determine if a 9 x 9 Sudoku board...

Permutations Problem

LeetCode 46. Given an array nums of distinct integers, return...

Permutations II Problem

LeetCode 47. Given a collection of numbers, nums, that might...

Palindrome Number Problem

LeetCode 9. Given an integer x, return true if x...

Next Permutation Problem

LeetCode 31. Implement next permutation, which rearranges numbers into the...

Multiply Strings Problem

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

Jump Game II Problem

LeetCode 45. Given an array of non-negative integers nums, you...

Integer to Roman Problem

LeetCode 12. Given an integer, convert it to a roman...

Group Anagrams Problem

LeetCode 49. Given an array of strings strs, group the...

First Missing Positive Problem

LeetCode 41. Given an unsorted integer array nums, return the...

Find First and Last Position of Element in Sorted Array Problem

LeetCode 34. Given the array nums after the possible rotation...

Divide Two Integers Problem

LeetCode 29. Write the code that will take a string...

Count and Say Problem

LeetCode 38. Write the code that will take a string...

Combination Sum Problem

LeetCode 39. Given an array of distinct integers candidates and...

Combination Sum II Problem

LeetCode 40. Given a collection of candidate numbers (candidates) and...

3Sum Closest Problem

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

Valid Parentheses Problem

LeetCode 20. Given a string s containing just the characters...

Swap Nodes in Pairs Problem

LeetCode 24. Given a linked list, swap every two adjacent...

Roman to Integer Problem

LeetCode 13. Given a roman numeral, convert it to an...

Reverse Integer Problem

LeetCode 7. Given a signed 32-bit integer x, return x...

Remove Nth Node From End of List Problem

LeetCode 19. Given the head of a linked list, remove...

Remove Duplicates from Sorted Array Problem

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

Longest Palindromic Substring Problem

LeetCode 5. Given a string s, return the longest palindromic...

Longest Common Prefix Problem

LeetCode 14. Write a function to find the longest common...

Letter Combinations of a Phone Number Problem

LeetCode 17. Given a string containing digits from 2-9 inclusive,...

Generate Parentheses Problem

LeetCode 22. Given n pairs of parentheses, write a function...

Depth of BST Given Insertion Order Problem

LeetCode 1902. You are given a 0-indexed integer array order...

Container With Most Water Problem

LeetCode 11. Given n non-negative integers a_1, a_2, …, a_n...

Smallest Greater Multiple Made of Two Digits Problem

LeetCode 1999. Given three integers, k, digit1, and digit2, you...

Reverse Prefix of Word Problem

LeetCode 2000. Given a 0-indexed string word and a character...

Users That Actively Request Confirmation Messages Problem

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

Strong Friendship Problem

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

Leetcodify Similar Friends Problem

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

Leetcodify Friends Recommendations Problem

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

First and Last Call On the Same Day Problem

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

Find Cutoff Score for Each School Problem

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

Employees With Missing Information Problem

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

Employees Whose Manager Left the Company Problem

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

Count the Number of Experiments Problem

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

Count Salary Categories Problem

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

Confirmation Rate Problem

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

All the Pairs With the Maximum Number of Common Followers Problem

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

The Latest Login in 2020 Problem

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

Suspicious Bank Accounts Problem

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

Page Recommendations II Problem

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

Orders With Maximum Quantity Above Average Problem

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

Maximum Transaction Each Day Problem

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

League Statistics Problem

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

Group Employees of the Same Salary Problem

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

Find Customers With Positive Revenue this Year Problem

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

Convert Date Format Problem

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

Calculate Special Bonus Problem

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

Rearrange Products Table Problem

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

Find Interview Candidates Problem

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

Determine Color Of A Chessboard Square Problem

LeetCode 1812. You are given coordinates, a string that represents...

Ad-Free Sessions Problem

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

String To Interger (atoi) Problem

LeetCode 8. Implement the myAtoi(string s) function, which converts a...

Primary Department For Each Employee Problem

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

Grand Slam Titles Problem

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

Product's Price For Each Store Problem

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

Find The Subtasks That Did Not Execute Problem

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

Add Two Numbers Problem

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

Sum Of Unique Elements Problem

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

Recyclable And Low Fat Products Problem

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

Leetflex Banned Accounts Problem

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

Insert Delete GetRandom O(1) Problem

LeetCode 380. Implement a RandomizedSet class.

N-Repeated Element In Size 2N Array Problem

LeetCode 961. In a array A of size 2N, there...

Intersection Of Two Arrays Problem

LeetCode 349. Given two arrays, write a function to compute...

Intersection Of Three Sorted Arrays Problem

LeetCode 1213. Given three integer arrays arr1, arr2 and arr3...

Find Total Time Spent By Each Employee Problem

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

Jewels And Stones Problem

LeetCode 771. You’re given strings jewels representing the types of...

Number Of Good Pairs Problem

LeetCode 1512. Given an array of integers nums. Return the...

Kth Missing Positive Number Problem

LeetCode 1539. Given an array arr of positive integers sorted...

The Number Of Employees Which Report To Each Employee Problem

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

Find Followers Count Problem

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

Count Apples And Oranges Problem

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

Biggest Window Between Visits Problem

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

Total Sales Amount By Year Problem

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

Sales By Day Of The Week Problem

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

Hopper Company Queries III Problem

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

Get The Second Most Recent Activity Problem

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

Find The Quiet Students In All Exams Problem

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

Tournament Winners Problem

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

Students Report By Geography Problem

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

Report Contiguous Dates Problem

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

Median Employee Salary Problem

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

Market Analysis II Problem

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

Hopper Company Queries I Problem

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

Game Play Analysis V Problem

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

User Purchase Platform Problem

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

Trips And Users Problem

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

Number Of Transactions Per Visit Problem

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

Human Traffic Of Stadium Problem

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

Hopper Company Queries II Problem

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

Find Median Given Frequency Of Numbers Problem

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

Find Cumulative Salary Of An Employee Problem

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

Department Top Three Salaries Problem

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

Average Salary: Departments VS Company Problem

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

Unpopular Books Problem

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

Second Degree Follower Problem

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

Reported Posts II Problem

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

Number Of Calls Between Two Persons Problem

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

Nth Highest Salary Problem

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

New Users Daily Count Problem

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

Monthly Transactions II Problem

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

Get Highest Answer Rate Question Problem

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

Department Highest Salary Problem

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

Article Views II Problem

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

Active Users Problem

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

Winning Candidate Problem

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

Team Scores In Football Tournament Problem

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

Rank Scores Problem

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

Product Sales Analysis III Problem

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

Movie Rating Problem

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

Investments In 2016 Problem

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

Immediate Food Delivery II Problem

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

Friend Requests II: Who Has The Most Friends Problem

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

Countries You Can Safely Invest In Problem

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

Count Student Number In Departments Problem

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

Bank Account Summary Problem

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

Tree Node Problem

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

The Most Recent Orders For Each Product Problem

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

Shortest Distance In A Plane Problem

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

Rectangles Area Problem

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

Product Price At A Given Date Problem

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

Page Recommendations Problem

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

Monthly Transactions I Problem

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

Market Analysis I Problem

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

Managers With At Least 5 Direct Reports Problem

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

Find The Missing IDs Problem

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

Exchange Seats Problem

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

Customers Who Bought All Products Problem

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

Active Business Problem

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

The Most Recent Three Orders Problem

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

Restaurant Growth Problem

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

Project Employees III Problem

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

Number Of Trusted Contacts Of A Customer Problem

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

NPV Queries Problem

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

Last Person To Fit In The Elevator Problem

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

Highest Grade For Each Student Problem

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

Evaluate Boolean Expression Problem

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

Calculate Salaries Problem

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

Activity Participants Problem

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

User Activity For The Past 30 Days II Problem

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

The Most Frequently Ordered Products For Each Customer Problem

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

Running Total For Different Genders Problem

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

Friendly Movies Streamed Last Month Problem

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

Friend Requests I: Overall Acceptance Rate Problem

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

Find The Start And End Number Of Continuous Ranges Problem

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

Customers Who Bought Products A And B But Not C Problem

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

Classes More Than 5 Students Problem

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

Capital Gain/Loss Problem

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

Biggest Single Number Problem

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

Apples & Oranges Problem

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

All People Report To The Given Manager Problem

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

Weather Type In Each Country Problem

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

User Activity For The Past 30 Days I Problem

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

Triangle Judgement Problem

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

Students And Examinations Problem

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

Sales Person Problem

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

Sales Analysis III Problem

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

Sales Analysis II Problem

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

Reported Posts Problem

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

Queries Quality And Percentage Problem

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

Project Employees II Problem

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

Project Employees I Problem

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

Number Of Comments Per Post Problem

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

Not Boring Movies Problem

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

Fix Product Name Format Problem

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

Consecutive Available Seats Problem

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

Ads Performance Problem

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

Top Travellers Problem

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

Swap Salary Problem

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

Shortest Distance Problem

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

Sales Analysis I Problem

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

Reformat Department Table Problem

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

Product Sales Analysis II Problem

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

Product Sales Analysis I Problem

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

List The Products Ordered In A Period Problem

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

Immediate Food Delivery I Problem

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

Find Users With Valid Emails Problem

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

Find Customer Referee Problem

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

Customer Placing The Largest Number Of Orders Problem

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

Customer Order Frequency Problem

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

Create A Session Bar Chart Problem

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

Big Countries Problem

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

Average Selling Price Problem

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

Article Views I Problem

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

Actors And Directors Who Cooperated At Least Three Times Problem

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

Unique Orders And Customers Per Month Problem

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

Sellers With No Sales Problem

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

Rising Temperature Problem

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

Game Play Analysis IV Problem

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

Game Play Analysis III Problem

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

Game Play Analysis II Problem

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

Game Play Analysis I Problem

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

Employee Bonus Problem

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

Delete Duplicate Emails Problem

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

Daily Leads And Partners Problem

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

Customer Who Visited But Did Not Make Any Transactions Problem

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

Product's Worth Over Invoices Problem

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

Percentage Of Users Attended A Contest Problem

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

Fix Names In A Table Problem

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

Duplicate Emails Problem

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

Customers Who Never Order Problem

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

Consecutive Numbers Problem

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

Average Time Of Process Per Machine Problem

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

Second Highest Salary Problem

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

Employees Earning More Than Their Managers Problem

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

Bank Account Summary II Problem

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

Group Sold Products By The Date Problem

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

All Valid Triplets That Can Represent A Country Problem

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

Warehouse Manager Problem

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

Students With Invalid Departments Problem

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

Replace Employee ID With The Unique Identifier Problem

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

Patients With A Condition Problem

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

Invalid Tweets Problem

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

Find The Team Size Problem

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

Combine Two Tables Problem

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

Maximum Equal Frequency Problem

LeetCode 1224. Given an array nums of positive integers, return...

Number of Islands Problem

LeetCode 200. Given an m x n 2d grid map...

Merge Intervals Problem

LeetCode 56. Given an array of intervals, merge all overlapping...

Diameter of Binary Tree Problem

LeetCode 543. Given a binary tree, compute the diameter of...

Reverse Linked List Problem

LeetCode 206. Reverse a singly linked list.

Reverse Linked List II Problem

LeetCode 92. Reverse a linked list from position m to...

Palindrome Linked List Problem

LeetCode 234. Given a singly linked list, determine if it’s...

Merge K Sorted Lists Problem

LeetCode 23. You are given an array of k linked-lists...

Merge Two Sorted Lists Problem

LeetCode 21. Merge two sorted linked lists and return a...

Median of Two Sorted Arrays Problem

LeetCode 4. Given two sorted arrays nums1 and nums2 of...

Valid Perfect Square Problem

LeetCode 367. Given a positive integer num, write a function...

Sqrt(x) Problem

LeetCode 69. Given a non-negative integer x, compute and return...

Search Insert Position Problem

LeetCode 35. Given a sorted array of distinct integers and...

Stream of Characters Problem

LeetCode 1032. Implement the StreamChecker class as follows. Constructor, initialize...

Maximum XOR of Two Numbers in an Array Problem

LeetCode 421. Given an integer array nums, return the maximum...

Implement Trie (Prefix Tree) Problem

LeetCode 208. Implement a Trie with insert, search, and startsWith...

Camelcase Matching Problem

LeetCode 1023. A query word matches a given pattern if...

Word Search II Problem

LeetCode 212. Given an m x n board of characters...

Two Sum Input Array Is Sorted Problem

LeetCode 167. Given an array of integers nums sorted in...

Subarray Sum Divisible By K Problem

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

Replace Words Problem

LeetCode 648. Given a dictionary consisting of many roots, and...

Longest Word In Dictionary Problem

LeetCode 720. Given a list of strings words representing an...

Four Sum II Problem

LeetCode 454. Given four lists A, B, C, D of...

Continuous Subarray Sum Problem

LeetCode 523. Given an array of non-negative integers nums and...

Concatenate Words Problem

LeetCode 472. Given a list of words (without duplicates), return...

Two Sum Less Than K Problem

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

Subarray Sum Equals K Problem

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

Subarray Product Less Than K Problem

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

Three Sum Problem

LeetCode 15. Given an array of integers nums, return all...

Four Sum Problem

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

Two Sum Problem

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

Tag Two Pointer

Palindrome Linked List Problem

LeetCode 234. Given a singly linked list, determine if it’s...

Two Sum Input Array Is Sorted Problem

LeetCode 167. Given an array of integers nums sorted in...

Two Sum Less Than K Problem

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

Subarray Product Less Than K Problem

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

Three Sum Problem

LeetCode 15. Given an array of integers nums, return all...

Four Sum Problem

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

Tag Trie

Stream of Characters Problem

LeetCode 1032. Implement the StreamChecker class as follows. Constructor, initialize...

Maximum XOR of Two Numbers in an Array Problem

LeetCode 421. Given an integer array nums, return the maximum...

Implement Trie (Prefix Tree) Problem

LeetCode 208. Implement a Trie with insert, search, and startsWith...

Camelcase Matching Problem

LeetCode 1023. A query word matches a given pattern if...

Word Search II Problem

LeetCode 212. Given an m x n board of characters...

Replace Words Problem

LeetCode 648. Given a dictionary consisting of many roots, and...

Longest Word In Dictionary Problem

LeetCode 720. Given a list of strings words representing an...

Concatenate Words Problem

LeetCode 472. Given a list of words (without duplicates), return...


Number of Islands Problem

LeetCode 200. Given an m x n 2d grid map...

Diameter of Binary Tree Problem

LeetCode 543. Given a binary tree, compute the diameter of...

Longest Word In Dictionary Problem

LeetCode 720. Given a list of strings words representing an...

Concatenate Words Problem

LeetCode 472. Given a list of words (without duplicates), return...

Tag Backtracking

Word Ladder II Problem

LeetCode 126. Given two words, beginWord and endWord, and a...

Word Search Problem

LeetCode 79. Given an m x n grid of characters...

Unique Binary Search Trees II Problem

LeetCode 95. Given an integer n, return all the structurally...

Subsets Problem

LeetCode 78. Given an integer array nums of unique elements,...

Subsets II Problem

LeetCode 90. Given an integer array nums that may contain...

Restore IP Addresses Problem

LeetCode 93. Given a string s containing only digits, return...

Gray Code Problem

LeetCode 89. Given an integer n, return any valid n-bit...

Combinations Problem

LeetCode 77. Given two integers n and k, return all...

N-Queens Problem

LeetCode 51. Given an integer n, return all distinct solutions...

N-Queens II Problem

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

Sudoku Solver Problem

LeetCode 37. Write a program to solve a Sudoku puzzle...

Permutations Problem

LeetCode 46. Given an array nums of distinct integers, return...

Permutations II Problem

LeetCode 47. Given a collection of numbers, nums, that might...

Combination Sum Problem

LeetCode 39. Given an array of distinct integers candidates and...

Combination Sum II Problem

LeetCode 40. Given a collection of candidate numbers (candidates) and...

Letter Combinations of a Phone Number Problem

LeetCode 17. Given a string containing digits from 2-9 inclusive,...

Generate Parentheses Problem

LeetCode 22. Given n pairs of parentheses, write a function...

Word Search II Problem

LeetCode 212. Given an m x n board of characters...

Tag Greedy

Best Time To Buy And Sell Stock Ii Problem

LeetCode 122. You are given an integer array prices where...

Jump Game Problem

LeetCode 55. Given an m x n matrix, return all...

Wildcard Matching Problem

LeetCode 44. Write the code that will take a string...

Jump Game II Problem

LeetCode 45. Given an array of non-negative integers nums, you...

Container With Most Water Problem

LeetCode 11. Given n non-negative integers a_1, a_2, …, a_n...

Maximum XOR of Two Numbers in an Array Problem

LeetCode 421. Given an integer array nums, return the maximum...

Tag Queue

Number of Islands Problem

LeetCode 200. Given an m x n 2d grid map...

Stream of Characters Problem

LeetCode 1032. Implement the StreamChecker class as follows. Constructor, initialize...


Search in Rotated Sorted Array II Problem

LeetCode 81. There is an integer array nums sorted in...

Search A 2D Matrix Problem

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

Find First and Last Position of Element in Sorted Array Problem

LeetCode 34. Given the array nums after the possible rotation...

Median of Two Sorted Arrays Problem

LeetCode 4. Given two sorted arrays nums1 and nums2 of...

Valid Perfect Square Problem

LeetCode 367. Given a positive integer num, write a function...

Sqrt(x) Problem

LeetCode 69. Given a non-negative integer x, compute and return...

Search Insert Position Problem

LeetCode 35. Given a sorted array of distinct integers and...

Tag C++

Value Categories in C++

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

Rvalue References in C++: Perfect Forwarding

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

Rvalue References in C++: Move Semantics

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

References in C++

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

Lvalue References in C++

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

Lambda Expressions in C++

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

Template Specializations in C++

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

Implicit Type Conversions in C++

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

Explicit Type Conversions in C++

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

Copy Constructors in C++

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

Inline Functions in C++

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

Function Pointers in C++

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

Online Book Reader System Problem

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

Parking Lot Problem

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

Call Center Problem

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

Singleton Design Pattern

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

Factory Design Pattern

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

Weak_Ptr in C++

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

Friend Class and Function in C++

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

Unique_Ptr in C++

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

Smart Pointers in C++

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

Shared_Ptr in C++

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

Templates in C++

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

Polymorphism in C++

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

Interfaces in C++

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

Tag Interface

Interfaces in C++

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

Tag Abstract Class

Interfaces in C++

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


Tag Pure Virtual Function

Polymorphism in C++

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

Interfaces in C++

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

Tag Concrete Class

Interfaces in C++

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

Tag Polymorphism

Polymorphism in C++

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

Tag Overload

Polymorphism in C++

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


Tag Override

Polymorphism in C++

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

Tag Virtual Function

Polymorphism in C++

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

Tag Template

Template Specializations in C++

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

Templates in C++

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

Tag Function Template

Templates in C++

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


Tag Class Template

Templates in C++

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

Tag Smart Pointers

Weak_Ptr in C++

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

Unique_Ptr in C++

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

Smart Pointers in C++

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

Shared_Ptr in C++

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

Tag RAII

Weak_Ptr in C++

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

Unique_Ptr in C++

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

Smart Pointers in C++

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

Shared_Ptr in C++

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

Tag Shared_Ptr

Smart Pointers in C++

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

Shared_Ptr in C++

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


Tag Raw Pointers

Smart Pointers in C++

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

Tag Unique_Ptr

Unique_Ptr in C++

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

Smart Pointers in C++

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

Tag Weak_Ptr

Weak_Ptr in C++

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

Smart Pointers in C++

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

Tag Friend Class

Friend Class and Function in C++

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


Tag Friend Function

Friend Class and Function in C++

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

Tag Cyclic Reference

Weak_Ptr in C++

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

Tag Weak Reference

Weak_Ptr in C++

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

Tag Factory Pattern

Factory Design Pattern

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


Tag Creational Pattern

Singleton Design Pattern

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

Factory Design Pattern

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

Tag Singleton Pattern

Call Center Problem

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

Singleton Design Pattern

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

Tag OOD

Online Book Reader System Problem

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

Parking Lot Problem

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

Call Center Problem

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

Tag Linked List

Flatten Binary Tree To Linked List Problem

LeetCode 114. Given the root of a binary tree, flatten...

Remove Duplicates from Sorted List Problem

LeetCode 83. Given the head of a sorted linked list,...

Remove Duplicates from Sorted List II Problem

LeetCode 82. Given the head of a sorted linked list,...

Partition List Problem

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

Rotate List Problem

LeetCode 61. Given the head of a linked list, rotate...

Reverse Nodes in k-Group Problem

LeetCode 25. Given a linked list, reverse the nodes of...

Swap Nodes in Pairs Problem

LeetCode 24. Given a linked list, swap every two adjacent...