Logo for ammarahmed.ca

Leetcode

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

Medium
Oct 06, 2025

146. LRU Cache

Design a data structure that follows the constraints of a Least Recently Used (LRU) cache.

#linked-list
#OOD

Easy
Oct 06, 2025

104. Maximum Depth of Binary Tree

Given the root of a binary tree, return its maximum depth.

#binary-tree

Medium
Oct 05, 2025

56. Merge Intervals

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.

#stack

Medium
Oct 04, 2025

200. Number of Islands

Given an m x n 2D binary grid grid which represents a map of '1' s (land) and '0' s (water), return the number of islands.

#graph
#matrix

Hard
Jul 29, 2025

76. Minimum Window Substring

Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t ( including duplicates) is included in the window. If there is no such substring, return the empty string "".

#sliding-window

Medium
Jul 28, 2025

567. Permutation in String

Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise.

#sliding-window

Easy
Jul 24, 2025

21. Merge Two Sorted Lists

You are given the heads of two sorted linked lists list1 and list2.

#linked-list
#sorting

Medium
Jun 14, 2025

3. Longest Substring Without Repeating Characters

Given a string s, find the length of the longest substring without duplicate characters.

#sliding-window

Medium
May 27, 2025

155. Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

#stack
#class

Medium
May 25, 2025

238. Product of Array Except Self

Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].

#arrays
#math