Notes in LeetCode

To Subscribe, use this Key


Status Last Update Fields
Published 07/03/2024 217. Contains DuplicateGiven an integer array nums, return true if any value appears at least twice in the array, and return&…
Published 07/03/2024 242. Valid AnagramGiven two strings s and t, return true if t is an anagram of s, and false otherwis…
Published 07/03/2024 1. Two SumGiven an array of integers nums and an integer target, return indices of the two numbers such that they add up to t…
Published 07/03/2024 49. Group AnagramsGiven an array of strings strs, group the anagrams together. You can return the answer in any order.An Anag…
Published 07/03/2024 347. Top K Frequent ElementsGiven an integer array nums and an integer k, return the k most frequent elements. You may r…
Published 07/03/2024 238. Product of Array Except SelfGiven an integer array nums, return an array answer such that answer[i] is equal to the…
Published 07/03/2024 36. Valid SudokuDetermine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the follo…
Published 07/03/2024 128. Longest Consecutive SequenceGiven an unsorted array of integers nums, return the length of the longest consecutive elements sequence.Yo…
Published 07/03/2024 125. Valid PalindromeA phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanu…
Published 07/03/2024 167. Two Sum II - Input Array Is SortedGiven a 1-indexed array of integers numbers that is already sorted in non-decreasing o…
Published 07/03/2024 15. 3SumGiven an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k…
Published 07/03/2024 11. Container With Most WaterYou are given an integer array height of length n. There are n vertical lines drawn such that th…
Published 07/03/2024 42. Trapping Rain WaterGiven n non-negative integers representing an elevation map where the width of each bar is 1, compute how much w…
Published 07/03/2024 20. Valid ParenthesesGiven a string s containing just the characters '(', ')', '{', '}', '[' and ']', det…
Published 07/03/2024 150. Evaluate Reverse Polish NotationYou are given an array of strings tokens that represents an arithmetic expression in a Reverse Pol…
Published 07/03/2024 22. Generate ParenthesesGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
Published 07/03/2024 739. Daily TemperaturesGiven an array of integers temperatures represents the daily temperatures, return an array answer such…
Published 07/03/2024 853. Car FleetThere are n cars at given miles away from the starting mile 0, traveling to reach the mile target.You are given two integ…
Published 07/03/2024 84. Largest Rectangle in HistogramGiven an array of integers heights representing the histogram's bar height where the width of each bar is&…
Published 07/03/2024 704. Binary SearchGiven an array of integers nums which is sorted in ascending order, and an integer target, write a function to search…
Published 07/03/2024 74. Search a 2D MatrixYou are given an m x n integer matrix matrix with the following two properties:Each row is sorted in non-dec…
Published 07/03/2024 875. Koko Eating BananasKoko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The …
Published 07/03/2024 153. Find Minimum in Rotated Sorted ArraySuppose an array of length n sorted in ascending order is rotated between 1 and…
Published 07/03/2024 33. Search in Rotated Sorted ArrayThere is an integer array nums sorted in ascending order (with distinct values).Prior to being p…
Published 07/03/2024 121. Best Time to Buy and Sell StockYou are given an array prices where prices[i] is the price of a given stock on the ith&nb…
Published 07/03/2024 3. Longest Substring Without Repeating CharactersGiven a string s, find the length of the longest substring (A substring&nbsp…
Published 07/03/2024 424. Longest Repeating Character ReplacementYou are given a string s and an integer k. You can choose any character of the string and c…
Published 07/03/2024 567. Permutation in StringGiven two strings s1 and s2, return true if s2 contains a permutation of s1, or&nbsp…
Published 07/03/2024 206. Reverse Linked ListGiven the head of a singly linked list, reverse the list, and return the reversed list.
Published 07/03/2024 21. Merge Two Sorted ListsYou are given the heads of two sorted linked lists list1 and list2.Merge the two lists into one sorted&n…
Published 07/03/2024 143. Reorder ListYou are given the head of a singly linked-list. The list can be represented as:L0 → L1 → … → Ln - 1 → Ln Reorder the list to be on th…
Published 07/03/2024 19. Remove Nth Node From End of ListGiven the head of a linked list, remove the nth node from the end of the list and return its h…
Published 07/03/2024 138. Copy List with Random PointerA linked list of length n is given such that each node contains an additional random pointer, which could …
Published 07/03/2024 2. Add Two NumbersYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse ord…
Published 07/03/2024 141. Linked List CycleGiven head, the head of a linked list, determine if the linked list has a cycle in it.There is a cycle in a linked list if …
Published 07/03/2024 226. Invert Binary TreeGiven the root of a binary tree, invert the tree, and return its root.
Published 07/03/2024 104. Maximum Depth of Binary TreeGiven the root of a binary tree, return its maximum depth.A binary tree's maximum depth is t…
Published 07/03/2024 543. Diameter of Binary TreeGiven the root of a binary tree, return the length of the diameter of the tree.The diameter&…
Published 07/03/2024 110. Balanced Binary TreeGiven a binary tree, determine if it is height-balanced (A height-balanced binary tree is a binary tree i…
Published 07/03/2024 100. Same TreeGiven the roots of two binary trees p and q, write a function to check if they are the same or not.Two binary trees are c…
Published 07/03/2024 572. Subtree of Another TreeGiven the roots of two binary trees root and subRoot, return true if there is a subtree of r…
Published 07/03/2024 235. Lowest Common Ancestor of a Binary Search TreeGiven a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in …
Published 07/03/2024 102. Binary Tree Level Order TraversalGiven the root of a binary tree, return the level order traversal of its nodes' values. (i.e., fr…
Published 07/03/2024 199. Binary Tree Right Side ViewGiven the root of a binary tree, imagine yourself standing on the right side of it, return th…
Published 07/03/2024 1448. Count Good Nodes in Binary TreeGiven a binary tree root, a node X in the tree is named good if in the path from root to…
Published 07/03/2024 98. Validate Binary Search TreeGiven the root of a binary tree, determine if it is a valid binary search tree (BST).A valid BST&nb…
Published 07/03/2024 230. Kth Smallest Element in a BSTGiven the root of a binary search tree, and an integer k, return the kth smallest valu…
Published 07/03/2024 1046. Last Stone WeightYou are given an array of integers stones where stones[i] is the weight of the ith stone.We are p…
Published 07/03/2024 973. K Closest Points to OriginGiven an array of points where points[i] = [xi, yi] represents a point on the X-Y plane a…
Published 07/03/2024 215. Kth Largest Element in an ArrayGiven an integer array nums and an integer k, return the kth largest element in the …
Published 07/03/2024 621. Task SchedulerYou are given an array of CPU tasks, each represented by letters A to Z, and a cooling time, n. Each cycle or i…
Published 07/03/2024 78. SubsetsGiven an integer array nums of unique elements, return all possible subsets (A subset of an ar…
Published 07/03/2024 39. Combination SumGiven an array of distinct integers candidates and a target integer target, return a list of all&nbsp…
Published 07/03/2024 46. PermutationsGiven an array nums of distinct integers, return all the possible permutations. You can return the answer in any o…
Published 07/03/2024 90. Subsets IIGiven an integer array nums that may contain duplicates, return all possible subsets (A subset of an …
Published 07/03/2024 40. Combination Sum IIGiven a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidat…
Published 07/03/2024 79. Word SearchGiven an m x n grid of characters board and a string word, return true if word exists in t…
Published 07/03/2024 17. Letter Combinations of a Phone NumberGiven a string containing digits from 2-9 inclusive, return all possible letter combinations that t…
Published 07/03/2024 51. N-QueensThe n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack…
Published 07/03/2024 200. Number of IslandsGiven an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return&…
Published 07/03/2024 695. Max Area of IslandYou are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4…
Published 07/03/2024 133. Clone GraphGiven a reference of a node in a connected undirected graph.Return a deep copy (clone) of the graph.Each node in t…
Published 07/03/2024 994. Rotting OrangesYou are given an m x n grid where each cell can have one of three values:0 representing an empty cell,1 r…
Published 07/03/2024 417. Pacific Atlantic Water FlowThere is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. …
Published 07/03/2024 130. Surrounded RegionsYou are given an m x n matrix board containing letters 'X' and 'O', capture region…
Published 07/03/2024 207. Course ScheduleThere are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given…
Published 07/03/2024 210. Course Schedule IIThere are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are gi…
Published 07/03/2024 684. Redundant ConnectionIn this problem, a tree is an undirected graph that is connected and has no cycles.You are given a graph that start…
Published 07/03/2024 127. Word LadderA transformation sequence from word beginWord to word endWord using a dictionary wordList is a…
Published 07/03/2024 57. Insert IntervalYou are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the…
Published 07/03/2024 56. Merge IntervalsGiven an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return&nb…
Published 07/03/2024 53. Maximum SubarrayGiven an integer array nums, find the subarray (A subarray is a contiguous non-empty sequence of elements…
Published 07/03/2024 55. Jump GameYou are given an integer array nums. You are initially positioned at the array's first index, and each element in the array rep…
Published 07/03/2024 846. Hand of StraightsAlice has some number of cards and she wants to rearrange the cards into groups so that each group is of size groupSize, an…
Published 07/03/2024 70. Climbing StairsYou are climbing a staircase. It takes n steps to reach the top.Each time you can either climb 1 or 2&nbsp…
Published 07/03/2024 198. House RobberYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only const…
Published 07/03/2024 62. Unique PathsThere is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). …
Published 07/03/2024 115. Distinct SubsequencesGiven two strings s and t, return the number of distinct subsequences of s which equals t.The …
Published 07/03/2024 136. Single NumberGiven a non-empty array of integers nums, every element appears twice except for one. Find that single one.…
Published 07/03/2024 191. Number of 1 BitsWrite a function that takes the binary representation of a positive integer and returns the number of set bits (A set bit refers …
Published 07/03/2024 268. Missing NumberGiven an array nums containing n distinct numbers in the range [0, n], return the only number in the …
Published 07/03/2024 48. Rotate ImageYou are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).You h…
Published 07/03/2024 66. Plus OneYou are given a large integer represented as an integer array digits, where each digits[i] is the ith d…
Published 07/03/2024 286. Walls and GatesYou are given an m x n grid rooms initialized with these three possible values.-1 A wall or an obstacle.0…
Status Last Update Fields