LeetCode

LeetCode Practice

GoogleTest - link

If you are currently using the Windows platform, type a command like the following for environment setup:

%comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
  • This command can be accessed from x64 Native Tools Command Prompt for VS xx.
$ cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
$ cmake --build build (or ninja)
$ cd build
$ ctest --output-on-failure

Data Structure

Linked List

21. Merge Two Sorted Lists

141. Linked List Cycle

160. Intersection of Two Linked Lists

206. Reverse Linked List

83. Remove Duplicates from Sorted List

234. Palindrome Linked List (Microsoft, Amazon, …)

Stack

20. Valid Parentheses

Queue

225. Implement Stack using Queues

232. Implement Queue using Stacks

622. Design Circular Queue

429. N-ary Tree Level Order Traversal

Hash

1. Two Sum

349. Intersection of Two Arrays

13. Roman to Integer

169. Majority Element

205. Isomorphic Strings

49. Group Anagrams

356. Line Reflection (LeetCode Premium)

138. Copy List with Random Pointer (Amazon, Facebook, …)

36. Valid Sudoku

String

67. Add Binary

28. Find the Index of the First Occurrence in a String

459. Repeated Substring Pattern

Tree

701. Insert into a Binary Search Tree

106. Construct Binary Tree from Inorder and Postorder Traversal

105. Construct Binary Tree from Preorder and Inorder Traversal

94. Binary Tree Inorder Traversal

98. Validate Binary Search Tree

101. Symmetric Tree

102. Binary Tree Level Order Traversal

104. Maximum Depth of Binary Tree

114. Flatten Binary Tree to Linked List

199. Binary Tree Right Side View

230. Kth Smallest Element in a BST

100. Same Tree

501. Find Mode in Binary Search Tree

366. Find Leaves of Binary Tree (LeetCode Premium)

Heap (Priority Queue)

1046. Last Stone Weight

Graph

841. Keys and Rooms

133. Clone Graph

207. Course Schedule

210. Course Schedule II

839. Similar String Groups

743. Network Delay Time

Union Find

547. Number of Provinces

Monotonic Stack

1475. Final Prices With a Special Discount in a Shop

496. Next Greater Element I

503. Next Greater Element II

Algorithms

Binary Search

704. Binary Search

35. Search Insert Position

34. Find First and Last Position of Element in Sorted Array

875. Koko Eating Bananas

33. Search in Rotated Sorted Array

Sorting

912. Sort an Array -> Practice Quick Sort and Merge Sort

Recursion

509. Fibonacci Number

70. Climbing Stairs

226. Invert Binary Tree

2. Add Two Numbers (Apple, Amazon, Microsoft, …)

695. Max Area of Island (Google, Facebook, …)

236. Lowest Common Ancestor of a Binary Tree

543. Diameter of Binary Tree

Two Pointer

344. Reverse String

167. Two Sum II - Input Array Is Sorted

26. Remove Duplicates from Sorted Array

977. Squares of a Sorted Array

680. Valid Palindrome II (Facebook, …)

15. 3Sum

16. 3Sum Closest

75. Sort Colors

283. Move Zeroes

Sliding Window

209. Minimum Size Subarray Sum

3. Longest Substring Without Repeating Characters

340. Longest Substring with At Most K Distinct Characters (LeetCode Premium)

713. Subarray Product Less Than K

Prefix Sum

238. Product of Array Except Self

209. Minimum Size Subarray Sum

560. Subarray Sum Equals K

Greedy

455. Assign Cookies

2410. Maximum Matching of Players With Trainers

Bit Manipulation

338. Counting Bits

136. Single Number

29. Divide Two Integers

Jungle

5. Longest Palindromic Substring

11. Container With Most Water

14. Longest Common Prefix

19. Remove Nth Node From End of List

24. Swap Nodes in Pairs

31. Next Permutation

621. Task Scheduler