Logo for ammarahmed.ca

Easy

Solutions and thought process for easy difficulty Leetcode problems.

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

20. Valid Parentheses

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

#stack

Easy
May 26, 2025

125. Valid Palindrome

A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.

#two-pointers

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