Logo for ammarahmed.ca

Leetcode

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

Hard
Aug 05, 2025

42. Trapping Rain Water

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.

#two-pointers

Hard
Jul 29, 2025

239. Sliding Window Maximum

You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.

#sliding-window

Medium
Jul 27, 2025

19. Remove Nth Node From End of List

Given the head of a linked list, remove the nth node from the end of the list and return its head.

#linked-list
#two-pointers

Medium
Jul 25, 2025

143. Reorder List

You are given the head of a singly linked-list. The list can be represented as:

#linked-list

Medium
Jun 14, 2025

981. Time Based Key

Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key's value at a certain timestamp.

#binary-search

Medium
Jun 13, 2025

33. Search in Rotated Sorted Array

There is an integer array nums sorted in ascending order (with distinct values).

#binary-search

Easy
May 28, 2025

206. Reverse Linked List

Given the head of a singly linked list, reverse the list, and return the reversed list.

#linked-list

Medium
May 27, 2025

74. Search a 2D Matrix

You are given an m x n integer matrix matrix with the following two properties:

#binary-search

Medium
May 24, 2025

347. Top K Frequent Elements

Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.

#arrays
#hashing

Easy
May 23, 2025

1. Two Sum

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

#arrays
#hashing