Logo for ammarahmed.ca

Leetcode

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

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
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

Medium
Jun 12, 2025

875. Koko Eating Bananas

Koko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The guards have gone and will come back in h hours.

#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

155. Min Stack

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

#stack
#class

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 25, 2025

128. Longest Consecutive Sequence

Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.

#arrays
#math

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

Medium
May 24, 2025

49. Group Anagrams

Given an array of strings strs, group the anagrams together. You can return the answer in any order.

#arrays
#hashing