Easy

Problem

Pattern

Lists

Description

Add Binary

Math, String, Bit Manipulation, Simulation

Grind 75, Grind 169

Given two binary strings a and b, return their sum as a binary string

Balanced Binary Tree

Tree, Depth-First Search, Binary Tree

Grind 75, Grind 169, NeetCode 150

Given a binary tree, determine if it is height-balanced

Best Time to Buy and Sell Stock

Array, Dynamic Programming

Blind 75, Grind 75, Grind 169, NeetCode 150, Google Top 50

You are given an array prices where prices[i] is the price of a given stock on the i :sup:th day. You want to

Binary Search

Array, Binary Search

Grind 75, Grind 169, NeetCode 150

Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search

Binary Tree Inorder Traversal

Stack, Tree, Depth-First Search, Binary Tree

Given the root of a binary tree, return the inorder traversal of its nodes’ values

Climbing Stairs

Math, Dynamic Programming, Memoization

Blind 75, Grind 75, Grind 169, NeetCode 150

You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how

Contains Duplicate

Array, Hash Table, Sorting

Blind 75, Grind 75, Grind 169, NeetCode 150

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

Contains Duplicate Ii

Array, Hash Table, Sliding Window

Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such

Convert Sorted Array to Binary Search Tree

Array, Divide and Conquer, Tree, Binary Search Tree, Binary Tree

Grind 169

Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary

Diameter of Binary Tree

Tree, Depth-First Search, Binary Tree

Grind 75, Grind 169, NeetCode 150

Given the root of a binary tree, return the length of the diameter of the tree. The diameter of a binary tree is the

Find the Index of the First Occurrence in a String

Two Pointers, String, String Matching

Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle

First Unique Character in a String

Hash Table, String, Queue, Counting

Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1

Fizz Buzz

Math, String, Simulation

Given an integer n, return a string array answer ( 1-indexed ) where: - answer[i] == “FizzBuzz” if i is divisible by

Happy Number

Hash Table, Math, Two Pointers

NeetCode 150, Google Top 50

Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: -

Intersection Of Two Arrays Ii

Array, Hash Table, Two Pointers, Binary Search, Sorting

Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must

Intersection Of Two Linked Lists

Hash Table, Linked List, Two Pointers

Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the

Invert Binary Tree

Tree, Depth-First Search, Breadth-First Search, Binary Tree

Blind 75, Grind 75, Grind 169, NeetCode 150

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

Is Subsequence

Two Pointers, String, Dynamic Programming

Given two strings s and t, return true if s is a subsequence of t , or false otherwise. A subsequence of a string is a

Isomorphic Strings

Hash Table, String

Given two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the characters in s

Kth Largest Element in a Stream

Tree, Design, Binary Search Tree, Heap (Priority Queue), Binary Tree, Data Stream

NeetCode 150

You are part of a university admissions office and need to keep track of the kth highest test score from applicants in

Last Stone Weight

Array, Heap (Priority Queue)

NeetCode 150

You are given an array of integers stones where stones[i] is the weight of the i :sup:th stone. We are playing a

Length Of Last Word

String

Given a string s consisting of words and spaces, return the length of the last word in the string. A word is a

Linked List Cycle

Hash Table, Linked List, Two Pointers

Blind 75, Grind 75, Grind 169, NeetCode 150

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

Longest Common Prefix

Array, String, Trie

Grind 169, Google Top 50

Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix,

Majority Element

Array, Hash Table, Divide and Conquer, Sorting, Counting

Grind 75, Grind 169

Given an array nums of size n, return the majority element. The majority element is the element that appears more than

Maximum Depth of Binary Tree

Tree, Depth-First Search, Breadth-First Search, Binary Tree

Blind 75, Grind 75, Grind 169, NeetCode 150

Given the root of a binary tree, return its maximum depth. A binary tree’s maximum depth is the number of nodes along

Merge Sorted Array

Array, Two Pointers, Sorting

You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n,

Merge Two Sorted Lists

Linked List, Recursion

Blind 75, Grind 75, Grind 169, NeetCode 150

You are given the heads of two sorted linked lists list1 and list2. Merge the two lists into one sorted list. The list

Min Cost Climbing Stairs

Array, Dynamic Programming

NeetCode 150

You are given an integer array cost where cost[i] is the cost of i :sup:th step on a staircase. Once you pay the

Missing Number

Array, Hash Table, Math, Binary Search, Bit Manipulation, Sorting

Blind 75, Grind 169, NeetCode 150

Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is

Palindrome Linked List

Linked List, Two Pointers, Stack, Recursion

Grind 169

Given the head of a singly linked list, return true if it is a palindrome or false otherwise

Palindrome Number

Math

Grind 169, Google Top 50

Given an integer x, return true if x is a palindrome , and false otherwise

Pascals Triangle

Array, Dynamic Programming

Given an integer numRows, return the first numRows of Pascal’s triangle. In Pascal’s triangle, each number is the

Plus One

Array, Math

NeetCode 150

You are given a large integer represented as an integer array digits, where each digits[i] is the i :sup:th digit of

Power Of Three

Math, Recursion

Given an integer n, return true if it is a power of three. Otherwise, return false. An integer n is a power of three,

Ransom Note

Hash Table, String, Counting

Grind 75, Grind 169

Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from

Remove Element

Array, Two Pointers

Given an integer array nums and an integer val, remove all occurrences of val in nums in-place

Reverse Linked List

Linked List, Recursion

Blind 75, Grind 75, Grind 169, NeetCode 150

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

Reverse String

Two Pointers, String

Write a function that reverses a string. The input string is given as an array of characters s. You must do this by

Roman to Integer

Hash Table, Math, String

Grind 169, Google Top 50

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. :: Symbol Value I

Same Tree

Tree, Depth-First Search, Breadth-First Search, Binary Tree

Blind 75, Grind 169, NeetCode 150

Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees

Sqrtx

Math, Binary Search

Given a non-negative integer x, return the square root of x rounded down to the nearest integer. The returned integer

Subtree of Another Tree

Tree, Depth-First Search, String Matching, Binary Tree, Hash Function

Blind 75, Grind 169, NeetCode 150

Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure

Summary Ranges

Array

You are given a sorted unique integer array nums. A range [a,b] is the set of all integers from a to b (inclusive)

Symmetric Tree

Tree, Depth-First Search, Breadth-First Search, Binary Tree

Grind 169

Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center)

Two Sum

Array, Hash Table

Blind 75, Grind 75, Grind 169, NeetCode 150, Google Top 50

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

Valid Anagram

Hash Table, String, Sorting

Blind 75, Grind 75, Grind 169, NeetCode 150

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

Valid Palindrome

Two Pointers, String

Blind 75, Grind 75, Grind 169, NeetCode 150

A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all

Valid Parentheses

String, Stack

Blind 75, Grind 75, Grind 169, NeetCode 150

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

Word Pattern

Hash Table, String

Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there is