98. Validate Binary Search Tree
Problem Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follo...
Problem Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follo...
Problem Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any o...
Problem You have intercepted a secret message encoded as a string of numbers. The message is decoded via the following mappin...
Problem You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed...
Problem Design a data structure that supports adding new words and finding if a string matches any previously added string. I...
Problem A trie (pronounced as “try”) or prefix tree is a tree data structure used to efficiently store and retrieve keys in a...
Problem There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array pr...
Problem You are given 2 positive integers l and r. For any number x, all positive divisors of x except x are called the prope...
Problem Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be co...
Problem 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 pla...
Problem Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islan...
Problem You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed...
Problem You are given an integer array coins representing coins of different denominations and an integer amount representing...
Problem You are given an integer n and a 2D integer array queries. There are n cities numbered from 0 to n - 1. Initially, th...
Problem There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robo...
Problem You are given an array of non-overlapping intervals intervals where intervals[i] = [startᵢ, endᵢ] represent the start...
Problem Given an array of intervals where intervals[i] = [startᵢ, endᵢ], merge all overlapping intervals, and return an array...
Problem You are given an integer array nums. You are initially positioned at the array’s first index, and each element in the...
Problem Given an m x n matrix, return all elements of the matrix in spiral order. https://leetcode.com/problems/spiral-matrix...
Problem Given an integer array nums, find the subarray with the largest sum, and return its sum. A subarray is a contiguous ...
Problem Given an array of intervals intervals where intervals[i] = [startᵢ, endᵢ], return the minimum number of intervals you...
Problem Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a...
Problem You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotat...
Problem There are n persons on a social media website. You are given an integer array ages where ages[i] is the age of the iᵗ...
Problem Given an integer array nums, return the length of the longest strictly increasing subsequence. A subsequence is an a...
Problem You are given a string s and an integer k. You can choose any character of the string and change it to any other uppe...
Problem You are given an m x n binary matrix grid. A row or column is considered palindromic if its values read the same forw...
Problem There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touche...
Problem There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your functi...
Problem Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums ...
Problem You are given an m x n binary matrix grid. A row or column is considered palindromic if its values read the same forw...
Problem Given an integer array nums, find a subarray that has the largest product, and return the product. A subarray is a c...