Leetcode Problems

Solutions to leetcode problems using Python

Arrays

4. Find median of two sorted arrays
33. Search in rotated sorted array
53. Max Sum Subarray
62. Grid Unique Paths
128. Longest Consecutive Sequence
287. Duplicate in Array
229. Majority Element II
493. Reverse Pairs
2439. Minimize Maximum of Array


Linked List

138. Clone Linked List with Random Pointer


Trees

366. Remove Leaves
968. Binary Tree Cameras
2096. Step Directions in binary tree


Dynamic Programming

120. Triangle
122. Buy and Sell Stock II
123. Buy and Sell Stock III
818. Car Problem
1155. Number of ways to roll dice
1277. Count Square Submatrices


Graphs

General:
127. Word Ladder
128. Word Ladder 2
200. Number of Islands
207. Course Schedule
695. Max Area of Island
994. Rotten Oranges
1293. Shortest path grid obstacles
1631. Path with Min Effort
2115. All possible recipes

BFS:
130. Surrounded Regions
139. Word Break
140. Word Break II
472. Concatenated Words
1020. Number of enclaves
1091. Shortest Path binary matrix

DFS:
79. Word Search

Union Find:
721. Account Merge
1579. Remove edges


Hash table

3. Longest Substring Without Repeating Characters
30. Substring with concatenated words
554. Brick Wall


Heap

295. Find Median from Stream
778. Swim in rising Water
973. K Closest Point
1882. Process task using servers
2034. Stock price fluctuation
2050. Parallel Courses


Stack

84. Largest Rectangle Area in Histogram
85. Maximal Rectangle
503. Next Greater Element


Two Pointers

15. 3Sum
42. Trapping Rain Water


Miscellaneous

12. Integer to Roman
13. Roman to Integer
36. Valid Sudoku
126. LRU Cache
460. LFU Cache