Logo for ammarahmed.ca

Leetcode

Showcasing my solutions to Leetcode problems in Python alongside my thought process and approach to solving them.

Medium
Feb 20, 2026

1448. Count Good Nodes in Binary Tree

#binary-tree
#dfs
Medium
Feb 20, 2026

199. Binary Tree Right Side View

#binary-tree
#queue
Medium
Feb 19, 2026

337. House Robber III

#binary-tree
#dp
Medium
Feb 18, 2026

102. Binary Tree Level Order Traversal

#binary-tree
#queue
Hard
Feb 18, 2026

23. Merge k Sorted Lists

#linked-list
#heap
Medium
Feb 18, 2026

146. LRU Cache

#hashmap
#linked-list
Medium
Feb 17, 2026

138. Copy List with Random Pointer

#linked-list
Medium
Jan 26, 2026

443. String Compression

#two-pointers
Medium
Jan 26, 2026

334. Increasing Triplet Subsequence

#math
#trick
Easy
Jan 25, 2026

1768. Merge Strings Alternately

#two-pointers
Medium
Jan 14, 2026

Infinite Taxi Driver

#graph
#bfs
Medium
Jan 13, 2026

1730. Shortest Path To Get Food

#graph
#bfs
Medium
Jan 13, 2026

1642. Furthest Building You Can Reach

#heap
Medium
Jan 13, 2026

752. Open the Lock

#graph
#bfs
Medium
Jan 13, 2026

Skyscraper Furthest Distance

#heap
Hard
Jan 13, 2026

Rummy Card Game

#sliding-window
#math
Medium
Jan 13, 2026

Minimum Lock Turns

#graph
#bfs
Hard
Jan 13, 2026

Max Level Party Invites

#graph
#dp
#dfs
Medium
Jan 12, 2026

235. Lowest Common Ancestor of a Binary Search Tree

#binary-tree
#dfs
Easy
Jan 12, 2026

572. Subtree of Another Tree

#binary-tree
#dfs
Easy
Jan 03, 2026

100. Same Tree

#binary-tree
#dfs
Easy
Jan 02, 2026

110. Balanced Binary Tree

#binary-tree
Hard
Dec 27, 2025

239. Sliding Window Maximum

#sliding-window
Hard
Dec 26, 2025

42. Trapping Rain Water

#two-pointers
#math
Medium
Dec 24, 2025

287. Find the Duplicate Number

#linked-list
#array
Medium
Dec 24, 2025

2. Add Two Numbers

#linked-list
#math
Medium
Dec 24, 2025

19. Remove Nth Node From End of List

#linked-list
Easy
Dec 24, 2025

543. Diameter of Binary Tree

#binary-tree
#dfs
Easy
Dec 23, 2025

104. Maximum Depth of Binary Tree

#binary-tree
#dfs
Easy
Dec 23, 2025

226. Invert Binary Tree

#binary-tree
#bfs
Medium
Dec 23, 2025

143. Reorder List

#linked-list
Easy
Dec 22, 2025

141. Linked List Cycle

#linked-list
Easy
Dec 22, 2025

21. Merge Two Sorted Lists

#linked-list
Easy
Dec 22, 2025

206. Reverse Linked List

#linked-list
Hard
Dec 22, 2025

76. Minimum Window Substring

#sliding-window
Medium
Dec 22, 2025

567. Permutation in String

#sliding-window
Medium
Dec 22, 2025

424. Longest Repeating Character Replacement

#sliding-window
Medium
Dec 22, 2025

3. Longest Substring Without Repeating Characters

#sliding-window
Easy
Dec 22, 2025

121. Best Time to Buy and Sell Stock

#sliding-window
Medium
Dec 22, 2025

33. Search in Rotated Sorted Array

#binary-search
Medium
Dec 22, 2025

153. Find Minimum in Rotated Sorted Array

#binary-search
Medium
Dec 22, 2025

875. Koko Eating Bananas

#binary-search
#math
Medium
Dec 22, 2025

74. Search a 2D Matrix

#binary-search
#matrix
Easy
Dec 22, 2025

704. Binary Search

#binary-search
Hard
Dec 22, 2025

84. Largest Rectangle in Histogram

#stack
#math
Medium
Dec 22, 2025

853. Car Fleet

#stack
#math
Medium
Dec 22, 2025

739. Daily Temperatures

#stack
Medium
Dec 22, 2025

22. Generate Parentheses

#stack
#recursion
Medium
Dec 22, 2025

150. Evaluate Reverse Polish Notation

#stack
#math
Medium
Dec 22, 2025

155. Min Stack

#stack
Easy
Dec 22, 2025

20. Valid Parentheses

#stack
Medium
Dec 22, 2025

11. Container With Most Water

#two-pointers
#math
Medium
Dec 22, 2025

15. 3Sum

#binary-search
#two-pointers
Medium
Dec 22, 2025

167. Two Sum II - Input Array Is Sorted

#two-pointers
#binary-search
Easy
Dec 22, 2025

125. Valid Palindrome

#two-pointers
#string
Medium
Dec 22, 2025

128. Longest Consecutive Sequence

#hashmap
#math
Medium
Dec 22, 2025

36. Valid Sudoku

#matrix
Medium
Dec 22, 2025

238. Product of Array Except Self

#math
Medium
Dec 22, 2025

347. Top K Frequent Elements

#hashmap
#frequency
Medium
Dec 22, 2025

49. Group Anagrams

#hashmap
#frequency
Easy
Dec 22, 2025

242. Valid Anagram

#hashmap
#frequency
Easy
Dec 22, 2025

217. Contains Duplicate

#hashmap
Easy
Dec 22, 2025

1. Two Sum

#hashmap
#math