87. Scramble String
We can scramble a string s to get a string t using the following algorithm: If the length of the...
1402. Reducing Dishes
A chef has collected data on the satisfaction level of his n dishes. Chef can cook any dish in 1...
983. Minimum Cost For Tickets
You have planned some train traveling one year in advance. The days of the year in which you will travel...
64. Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which...
2360. Longest Cycle in a Graph
You are given a directed graph of n nodes numbered from 0 to n - 1, where each node has...
2316. Count Unreachable Pairs of Nodes in an Undirected Graph
You are given an integer n. There is an undirected graph with n nodes, numbered from 0 to n -...
1466. Reorder Routes to Make All Paths Lead to the City Zero
There are n cities numbered from 0 to n - 1 and n - 1 roads such that there is...
1319. Number of Operations to Make Network Connected
There are n computers numbered from 0 to n - 1 connected by ethernet cables connections forming a network where...
2492. Minimum Score of a Path Between Two Cities
You are given a positive integer n representing n cities numbered from 1 to n. You are also given a...
2348. Number of Zero-Filled Subarrays
Given an integer array nums, return the number of subarrays filled with 0. A subarray is a contiguous non-empty sequence...
605. Can Place Flowers
You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot...
211. Design Add and Search Words Data Structure
Design a data structure that supports adding new words and finding if a string matches any previously added string. Implement...
1472. Design Browser History
You have a browser of one tab where you start on the homepage and you can visit another url, get...
208. Implement Trie (Prefix Tree)
A trie (pronounced as “try”) or prefix tree is a tree data structure used to efficiently store and retrieve keys...
106. Construct Binary Tree from Inorder and Postorder Traversal
Given two integer arrays inorder and postorder where inorder is the inorder traversal of a binary tree and postorder is...
958. Check Completeness of a Binary Tree
Given the root of a binary tree, determine if it is a complete binary tree. In a complete binary tree,...
129. Sum Root to Leaf Numbers
You are given the root of a binary tree containing digits from 0 to 9 only. Each root-to-leaf path in...
101. Symmetric Tree
Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center)....
23. Merge k Sorted Lists
You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists...
109. Convert Sorted List to Binary Search Tree
Given the head of a singly linked list where elements are sorted in ascending order, convert it to a height-balanced...
382. Linked List Random Node
Given a singly linked list, return a random node’s value from the linked list. Each node must have the same...
142. Linked List Cycle II
Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return...
875. Koko Eating Bananas
Koko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The guards have...
2187. Minimum Time to Complete Trips
You are given an array time where time[i] denotes the time taken by the ith bus to complete one trip....
1539. Kth Missing Positive Number
Given an array arr of positive integers sorted in a strictly increasing order, and an integer k. Return the kth...
1345. Jump Game IV
Given an array of integers arr, you are initially positioned at the first index of the array. In one step...
2444. Count Subarrays With Fixed Bounds
You are given an integer array nums and two integers minK and maxK. A fixed-bound subarray of nums is a...
28. 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...
443. String Compression
Given an array of characters chars, compress it using the following algorithm: Begin with an empty string s. For each...
912. Sort an Array
Given an array of integers nums, sort the array in ascending order and return it. You must solve the problem...