Logo for ammarahmed.ca

Leetcode

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

Medium
Aug 03, 2025

287. Find the Duplicate Number

Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive.

#linked-list

Medium
Jul 27, 2025

424. Longest Repeating Character Replacement

You are given a string s and an integer k. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most k times.

#sliding-window

Easy
Jul 24, 2025

141. Linked List Cycle

Given head, the head of a linked list, determine if the linked list has a cycle in it.

#linked-list

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
Jun 13, 2025

153. Find Minimum in Rotated Sorted Array

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become:

#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

Medium
Jun 09, 2025

22. Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

#stack
#recursion

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