id
int64
1
2k
content
stringlengths
272
88.9k
title
stringlengths
3
77
title_slug
stringlengths
3
79
question_content
stringlengths
230
5k
question_hints
stringclasses
695 values
tag
stringclasses
618 values
level
stringclasses
3 values
similar_question_ids
stringclasses
822 values
1,297
hey uh well welcome to my equal summary section so this is called maximum number of options of the substrings so given the string s you need to return the maximum number of occurrences of any substrings under the following rules the number of unique characters in your substring must be less or equal to max letters so t...
Maximum Number of Occurrences of a Substring
maximum-number-of-balloons
Given a string `s`, return the maximum number of ocurrences of **any** substring under the following rules: * The number of unique characters in the substring must be less than or equal to `maxLetters`. * The substring size must be between `minSize` and `maxSize` inclusive. **Example 1:** **Input:** s = "aababc...
Count the frequency of letters in the given string. Find the letter than can make the minimum number of instances of the word "balloon".
Hash Table,String,Counting
Easy
null
1,773
hey everyone tonight we're working on lead Coke challenge number 1773 called count items matching a rule in this challenge we're given an array of items and let's look down here at this example to see what the array looks like each one of these items is itself an array with uh with three elements in it which sort of de...
Count Items Matching a Rule
percentage-of-users-attended-a-contest
You are given an array `items`, where each `items[i] = [typei, colori, namei]` describes the type, color, and name of the `ith` item. You are also given a rule represented by two strings, `ruleKey` and `ruleValue`. The `ith` item is said to match the rule if **one** of the following is true: * `ruleKey == "type "` ...
null
Database
Easy
1338
292
okay cool 292 NIM game you're playing the following game with your friend there's a heap of stones on the table you each time one of you take turns to remove one two three stones the one crew removes the last stone will be the winner you will take the first turn to remove the stones both of you're very clever nap optim...
Nim Game
nim-game
You are playing the following Nim Game with your friend: * Initially, there is a heap of stones on the table. * You and your friend will alternate taking turns, and **you go first**. * On each turn, the person whose turn it is will remove 1 to 3 stones from the heap. * The one who removes the last stone is the...
If there are 5 stones in the heap, could you figure out a way to remove the stones such that you will always be the winner?
Math,Brainteaser,Game Theory
Easy
294
661
Hello Everyone, our question today is Image Smoother. In this question, we have been given a matrix, okay, m cross n size. Now inside this matrix, we have to choose a small image, like if we chose this element, if we like for now. These elements are considered, if we choose this element, then we have to take the averag...
Image Smoother
image-smoother
An **image smoother** is a filter of the size `3 x 3` that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding cells (i.e., the average of the nine cells in the blue smoother). If one or more of the surrounding cells of a cell is not present, we do not consider it ...
null
Array,Matrix
Easy
null
576
hey guys welcome to a new video in today's video we're going to look at a lead code problem and the problem's name is out of boundary paths so in this question we had given a m into n grid with a ball so initially the ball is at the position start row comma start column which are given as input parameters you are allow...
Out of Boundary Paths
out-of-boundary-paths
There is an `m x n` grid with a ball. The ball is initially at the position `[startRow, startColumn]`. You are allowed to move the ball to one of the four adjacent cells in the grid (possibly out of the grid crossing the grid boundary). You can apply **at most** `maxMove` moves to the ball. Given the five integers `m`...
Is traversing every path feasible? There are many possible paths for a small matrix. Try to optimize it. Can we use some space to store the number of paths and update them after every move? One obvious thing: the ball will go out of the boundary only by crossing it. Also, there is only one possible way the ball can go ...
Dynamic Programming
Medium
688,2239
295
Hello hello viewers welcome to my video straight side fitting tribute to problems for final scene from doing so you give me data stream and two for Indian from its Sudhir and corporation border area village 500 600 number one number two To To Hasni Aayegi Bana The Number This Time And 155 Likes Traveled Person And What...
Find Median from Data Stream
find-median-from-data-stream
The **median** is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two middle values. * For example, for `arr = [2,3,4]`, the median is `3`. * For example, for `arr = [2,3]`, the median is `(2 + 3) / 2 = 2.5`. Implement the M...
null
Two Pointers,Design,Sorting,Heap (Priority Queue),Data Stream
Hard
480,1953,2207
515
hello welcome back to my channel i'm here to do my 100 lego challenge today we have leeco 515 find the largest number in the each tree row so given the root of the binary tree return an array of the largest value in each rows of the tree zero inducted and take a look at this example by what they mean by row is horizont...
Find Largest Value in Each Tree Row
find-largest-value-in-each-tree-row
Given the `root` of a binary tree, return _an array of the largest value in each row_ of the tree **(0-indexed)**. **Example 1:** **Input:** root = \[1,3,2,5,3,null,9\] **Output:** \[1,3,9\] **Example 2:** **Input:** root = \[1,2,3\] **Output:** \[1,3\] **Constraints:** * The number of nodes in the tree will be...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
382
hello guys welcome to deep codes and in today's video we will discuss grid code question 382 that says link list random node so here in this question you are given the one link list with a head pointer and you need to generate a random node from it every time so every time for a get random calls you need to generate a ...
Linked List Random Node
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 probability** of being chosen. Implement the `Solution` class: * `Solution(ListNode head)` Initializes the object with the head of the singly-linked list `head`. * `int getRandom()` Chooses a node randoml...
null
Linked List,Math,Reservoir Sampling,Randomized
Medium
398
983
hey so welcome back this is another daily go prom so today it's called minimum cost for tickets into medium level dining program problem so you're just given an array here called days and so this just represents the days of the year that you want to travel on so you want to travel on day one day four six and so forth b...
Minimum Cost For Tickets
validate-stack-sequences
You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array `days`. Each day is an integer from `1` to `365`. Train tickets are sold in **three different ways**: * a **1-day** pass is sold for `costs[0]` dollars, * a **7-day** pass is sold...
null
Array,Stack,Simulation
Medium
null
61
what's up guys is everyone here my channel is dedicated to hacking hacker rank in the code solution explanation so check out my channel subscribe and like this video if you haven't already today i'm going to be going over rotate list medium it's a linked list problem so basically they want us to just rotate the list bu...
Rotate List
rotate-list
Given the `head` of a linked list, rotate the list to the right by `k` places. **Example 1:** **Input:** head = \[1,2,3,4,5\], k = 2 **Output:** \[4,5,1,2,3\] **Example 2:** **Input:** head = \[0,1,2\], k = 4 **Output:** \[2,0,1\] **Constraints:** * The number of nodes in the list is in the range `[0, 500]`. * ...
null
Linked List,Two Pointers
Medium
189,725
1,044
Hello hello viewers welcome back to take to join this video will see the longest replicate sub skin problem with established code in youtube channel so let's not look at the problem statement this problem se veer the longest duplicate subscribe and subscribe the Channel Please subscribe and subscirbe will sleep during ...
Longest Duplicate Substring
find-common-characters
Given a string `s`, consider all _duplicated substrings_: (contiguous) substrings of s that occur 2 or more times. The occurrences may overlap. Return **any** duplicated substring that has the longest possible length. If `s` does not have a duplicated substring, the answer is `" "`. **Example 1:** **Input:** s = "ba...
null
Array,Hash Table,String
Easy
350
1,793
Hello everyone welcome to my channel Quote Sorry with Mike So today we are going to do video number 20 of our Grady playlist ok lead code number 1793 is hard marked but actually I will make it quite easy the explanation will be in a very basic way ok And we will also understand why this is a problem of greedy and why g...
Maximum Score of a Good Subarray
minimum-moves-to-make-array-complementary
You are given an array of integers `nums` **(0-indexed)** and an integer `k`. The **score** of a subarray `(i, j)` is defined as `min(nums[i], nums[i+1], ..., nums[j]) * (j - i + 1)`. A **good** subarray is a subarray where `i <= k <= j`. Return _the maximum possible **score** of a **good** subarray._ **Example 1:**...
Given a target sum x, each pair of nums[i] and nums[n-1-i] would either need 0, 1, or 2 modifications. Can you find the optimal target sum x value such that the sum of modifications is minimized? Create a difference array to efficiently sum all the modifications.
Array,Hash Table,Prefix Sum
Medium
null
510
question 5 10 in order successor in binary search three giving a node in a binary search tree return the in order successor of that node in the binary search tree if the node has no inorder successor return null so what is the successor of a node is the node with the smallest key greater than the node.vap so let's go g...
Inorder Successor in BST II
count-subarrays-with-more-ones-than-zeros
Given a `node` in a binary search tree, return _the in-order successor of that node in the BST_. If that node has no in-order successor, return `null`. The successor of a `node` is the node with the smallest key greater than `node.val`. You will have direct access to the node but not to the root of the tree. Each nod...
Change the zeros in nums to -1 and create a prefix sum array prefixSum using the new nums. If prefixSum[i] for any index i in the range 0 <= i < prefixSum.length is positive, that means that there are more ones than zeros in the prefix ending at index i. If prefixSum[j] > prefixSum[i] for two indexes i and j such that ...
Array,Binary Search,Divide and Conquer,Binary Indexed Tree,Segment Tree,Merge Sort,Ordered Set
Medium
474,1999,2261
47
hi everyone it's Jin today we are going to solve a problem when we are given a collection of numbers we are given an array of nums that may contain duplicates and we need to return all possible permutations in any order okay so and we are given two examples for example the first example one two and we have three permut...
Permutations II
permutations-ii
Given a collection of numbers, `nums`, that might contain duplicates, return _all possible unique permutations **in any order**._ **Example 1:** **Input:** nums = \[1,1,2\] **Output:** \[\[1,1,2\], \[1,2,1\], \[2,1,1\]\] **Example 2:** **Input:** nums = \[1,2,3\] **Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,...
null
Array,Backtracking
Medium
31,46,267,1038
946
Hello everyone, welcome to me, this is the question of my channel, but this is very easy if you understand it, which is fine, I have given you two, one is named Pop, okay, so both the sequences have been given, right? 1 2 3 4 5 in one. 45321, so it is asking you, it is saying that this is the sequence of the stock, tha...
Validate Stack Sequences
smallest-range-ii
Given two integer arrays `pushed` and `popped` each with distinct values, return `true` _if this could have been the result of a sequence of push and pop operations on an initially empty stack, or_ `false` _otherwise._ **Example 1:** **Input:** pushed = \[1,2,3,4,5\], popped = \[4,5,3,2,1\] **Output:** true **Explana...
null
Array,Math,Greedy,Sorting
Medium
null
328
Hi everyone welcome back you take with Runas in this video we are covering a problem statement and linked list in this question we have given hard note of a single linked list and what we have to do is to arrange our linked list in such groups meaning Like there will be odd indexes, there are no indexes in the link lis...
Odd Even Linked List
odd-even-linked-list
Given the `head` of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return _the reordered list_. The **first** node is considered **odd**, and the **second** node is **even**, and so on. Note that the relative order inside both the even and odd groups s...
null
Linked List
Medium
725
821
hello everyone so in this video let us talk about an easy problem from lead code the problem name is shortest distance to a character so the problem statement goes like this that you're given a string s and a character c that occurs in that string s now return an array of integers answer where answer of length is same ...
Shortest Distance to a Character
bricks-falling-when-hit
Given a string `s` and a character `c` that occurs in `s`, return _an array of integers_ `answer` _where_ `answer.length == s.length` _and_ `answer[i]` _is the **distance** from index_ `i` _to the **closest** occurrence of character_ `c` _in_ `s`. The **distance** between two indices `i` and `j` is `abs(i - j)`, where...
null
Array,Union Find,Matrix
Hard
2101,2322
452
Hello hello everyone welcome and welcome back to my channel suggestion or going to solve the problem 155 not laga de video please like it and effective subscribe To My Channel Please subscribe so let's you get to fifteen years without any further delay started pure problem is minimum Number Of Fruit Balloons Very Simpl...
Minimum Number of Arrows to Burst Balloons
minimum-number-of-arrows-to-burst-balloons
There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array `points` where `points[i] = [xstart, xend]` denotes a balloon whose **horizontal diameter** stretches between `xstart` and `xend`. You do not know the exact y-coordinates of the ball...
null
Array,Greedy,Sorting
Medium
253,435
705
hey and welcome today we are going to solve design hash interview question we will Implement a really handy data structure so consider this as a gem let's get into it here we have the sequence of operations that is going to be thrown to us to handle from First Look to this we will have three operations so at the first ...
Design HashSet
design-hashset
Design a HashSet without using any built-in hash table libraries. Implement `MyHashSet` class: * `void add(key)` Inserts the value `key` into the HashSet. * `bool contains(key)` Returns whether the value `key` exists in the HashSet or not. * `void remove(key)` Removes the value `key` in the HashSet. If `key` do...
null
null
Easy
null
326
welcome back to algo today's question is leak code 326 power of three so we're given an integer n and we need to return true if it's a power of three otherwise return false now an integer N is a power of three if there exists an integer X such that n is equal to 3 to the^ of X such that n is equal to 3 to the^ of X suc...
Power of Three
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, if there exists an integer `x` such that `n == 3x`. **Example 1:** **Input:** n = 27 **Output:** true **Explanation:** 27 = 33 **Example 2:** **Input:** n = 0 **Output:** false **Explanat...
null
Math,Recursion
Easy
231,342,1889
565
welcome to september's leeco challenge today's problem is array nesting you are given an integer array nums of length n where nums is a permutation of the numbers in the range 0 to n minus 1. now you should build a set s of k equaling all these various numbers of k the numbers of nums of k the numbers of k and so on an...
Array Nesting
array-nesting
You are given an integer array `nums` of length `n` where `nums` is a permutation of the numbers in the range `[0, n - 1]`. You should build a set `s[k] = {nums[k], nums[nums[k]], nums[nums[nums[k]]], ... }` subjected to the following rule: * The first element in `s[k]` starts with the selection of the element `num...
null
Array,Depth-First Search
Medium
339,341,364
33
hello and welcome today we're doing a question from Le code called search in rotated sorted array it's a medium and we're going to jump right into it there is an integer array nums sorted in ascending order with distinct values prior to being passed to your function nums is possibly rotated at an unknown pivot index k ...
Search in Rotated Sorted Array
search-in-rotated-sorted-array
There is an integer array `nums` sorted in ascending order (with **distinct** values). Prior to being passed to your function, `nums` is **possibly rotated** at an unknown pivot index `k` (`1 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]]` ...
null
Array,Binary Search
Medium
81,153,2273
78
Hello hello friends today I will discuss and after this thought to back tracking play list and we will post around sure bluetooth on tap tracking including lord of number of proving standard problems and also problem easy interview syed ali songs play list and difficult discuss we medium problems From grated sob you un...
Subsets
subsets
Given an integer array `nums` of **unique** elements, return _all possible_ _subsets_ _(the power set)_. The solution set **must not** contain duplicate subsets. Return the solution in **any order**. **Example 1:** **Input:** nums = \[1,2,3\] **Output:** \[\[\],\[1\],\[2\],\[1,2\],\[3\],\[1,3\],\[2,3\],\[1,2,3\]\] ...
null
Array,Backtracking,Bit Manipulation
Medium
90,320,800,2109,2170
86
hi everyone today we are going to sort of the little code question partition list so you are given head of a link to list and the value X partition it such that all knows less than x come before knows greater than or equal to X you should preserve the original relative order of the nodes in each of two partitions so le...
Partition List
partition-list
Given the `head` of a linked list and a value `x`, partition it such that all nodes **less than** `x` come before nodes **greater than or equal** to `x`. You should **preserve** the original relative order of the nodes in each of the two partitions. **Example 1:** **Input:** head = \[1,4,3,2,5,2\], x = 3 **Output:**...
null
Linked List,Two Pointers
Medium
2265
4
you guys ready to tackle a brand new problem if you want to code along make sure to hit the link in the description below it's time to pop our daily dose of code we fought and defeated easy problems we've bested medium problems and now we're finally stepping into the realm of hard problems will we be able to vacuish th...
Median of Two Sorted Arrays
median-of-two-sorted-arrays
Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays. The overall run time complexity should be `O(log (m+n))`. **Example 1:** **Input:** nums1 = \[1,3\], nums2 = \[2\] **Output:** 2.00000 **Explanation:** merged array = \[1,2,3\] and median is ...
null
Array,Binary Search,Divide and Conquer
Hard
null
832
and welcome to my channel today we are going to liquid the flipping image question in python so we are given a binary matrix a we want to flip the image horizontally and then invert it and return the resulting image so um first we need to flip the image around horizontally it means that each row of the image is reverse...
Flipping an Image
binary-tree-pruning
Given an `n x n` binary matrix `image`, flip the image **horizontally**, then invert it, and return _the resulting image_. To flip an image horizontally means that each row of the image is reversed. * For example, flipping `[1,1,0]` horizontally results in `[0,1,1]`. To invert an image means that each `0` is repla...
null
Tree,Depth-First Search,Binary Tree
Medium
null
1,091
show you how to solve lethal question 1091 shortest the path in the binary matrix so given a n multiplex and binary matrix a grid like this for example return the length of the shortest clear path in the matrix and if there is no clear path at all return minus one so a clear path in the binary matrix is a path from the...
Shortest Path in Binary Matrix
maximum-average-subtree
Given an `n x n` binary matrix `grid`, return _the length of the shortest **clear path** in the matrix_. If there is no clear path, return `-1`. A **clear path** in a binary matrix is a path from the **top-left** cell (i.e., `(0, 0)`) to the **bottom-right** cell (i.e., `(n - 1, n - 1)`) such that: * All the visite...
Can you find the sum of values and the number of nodes for every sub-tree ? Can you find the sum of values and the number of nodes for a sub-tree given the sum of values and the number of nodes of it's left and right sub-trees ? Use depth first search to recursively find the solution for the children of a node then use...
Tree,Depth-First Search,Binary Tree
Medium
2126
705
hey everybody this is Larry this is day 30 I think the second to last day of the vehicle daily challenge hit the like button hit the Subscribe button join me Discord let me know what you think about today's file so it seems like we're having a hash set again uh I don't know thanks for watching if you're watching I'm st...
Design HashSet
design-hashset
Design a HashSet without using any built-in hash table libraries. Implement `MyHashSet` class: * `void add(key)` Inserts the value `key` into the HashSet. * `bool contains(key)` Returns whether the value `key` exists in the HashSet or not. * `void remove(key)` Removes the value `key` in the HashSet. If `key` do...
null
null
Easy
null
205
so hello guys today we will be solving yet another problem of neat code which is isomorphic strings so what are isomorphic strings true strings s and t are isomorphic if the characters in s can be replaced to get d that is we can see that here it is e g x and it is a d so for e the character mapped is a and for g the c...
Isomorphic Strings
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` can be replaced to get `t`. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same characte...
null
Hash Table,String
Easy
290
367
it's lead code problem 367 and our task is to check whether a given number is a perfect square or not so for example if you are given a number 25 you know that for 25 we can always find a value 5 whose square is equal to 25 uh but on the other hand if you are given a number like 24 then we know that for a value 4 its s...
Valid Perfect Square
valid-perfect-square
Given a positive integer num, return `true` _if_ `num` _is a perfect square or_ `false` _otherwise_. A **perfect square** is an integer that is the square of an integer. In other words, it is the product of some integer with itself. You must not use any built-in library function, such as `sqrt`. **Example 1:** **In...
null
Math,Binary Search
Easy
69,633
21
hi guys in this video we'll look at how we can merge two sorted linked lists into a single one so given two sorted linked lists merge them into one linked list such that all the element of the new list are sorted so our examples are straightforward self-explanatory our straightforward self-explanatory our straightforwa...
Merge Two Sorted Lists
merge-two-sorted-lists
You are given the heads of two sorted linked lists `list1` and `list2`. Merge the two lists in a one **sorted** list. The list should be made by splicing together the nodes of the first two lists. Return _the head of the merged linked list_. **Example 1:** **Input:** list1 = \[1,2,4\], list2 = \[1,3,4\] **Output:**...
null
Linked List,Recursion
Easy
23,88,148,244,1774,2071
30
Hello friends to Jhal Ajay, once again welcome all of you to my YouTube channel Tier-3, all of you to my YouTube channel Tier-3, all of you to my YouTube channel Tier-3, so before continuing with today's video, I would like to say that I will put the link of Telegram group in the description, so please join you all. Wh...
Substring with Concatenation of All Words
substring-with-concatenation-of-all-words
You are given a string `s` and an array of strings `words`. All the strings of `words` are of **the same length**. A **concatenated substring** in `s` is a substring that contains all the strings of any permutation of `words` concatenated. * For example, if `words = [ "ab ", "cd ", "ef "]`, then `"abcdef "`, `"abef...
null
Hash Table,String,Sliding Window
Hard
76
1,289
Hello Friends Shot Dead A Victim Discuss Another Problem List Court Problem Name Minimum Falling Part To End Its Heart Problem Voice Of Soil Discussed Hot Problem Today Itself When Did This Almost Same Problem But History Rich Different Countries But In This Problem Voice Of To Do The Matrix OK selection let's move to ...
Minimum Falling Path Sum II
day-of-the-week
Given an `n x n` integer matrix `grid`, return _the minimum sum of a **falling path with non-zero shifts**_. A **falling path with non-zero shifts** is a choice of exactly one element from each row of `grid` such that no two elements chosen in adjacent rows are in the same column. **Example 1:** **Input:** arr = \[\...
Sum up the number of days for the years before the given year. Handle the case of a leap year. Find the number of days for each month of the given year.
Math
Easy
null
746
hello and welcome to programming rush today in this video we are going to discuss the problem minimum cost climbing stage that is the problem number 1746 so here in this problem we will be given the cost to climb each step and we need to minimize it and it is the very much simple thing that for minimization we choose d...
Min Cost Climbing Stairs
prefix-and-suffix-search
You are given an integer array `cost` where `cost[i]` is the cost of `ith` step on a staircase. Once you pay the cost, you can either climb one or two steps. You can either start from the step with index `0`, or the step with index `1`. Return _the minimum cost to reach the top of the floor_. **Example 1:** **Input...
For a word like "test", consider "#test", "t#test", "st#test", "est#test", "test#test". Then if we have a query like prefix = "te", suffix = "t", we can find it by searching for something we've inserted starting with "t#te".
String,Design,Trie
Hard
211
1,038
hi everyone it's sorin today we are going to solve a problem when we are given a binary tree and we need to convert it to a greater tree so what's that mean it means that the value of each node we are updating to value of that node plus the value of all other nodes which are greater than the value of this one for examp...
Binary Search Tree to Greater Sum Tree
number-of-squareful-arrays
Given the `root` of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus the sum of all keys greater than the original key in BST. As a reminder, a _binary search tree_ is a tree that satisfies these constraints: * The left subtree of a...
null
Array,Math,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask
Hard
47
230
question 230 of leak code cave smallest element in a bst so given the root of a binary search tree and an integer k return the cave's smallest value of all the values of the nodes in the tree in the first example we have a bst right here binary search tree we have a k value equal to one and the output is one in the sec...
Kth Smallest Element in a BST
kth-smallest-element-in-a-bst
Given the `root` of a binary search tree, and an integer `k`, return _the_ `kth` _smallest value (**1-indexed**) of all the values of the nodes in the tree_. **Example 1:** **Input:** root = \[3,1,4,null,2\], k = 1 **Output:** 1 **Example 2:** **Input:** root = \[5,3,6,2,4,null,null,1\], k = 3 **Output:** 3 **Cons...
Try to utilize the property of a BST. Try in-order traversal. (Credits to @chan13) What if you could modify the BST node's structure? The optimal runtime complexity is O(height of BST).
Tree,Depth-First Search,Binary Search Tree,Binary Tree
Medium
94,671
350
Ajay Ko Hello Everyone Welcome To Search Kya Sarp Baurail Posted Videos YouTube Handed Activated Subscribe Sukrant Editor End Second Subscribe To Present In The Number To Now School Want To Subscribe Quantum Aap Snan Further Correspondence End Look Forward To Fight With You Are Not Just Looking For November 1999 Tarf 2...
Intersection of Two Arrays II
intersection-of-two-arrays-ii
Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must appear as many times as it shows in both arrays and you may return the result in **any order**. **Example 1:** **Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\] **Output:** \[2,2\] **Example 2:** **I...
null
Array,Hash Table,Two Pointers,Binary Search,Sorting
Easy
349,1044,1392,2282
1,814
given a list of numbers find How many pairs are considered nice a pair of numbers is considered nice if the first number plus the reverse of the second number is equal to the second number plus the reverse of the first number so for example 42 + 97 reversed is 42 + 79 for example 42 + 97 reversed is 42 + 79 for example...
Count Nice Pairs in an Array
jump-game-vi
You are given an array `nums` that consists of non-negative integers. Let us define `rev(x)` as the reverse of the non-negative integer `x`. For example, `rev(123) = 321`, and `rev(120) = 21`. A pair of indices `(i, j)` is **nice** if it satisfies all of the following conditions: * `0 <= i < j < nums.length` * `nu...
Let dp[i] be "the maximum score to reach the end starting at index i". The answer for dp[i] is nums[i] + max{dp[i+j]} for 1 <= j <= k. That gives an O(n*k) solution. Instead of checking every j for every i, keep track of the largest dp[i] values in a heap and calculate dp[i] from right to left. When the largest value i...
Array,Dynamic Programming,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue
Medium
239,2001
39
In this video, we will discuss the combinations, its category is medium. In this problem, you have been given a number of integers whose green elements are distinct and you have also been given a target to wait. What you have to return is the list of unique combinations. True. Date frozen numbers even to the target are...
Combination Sum
combination-sum
Given an array of **distinct** integers `candidates` and a target integer `target`, return _a list of all **unique combinations** of_ `candidates` _where the chosen numbers sum to_ `target`_._ You may return the combinations in **any order**. The **same** number may be chosen from `candidates` an **unlimited number of...
null
Array,Backtracking
Medium
17,40,77,216,254,377
190
Hello hello everyone welcome to my channel today date waiver af chale recording chahiye bhi problem hai reverse begusarai vs sign in teacher swift solving this problem let's do subscribe operator so let's say number 205 to zor weaver only memory computer memory 98100 to the last phase of this The Number Will Be Id Numb...
Reverse Bits
reverse-bits
Reverse bits of a given 32 bits unsigned integer. **Note:** * Note that in some languages, such as Java, there is no unsigned integer type. In this case, both input and output will be given as a signed integer type. They should not affect your implementation, as the integer's internal binary representation is the s...
null
Divide and Conquer,Bit Manipulation
Easy
7,191,2238
62
welcome to June's LICO challenge today's problem is unique paths a robot is located at the top-left corner and we located at the top-left corner and we located at the top-left corner and we want to find out how many unique paths are there to the finish which is the bottom right the robot can only move down or right at ...
Unique Paths
unique-paths
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 robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time. Given the two integers `m` and `n`, return _the nu...
null
Math,Dynamic Programming,Combinatorics
Medium
63,64,174,2192
106
That in this video will resume writing and binary tree giving its an order and posters soft for its water in water and posters these posters will actually print everything subscribe must subscribe all subscribe root will come in and subscribe to ke din hair oil soothe fruits will come And First Left Not Welcome Day-Nig...
Construct Binary Tree from Inorder and Postorder Traversal
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 the postorder traversal of the same tree, construct and return _the binary tree_. **Example 1:** **Input:** inorder = \[9,3,15,20,7\], postorder = \[9,15,7,20,3\] **Output:** \[3,9,20,null,n...
null
Array,Hash Table,Divide and Conquer,Tree,Binary Tree
Medium
105
354
today we're gonna working on lead code question number 354 uh russian dollar envelopes uh you are given a 2d array of integers uh envelopes where the envelopes of i is gonna be have on the width and the height i represent represents the width and the height of an envelope when an envelope can fit into an other if and o...
Russian Doll Envelopes
russian-doll-envelopes
You are given a 2D array of integers `envelopes` where `envelopes[i] = [wi, hi]` represents the width and the height of an envelope. One envelope can fit into another if and only if both the width and height of one envelope are greater than the other envelope's width and height. Return _the maximum number of envelope...
null
Array,Binary Search,Dynamic Programming,Sorting
Hard
300,2123
930
hey everyone welcome back and let's write some more neat code today so today let's solve the problem binary subarrays with sum we're given a binary array of integers and that just means it has zeros and ones and we're given an integer goal which is basically the target sum that we want to reach and we want to reach it ...
Binary Subarrays With Sum
all-possible-full-binary-trees
Given a binary array `nums` and an integer `goal`, return _the number of non-empty **subarrays** with a sum_ `goal`. A **subarray** is a contiguous part of the array. **Example 1:** **Input:** nums = \[1,0,1,0,1\], goal = 2 **Output:** 4 **Explanation:** The 4 subarrays are bolded and underlined below: \[**1,0,1**,0...
null
Dynamic Programming,Tree,Recursion,Memoization,Binary Tree
Medium
null
1,828
number of points inside a cycle so we are going to check how many points inside a cycle it also including the point on the um on the cycle so for example this is a cycle if some point on the cycle so this point is also included yeah let's just check one example so for query 2 three and one so where is 2 three uh we're ...
Queries on Number of Points Inside a Circle
count-ways-to-distribute-candies
You are given an array `points` where `points[i] = [xi, yi]` is the coordinates of the `ith` point on a 2D plane. Multiple points can have the **same** coordinates. You are also given an array `queries` where `queries[j] = [xj, yj, rj]` describes a circle centered at `(xj, yj)` with a radius of `rj`. For each query `...
Try to define a recursive approach. For the ith candies, there will be one of the two following cases: If the i - 1 previous candies are already distributed into k bags for the ith candy, you can have k * dp[n - 1][k] ways to distribute the ith candy. We need then to solve the state of (n - 1, k). If the i - 1 previous...
Dynamic Programming
Hard
null
222
Hi gas welcome and welcome back to my channel so today our problem is count complete tree notes so what have you given us in this problem statement here we have been given a root note complete binary's ok what we have to do is to find Number of notes in the OK, so before this you have to understand what is a complete b...
Count Complete Tree Nodes
count-complete-tree-nodes
Given the `root` of a **complete** binary tree, return the number of the nodes in the tree. According to **[Wikipedia](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled in a complete binary tree, and all nodes in the last level are as far lef...
null
Binary Search,Tree,Depth-First Search,Binary Tree
Medium
270
819
Shri Ram Bhaiya, how are you friend, everything is fine, you can do sugar life and subscribe, if you subscribe, it is quiet, said that everyone's frequency has to be freed, that Sanjay Dutt has become in and looted the contracts, subscribe, and subscribe. After subscribing to the channel, we can understand these three ...
Most Common Word
minimum-swaps-to-make-sequences-increasing
Given a string `paragraph` and a string array of the banned words `banned`, return _the most frequent word that is not banned_. It is **guaranteed** there is **at least one word** that is not banned, and that the answer is **unique**. The words in `paragraph` are **case-insensitive** and the answer should be returned ...
null
Array,Dynamic Programming
Hard
2234
1,748
hello quick introduction to the video my name is Cameron I a graduate Apprentice software engineer currently studying at Glasgow University and I'm using this video as a way to sort of rucky debug a l code problem just attempt to solve it talk through my thought process and hopefully it's useful to someone on here so u...
Sum of Unique Elements
best-team-with-no-conflicts
You are given an integer array `nums`. The unique elements of an array are the elements that appear **exactly once** in the array. Return _the **sum** of all the unique elements of_ `nums`. **Example 1:** **Input:** nums = \[1,2,3,2\] **Output:** 4 **Explanation:** The unique elements are \[1,3\], and the sum is 4. ...
First, sort players by age and break ties by their score. You can now consider the players from left to right. If you choose to include a player, you must only choose players with at least that score later on.
Array,Dynamic Programming,Sorting
Medium
null
1,904
hey everybody this is larry this is me going with q2 of the elite co weekly contest 246 the number of full rounds you have played so hit the like button hit the subscribe button join me on discord let me know what you think about taste prom so this is a just a math problem and basically you the thing to note is that um...
The Number of Full Rounds You Have Played
second-largest-digit-in-a-string
You are participating in an online chess tournament. There is a chess round that starts every `15` minutes. The first round of the day starts at `00:00`, and after every `15` minutes, a new round starts. * For example, the second round starts at `00:15`, the fourth round starts at `00:45`, and the seventh round star...
First of all, get the distinct characters since we are only interested in those Let's note that there might not be any digits.
Hash Table,String
Easy
null
1,207
Welcome, you are my channel, the reason for that is that there is another B solution which can be considered, okay, that should also come, okay, so let's see this question: Google, see this question: Google, see this question: Google, Amazon, Netflix, something extra, also, expecting you, expecting from you, okay, what...
Unique Number of Occurrences
delete-nodes-and-return-forest
Given an array of integers `arr`, return `true` _if the number of occurrences of each value in the array is **unique** or_ `false` _otherwise_. **Example 1:** **Input:** arr = \[1,2,2,1,1,3\] **Output:** true **Explanation:** The value 1 has 3 occurrences, 2 has 2 and 3 has 1. No two values have the same number of oc...
null
Tree,Depth-First Search,Binary Tree
Medium
2175
337
hey guys welcome back to this lit good problem how's robert iii the thief has found himself a new place for his delivery again there is only one entrance to this area called root besides the route is how it has one and only one parent house after a tour the smart thief realized that all houses in this plate forms a bin...
House Robber III
house-robber-iii
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called `root`. Besides the `root`, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will automatically contact the police if ...
null
Dynamic Programming,Tree,Depth-First Search,Binary Tree
Medium
198,213
92
hello and welcome to another video today we're going to be working on reverse link list 2 which is similar to reverse link list one but now we are reversing a chunk of a linked list not the whole thing so for example given a link list of five elements and given two and four we need to reverse the linked list from nodes...
Reverse Linked List II
reverse-linked-list-ii
Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_. **Example 1:** **Input:** head = \[1,2,3,4,5\], left = 2, right = 4 **Output:** \[1,4,3,2,5\] **Example 2:** **I...
null
Linked List
Medium
206
292
all right so today is day 32 of the 100 days elite code today we got number 292 nim game it's an easy problem um and it's actually pretty uh it's a pretty cool thought experiment um and this the solution is very simple once you understand it so it reads as follows you are playing the following them game with your frien...
Nim Game
nim-game
You are playing the following Nim Game with your friend: * Initially, there is a heap of stones on the table. * You and your friend will alternate taking turns, and **you go first**. * On each turn, the person whose turn it is will remove 1 to 3 stones from the heap. * The one who removes the last stone is the...
If there are 5 stones in the heap, could you figure out a way to remove the stones such that you will always be the winner?
Math,Brainteaser,Game Theory
Easy
294
386
hello and welcome back everyone to the opaxor youtube channel it is oppax or sam here uh with another solution for a leeco problem today we are looking at late code 386 lexicographical numbers so let's go over the problem statement given an integer n return 1 minus n in lexicographical order so for example given 13 ret...
Lexicographical Numbers
lexicographical-numbers
Given an integer `n`, return all the numbers in the range `[1, n]` sorted in lexicographical order. You must write an algorithm that runs in `O(n)` time and uses `O(1)` extra space. **Example 1:** **Input:** n = 13 **Output:** \[1,10,11,12,13,2,3,4,5,6,7,8,9\] **Example 2:** **Input:** n = 2 **Output:** \[1,2\] *...
null
Depth-First Search,Trie
Medium
null
1,038
hey everybody this is Larry this is me going over I'm going to do one more uh it's November 12th I'm gonna do a bonus question just because today's poem was a little bit silly so I'm just gonna get a little bit of practice in before um before the contest which is in about an hour or so and then take a little bit of a b...
Binary Search Tree to Greater Sum Tree
number-of-squareful-arrays
Given the `root` of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus the sum of all keys greater than the original key in BST. As a reminder, a _binary search tree_ is a tree that satisfies these constraints: * The left subtree of a...
null
Array,Math,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask
Hard
47
140
so okay the last question for the die um so in this video there are two goals the first goal is to find the solution for this problem and we are going to do some coding on top of it and the other goal is to see how we should be having a real interview so let's get started so remember the first step in the real intervie...
Word Break II
word-break-ii
Given a string `s` and a dictionary of strings `wordDict`, add spaces in `s` to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in **any order**. **Note** that the same word in the dictionary may be reused multiple times in the segmentation. **Example 1:** **Input:...
null
Hash Table,String,Dynamic Programming,Backtracking,Trie,Memoization
Hard
139,472
509
hello and welcome to another video today we're going to be solving lead code 509 fibonacci number feel free to pause the video just to read through this and understand what the question is that's actually asking for however i prefer to go through the examples as i find the examples a lot more descriptive than the actua...
Fibonacci Number
inorder-successor-in-bst-ii
The **Fibonacci numbers**, commonly denoted `F(n)` form a sequence, called the **Fibonacci sequence**, such that each number is the sum of the two preceding ones, starting from `0` and `1`. That is, F(0) = 0, F(1) = 1 F(n) = F(n - 1) + F(n - 2), for n > 1. Given `n`, calculate `F(n)`. **Example 1:** **Input:** n = ...
null
Tree,Binary Search Tree,Binary Tree
Medium
285
783
um hello so today we are going to do this problem which is part of lead code daily challenge minimum distance between BST nodes so we have a binary search tree like here and the goal here is to return the minimum difference between the values of any two different nodes in the tree right so the minimum difference betwee...
Minimum Distance Between BST Nodes
search-in-a-binary-search-tree
Given the `root` of a Binary Search Tree (BST), return _the minimum difference between the values of any two different nodes in the tree_. **Example 1:** **Input:** root = \[4,2,6,1,3\] **Output:** 1 **Example 2:** **Input:** root = \[1,0,48,null,null,12,49\] **Output:** 1 **Constraints:** * The number of nodes...
null
Tree,Binary Search Tree,Binary Tree
Easy
270,784
129
Hello viewers welcome back to back door and this video will see the UPA-2 Leaf video will see the UPA-2 Leaf video will see the UPA-2 Leaf Numbers Problem World List Ko De 26th June Challenge So Let's Not Look At The Problem Statement In This Problem Were Giver Bank And To Find The Sum Of The Numbers From Route to Cash...
Sum Root to Leaf Numbers
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 the tree represents a number. * For example, the root-to-leaf path `1 -> 2 -> 3` represents the number `123`. Return _the total sum of all root-to-leaf numbers_. Test cases are generated so that the answer w...
null
Tree,Depth-First Search,Binary Tree
Medium
112,124,1030
3
we are given a string and we need to find out the length of the longest substring that does not have any repeating characters for example if this is the given string then the longest substring without repeating characters is this to solve this we will use two pointers I and J One pointer to track the beginning of the s...
Longest Substring Without Repeating Characters
longest-substring-without-repeating-characters
Given a string `s`, find the length of the **longest** **substring** without repeating characters. **Example 1:** **Input:** s = "abcabcbb " **Output:** 3 **Explanation:** The answer is "abc ", with the length of 3. **Example 2:** **Input:** s = "bbbbb " **Output:** 1 **Explanation:** The answer is "b ", with t...
null
Hash Table,String,Sliding Window
Medium
159,340,1034,1813,2209
163
yo what's up everybody how's going so today we are going to solve the one of the very good question which is missing range i don't know why this question has too much dislike but this question is pretty good believe me this question is awesome but i don't know why people do dislikes i will go for the likes all right gu...
Missing Ranges
missing-ranges
You are given an inclusive range `[lower, upper]` and a **sorted unique** integer array `nums`, where all elements are in the inclusive range. A number `x` is considered **missing** if `x` is in the range `[lower, upper]` and `x` is not in `nums`. Return _the **smallest sorted** list of ranges that **cover every miss...
null
Array
Easy
228
91
right so i was doing this problem the code base i discussed the cursive solution and then added memorization now i wanted to extend on that and just convert that my moist recursive direct program installation into a bottom-up time programming into a bottom-up time programming into a bottom-up time programming but i don...
Decode Ways
decode-ways
A message containing letters from `A-Z` can be **encoded** into numbers using the following mapping: 'A' -> "1 " 'B' -> "2 " ... 'Z' -> "26 " To **decode** an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For examp...
null
String,Dynamic Programming
Medium
639,2091
938
Hello everyone welcome to my channel so today we will van the question number of our binary search tree playlist the first question is lead code number 9938 ok the name of the question is range sam of bst ok will be given ok and will give you a range ok Range is my loss, both are inclusive. Okay, whatever notes you hav...
Range Sum of BST
numbers-at-most-n-given-digit-set
Given the `root` node of a binary search tree and two integers `low` and `high`, return _the sum of values of all nodes with a value in the **inclusive** range_ `[low, high]`. **Example 1:** **Input:** root = \[10,5,15,3,7,null,18\], low = 7, high = 15 **Output:** 32 **Explanation:** Nodes 7, 10, and 15 are in the ra...
null
Array,Math,Binary Search,Dynamic Programming
Hard
null
513
everyone welcome back and let's write some more neat code today so today let's solve the problem find bottom left tree value we're given the root of a binary tree and it's always going to be non-empty and we just want to return the non-empty and we just want to return the non-empty and we just want to return the left m...
Find Bottom Left Tree Value
find-bottom-left-tree-value
Given the `root` of a binary tree, return the leftmost value in the last row of the tree. **Example 1:** **Input:** root = \[2,1,3\] **Output:** 1 **Example 2:** **Input:** root = \[1,2,3,4,null,5,6,null,null,7\] **Output:** 7 **Constraints:** * The number of nodes in the tree is in the range `[1, 104]`. * `-...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
322
hey there and welcome to another Elite code prom So today we're going to be doing Pro number 322 coin change and this is going to be one of the uh more important dynamic programming problems it's not a hard one but you need to know the concepts for this problem I think it's called the unbounded knapsack problem where y...
Coin Change
coin-change
You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money. Return _the fewest number of coins that you need to make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `-1`. You may a...
null
Array,Dynamic Programming,Breadth-First Search
Medium
1025,1393,2345
406
Hello Everyone Welcome to my channel Today's Question is Urine Infection White Video Channel Please subscribe our YouTube Channel and subscribe the Channel Please subscribe and subscribe the Ki and Begin with Example in Wedding Input and Buddhists in Food and Answers and Looked So Let's Move Two Boys Pay How They Can S...
Queue Reconstruction by Height
queue-reconstruction-by-height
You are given an array of people, `people`, which are the attributes of some people in a queue (not necessarily in order). Each `people[i] = [hi, ki]` represents the `ith` person of height `hi` with **exactly** `ki` other people in front who have a height greater than or equal to `hi`. Reconstruct and return _the queu...
What can you say about the position of the shortest person? If the position of the shortest person is i, how many people would be in front of the shortest person? Once you fix the position of the shortest person, what can you say about the position of the second shortest person?
Array,Greedy,Binary Indexed Tree,Segment Tree,Sorting
Medium
315
530
Hello friends welcome to code Sutra in this video we'll be solving lead code problem number 530 the minimum absolute difference in a binary search tree also called as BST so what is a BST is the one in which the left subtree is always lesser than the root node and the right subtree values is always greater than the roo...
Minimum Absolute Difference in BST
minimum-absolute-difference-in-bst
Given the `root` of a Binary Search Tree (BST), return _the minimum absolute difference between the values of any two different nodes in the tree_. **Example 1:** **Input:** root = \[4,2,6,1,3\] **Output:** 1 **Example 2:** **Input:** root = \[1,0,48,null,null,12,49\] **Output:** 1 **Constraints:** * The number...
null
Tree,Depth-First Search,Breadth-First Search,Binary Search Tree,Binary Tree
Easy
532
1,032
uh hey everybody this is larry this is day 23 of the leeco daily challenge hit the like button hit the subscribe button join me on discord uh and hang out uh let's go look at today's prime stream of characters uh okay so it's a classified implement we have to stream checker uh okay and then true the last k characters c...
Stream of Characters
satisfiability-of-equality-equations
Design an algorithm that accepts a stream of characters and checks if a suffix of these characters is a string of a given array of strings `words`. For example, if `words = [ "abc ", "xyz "]` and the stream added the four characters (one by one) `'a'`, `'x'`, `'y'`, and `'z'`, your algorithm should detect that the suf...
null
Array,String,Union Find,Graph
Medium
null
746
we recently solved climbing stairs which is basically a Fibonacci Sequence but now we need to solve Min cost climbing stairs so we're given an integer array of cost where each cost at I is the cost of the I step on a staircase once you pay that cost you can either climb one or two steps and you can either start from th...
Min Cost Climbing Stairs
prefix-and-suffix-search
You are given an integer array `cost` where `cost[i]` is the cost of `ith` step on a staircase. Once you pay the cost, you can either climb one or two steps. You can either start from the step with index `0`, or the step with index `1`. Return _the minimum cost to reach the top of the floor_. **Example 1:** **Input...
For a word like "test", consider "#test", "t#test", "st#test", "est#test", "test#test". Then if we have a query like prefix = "te", suffix = "t", we can find it by searching for something we've inserted starting with "t#te".
String,Design,Trie
Hard
211
754
welcome to december's lego challenge today's problem is reach a number you are standing at position zero on an infinite number line there is a goal at position target on each move you can either go left or right during the nth move starting from zero or one you can take n steps so on the first move you can take one ste...
Reach a Number
cracking-the-safe
You are standing at position `0` on an infinite number line. There is a destination at position `target`. You can make some number of moves `numMoves` so that: * On each move, you can either go left or right. * During the `ith` move (starting from `i == 1` to `i == numMoves`), you take `i` steps in the chosen dir...
We can think of this problem as the problem of finding an Euler path (a path visiting every edge exactly once) on the following graph: there are $$k^{n-1}$$ nodes with each node having $$k$$ edges. It turns out this graph always has an Eulerian circuit (path starting where it ends.) We should visit each node in "po...
Depth-First Search,Graph,Eulerian Circuit
Hard
null
904
hey everyone welcome to Tech void in this video we are going to solve problem number 904 fruit into baskets so given an integer array of fruits we need to return the maximum number of fruits we can pick I'm going to explain you guys the rules for this problem and how we are going to solve this particular problem now le...
Fruit Into Baskets
leaf-similar-trees
You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by an integer array `fruits` where `fruits[i]` is the **type** of fruit the `ith` tree produces. You want to collect as much fruit as possible. However, the owner has some strict rules that you must foll...
null
Tree,Depth-First Search,Binary Tree
Easy
null
72
hey guys how's everything going let's take a look at number 72 at a distance we were given two words with one and we're two and I find the minimum number of operations required to convert word one - where - which means to word one - where - which means to word one - where - which means to transform yeah we have three o...
Edit Distance
edit-distance
Given two strings `word1` and `word2`, return _the minimum number of operations required to convert `word1` to `word2`_. You have the following three operations permitted on a word: * Insert a character * Delete a character * Replace a character **Example 1:** **Input:** word1 = "horse ", word2 = "ros " **O...
null
String,Dynamic Programming
Hard
161,583,712,1105,2311
10
regular expression matching one of the hard lead code problems has this one kept you up late at night so let's walk through this together and in honor of this being a dynamic programming problem we will break everything down into simpler sub problems to help you better understand this so first let's understand the prob...
Regular Expression Matching
regular-expression-matching
Given an input string `s` and a pattern `p`, implement regular expression matching with support for `'.'` and `'*'` where: * `'.'` Matches any single character.​​​​ * `'*'` Matches zero or more of the preceding element. The matching should cover the **entire** input string (not partial). **Example 1:** **Input:...
null
String,Dynamic Programming,Recursion
Hard
44
382
hello everyone welcome back to the channel and today we will install bleach code daily challenge problem number 382 linked list random note so uh it's stacked as a medium problem but I would say it's rather an easy problem to solve and what we have to do is like uh they have given us a class by the name solution and th...
Linked List Random Node
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 probability** of being chosen. Implement the `Solution` class: * `Solution(ListNode head)` Initializes the object with the head of the singly-linked list `head`. * `int getRandom()` Chooses a node randoml...
null
Linked List,Math,Reservoir Sampling,Randomized
Medium
398
217
Hello Gas Myself Amrita Welcome Back To Our Channel Technosis So In Today's Video Are Going To Discuss Lead Code Problem Number 217 Date Is Content To Clicks So Let's Get Started Let's First Understand The Problem Given And Wait Ares Return True If Other Value Appears At List Tis in the and return false if every elemen...
Contains Duplicate
contains-duplicate
Given an integer array `nums`, return `true` if any value appears **at least twice** in the array, and return `false` if every element is distinct. **Example 1:** **Input:** nums = \[1,2,3,1\] **Output:** true **Example 2:** **Input:** nums = \[1,2,3,4\] **Output:** false **Example 3:** **Input:** nums = \[1,1,1,...
null
Array,Hash Table,Sorting
Easy
219,220
341
welcome to day 8 of lead code made challenge today we have question number 341 flatten nested list titrator so in this question they have given us a nested list of integers each element is either an integer or a list whose element may also be integer or other list we have to implement an iterator to flatten it we have ...
Flatten Nested List Iterator
flatten-nested-list-iterator
You are given a nested list of integers `nestedList`. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an iterator to flatten it. Implement the `NestedIterator` class: * `NestedIterator(List nestedList)` Initializes the iterator with the nested list `nestedLi...
null
Stack,Tree,Depth-First Search,Design,Queue,Iterator
Medium
251,281,385,565
137
So hello friends, welcome to my YouTube channel where today we are going to talk about lead code problem number 137 which is a single number, so what is told in this problem, we have been given the problem in our neck. Let's read the statement carefully. Jeevan and Eritaiger numbers upper three times it ok so finder si...
Single Number II
single-number-ii
Given an integer array `nums` where every element appears **three times** except for one, which appears **exactly once**. _Find the single element and return it_. You must implement a solution with a linear runtime complexity and use only constant extra space. **Example 1:** **Input:** nums = \[2,2,3,2\] **Output:**...
null
Array,Bit Manipulation
Medium
136,260
307
hey everybody this is larry this is day 18 of the june eco daily challenge uh hit the like button hit the subscribe button join me on discord you know the deal uh but anyway today's problem is the range sum query friday is a happy friday fun day for friday anyway uh i am stopping this live so i am very incoherent so ye...
Range Sum Query - Mutable
range-sum-query-mutable
Given an integer array `nums`, handle multiple queries of the following types: 1. **Update** the value of an element in `nums`. 2. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`. Implement the `NumArray` class: * `NumArray(int[] nums)` Initi...
null
Array,Design,Binary Indexed Tree,Segment Tree
Medium
303,308
918
Jhaal Hello Everyone Welcome to Channel Today's Question is Maximum Circular YouTube Channel Subscribe Solar Light to Turn on This Channel and Definitely Help You with Your Interview that a Question is Maximum Circular Such of India is represented by the Phantom Maximum Possible Some of Unknown's Service Three And lag ...
Maximum Sum Circular Subarray
reachable-nodes-in-subdivided-graph
Given a **circular integer array** `nums` of length `n`, return _the maximum possible sum of a non-empty **subarray** of_ `nums`. A **circular array** means the end of the array connects to the beginning of the array. Formally, the next element of `nums[i]` is `nums[(i + 1) % n]` and the previous element of `nums[i]` ...
null
Graph,Heap (Priority Queue),Shortest Path
Hard
2213,2218
875
hello guys welcome to deep codes and in today's video we will discuss grid code question 875 that says Coco eating bananas so guys if you have saw yesterday's Elite called daily tolerance challenge question then this question might be very much easier for you this is almost similar to that and yeah if you have any doub...
Koko Eating Bananas
longest-mountain-in-array
Koko loves to eat bananas. There are `n` piles of bananas, the `ith` pile has `piles[i]` bananas. The guards have gone and will come back in `h` hours. Koko can decide her bananas-per-hour eating speed of `k`. Each hour, she chooses some pile of bananas and eats `k` bananas from that pile. If the pile has less than `k...
null
Array,Two Pointers,Dynamic Programming,Enumeration
Medium
1766,2205
443
Hello friends today I am going to solve liquid problem number 443 sting compression in this problem we are given an array of characters and we need to compute um for each empty string as in the characters uh we are going to find the com consecutive repeating characters the number of consecutive repeating characters and...
String Compression
string-compression
Given an array of characters `chars`, compress it using the following algorithm: Begin with an empty string `s`. For each group of **consecutive repeating characters** in `chars`: * If the group's length is `1`, append the character to `s`. * Otherwise, append the character followed by the group's length. The co...
How do you know if you are at the end of a consecutive group of characters?
Two Pointers,String
Medium
38,271,604,1241
1,971
hey guys thanks for joining in this video we're going to take a look at problem 1971 on the code find of path existing graph so what we'll do in this video is first we'll go for the problem description take a look at the examples they provide then we'll discuss any edge cases that we have to look out for we'll think ab...
Find if Path Exists in Graph
incremental-memory-leak
There is a **bi-directional** graph with `n` vertices, where each vertex is labeled from `0` to `n - 1` (**inclusive**). The edges in the graph are represented as a 2D integer array `edges`, where each `edges[i] = [ui, vi]` denotes a bi-directional edge between vertex `ui` and vertex `vi`. Every vertex pair is connecte...
What is the upper bound for the number of seconds? Simulate the process of allocating memory.
Simulation
Medium
null
523
foreign solution to day 26th of October liquid challenge the problem that we have in today is some this question is a medium level question on lead code and I totally feel the same the question says you're given an array of integers and an integer value K what do you need to check whether there exists a sub array a con...
Continuous Subarray Sum
continuous-subarray-sum
Given an integer array nums and an integer k, return `true` _if_ `nums` _has a **good subarray** or_ `false` _otherwise_. A **good subarray** is a subarray where: * its length is **at least two**, and * the sum of the elements of the subarray is a multiple of `k`. **Note** that: * A **subarray** is a contiguo...
null
Array,Hash Table,Math,Prefix Sum
Medium
560,2119,2240
154
Jhaal Hello Hi Guys How are you I am positive doing good welcome to the land co disney today will solve this question is gold question and this point maximum in walnut 10 and e in pink also in side also unique and father have sold the find minimum Indicated That Are Not So Difficult Decisions Taken To Fit Improve Searc...
Find Minimum in Rotated Sorted Array II
find-minimum-in-rotated-sorted-array-ii
Suppose an array of length `n` sorted in ascending order is **rotated** between `1` and `n` times. For example, the array `nums = [0,1,4,4,5,6,7]` might become: * `[4,5,6,7,0,1,4]` if it was rotated `4` times. * `[0,1,4,4,5,6,7]` if it was rotated `7` times. Notice that **rotating** an array `[a[0], a[1], a[2], ....
null
Array,Binary Search
Hard
153
3
hello everyone and welcome to Python programming practice in this episode we are going to be covering leet code number three longest substring without repeating characters now this is a medium difficulty problem so it's probably going to be somewhat tricky so we're gonna have to think a bit before we start coding proba...
Longest Substring Without Repeating Characters
longest-substring-without-repeating-characters
Given a string `s`, find the length of the **longest** **substring** without repeating characters. **Example 1:** **Input:** s = "abcabcbb " **Output:** 3 **Explanation:** The answer is "abc ", with the length of 3. **Example 2:** **Input:** s = "bbbbb " **Output:** 1 **Explanation:** The answer is "b ", with t...
null
Hash Table,String,Sliding Window
Medium
159,340,1034,1813,2209
1,046
um hello so today we are going to take a look at this problem um as part of the late code april challenge so let's get started um so this um basically we have an array of stones um and each position represents the eifstone and what we are doing is playing a game with these stones where we take each time the two heavies...
Last Stone Weight
max-consecutive-ones-iii
You are given an array of integers `stones` where `stones[i]` is the weight of the `ith` stone. We are playing a game with the stones. On each turn, we choose the **heaviest two stones** and smash them together. Suppose the heaviest two stones have weights `x` and `y` with `x <= y`. The result of this smash is: * I...
One thing's for sure, we will only flip a zero if it extends an existing window of 1s. Otherwise, there's no point in doing it, right? Think Sliding Window! Since we know this problem can be solved using the sliding window construct, we might as well focus in that direction for hints. Basically, in a given window, we c...
Array,Binary Search,Sliding Window,Prefix Sum
Medium
340,424,485,487,2134
1,335
hello hi guys good morning welcome back I hope that you guys are doing well minimum difficulty of a job schedule it has been asked by Amazon last 2 months and also is quite popular for Uber Adobe and other companies also so let's start and again uh we'll see everything starting from top down bottom up top bottom optimi...
Minimum Difficulty of a Job Schedule
maximum-candies-allocated-to-k-children
You want to schedule a list of jobs in `d` days. Jobs are dependent (i.e To work on the `ith` job, you have to finish all the jobs `j` where `0 <= j < i`). You have to finish **at least** one task every day. The difficulty of a job schedule is the sum of difficulties of each day of the `d` days. The difficulty of a da...
For a fixed number of candies c, how can you check if each child can get c candies? Use binary search to find the maximum c as the answer.
Array,Binary Search
Medium
907,1886,2000,2027,2188,2294
225
Hello everyone welcome to my channel and good question is liquid number 2005 mark it D but remember that such questions are very important especially for freshers who have to give interview just out of college, such questions are very important for them ok So let's start implement stock using, how much do you have to i...
Implement Stack using Queues
implement-stack-using-queues
Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (`push`, `top`, `pop`, and `empty`). Implement the `MyStack` class: * `void push(int x)` Pushes element x to the top of the stack. * `int pop()` Removes the element on the top...
null
Stack,Design,Queue
Easy
232
117
Jhaal Ajay Ko Hello friends welcome to my YouTube channel Tier-3 channel Tier-3 channel Tier-3 Article Where going to solve liquid problem or problem name is popularity next flight pointers in is not to basically but to me in this question being given by ministry will just have to Change date for particular node if is ...
Populating Next Right Pointers in Each Node II
populating-next-right-pointers-in-each-node-ii
Given a binary tree struct Node { int val; Node \*left; Node \*right; Node \*next; } Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to `NULL`. Initially, all next pointers are set to `NULL`. **Example 1:** **Input:** root = \[1,2,3...
null
Linked List,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
116
1,720
Hello hello welcome to shoulder drop only purush video hanuman hai because you can cure your 120 dip and 108 all problems with mint this dat consists of innovative which pimples imported into another entry are important planet in this earth in support of I request to player More during the match and will give benefit o...
Decode XORed Array
crawler-log-folder
There is a **hidden** integer array `arr` that consists of `n` non-negative integers. It was encoded into another integer array `encoded` of length `n - 1`, such that `encoded[i] = arr[i] XOR arr[i + 1]`. For example, if `arr = [1,0,2,1]`, then `encoded = [1,2,3]`. You are given the `encoded` array. You are also give...
Simulate the process but don’t move the pointer beyond the main folder. Simulate the process but don’t move the pointer beyond the main folder.
Array,String,Stack
Easy
682,874
767
hey guys so today we are going to discuss if the question called as reorganized string so this is a lit good medium question this is also a very important question because this question is an important data structure called i'll tell you that later so let's start with the question so given a string rearrange the charac...
Reorganize String
prime-number-of-set-bits-in-binary-representation
Given a string `s`, rearrange the characters of `s` so that any two adjacent characters are not the same. Return _any possible rearrangement of_ `s` _or return_ `" "` _if not possible_. **Example 1:** **Input:** s = "aab" **Output:** "aba" **Example 2:** **Input:** s = "aaab" **Output:** "" **Constraints:** * ...
Write a helper function to count the number of set bits in a number, then check whether the number of set bits is 2, 3, 5, 7, 11, 13, 17 or 19.
Math,Bit Manipulation
Easy
191
1,048
hey everybody this is larry this is day 15 wow middle of the month already of the june nico day challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's farm so i actually today i actually record before i decide what video intro to do still in the room so hopefu...
Longest String Chain
clumsy-factorial
You are given an array of `words` where each word consists of lowercase English letters. `wordA` is a **predecessor** of `wordB` if and only if we can insert **exactly one** letter anywhere in `wordA` **without changing the order of the other characters** to make it equal to `wordB`. * For example, `"abc "` is a **...
null
Math,Stack,Simulation
Medium
null
934
hey so welcome back and this is another daily compromise so today it's called shortest bridge and it's a medium level graph problem so for this you are given a graph which is a two-dimensional uh a graph which is a two-dimensional uh a graph which is a two-dimensional uh Matrix here where the number of rows in the colu...
Shortest Bridge
bitwise-ors-of-subarrays
You are given an `n x n` binary matrix `grid` where `1` represents land and `0` represents water. An **island** is a 4-directionally connected group of `1`'s not connected to any other `1`'s. There are **exactly two islands** in `grid`. You may change `0`'s to `1`'s to connect the two islands to form **one island**. ...
null
Array,Dynamic Programming,Bit Manipulation
Medium
null
329
hi guys this is khushboo and welcome to algorithms made easy in this video we will go through the question longest increasing path in a matrix given an m cross an integer matrix return the length of longest increasing path in that matrix from each cell you can either move in four direction that is left right up or down...
Longest Increasing Path in a Matrix
longest-increasing-path-in-a-matrix
Given an `m x n` integers `matrix`, return _the length of the longest increasing path in_ `matrix`. From each cell, you can either move in four directions: left, right, up, or down. You **may not** move **diagonally** or move **outside the boundary** (i.e., wrap-around is not allowed). **Example 1:** **Input:** matr...
null
Dynamic Programming,Depth-First Search,Breadth-First Search,Graph,Topological Sort,Memoization
Hard
null
278
hi everyone today we'll be solving the code 278 which is called the first bad version the problem says that you're a product manager and currently leading a team to develop a new product unfortunately the latest version of your product fills the quality check since each version is developed based on the previous versio...
First Bad Version
first-bad-version
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad. Suppose you have `n` versions `[1, 2, ..., n]` an...
null
Binary Search,Interactive
Easy
34,35,374
103
Hello gas welcome back to my channel think on today this need code challenge is binary tree zigzag level so what to do in this question basically I have given you a route binary is ok and what you have to do is to print the level outdoor in zigzag order Okay, so simple level on driver sir, if it is there, then what do ...
Binary Tree Zigzag Level Order Traversal
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 right, then right to left for the next level and alternate between). **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** \[\[3\],\[20,9\],\[15,7\]\] **Example 2:** **Input:** roo...
null
Tree,Breadth-First Search,Binary Tree
Medium
102
1,975
hey everybody this is larry this is me going with q2 of the bi-weekly me going with q2 of the bi-weekly me going with q2 of the bi-weekly contest 59 maximum matrix sum so hit the like button hit the subscribe button join me on discord let me know what you think about this problem i spent about four minutes on because i...
Maximum Matrix Sum
minimum-distance-to-the-target-element
You are given an `n x n` integer `matrix`. You can do the following operation **any** number of times: * Choose any two **adjacent** elements of `matrix` and **multiply** each of them by `-1`. Two elements are considered **adjacent** if and only if they share a **border**. Your goal is to **maximize** the summatio...
Loop in both directions until you find the target element. For each index i such that nums[i] == target calculate abs(i - start).
Array
Easy
null
326
hi i am suhan and you are watching my lead code series today we are gonna talk about the power of three yes it's a 326 question of lead code it is categorized as an easy question at e and it is easy first we will see what this question tells or what is given to us we are given an integer n and we have to written true i...
Power of Three
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, if there exists an integer `x` such that `n == 3x`. **Example 1:** **Input:** n = 27 **Output:** true **Explanation:** 27 = 33 **Example 2:** **Input:** n = 0 **Output:** false **Explanat...
null
Math,Recursion
Easy
231,342,1889
897
elephants didn't understand this question from did for problem number eight 97 increasing for this one so in this question you are given a binary search tree and you have to arrange the tree in for the traps will move it so that the left floor left most node in the tree is now appropriately and every wood has no left c...
Increasing Order Search Tree
prime-palindrome
Given the `root` of a binary search tree, rearrange the tree in **in-order** so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only one right child. **Example 1:** **Input:** root = \[5,3,6,2,4,null,8,1,null,null,null,7,9\] **Output:** \[1,null,2,null,3,null,4,nul...
null
Math
Medium
2202
1,639
hey so welcome back in this another daily code problem so yeah feel free to let me know in the comments below like the approach that you took and also check out in the link in the description I actually always show like my code and the approach I took and like a written solution so yeah feel free to check that out but ...
Number of Ways to Form a Target String Given a Dictionary
friendly-movies-streamed-last-month
You are given a list of strings of the **same length** `words` and a string `target`. Your task is to form `target` using the given `words` under the following rules: * `target` should be formed from left to right. * To form the `ith` character (**0-indexed**) of `target`, you can choose the `kth` character of th...
null
Database
Easy
null