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
117
although let's talk about populating next right pointers in each node too so you're given a class note and this is uh written in c language right but it doesn't matter so the idea is you have to point your each level at the end you have to point at the no and then if you are in the same level you have to point on your ...
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
451
foreign problem Short character by frequencies let us see what it says so given a string s okay sort it in it a decreasing order based on the frequency of the characters is the number of time it appears in the string return the sorted string if there is if there are multiple answer written any one of them okay example ...
Sort Characters By Frequency
sort-characters-by-frequency
Given a string `s`, sort it in **decreasing order** based on the **frequency** of the characters. The **frequency** of a character is the number of times it appears in the string. Return _the sorted string_. If there are multiple answers, return _any of them_. **Example 1:** **Input:** s = "tree " **Output:** "eer...
null
Hash Table,String,Sorting,Heap (Priority Queue),Bucket Sort,Counting
Medium
347,387,1741
1,601
so hey everyone I am Tanish and you guys are watching cortanish and in this video what we are going to see is the day Elite code daily challenge which is that the 1601 and which is maximum number of achievable transfer requests fine let us quickly jump to the question what they said uh we have in building number from z...
Maximum Number of Achievable Transfer Requests
maximum-number-of-achievable-transfer-requests
We have `n` buildings numbered from `0` to `n - 1`. Each building has a number of employees. It's transfer season, and some employees want to change the building they reside in. You are given an array `requests` where `requests[i] = [fromi, toi]` represents an employee's request to transfer from building `fromi` to bu...
null
null
Hard
null
435
hello everyone so in this video let us talk about one more medium level problem from lead code the problem name is non-overlapping intervals so problem non-overlapping intervals so problem non-overlapping intervals so problem statement goes like this that you are given an array of intervals where intervals of I represe...
Non-overlapping Intervals
non-overlapping-intervals
Given an array of intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping_. **Example 1:** **Input:** intervals = \[\[1,2\],\[2,3\],\[3,4\],\[1,3\]\] **Output:** 1 **Explanation:** \[1,3\] can be removed ...
null
Array,Dynamic Programming,Greedy,Sorting
Medium
452
35
hello everyone I welcome you all in our another D session where we'll be solving another DSA problem based on AR as previous we will also go from s Med easy medium than hard our today's problem is search index position let's check out here it is given a problem statement we will read given a sorted order of distinct in...
Search Insert Position
search-insert-position
Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You must write an algorithm with `O(log n)` runtime complexity. **Example 1:** **Input:** nums = \[1,3,5,6\], target = 5 **Output:** 2 **Exa...
null
Array,Binary Search
Easy
278
227
Loot Hello Guys Welcome Remedies To David C The Question Basic Related To In This Question Maze Subscribe 1020 Plus Minus Multiplication Division Withdraw Cases Against Subscribe Loot subscribe and subscribe the Channel and subscribe August Acts And Multiply The Current Number And Returned 2 Results For Diet Rich in to...
Basic Calculator II
basic-calculator-ii
Given a string `s` which represents an expression, _evaluate this expression and return its value_. The integer division should truncate toward zero. You may assume that the given expression is always valid. All intermediate results will be in the range of `[-231, 231 - 1]`. **Note:** You are not allowed to use any ...
null
Math,String,Stack
Medium
224,282,785
32
hello everyone welcome to coderscam and today we are the third day of april lead code challenge and the problem we are going to cover is longest valid paranthesis so the input given here is a string which is consisting of parenthesis and we have to return the length of longest valid parenthesis in the given string a pa...
Longest Valid Parentheses
longest-valid-parentheses
Given a string containing just the characters `'('` and `')'`, return _the length of the longest valid (well-formed) parentheses_ _substring_. **Example 1:** **Input:** s = "(() " **Output:** 2 **Explanation:** The longest valid parentheses substring is "() ". **Example 2:** **Input:** s = ")()()) " **Output:** ...
null
String,Dynamic Programming,Stack
Hard
20
634
hey everybody this is Larry this is me trying to do an extra problem get my money worth on premium so uh yeah how do I do this I always forget every time yeah let's do a random RNG problem that I haven't done before so we'll be fair uh it's 6:34 find the derangement of n uh it's 6:34 find the derangement of n uh it's 6...
Find the Derangement of An Array
find-the-derangement-of-an-array
In combinatorial mathematics, a **derangement** is a permutation of the elements of a set, such that no element appears in its original position. You are given an integer `n`. There is originally an array consisting of `n` integers from `1` to `n` in ascending order, return _the number of **derangements** it can gener...
null
Math,Dynamic Programming
Medium
null
1,537
hey everybody this is larry um yeah maybe i only do well in the dynamic program forms but let's go over today's problem uh get the maximum score today uh the contest 200th um hard question uh so yeah so basically you could choose from the problem assess you that you can choose from any uh you know you could choose from...
Get the Maximum Score
maximum-score-after-splitting-a-string
You are given two **sorted** arrays of distinct integers `nums1` and `nums2.` A **valid path** is defined as follows: * Choose array `nums1` or `nums2` to traverse (from index-0). * Traverse the current array from left to right. * If you are reading any value that is present in `nums1` and `nums2` you are allow...
Precompute a prefix sum of ones ('1'). Iterate from left to right counting the number of zeros ('0'), then use the precomputed prefix sum for counting ones ('1'). Update the answer.
String
Easy
null
329
hey guys welcome back today we're going to solve lead codes problem number 329 longest increasing path in a matrix so given an integral matrix we need to find the length of the longest increasing path so remember that the directions we can move in are left right up and down we cannot move diagonally so this would be an...
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
748
oh hey everybody this is Larry this is me doing an extra problem because we haven't uh how do I do this do a um yeah because we've already done the prom I guess we could have done the algor because I always worry about getting a random well it is or going be RNG it is day 18 or something like this I mean it's technical...
Shortest Completing Word
largest-number-at-least-twice-of-others
Given a string `licensePlate` and an array of strings `words`, find the **shortest completing** word in `words`. A **completing** word is a word that **contains all the letters** in `licensePlate`. **Ignore numbers and spaces** in `licensePlate`, and treat letters as **case insensitive**. If a letter appears more than...
Scan through the array to find the unique largest element `m`, keeping track of it's index `maxIndex`. Scan through the array again. If we find some `x != m` with `m < 2*x`, we should return `-1`. Otherwise, we should return `maxIndex`.
Array,Sorting
Easy
2274,2327
336
Ki A Hello Everyone Welcome To Date 30th June List Challenge And Aspirations Thailand Grand Prix Race In This Western Wear Giving Energy Of Words And Into Identifying Na Dharo Mix Subscribe ABCD One With Difficult To All Subscribe Follow Rock Play List Suzy 6 And Saffron Approach Problem All Possible And Weather Or Not...
Palindrome Pairs
palindrome-pairs
You are given a **0-indexed** array of **unique** strings `words`. A **palindrome pair** is a pair of integers `(i, j)` such that: * `0 <= i, j < words.length`, * `i != j`, and * `words[i] + words[j]` (the concatenation of the two strings) is a palindrome. Return _an array of all the **palindrome pairs** of_ `...
null
Array,Hash Table,String,Trie
Hard
5,214,2237
827
hey everybody this is larry this is day one of the august league daily challenge hit the like button hit the subscriber and join me on discord i'm gonna be doing this all month so you know do it with me and let's do it together i haven't i think i'm on um let's see 12 15 or 16 month streaks so you know let's keep going...
Making A Large Island
expressive-words
You are given an `n x n` binary matrix `grid`. You are allowed to change **at most one** `0` to be `1`. Return _the size of the largest **island** in_ `grid` _after applying this operation_. An **island** is a 4-directionally connected group of `1`s. **Example 1:** **Input:** grid = \[\[1,0\],\[0,1\]\] **Output:** ...
null
Array,Two Pointers,String
Medium
null
1,721
how's it going everybody in this video i'm going to be walking you through a solution to leak code problem 1721 and it's swapping nodes in a to list so if we read the description real quick you're given the head of the list and it wants you to return the head of the list after swapping the kth value node from the start...
Swapping Nodes in a Linked List
maximum-profit-of-operating-a-centennial-wheel
You are given the `head` of a linked list, and an integer `k`. Return _the head of the linked list after **swapping** the values of the_ `kth` _node from the beginning and the_ `kth` _node from the end (the list is **1-indexed**)._ **Example 1:** **Input:** head = \[1,2,3,4,5\], k = 2 **Output:** \[1,4,3,2,5\] **Ex...
Think simulation Note that the number of turns will never be more than 50 / 4 * n
Array,Simulation
Medium
null
160
hey guys rob here from brevity and in this video we're going to be solving one of amazon's most favorite questions the intersection point of two linked lists first of all congratulations on making it to week three glad to see you didn't give up are you enjoying the song for learning environment on youtube and discord i...
Intersection of Two Linked Lists
intersection-of-two-linked-lists
Given the heads of two singly linked-lists `headA` and `headB`, return _the node at which the two lists intersect_. If the two linked lists have no intersection at all, return `null`. For example, the following two linked lists begin to intersect at node `c1`: The test cases are generated such that there are no cycle...
null
Hash Table,Linked List,Two Pointers
Easy
599
171
hey YouTube welcome back today we have this problem um Excel sheet column number uh given a string column title that represent the column title as it appears in an Excel sheet return its corresponding column number for example a equals 1 b equals 2 C equals 3 Z equals 26 A equals 27 a b equals 28 so on so forth um and ...
Excel Sheet Column Number
excel-sheet-column-number
Given a string `columnTitle` that represents the column title as appears in an Excel sheet, return _its corresponding column number_. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 ... **Example 1:** **Input:** columnTitle = "A " **Output:** 1 **Example 2:** **Input:** columnTitle = "AB " **Ou...
null
Math,String
Easy
168,2304
1,171
Hello friends, today we are going to solve a problem. Today's question was asked. What is the question of the problem? What is the question? Today's question is given below. The test tells us how to approach the question. Think about the code. What kind of code should it be? Let's understand what we have to do, let's a...
Remove Zero Sum Consecutive Nodes from Linked List
shortest-path-in-binary-matrix
Given the `head` of a linked list, we repeatedly delete consecutive sequences of nodes that sum to `0` until there are no such sequences. After doing so, return the head of the final linked list. You may return any such answer. (Note that in the examples below, all sequences are serializations of `ListNode` objects.)...
Do a breadth first search to find the shortest path.
Array,Breadth-First Search,Matrix
Medium
null
1,512
i'm going over a number of good pairs and uh we will use a same input given here which is here blue is index red is value and i use the mem is 101 i mean size is 101 but to make life simple i'll just use five so uh let's start um it's okay first visit um index zero right okay i have a value on and do i have any pairs s...
Number of Good Pairs
design-underground-system
Given an array of integers `nums`, return _the number of **good pairs**_. A pair `(i, j)` is called _good_ if `nums[i] == nums[j]` and `i` < `j`. **Example 1:** **Input:** nums = \[1,2,3,1,1,3\] **Output:** 4 **Explanation:** There are 4 good pairs (0,3), (0,4), (3,4), (2,5) 0-indexed. **Example 2:** **Input:** nu...
Use two hash tables. The first to save the check-in time for a customer and the second to update the total time between two stations.
Hash Table,String,Design
Medium
2285
1,896
hey everybody this is larry this is me going with q4 of the bi-weekly me going with q4 of the bi-weekly me going with q4 of the bi-weekly contest 54 minimum cost to change the final value of expression so this was a very really hard problem um i have solved this before which is how i am able to solve and even then i ac...
Minimum Cost to Change the Final Value of Expression
maximum-score-from-performing-multiplication-operations
You are given a **valid** boolean expression as a string `expression` consisting of the characters `'1'`,`'0'`,`'&'` (bitwise **AND** operator),`'|'` (bitwise **OR** operator),`'('`, and `')'`. * For example, `"()1|1 "` and `"(1)&() "` are **not valid** while `"1 "`, `"(((1))|(0)) "`, and `"1|(0&(1)) "` are **valid*...
At first glance, the solution seems to be greedy, but if you try to greedily take the largest value from the beginning or the end, this will not be optimal. You should try all scenarios but this will be costy. Memoizing the pre-visited states while trying all the possible scenarios will reduce the complexity, and hence...
Array,Dynamic Programming
Medium
1538,1808
1,725
so lead code 1725 number of rectangles that can form the largest square so in this problem you're given an array of rectangles and you need to return the number of rectangles that can be cut up to make a square with a side length of max len and what is max length max len is just the side length of the largest square th...
Number Of Rectangles That Can Form The Largest Square
number-of-sets-of-k-non-overlapping-line-segments
You are given an array `rectangles` where `rectangles[i] = [li, wi]` represents the `ith` rectangle of length `li` and width `wi`. You can cut the `ith` rectangle to form a square with a side length of `k` if both `k <= li` and `k <= wi`. For example, if you have a rectangle `[4,6]`, you can cut it to get a square wit...
Try to use dynamic programming where the current index and remaining number of line segments to form can describe any intermediate state. To make the computation of each state in constant time, we could add another flag to the state that indicates whether or not we are in the middle of placing a line (placed start poin...
Math,Dynamic Programming
Medium
null
47
foreign is called permutations too you have your gaming collection of numbers nums that might contain duplicates which is important fact here and we have to return all possible unique rotation in any order Suite so the final output cannot have duplicates and here we are given the example one two and here all are the al...
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
309
in this video we're going to take a look at a legal problem called best time to buy and sell stock with cool down so you're given an array of prices where prices i is the price of a given stock on life day so find the maximum profit you can achieve you might complete as many transactions you would like buy one and sell...
Best Time to Buy and Sell Stock with Cooldown
best-time-to-buy-and-sell-stock-with-cooldown
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day. Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the following restrictions: * After you sell your stock, yo...
null
Array,Dynamic Programming
Medium
121,122
1,413
hello viewers welcome back to my channel I hope you are enjoying all the videos that I'm uploading if you haven't subscribed to my channel yet please go ahead and subscribe to my channel and also share among your friends today's problem is minimum value to get positive step-by-step some so given an array of step-by-ste...
Minimum Value to Get Positive Step by Step Sum
maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold
Given an array of integers `nums`, you start with an initial **positive** value _startValue__._ In each iteration, you calculate the step by step sum of _startValue_ plus elements in `nums` (from left to right). Return the minimum **positive** value of _startValue_ such that the step by step sum is never less than 1....
Store prefix sum of all grids in another 2D array. Try all possible solutions and if you cannot find one return -1. If x is a valid answer then any y < x is also valid answer. Use binary search to find answer.
Array,Binary Search,Matrix,Prefix Sum
Medium
null
688
welcome back to our channel in this video let us write the python program to find the probability of thick knife to remain inside the chessboard after taking k number of steps as we know there are 8 possible moves for the knight in the chessboard as indicated in the screen they move in l-shaped in the screen they move ...
Knight Probability in Chessboard
knight-probability-in-chessboard
On an `n x n` chessboard, a knight starts at the cell `(row, column)` and attempts to make exactly `k` moves. The rows and columns are **0-indexed**, so the top-left cell is `(0, 0)`, and the bottom-right cell is `(n - 1, n - 1)`. A chess knight has eight possible moves it can make, as illustrated below. Each move is ...
null
Dynamic Programming
Medium
576
337
Hello friends uh welcome to my channel let's have a look at problem 337 horse robber 3. this video is a continuation on host Global problem problems 198 and 213. so this horse robber 3 involves binary tree because the thief improved in data structure and algorithms so a binary tree actually can be defined recursively s...
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
1,675
hello everybody this is larry this is day 30 of the um january lead code daily challenge uh oh okay second to last day um of the month hit the like button hit the subscribe button join me on discord let me know what you think about today's farm and stuff like that hope everyone's just doing well in life uh you know end...
Minimize Deviation in Array
magnetic-force-between-two-balls
You are given an array `nums` of `n` positive integers. You can perform two types of operations on any element of the array any number of times: * If the element is **even**, **divide** it by `2`. * For example, if the array is `[1,2,3,4]`, then you can do this operation on the last element, and the array wil...
If you can place balls such that the answer is x then you can do it for y where y < x. Similarly if you cannot place balls such that the answer is x then you can do it for y where y > x. Binary search on the answer and greedily see if it is possible.
Array,Binary Search,Sorting
Medium
2188
102
hello everyone so in this video i'm going to explain about today liquid daily challenge so today question is binary tree level order traversal in this machine they are given the root of the binary return the level order traversal of its nodes values okay we want to do level of traversal of the tree so it is a basic typ...
Binary Tree Level Order Traversal
binary-tree-level-order-traversal
Given the `root` of a binary tree, return _the level order traversal of its nodes' values_. (i.e., from left to right, level by level). **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** \[\[3\],\[9,20\],\[15,7\]\] **Example 2:** **Input:** root = \[1\] **Output:** \[\[1\]\] **Example 3:** **I...
null
Tree,Breadth-First Search,Binary Tree
Medium
103,107,111,314,637,764,1035
7
hello welcome back to my channel for uh the hanjaliko challenge and today we have reverse integer really similar to the question that we did um but i'm here to do that one more time so basically we will import an integer and output a reverse digit of the integer here's example one two three be three to one but negative...
Reverse Integer
reverse-integer
Given a signed 32-bit integer `x`, return `x` _with its digits reversed_. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-231, 231 - 1]`, then return `0`. **Assume the environment does not allow you to store 64-bit integers (signed or unsigned).** **Example 1:** **Input:** x = 123 ...
null
Math
Medium
8,190,2238
344
hey guys welcome to a new video in today's video we're going to look at a liquid problem and the problem's name is reverse train so in this we are given a character array which contains characters and we have to reverse the characters present inside the array with the time complexity in space that is often the space co...
Reverse String
reverse-string
Write a function that reverses a string. The input string is given as an array of characters `s`. You must do this by modifying the input array [in-place](https://en.wikipedia.org/wiki/In-place_algorithm) with `O(1)` extra memory. **Example 1:** **Input:** s = \["h","e","l","l","o"\] **Output:** \["o","l","l","e","h...
The entire logic for reversing a string is based on using the opposite directional two-pointer approach!
Two Pointers,String,Recursion
Easy
345,541
661
hello hi guys good morning welcome back to the new video I hope that you guys are doing good so firstly my MacBook is dead so I'm recording back on my Windows laptop um so like there is not much setup I tried but the OBS is not starting at all it just says the OBS shut down like it didn't shut down properly and you wou...
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
881
hey everyone welcome back and let's write some more neat code today so today let's solve the problem boats to save people we're given an array of people and each value in this array represents a person of course but more specifically it represents the weight of that person we're also given an infinite number of boats w...
Boats to Save People
loud-and-rich
You are given an array `people` where `people[i]` is the weight of the `ith` person, and an **infinite number of boats** where each boat can carry a maximum weight of `limit`. Each boat carries at most two people at the same time, provided the sum of the weight of those people is at most `limit`. Return _the minimum n...
null
Array,Depth-First Search,Graph,Topological Sort
Medium
null
1,498
hello hi guys good morning welcome back to the next video is a problem number of sequences that satisfy the given some condition no matter what if you have solved this problem no matter what just watch this video because see the logic would be for sure same if you have solved it logic will be for sure say but the numbe...
Number of Subsequences That Satisfy the Given Sum Condition
find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree
You are given an array of integers `nums` and an integer `target`. Return _the number of **non-empty** subsequences of_ `nums` _such that the sum of the minimum and maximum element on it is less or equal to_ `target`. Since the answer may be too large, return it **modulo** `109 + 7`. **Example 1:** **Input:** nums =...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
131
in this video we're going to take a look at a legal problem called partition palindrome so given a string s partition as such that every substring of the partition is a palindrome so return all uh possible palindrome partitioning of s so a palindrome string is a string that reads the same backwards forward so here you ...
Palindrome Partitioning
palindrome-partitioning
Given a string `s`, partition `s` such that every substring of the partition is a **palindrome**. Return _all possible palindrome partitioning of_ `s`. **Example 1:** **Input:** s = "aab" **Output:** \[\["a","a","b"\],\["aa","b"\]\] **Example 2:** **Input:** s = "a" **Output:** \[\["a"\]\] **Constraints:** * `1...
null
String,Dynamic Programming,Backtracking
Medium
132,1871
199
welcome to lead programmer today we are going to solve the question binary tree right side view uh so essentially you have a binary tree imagine that you're standing on the right side of it you'll have to uh return the values that are visible from the top to the bottom so imagine uh you are standing to the right side o...
Binary Tree Right Side View
binary-tree-right-side-view
Given the `root` of a binary tree, imagine yourself standing on the **right side** of it, return _the values of the nodes you can see ordered from top to bottom_. **Example 1:** **Input:** root = \[1,2,3,null,5,null,4\] **Output:** \[1,3,4\] **Example 2:** **Input:** root = \[1,null,3\] **Output:** \[1,3\] **Examp...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
116,545
66
hey what's up guys Nagoya tea already checking Kodi stuff on twitch in YouTube this problem is called +1 oh yeah check this problem is called +1 oh yeah check this problem is called +1 oh yeah check the description bro man formation premium problems on patreon reach out to me via discord if you want to +1 is easy me vi...
Plus One
plus-one
You are given a **large integer** represented as an integer array `digits`, where each `digits[i]` is the `ith` digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading `0`'s. Increment the large integer by one and re...
null
Array,Math
Easy
43,67,369,1031
337
hi guys welcome back to my channel my name is radhika and today we are going to solve house robber problem three i know this is too much of a house robber but believe me this is different from the last two problems that we solved obviously this is an extension of that problem but the structure is totally different so l...
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
1,887
So in today's video, we are going to solve the question number 187 of lid code, reduction operation to make the array elements equal. In this question, we will be given an array named names, we have to return how many number of operations will we have to do. And to equal the elements of the array, as you can see here, ...
Reduction Operations to Make the Array Elements Equal
minimum-degree-of-a-connected-trio-in-a-graph
Given an integer array `nums`, your goal is to make all elements in `nums` equal. To complete one operation, follow these steps: 1. Find the **largest** value in `nums`. Let its index be `i` (**0-indexed**) and its value be `largest`. If there are multiple elements with the largest value, pick the smallest `i`. 2. F...
Consider a trio with nodes u, v, and w. The degree of the trio is just degree(u) + degree(v) + degree(w) - 6. The -6 comes from subtracting the edges u-v, u-w, and v-w, which are counted twice each in the vertex degree calculation. To get the trios (u,v,w), you can iterate on u, then iterate on each w,v such that w and...
Graph
Hard
null
41
hey guys welcome back to another video and today we're going to be solving the leakout question first missing positive all right so in this question we're given an unsorted integer array and we want to find the smallest missing positive integer so uh one more thing you want to notice is that we only want the positive i...
First Missing Positive
first-missing-positive
Given an unsorted integer array `nums`, return the smallest missing positive integer. You must implement an algorithm that runs in `O(n)` time and uses constant extra space. **Example 1:** **Input:** nums = \[1,2,0\] **Output:** 3 **Explanation:** The numbers in the range \[1,2\] are all in the array. **Example 2:*...
Think about how you would solve the problem in non-constant space. Can you apply that logic to the existing space? We don't care about duplicates or non-positive integers Remember that O(2n) = O(n)
Array,Hash Table
Hard
268,287,448,770
1,007
hey everyone nitish's side hope you are doing well so let's start with the question so the question is minimum domino rotation for equal rows okay so you have in a row of dominoes you have top eye and a bottom eye represent the top and bottom halves of the ith domino okay domino is a tile with two numbers from one to s...
Minimum Domino Rotations For Equal Row
numbers-with-same-consecutive-differences
In a row of dominoes, `tops[i]` and `bottoms[i]` represent the top and bottom halves of the `ith` domino. (A domino is a tile with two numbers from 1 to 6 - one on each half of the tile.) We may rotate the `ith` domino, so that `tops[i]` and `bottoms[i]` swap values. Return the minimum number of rotations so that all...
null
Backtracking,Breadth-First Search
Medium
null
1,816
Hello hello ok let's start a new question attract sentence it is given that we have a list we have time only space and capital word and resolve all small letters only involve so what we have to do is that in that smell length is given number of words same number of words We have to attend that weapon till the words and...
Truncate Sentence
lowest-common-ancestor-of-a-binary-tree-iv
A **sentence** is a list of words that are separated by a single space with no leading or trailing spaces. Each of the words consists of **only** uppercase and lowercase English letters (no punctuation). * For example, `"Hello World "`, `"HELLO "`, and `"hello world hello world "` are all sentences. You are given a...
Starting from the root, traverse the left and the right subtrees, checking if one of the nodes exist there. If one of the subtrees doesn't contain any given node, the LCA can be the node returned from the other subtree If both subtrees contain nodes, the LCA node is the current node.
Tree,Depth-First Search,Binary Tree
Medium
235,236,1218,1780,1790,1816
1,283
in this video we will solve a smallest divisor problem so first let's see the problem so we have an array of integers and there is a threshold given to us so we have to find numbers starting from smallest number such that if we divide all the numbers in this array by that number which we choose and which we are suppose...
Find the Smallest Divisor Given a Threshold
reformat-date
Given an array of integers `nums` and an integer `threshold`, we will choose a positive integer `divisor`, divide all the array by it, and sum the division's result. Find the **smallest** `divisor` such that the result mentioned above is less than or equal to `threshold`. Each result of the division is rounded to the ...
Handle the conversions of day, month and year separately. Notice that days always have a two-word ending, so if you erase the last two characters of this days you'll get the number.
String
Easy
null
285
That Welcome Back Print Ubuntu Solid Problem Foods And In Order Successor In Bst Aa Saw You Might Already Know Data Offer Create List Code And Your Daughter Solution Videos In Java J2ee Technology Advisor For Recording Problems Jewelers J2ee Interview Related Videos To Help People You Know What Kind of Frequently Asked...
Inorder Successor in BST
inorder-successor-in-bst
Given the `root` of a binary search tree and a node `p` in it, return _the in-order successor of that node in the BST_. If the given node has no in-order successor in the tree, return `null`. The successor of a node `p` is the node with the smallest key greater than `p.val`. **Example 1:** **Input:** root = \[2,1,3\...
null
Tree,Depth-First Search,Binary Search Tree,Binary Tree
Medium
94,173,509
1,637
hello everyone welcome to another video now in this video we are going to look at another Aries medium level question but it says medium but it is really easy so what the question is that we need to find the wildest sorry the widest vertical area between two points containing no points now what does this mean so widest...
Widest Vertical Area Between Two Points Containing No Points
string-compression-ii
Given `n` `points` on a 2D plane where `points[i] = [xi, yi]`, Return _the **widest vertical area** between two points such that no points are inside the area._ A **vertical area** is an area of fixed-width extending infinitely along the y-axis (i.e., infinite height). The **widest vertical area** is the one with the ...
Use dynamic programming. The state of the DP can be the current index and the remaining characters to delete. Having a prefix sum for each character can help you determine for a certain character c in some specific range, how many characters you need to delete to merge all occurrences of c in that range.
String,Dynamic Programming
Hard
null
201
hey guys welcome to day 23 of our decode challenge and please problem is problem but 201 that is bitwise anding of number numbers range which means given a range of numbers you need to do bitwise and on each of the member right you have M to n in the range and you need to return the end bitwise and of all the numbers i...
Bitwise AND of Numbers Range
bitwise-and-of-numbers-range
Given two integers `left` and `right` that represent the range `[left, right]`, return _the bitwise AND of all numbers in this range, inclusive_. **Example 1:** **Input:** left = 5, right = 7 **Output:** 4 **Example 2:** **Input:** left = 0, right = 0 **Output:** 0 **Example 3:** **Input:** left = 1, right = 2147...
null
Bit Manipulation
Medium
null
91
That in this video you will see Lord Number is Way Two Decades Ago When Called So You Must Have Died of Mine in Coding and Decoding Scheme Sudhir Visit Unicode Encoding Share It's Very True Love Can Join Coding and Become Difficult Decoding Suid Twitter Account How Way Can Give Video subscribe to subscribe our ki elect...
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
250
hello guys uh let's solve count uni values of trees today uh so this question we are given the root of a binary tree and we simply just need to return the number of uni valued subtrees uh and they're defining a universal subtree as a subtree where all the nodes of the subtree including itself uh have the same value rig...
Count Univalue Subtrees
count-univalue-subtrees
Given the `root` of a binary tree, return _the number of **uni-value**_ _subtrees_. A **uni-value subtree** means all nodes of the subtree have the same value. **Example 1:** **Input:** root = \[5,1,5,5,5,null,5\] **Output:** 4 **Example 2:** **Input:** root = \[\] **Output:** 0 **Example 3:** **Input:** root = ...
null
Tree,Depth-First Search,Binary Tree
Medium
572,687
145
Hello everyone, friends, now I will solve problem number 145 reverse traversal of a binary tree So reverse traversal of a binary tree is called Traversal in order left node right node root Let's look at this diagram How it works, that is, we start from five We go along the left nodes we reach zero we add zero then add ...
Binary Tree Postorder Traversal
binary-tree-postorder-traversal
Given the `root` of a binary tree, return _the postorder traversal of its nodes' values_. **Example 1:** **Input:** root = \[1,null,2,3\] **Output:** \[3,2,1\] **Example 2:** **Input:** root = \[\] **Output:** \[\] **Example 3:** **Input:** root = \[1\] **Output:** \[1\] **Constraints:** * The number of the n...
null
Stack,Tree,Depth-First Search,Binary Tree
Easy
94,776
212
Hello One Should Appear give a like And subscribe The Amazing spider-man More Subscribe My Channel Subscribe Button Hai That Boat Less Lessons and Miscellaneous Tow Ring to Indore Train Subah Subh Virudh subscribe our Channel subscribe to the Page if you liked The Video then subscribe to the Page Loota Container Startd...
Word Search II
word-search-ii
Given an `m x n` `board` of characters and a list of strings `words`, return _all words on the board_. Each word must be constructed from letters of sequentially adjacent cells, where **adjacent cells** are horizontally or vertically neighboring. The same letter cell may not be used more than once in a word. **Exampl...
You would need to optimize your backtracking to pass the larger test. Could you stop backtracking earlier? If the current candidate does not exist in all words' prefix, you could stop backtracking immediately. What kind of data structure could answer such query efficiently? Does a hash table work? Why or why not? How a...
Array,String,Backtracking,Trie,Matrix
Hard
79,1022,1433
212
Everyone, today we will make a playlist of Try Data Structure, so today we will do the first question, okay and this question is very popular and famous Now let's come to this question, what is the question and how to make it, so before that, let me tell you this. There is a question called word search. Well, this word...
Word Search II
word-search-ii
Given an `m x n` `board` of characters and a list of strings `words`, return _all words on the board_. Each word must be constructed from letters of sequentially adjacent cells, where **adjacent cells** are horizontally or vertically neighboring. The same letter cell may not be used more than once in a word. **Exampl...
You would need to optimize your backtracking to pass the larger test. Could you stop backtracking earlier? If the current candidate does not exist in all words' prefix, you could stop backtracking immediately. What kind of data structure could answer such query efficiently? Does a hash table work? Why or why not? How a...
Array,String,Backtracking,Trie,Matrix
Hard
79,1022,1433
141
Today we will solve the next problem of Blind 75 whose name is Detector Cycle in D Link. So first of all let us see the problem statement that Jivan is the head. We remember the last problem we had discussed if we have given the head and date mains has given us the hole. Linklist is given and de head of de link is dete...
Linked List Cycle
linked-list-cycle
Given `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 there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that tail's `next` pointer is co...
null
Hash Table,Linked List,Two Pointers
Easy
142,202
205
welcome back everyone we're going to be solving Lee code 205 isomorphic strings so we're given two strings s and t and we want to determine if they are isomorphic two strings s and t are isomorphic if the characters in s can be replaced to get t T okay all occurrences of a character must be replaced with another charac...
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
791
you guys this is your husband going in this video I'm going to take a look at seven nine one it's meat medium not that difficult I think I'd cast custom sort string s MTS trains can post up for it for case letters in S is order so no letters a Christmas at once s was sorted in some custom order huh we want permute the ...
Custom Sort String
split-bst
You are given two strings order and s. All the characters of `order` are **unique** and were sorted in some custom order previously. Permute the characters of `s` so that they match the order that `order` was sorted. More specifically, if a character `x` occurs before a character `y` in `order`, then `x` should occur ...
Use recursion. If root.val <= V, you split root.right into two halves, then join it's left half back on root.right.
Tree,Binary Search Tree,Recursion,Binary Tree
Medium
450
73
hey guys welcome to a new video in today's video we're going to look at the lead code problem and the problem's name is set Matrix zeros so in this question we are given a m by an integer Matrix called Matrix and if our element is zero set its entire row and column to zeros and the most important thing is we have to do...
Set Matrix Zeroes
set-matrix-zeroes
Given an `m x n` integer matrix `matrix`, if an element is `0`, set its entire row and column to `0`'s. You must do it [in place](https://en.wikipedia.org/wiki/In-place_algorithm). **Example 1:** **Input:** matrix = \[\[1,1,1\],\[1,0,1\],\[1,1,1\]\] **Output:** \[\[1,0,1\],\[0,0,0\],\[1,0,1\]\] **Example 2:** **In...
If any cell of the matrix has a zero we can record its row and column number using additional memory. But if you don't want to use extra memory then you can manipulate the array instead. i.e. simulating exactly what the question says. Setting cell values to zero on the fly while iterating might lead to discrepancies. ...
Array,Hash Table,Matrix
Medium
289,2244,2259,2314
354
hello everyone welcome to day 25 of lead code made challenge today we have question number 354 russian doll envelope in this question they have given us 2d array of integer envelope where envelope of i is equals to w comma h represent the width and the height of an envelope one envelope can fit into another if and only...
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
1,092
Jhaal Hello friends today's juice welcome shots comment super scenes with strings given that you have to return shot test lab test year 1st year to s subsidies if pimples wrinkles if anyone can return then let's take this example, this is also like this And cb2 strings have been given, even more than easy S, E and C. N...
Shortest Common Supersequence
maximum-difference-between-node-and-ancestor
Given two strings `str1` and `str2`, return _the shortest string that has both_ `str1` _and_ `str2` _as **subsequences**_. If there are multiple valid strings, return **any** of them. A string `s` is a **subsequence** of string `t` if deleting some number of characters from `t` (possibly `0`) results in the string `s`...
For each subtree, find the minimum value and maximum value of its descendants.
Tree,Depth-First Search,Binary Tree
Medium
null
357
today we're gonna be working on lead code question number 357 okay account numbers are the unique digits so you have been given an integer n written the count of all numbers with unique digits so 1 2 3 are not gonna be considered unique so if n is equal to 2 so what he is saying is like from 0 to 10 raised per 2 which ...
Count Numbers with Unique Digits
count-numbers-with-unique-digits
Given an integer `n`, return the count of all numbers with unique digits, `x`, where `0 <= x < 10n`. **Example 1:** **Input:** n = 2 **Output:** 91 **Explanation:** The answer should be the total numbers in the range of 0 <= x < 100, excluding 11,22,33,44,55,66,77,88,99 **Example 2:** **Input:** n = 0 **Output:** 1...
A direct way is to use the backtracking approach. Backtracking should contains three states which are (the current number, number of steps to get that number and a bitmask which represent which number is marked as visited so far in the current number). Start with state (0,0,0) and count all valid number till we reach n...
Math,Dynamic Programming,Backtracking
Medium
null
725
hello hi guys good morning welcome back to the new videos split linked list in Parts it's a very not very if you have watched the last three videos last three daily videos then you should be able to solve it why because you didn't like the concept of linked list is not much but the concept actual behind concept is the ...
Split Linked List in Parts
split-linked-list-in-parts
Given the `head` of a singly linked list and an integer `k`, split the linked list into `k` consecutive linked list parts. The length of each part should be as equal as possible: no two parts should have a size differing by more than one. This may lead to some parts being null. The parts should be in the order of occ...
If there are N nodes in the list, and k parts, then every part has N/k elements, except the first N%k parts have an extra one.
Linked List
Medium
61,328
808
Hello guys welcome to me youtube channel so today we are going to solve today's link code problem 801 auspicious serving so we have two soups given two types of soups type and ml are given both the quantity is mentioned. Maa ok, so if I have a tax operation then I will give you 100 rupees and zero rupees, then what is ...
Soup Servings
number-of-matching-subsequences
There are two types of soup: **type A** and **type B**. Initially, we have `n` ml of each type of soup. There are four kinds of operations: 1. Serve `100` ml of **soup A** and `0` ml of **soup B**, 2. Serve `75` ml of **soup A** and `25` ml of **soup B**, 3. Serve `50` ml of **soup A** and `50` ml of **soup B**, an...
null
Hash Table,String,Trie,Sorting
Medium
392,1051,2186
1,712
that's french for hello how are you doing friends i'm sure you're doing great but you will do even better once you solve this problem that i'm going to explain you right now the feeling the satisfaction i know sometimes you doubt yourself you're like all those people working for google and facebook and amazon and twitt...
Ways to Split Array Into Three Subarrays
unique-orders-and-customers-per-month
A split of an integer array is **good** if: * The array is split into three **non-empty** contiguous subarrays - named `left`, `mid`, `right` respectively from left to right. * The sum of the elements in `left` is less than or equal to the sum of the elements in `mid`, and the sum of the elements in `mid` is less ...
null
Database
Easy
null
1,695
welcome to may's lego challenge today's problem is maximum eraser value you are given an array of positive integers nums and want to erase a sub array containing unique elements the score you get by erasing the sub array is equal to the sum of its elements the elements of the subarray that we deleted anyway so return t...
Maximum Erasure Value
maximum-sum-obtained-of-any-permutation
You are given an array of positive integers `nums` and want to erase a subarray containing **unique elements**. The **score** you get by erasing the subarray is equal to the **sum** of its elements. Return _the **maximum score** you can get by erasing **exactly one** subarray._ An array `b` is called to be a subarray...
Indexes with higher frequencies should be bound with larger values
Array,Greedy,Sorting,Prefix Sum
Medium
null
54
when i first came across this problem it looked at first glance to be quite easy i thought you know you just start at the zero point in the matrix and go across the first row down the column back from that row at the bottom up to the column you're at and then continue the traversal in a spiral fashion as you collect yo...
Spiral Matrix
spiral-matrix
Given an `m x n` `matrix`, return _all elements of the_ `matrix` _in spiral order_. **Example 1:** **Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\] **Output:** \[1,2,3,6,9,8,7,4,5\] **Example 2:** **Input:** matrix = \[\[1,2,3,4\],\[5,6,7,8\],\[9,10,11,12\]\] **Output:** \[1,2,3,4,8,12,11,10,9,5,6,7\] **Const...
Well for some problems, the best way really is to come up with some algorithms for simulation. Basically, you need to simulate what the problem asks us to do. We go boundary by boundary and move inwards. That is the essential operation. First row, last column, last row, first column and then we move inwards by 1 and th...
Array,Matrix,Simulation
Medium
59,921
328
hey everyone in this video we are going to solve the odd event linked list question on lead code so we are given a head of a singly linked list so we need to return all the nodes with odd indices first followed by the notes with even indices so one thing to remember here we are not talking about the value inside the no...
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
1,997
I'm back let's do Elite code first day where you have been in all the rooms okay so I did this question before I mean just now and it is quite tricky but it's a very nice neat DB question sorry for spoiling okay so let's go through uh there are any rooms you need to visit label with zero to n minus one each day is labe...
First Day Where You Have Been in All the Rooms
next-palindrome-using-same-digits
There are `n` rooms you need to visit, labeled from `0` to `n - 1`. Each day is labeled, starting from `0`. You will go in and visit one room a day. Initially on day `0`, you visit room `0`. The **order** you visit the rooms for the coming days is determined by the following **rules** and a given **0-indexed** array `...
Is it possible to swap one character in the first half of the palindrome to make the next one? Are there different cases for when the length is odd and even?
Two Pointers,String
Hard
556,564
1,492
hey everybody this is larry this is one of uh one of the problems i sell for the bi-weekly contest 29 for the bi-weekly contest 29 for the bi-weekly contest 29 uh i'm gonna put the explanation in the beginning and then i'm gonna do the live coding of it afterwards let me know what you think about this format i'm still ...
The kth Factor of n
time-needed-to-inform-all-employees
You are given two positive integers `n` and `k`. A factor of an integer `n` is defined as an integer `i` where `n % i == 0`. Consider a list of all factors of `n` sorted in **ascending order**, return _the_ `kth` _factor_ in this list or return `-1` if `n` has less than `k` factors. **Example 1:** **Input:** n = 12,...
The company can be represented as a tree, headID is always the root. Store for each node the time needed to be informed of the news. Answer is the max time a leaf node needs to be informed.
Tree,Depth-First Search,Breadth-First Search
Medium
104,124
297
hello friends in this session we are going to discuss another lead code problem serialize and de-serialize problem serialize and de-serialize problem serialize and de-serialize binary tree this is one of the very common interview question asked in many companies what is serialization as per the problem statement or eve...
Serialize and Deserialize Binary Tree
serialize-and-deserialize-binary-tree
Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment. Design an algorithm to serialize and deserialize a bi...
null
String,Tree,Depth-First Search,Breadth-First Search,Design,Binary Tree
Hard
271,449,652,765
63
in this video we'll be going over the bottom up a very approach of unique paths two so in our previous 2d matrix approach we can see that in each of the iteration we're only relying on values from the current row and also the row below this means we can use a single array to represent our 2d matrix now let's go over th...
Unique Paths II
unique-paths-ii
You are given an `m x n` integer array `grid`. There is a robot 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. An obstacle and space are marked as ...
The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be if obstacleGrid[i][j] is not an obstacle ...
Array,Dynamic Programming,Matrix
Medium
62,1022
437
Hello Everyone in the on 17th October Subscribe Do Subscribe My Channel Subscribe Do Subscribe To Hai Digestive Process Liquid 437 Other Crops Ka Atal Gautam No Conflict Video Channel and subscribe the Channel subscribe our YouTube Channel and subscribe the according to the distic button Improve Vinod Algorithm To or e...
Path Sum III
path-sum-iii
Given the `root` of a binary tree and an integer `targetSum`, return _the number of paths where the sum of the values along the path equals_ `targetSum`. The path does not need to start or end at the root or a leaf, but it must go downwards (i.e., traveling only from parent nodes to child nodes). **Example 1:** **In...
null
Tree,Depth-First Search,Binary Tree
Medium
112,113,666,687
490
hey what's up guys chung here again okay so today let's take a look at uh this list called problem number 490 the maze it's a good problem in my opinion okay so the problem says there's a ball in the maze with empty spaces and the walls and the ball can go through the empty spaces either up down left and right but it w...
The Maze
the-maze
There is a ball in a `maze` with empty spaces (represented as `0`) and walls (represented as `1`). The ball can go through the empty spaces by rolling **up, down, left or right**, but it won't stop rolling until hitting a wall. When the ball stops, it could choose the next direction. Given the `m x n` `maze`, the ball...
null
Depth-First Search,Breadth-First Search,Graph
Medium
499,505
524
hi everyone welcome to my channel let's solve the problem longest word in dictionary through deleting so given a string and a string dictionary find the longest string in the dictionary that can be formed by deleting some characters of the given string so if there are more than one possible result return the longest wo...
Longest Word in Dictionary through Deleting
longest-word-in-dictionary-through-deleting
Given a string `s` and a string array `dictionary`, return _the longest string in the dictionary that can be formed by deleting some of the given string characters_. If there is more than one possible result, return the longest word with the smallest lexicographical order. If there is no possible result, return the emp...
null
Array,Two Pointers,String,Sorting
Medium
720
57
hey guys it's offline one here and today we're going to be solving instant interval in this problem we're given an array of non-overlapping intervals where array of non-overlapping intervals where array of non-overlapping intervals where each interval tells us a start point and an end point and they're telling us that ...
Insert Interval
insert-interval
You are given an array of non-overlapping intervals `intervals` where `intervals[i] = [starti, endi]` represent the start and the end of the `ith` interval and `intervals` is sorted in ascending order by `starti`. You are also given an interval `newInterval = [start, end]` that represents the start and end of another i...
null
Array
Medium
56,715
1,354
hey everybody this is larry this is day 24 of the june eco daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's problem as soon as it loads um yeah i'm feeling a little bit off today so let me know uh we'll see how that goes because i was outside and i...
Construct Target Array With Multiple Sums
find-players-with-zero-or-one-losses
You are given an array `target` of n integers. From a starting array `arr` consisting of `n` 1's, you may perform the following procedure : * let `x` be the sum of all elements currently in your array. * choose index `i`, such that `0 <= i < n` and set the value of `arr` at index `i` to `x`. * You may repeat thi...
Count the number of times a player loses while iterating through the matches.
Array,Hash Table,Sorting,Counting
Medium
236
1,652
let's solve the problem diffuse the bomb that's problem number 1652 it's a long problem here but I'll explain in simple words so you'll be given an array say something like this 1 2 3 4 5 which will be called as code and you'll be given a uh another integer K say for example k0 so what they're saying is if you get K Ze...
Defuse the Bomb
minimum-suffix-flips
You have a bomb to defuse, and your time is running out! Your informer will provide you with a **circular** array `code` of length of `n` and a key `k`. To decrypt the code, you must replace every number. All the numbers are replaced **simultaneously**. * If `k > 0`, replace the `ith` number with the sum of the **n...
Consider a strategy where the choice of bulb with number i is increasing. In such a strategy, you no longer need to worry about bulbs that have been set to the left.
String,Greedy
Medium
null
1,857
hey what's up guys uh this is juan here so today uh lead code number 1857 largest color value in the directed graph so this one is a pretty cool graph problem okay so you're given like a directed graph you know of un colored nose and m edges okay and the nodes number are from zero to n minus one and then you're also gi...
Largest Color Value in a Directed Graph
largest-color-value-in-a-directed-graph
There is a **directed graph** of `n` colored nodes and `m` edges. The nodes are numbered from `0` to `n - 1`. You are given a string `colors` where `colors[i]` is a lowercase English letter representing the **color** of the `ith` node in this graph (**0-indexed**). You are also given a 2D array `edges` where `edges[j]...
null
null
Hard
null
988
hello peeps what's up we are here to solve another program from lead code this title is smallest string starting from belief given the root binary tree each node has a value 0 to 25 representing characters from a to z and we need to find out the smallest lexicographical string that can be formed during in the path from...
Smallest String Starting From Leaf
flip-equivalent-binary-trees
You are given the `root` of a binary tree where each node has a value in the range `[0, 25]` representing the letters `'a'` to `'z'`. Return _the **lexicographically smallest** string that starts at a leaf of this tree and ends at the root_. As a reminder, any shorter prefix of a string is **lexicographically smaller...
null
Tree,Depth-First Search,Binary Tree
Medium
null
123
hi guys hope you're doing great our today's question is best time to buy and sell stock three so the question says say you have an array for which the aia tournament is the price of the given stock one day i design an algorithm to find the maximum profit you will complete at most two transactions you may not engage in ...
Best Time to Buy and Sell Stock III
best-time-to-buy-and-sell-stock-iii
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day. Find the maximum profit you can achieve. You may complete **at most two transactions**. **Note:** You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again). **Exampl...
null
Array,Dynamic Programming
Hard
121,122,188,689
763
hello everyone welcome to question coder so in this video we will see the question that is partition labels so it is a medium level question and the problem statement is a string as of lowercase english letters is given so we want to partition the string into as many parts as possible so that each letter appears in at ...
Partition Labels
special-binary-string
You are given a string `s`. We want to partition the string into as many parts as possible so that each letter appears in at most one part. Note that the partition is done so that after concatenating all the parts in order, the resultant string should be `s`. Return _a list of integers representing the size of these ...
Draw a line from (x, y) to (x+1, y+1) if we see a "1", else to (x+1, y-1). A special substring is just a line that starts and ends at the same y-coordinate, and that is the lowest y-coordinate reached. Call a mountain a special substring with no special prefixes - ie. only at the beginning and end is the lowest y-coo...
String,Recursion
Hard
678
110
okay this see the um easy question and the topic Tre defic b anyway uh so we have the uh we are given a binary tree and we must determine if see high balance binary tree so a high balance binary tree is a tree with the depth of two sub trees of every node never differs by uh more than one which mean we can see the not ...
Balanced Binary Tree
balanced-binary-tree
Given a binary tree, determine if it is **height-balanced**. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** true **Example 2:** **Input:** root = \[1,2,2,3,3,null,null,4,4\] **Output:** false **Example 3:** **Input:** root = \[\] **Output:** true **Constraints:** * The number of nodes ...
null
Tree,Depth-First Search,Binary Tree
Easy
104
223
So gas main us review agarwal welcome tu ko tricks channel made for you made by so let's not start today sleep good problem name of good problem for today is rectangle area medium level problem trust me which is very simple problem don't worry If there is no such thing, then first of all let us see what is given in thi...
Rectangle Area
rectangle-area
Given the coordinates of two **rectilinear** rectangles in a 2D plane, return _the total area covered by the two rectangles_. The first rectangle is defined by its **bottom-left** corner `(ax1, ay1)` and its **top-right** corner `(ax2, ay2)`. The second rectangle is defined by its **bottom-left** corner `(bx1, by1)` ...
null
Math,Geometry
Medium
866
739
foreign hello everyone and welcome back to another video So today we're going to be sewing the leaf code question 739 daily temperatures cool so we're going to be given an area of integers called temperatures and they represent the daily temperatures okay so what we need to do is we return an array called answer where ...
Daily Temperatures
daily-temperatures
Given an array of integers `temperatures` represents the daily temperatures, return _an array_ `answer` _such that_ `answer[i]` _is the number of days you have to wait after the_ `ith` _day to get a warmer temperature_. If there is no future day for which this is possible, keep `answer[i] == 0` instead. **Example 1:**...
If the temperature is say, 70 today, then in the future a warmer temperature must be either 71, 72, 73, ..., 99, or 100. We could remember when all of them occur next.
Array,Stack,Monotonic Stack
Medium
496,937
141
hey guys in this video i'll be going through how to solve leak code question 141 called linked list cycle so in this question we're going to be given the head of a linked list and our task is to determine if there is a cycle in the list um so in this example this would be an example where there is a cycle because this ...
Linked List Cycle
linked-list-cycle
Given `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 there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that tail's `next` pointer is co...
null
Hash Table,Linked List,Two Pointers
Easy
142,202
153
hey there everyone welcome back to lead coding i am your host faraz and we are solving the questions from binary search i uploaded an assignment for binary search and there were five questions in the assignment it was the first assignment of binary search and this is the third question of that assignment if you haven't...
Find Minimum in Rotated Sorted Array
find-minimum-in-rotated-sorted-array
Suppose an array of length `n` sorted in ascending order is **rotated** between `1` and `n` times. For example, the array `nums = [0,1,2,4,5,6,7]` might become: * `[4,5,6,7,0,1,2]` if it was rotated `4` times. * `[0,1,2,4,5,6,7]` if it was rotated `7` times. Notice that **rotating** an array `[a[0], a[1], a[2], ....
Array was originally in ascending order. Now that the array is rotated, there would be a point in the array where there is a small deflection from the increasing sequence. eg. The array would be something like [4, 5, 6, 7, 0, 1, 2]. You can divide the search space into two and see which direction to go. Can you think ...
Array,Binary Search
Medium
33,154
576
hello hi guys good morning welcome back to the new video in this problem out of boundary pairs now if you have done this problem and if you think it's a easy problem then for sure you have not done this problem because there is we go on from very scratch like region memorization bottom up and all that stuff you will go...
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
744
hey everyone today we are going to solve the little question find the smallest retargeters and Target so you are given an array of characters letters that is sorted in non-decreasing order and the sorted in non-decreasing order and the sorted in non-decreasing order and the character Target there are at least two diffe...
Find Smallest Letter Greater Than Target
network-delay-time
You are given an array of characters `letters` that is sorted in **non-decreasing order**, and a character `target`. There are **at least two different** characters in `letters`. Return _the smallest character in_ `letters` _that is lexicographically greater than_ `target`. If such a character does not exist, return t...
We visit each node at some time, and if that time is better than the fastest time we've reached this node, we travel along outgoing edges in sorted order. Alternatively, we could use Dijkstra's algorithm.
Depth-First Search,Breadth-First Search,Graph,Heap (Priority Queue),Shortest Path
Medium
2151,2171
1,673
Hello Pintu Bhaiya Lakhan Question Images Of Shinchen Biwi Three A Question Find The Most Competitive Subsequent Play Store's Dual Air Lines And Positivity Subscribe To Scientist This Sub Sequence Pimples Optimization Element From His Form Is Also Giving Subscription 1234 Work And On Thursday Subscribe to that ball par...
Find the Most Competitive Subsequence
find-the-most-competitive-subsequence
Given an integer array `nums` and a positive integer `k`, return _the most **competitive** subsequence of_ `nums` _of size_ `k`. An array's subsequence is a resulting sequence obtained by erasing some (possibly zero) elements from the array. We define that a subsequence `a` is more **competitive** than a subsequence ...
null
null
Medium
null
127
hey yo what's up guys babybear4812 coming at you one more time leak code 127 word louder this time and um i'm laughing for two reasons one is like i struggle with this problem i think medium is deceptive here i think this should be a hard uh the other thing is that it is actually my second time recording this video i f...
Word Ladder
word-ladder
A **transformation sequence** from word `beginWord` to word `endWord` using a dictionary `wordList` is a sequence of words `beginWord -> s1 -> s2 -> ... -> sk` such that: * Every adjacent pair of words differs by a single letter. * Every `si` for `1 <= i <= k` is in `wordList`. Note that `beginWord` does not need ...
null
Hash Table,String,Breadth-First Search
Hard
126,433
237
Hello friends today I'm going to solve liquid problem number 237 delete note in a linked list so what's a link list let's see first um so in a linked list we actually have multiple notes and each nose are connected with each other in one way or other so if there is only one direction in which the nodes are connected th...
Delete Node in a Linked List
delete-node-in-a-linked-list
There is a singly-linked list `head` and we want to delete a node `node` in it. You are given the node to be deleted `node`. You will **not be given access** to the first node of `head`. All the values of the linked list are **unique**, and it is guaranteed that the given node `node` is not the last node in the linke...
null
Linked List
Easy
203
1,727
so in this question we have to find the largest area of submatrix uh and here uh we can only in reorder The Columns so if you can see in this question uh we are given with a matrix and after reordering the columns so we after like placing this uh this column 111 uh in the middle we are getting an area of four so let's ...
Largest Submatrix With Rearrangements
cat-and-mouse-ii
You are given a binary matrix `matrix` of size `m x n`, and you are allowed to rearrange the **columns** of the `matrix` in any order. Return _the area of the largest submatrix within_ `matrix` _where **every** element of the submatrix is_ `1` _after reordering the columns optimally._ **Example 1:** **Input:** matri...
Try working backward: consider all trivial states you know to be winning or losing, and work backward to determine which other states can be labeled as winning or losing.
Math,Dynamic Programming,Breadth-First Search,Graph,Memoization,Game Theory
Hard
805,949
139
hey and welcome back to the channel today I will show you how to solve word break interview question from lead code this question has been mostly asked by Facebook but it also has been asked by various other companies like so we will use JavaScript via BFS Solution by leveraging an area as a queue also there will be an...
Word Break
word-break
Given a string `s` and a dictionary of strings `wordDict`, return `true` if `s` can be segmented into a space-separated sequence of one or more dictionary words. **Note** that the same word in the dictionary may be reused multiple times in the segmentation. **Example 1:** **Input:** s = "leetcode ", wordDict = \[ "...
null
Hash Table,String,Dynamic Programming,Trie,Memoization
Medium
140
111
A firewall welcome to bank OTP just like guddu beat change the name of the volume minimum death of binary tree select so friends problem solve problems and given a banner tree - minimum death and the given a banner tree - minimum death and the given a banner tree - minimum death and the number of notes of this type of ...
Minimum Depth of Binary Tree
minimum-depth-of-binary-tree
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. **Note:** A leaf is a node with no children. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** 2 **Example 2:** **Input:** root = \[2...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
102,104
56
A Heavy 1872 Will Be Discussing District Problems From 28th March Overlapping Sub Intervals Subh Problem States Having Been A Collection Of Intervals Neetu Mann Chaugi Overlapping Intervals Application Use In The Form Of Free Water Into Coma Sex Begum Attendant Team Ko 180 Vacancy Date 15312 Weak Overlapping 100 Years ...
Merge Intervals
merge-intervals
Given an array of `intervals` where `intervals[i] = [starti, endi]`, merge all overlapping intervals, and return _an array of the non-overlapping intervals that cover all the intervals in the input_. **Example 1:** **Input:** intervals = \[\[1,3\],\[2,6\],\[8,10\],\[15,18\]\] **Output:** \[\[1,6\],\[8,10\],\[15,18\]\...
null
Array,Sorting
Medium
57,252,253,495,616,715,761,768,1028,2297,2319
48
so guys so this is Josh from Brazil right now so moving along with the matrix related problems last one was solved as a transpose E and matrix which we did it with the easiest way possible we still using a little bit of space this problem is a little bit more complex but you can also use that transpose technique so I d...
Rotate Image
rotate-image
You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise). You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati...
null
Array,Math,Matrix
Medium
2015
701
Hello guys welcome to my video directly guava problem vijay call insert into binary search tree subscribe now to receive new updates reviews and property value 12-12-12-12-12-12-12 all the best all the example of all the great wealth and property example person to Interest BST Web Lines At Least Sundar Roop Note 90 Let...
Insert into a Binary Search Tree
insert-into-a-binary-search-tree
You are given the `root` node of a binary search tree (BST) and a `value` to insert into the tree. Return _the root node of the BST after the insertion_. It is **guaranteed** that the new value does not exist in the original BST. **Notice** that there may exist multiple valid ways for the insertion, as long as the tre...
null
null
Medium
null
605
hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you have not liked the video please like it subscribe to my channel so that you get notified whenever i post a new video so without any further ado let's get started so the problem is can pl...
Can Place Flowers
can-place-flowers
You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in **adjacent** plots. Given an integer array `flowerbed` containing `0`'s and `1`'s, where `0` means empty and `1` means not empty, and an integer `n`, return `true` _if_ `n` _new flowers can be plan...
null
Array,Greedy
Easy
495,735
1,732
Hi guys, Namaskar, let us do 90 day AC prep. This is the question. Lead code 1732. Find the highest altitude. 18th question is this from lead code 75. See what the question was. So, I am telling you that you are standing at zero altitude and I am telling you this. Have you gained or lost your attitude? Tell me what was...
Find the Highest Altitude
minimum-one-bit-operations-to-make-integers-zero
There is a biker going on a road trip. The road trip consists of `n + 1` points at different altitudes. The biker starts his trip on point `0` with altitude equal `0`. You are given an integer array `gain` of length `n` where `gain[i]` is the **net gain in altitude** between points `i`​​​​​​ and `i + 1` for all (`0 <=...
The fastest way to convert n to zero is to remove all set bits starting from the leftmost one. Try some simple examples to learn the rule of how many steps are needed to remove one set bit. consider n=2^k case first, then solve for all n.
Dynamic Programming,Bit Manipulation,Memoization
Hard
2119
1,190
Ajay Ko Hello friends good in this set bank wedding today we are going to do this is question on reverse substring between legs what is to do a spray that they will get a pin at school time it has parentheses inside it and some English lower case letters According to this constant and it would have been ABCD that now i...
Reverse Substrings Between Each Pair of Parentheses
smallest-common-region
You are given a string `s` that consists of lower case English letters and brackets. Reverse the strings in each pair of matching parentheses, starting from the innermost one. Your result should **not** contain any brackets. **Example 1:** **Input:** s = "(abcd) " **Output:** "dcba " **Example 2:** **Input:** s...
Try to model the problem as a graph problem. The given graph is a tree. The problem is reduced to finding the lowest common ancestor of two nodes in a tree.
Array,Hash Table,String,Tree,Depth-First Search,Breadth-First Search
Medium
235,236
355
today we're gonna be working on lead code question number 355 on design twitter i design a simplified version of twitter where users can post tweets follow and follow another user and is able to see the 10 most recent tweets in the user's news feed implement the twitter class twitter function is going to initialize the...
Design Twitter
design-twitter
Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the `10` most recent tweets in the user's news feed. Implement the `Twitter` class: * `Twitter()` Initializes your twitter object. * `void postTweet(int userId, int tweetId)` Composes a new tweet w...
null
Hash Table,Linked List,Design,Heap (Priority Queue)
Medium
1640
70
in this video we'll go over lead code question number 70 climbing stairs here's the question you are climbing a staircase that has n steps you can either climb one step or two steps at a time how many distinct ways can you climb to the top we'll also assume that n is at least one so for example if the staircase has thr...
Climbing Stairs
climbing-stairs
You are climbing a staircase. It takes `n` steps to reach the top. Each time you can either climb `1` or `2` steps. In how many distinct ways can you climb to the top? **Example 1:** **Input:** n = 2 **Output:** 2 **Explanation:** There are two ways to climb to the top. 1. 1 step + 1 step 2. 2 steps **Example 2:** ...
To reach nth step, what could have been your previous steps? (Think about the step sizes)
Math,Dynamic Programming,Memoization
Easy
747,1013,1236
498
hey guys I hope you're doing well this is Jay sir who is not good at algorithms I'm making these videos to prepare my interview in eczema in this video I'm going to take the cap for 9 8 diagonal Travis we're given matrix of n by n elements we turn audience of the matrix in diagonal order as shown in the below image 1 2...
Diagonal Traverse
diagonal-traverse
Given an `m x n` matrix `mat`, return _an array of all the elements of the array in a diagonal order_. **Example 1:** **Input:** mat = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\] **Output:** \[1,2,4,7,5,3,6,8,9\] **Example 2:** **Input:** mat = \[\[1,2\],\[3,4\]\] **Output:** \[1,2,3,4\] **Constraints:** * `m == mat.leng...
null
Array,Matrix,Simulation
Medium
2197
201
okay so what's up guys this is a here and let us continue with the next question of a bit manipulation playlist so the next question is about the bitwise and of range numbers the question is a medium category so let us read the question is very self-explanatory as well so we have been self-explanatory as well so we hav...
Bitwise AND of Numbers Range
bitwise-and-of-numbers-range
Given two integers `left` and `right` that represent the range `[left, right]`, return _the bitwise AND of all numbers in this range, inclusive_. **Example 1:** **Input:** left = 5, right = 7 **Output:** 4 **Example 2:** **Input:** left = 0, right = 0 **Output:** 0 **Example 3:** **Input:** left = 1, right = 2147...
null
Bit Manipulation
Medium
null
2,000
Welcome back tu video and in this video we will see this easy level problem whose name is reverse prefix of word so friends directly we see the example and understand it then friends we will be given a word and a character will be given like right here. If di is given then we will look at di first, that means we will m...
Reverse Prefix of Word
minimum-speed-to-arrive-on-time
Given a **0-indexed** string `word` and a character `ch`, **reverse** the segment of `word` that starts at index `0` and ends at the index of the **first occurrence** of `ch` (**inclusive**). If the character `ch` does not exist in `word`, do nothing. * For example, if `word = "abcdefd "` and `ch = "d "`, then you s...
Given the speed the trains are traveling at, can you find the total time it takes for you to arrive? Is there a cutoff where any speeds larger will always allow you to arrive on time?
Array,Binary Search
Medium
1335,2013,2294