Logo for ammarahmed.ca

Easy

Solutions and thought process for easy difficulty Leetcode problems.

Easy
Oct 06, 2025

226. Invert Binary Tree

Given the root of a binary tree, invert the tree, and return its root.

#binary-tree

Easy
Oct 06, 2025

104. Maximum Depth of Binary Tree

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

#binary-tree

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

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

Easy
May 27, 2025

121. Best Time to Buy and Sell Stock

You are given an array prices where prices[i] is the price of a given stock on the ith day.

#sliding-window

Easy
May 27, 2025

704. Binary Search

Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1.

#binary-search

Easy
May 23, 2025

217. Contains Duplicate

Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.

#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

Easy
May 23, 2025

242. Valid Anagram

Given two strings s and t, return true if t is an anagram of s, and false otherwise.

#arrays
#hashing