Medium

  • Add Two Numbers – You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse…

  • Binary Tree Level Order Traversal – Given the root of a binary tree, return the level order traversal of its nodes’ values. (i.e., from left to right,…

  • Binary Tree Zigzag Level Order Traversal – Given the root of a binary tree, return the zigzag level order traversal of its nodes’ values. (i.e., from left to…

  • Bitwise AND Of Numbers Range – Given two integers left and right that represent the range [left, right], return *the bitwise AND of all numbers in…

  • Construct Binary Tree From Preorder And Inorder Traversal – Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is…

  • Container With Most Water – You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the…

  • Count And Say – The count-and-say sequence is a sequence of digit strings defined by the recursive formula: - countAndSay(1) = “1” -…

  • Count Primes – Given an integer n, return the number of prime numbers that are strictly less than n.

  • Delete Node In A Linked List – There is a singly-linked list head and we want to delete a node node in it. You are given the node to be deleted node….

  • Divide Two Integers – Given two integers dividend and divisor, divide two integers without using multiplication, division, and mod operator….

  • Find First And Last Position Of Element In Sorted Array – Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target…

  • Game Of Life – According to Wikipedia’s article: “The Game of Life, also…

  • Gas Station – There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i]. You…

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

  • Group Anagrams – Given an array of strings strs, group the anagrams together. You can return the answer in any order.

  • H Index – Given an array of integers citations where citations[i] is the number of citations a researcher received for their i...

  • Insert Delete Get Random O1 – Implement the RandomizedSet class: - RandomizedSet() Initializes the RandomizedSet object. - bool insert(int val)…

  • Integer To Roman – Seven different symbols represent Roman numerals with the following values: ====== ===== Symbol Value ====== ===== I …

  • Jump Game – You are given an integer array nums. You are initially positioned at the array’s first index, and each element in the…

  • LRU Cache – Design a data structure that follows the constraints of a `Least Recently Used (LRU) cache…

  • Length Of Longest Substring – Given a string s, find the length of the longest substring without duplicate characters.

  • Letter Combinations Of A Phone Number – Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could…

  • Longest Palindromic Substring – Given a string s, return the longest palindromic substring in s.

  • Maximum Subarray – Given an integer array nums, find the subarray with the largest sum, and return its sum.

  • Merge Intervals – Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals,…

  • Permutations – Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.

  • Pow – Implement pow(x, n), which calculates x raised to the power n…

  • Product Of Array Except Self – Given an integer array nums, return an array answer *such that answer[i] is equal to the product of all the elements…

  • Remove Duplicates From Sorted Array II – Given an integer array nums sorted in non-decreasing order, remove some duplicates `in-place…

  • Remove Nth Node From End Of List – Given the head of a linked list, remove the nth node from the end of the list and return its head.

  • Reverse Integer – Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the…

  • Reverse Words In A String – Given an input string s, reverse the order of the words. A word is defined as a sequence of non-space characters. The…

  • Rotate Image – You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate…

  • Search In Rotated Array – There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your…

  • Set Matrix Zeroes – Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0’s. You must do it `in…

  • Single Number II – Given an integer array nums where every element appears **three times except for one, which appears exactly once*. Find…

  • Sort List – Given the head of a linked list, return the list after sorting it in ascending order.

  • String To Integer – Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer. The algorithm for…

  • Subsets – Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must…

  • Three Sum – Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k,…

  • Tries

  • Two Sum II – Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that…

  • Valid Sudoku – Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following…

  • Zig Zag Conversion – The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to…