Easy
Add Binary – Given two binary strings a and b, return their sum as a binary string.
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. You want to…
Binary Tree Inorder Traversal – Given the root of a binary tree, return the inorder traversal of its nodes’ values.
Climbing Stairs – 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 II – 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 BST – Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced *binary…
Find The Index Of The First Occurrence In A String – 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 – 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 – Given an integer n, return a string array answer (1-indexed) where: - answer[i] == “FizzBuzz” if i is divisible by…
Happy Number – 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 – Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must…
Intersection Of Two Linked Lists – 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 – Given the root of a binary tree, invert the tree, and return its root.
Is Subsequence – 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 – Given two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the characters in s…
Length Of Last Word – 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 – 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 – Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix,…
Majority Element – 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 – 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 – You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n,…
Merge Two Sorted Lists – You are given the heads of two sorted linked lists list1 and list2. Merge the two lists into one sorted list. The list…
Missing Number – 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 – Given the head of a singly linked list, return true if it is a palindrome or false otherwise.
Palindrome Number – Given an integer x, return true if x is a palindrome, and false otherwise.
Pascals Triangle – Given an integer numRows, return the first numRows of Pascal’s triangle. In Pascal’s triangle, each number is the…
Plus One – You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of…
Power Of Three – 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 – Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from…
Remove Element – Given an integer array nums and an integer val, remove all occurrences of val in nums `in-place…
Reverse Linked List – Given the head of a singly linked list, reverse the list, and return the reversed list.
Reverse 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 – Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. :: Symbol Value I …
Same Tree – 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 – Given a non-negative integer x, return the square root of x rounded down to the nearest integer. The returned integer…
Summary Ranges – 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 – Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).
Two Sum – Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to…
Valid Anagram – Given two strings s and t, return true if t is an anagram of s, and false otherwise.
Valid Palindrome – A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all…
Valid Parentheses – Given a string s containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the input string is…
Word Pattern – Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there is…