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
428
okay let's take a look at leak code 428 serialized and deserialized and airy tree so yesterday i posted a video of the serialized and dc realized binary slash binary search tree and this problem is very similar in that we're gonna use pre-order traversal again uh gonna use pre-order traversal again uh gonna use pre-ord...
Serialize and Deserialize N-ary Tree
serialize-and-deserialize-n-ary-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 an N...
null
null
Hard
null
318
in this video we are going to solve a problem where we have to find the maximum product of word lengths so we are given an array of words like abc is a word then we have let's say bcd and so on many words and we have to pick two words out of this array and we have to pick the word such that none of the characters in wo...
Maximum Product of Word Lengths
maximum-product-of-word-lengths
Given a string array `words`, return _the maximum value of_ `length(word[i]) * length(word[j])` _where the two words do not share common letters_. If no such two words exist, return `0`. **Example 1:** **Input:** words = \[ "abcw ", "baz ", "foo ", "bar ", "xtfn ", "abcdef "\] **Output:** 16 **Explanation:** The two ...
null
Array,String,Bit Manipulation
Medium
null
392
This is a Pakistani serial, today it's all its subsequent spider-man, it is a very simple subsequent spider-man, it is a very simple subsequent spider-man, it is a very simple problem, so let's stay on some questions, if this is a sequence, it means it is ABC, subscribe to Twitter and if not then for. Return and the se...
Is Subsequence
is-subsequence
Given two strings `s` and `t`, return `true` _if_ `s` _is a **subsequence** of_ `t`_, or_ `false` _otherwise_. A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i...
null
Two Pointers,String,Dynamic Programming
Easy
808,1051
112
Indian Welcome Back to My Channel Ayurvedic Cream Events Today Will Be Solving Problems Facing Maximum Panch Samini Given in Binary Tree Now What is a Parts and This Seedhi Previous Video Aapta is Nothing But Any 5 Lakhs Start From Any Day Ago to Day Odds What We Call This Five Okay And In Emergency Single Not Will Onl...
Path Sum
path-sum
Given the `root` of a binary tree and an integer `targetSum`, return `true` if the tree has a **root-to-leaf** path such that adding up all the values along the path equals `targetSum`. A **leaf** is a node with no children. **Example 1:** **Input:** root = \[5,4,8,11,null,13,4,7,2,null,null,null,1\], targetSum = 22...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
113,124,129,437,666
714
hi everyone so let's talk about the base time to buy and sell stock with transaction b so you're giving given the price array and also integer fee so you want to find out maximum property you can achieve and then if the constraint cannot do the subsection simultaneously so which means you want to buy and sell the stock...
Best Time to Buy and Sell Stock with Transaction Fee
best-time-to-buy-and-sell-stock-with-transaction-fee
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day, and an integer `fee` representing a transaction fee. Find the maximum profit you can achieve. You may complete as many transactions as you like, but you need to pay the transaction fee for each transaction. **Note:** You...
Consider the first K stock prices. At the end, the only legal states are that you don't own a share of stock, or that you do. Calculate the most profit you could have under each of these two cases.
Array,Dynamic Programming,Greedy
Medium
122
427
In this video we will discuss the problem of Construct Battery, its category is medium, what is this problem and then you have to construct it. There is a data structure in which each internal mode has tax children and apart from that it stores two data. Basically the structure of each mode will be like this, there wil...
Construct Quad Tree
construct-quad-tree
Given a `n * n` matrix `grid` of `0's` and `1's` only. We want to represent `grid` with a Quad-Tree. Return _the root of the Quad-Tree representing_ `grid`. A Quad-Tree is a tree data structure in which each internal node has exactly four children. Besides, each node has two attributes: * `val`: True if the node r...
null
null
Medium
null
888
Hello guys welcome to problem in lead code called fair candidates where and reduced problem Elva Edison bread different size where is the size of the white beard angry bird lies in the side of the cheek and subscribe our Answer subscribe The Channel and subscribe the Channel Please subscribe and subscirbe Total Number ...
Fair Candy Swap
mirror-reflection
Alice and Bob have a different total number of candies. You are given two integer arrays `aliceSizes` and `bobSizes` where `aliceSizes[i]` is the number of candies of the `ith` box of candy that Alice has and `bobSizes[j]` is the number of candies of the `jth` box of candy that Bob has. Since they are friends, they wo...
null
Math,Geometry
Medium
null
124
binary tree maximum part okay so in this question what we have address of the root node of a binary tree and what we need to do we need to return the maximum part okay so basically what we need to do is we have lots of possible parts right so let's say this is one part this is in fact also one part so we have n number ...
Binary Tree Maximum Path Sum
binary-tree-maximum-path-sum
A **path** in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence **at most once**. Note that the path does not need to pass through the root. The **path sum** of a path is the sum of the node's values in the path. ...
null
Dynamic Programming,Tree,Depth-First Search,Binary Tree
Hard
112,129,666,687,1492
392
the holiday today's liquid in challenge question is called a subsequence we have two strings s and T we need to check if the first string is the subsequence of the second one subsequence of a string is a new string obtained by deleting some of the characters from the original string without changing the relative orderi...
Is Subsequence
is-subsequence
Given two strings `s` and `t`, return `true` _if_ `s` _is a **subsequence** of_ `t`_, or_ `false` _otherwise_. A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i...
null
Two Pointers,String,Dynamic Programming
Easy
808,1051
1,772
hey everyone this is steve today let's go through lithium problem 1772 solve features by popularity i think this is a problem that came up in one of the recent contests pretty straightforward but still it's fun that i used a combination of anyone could use a combination of different data structures so first let's take ...
Sort Features by Popularity
create-sorted-array-through-instructions
You are given a string array `features` where `features[i]` is a single word that represents the name of a feature of the latest product you are working on. You have made a survey where users have reported which features they like. You are given a string array `responses`, where each `responses[i]` is a string containi...
This problem is closely related to finding the number of inversions in an array if i know the position in which i will insert the i-th element in I can find the minimum cost to insert it
Array,Binary Search,Divide and Conquer,Binary Indexed Tree,Segment Tree,Merge Sort,Ordered Set
Hard
2280,2319
525
hey everyone welcome back and let's write some more neat code today so today let's solve the problem contiguous array we're given a binary array of nums meaning it just consists of zero and one in the input array and we want to return the maximum length of a continuous subarray with an equal number of zeros and ones th...
Contiguous Array
contiguous-array
Given a binary array `nums`, return _the maximum length of a contiguous subarray with an equal number of_ `0` _and_ `1`. **Example 1:** **Input:** nums = \[0,1\] **Output:** 2 **Explanation:** \[0, 1\] is the longest contiguous subarray with an equal number of 0 and 1. **Example 2:** **Input:** nums = \[0,1,0\] **O...
null
Array,Hash Table,Prefix Sum
Medium
325
1,710
hello and welcome back to the cracking Fang YouTube channel today we're going to be solving lead code problem 1710 maximum units on a truck we are assigned to put some amount of boxes onto one truck you are given a 2G array box types or box types of I contains two elements number of boxes and number of units per box th...
Maximum Units on a Truck
find-servers-that-handled-most-number-of-requests
You are assigned to put some amount of boxes onto **one truck**. You are given a 2D array `boxTypes`, where `boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]`: * `numberOfBoxesi` is the number of boxes of type `i`. * `numberOfUnitsPerBoxi` is the number of units in each box of the type `i`. You are also given...
To speed up the next available server search, keep track of the available servers in a sorted structure such as an ordered set. To determine if a server is available, keep track of the end times for each task in a heap and add the server to the available set once the soonest task ending time is less than or equal to th...
Array,Greedy,Heap (Priority Queue),Ordered Set
Hard
null
832
how's anyone guys today we're gonna be going over a problem called flipping an image this is a common league code question and there be questions asked by Google it says given a by a binary matrix a we want to flip the image horizontally and then invert it and return the resulting image to flip an image horizontally me...
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,732
hello guys welcome back to my channel and today we are going to solve a new liquid question that is find the highest altitude the question says there is a biker going on a road trip the road trip consists of n plus one consisting uh points at different altitudes the bikers start to slip 1.0 with an altitude start to sl...
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,171
guys welcome back to our daily lead code Challenge Series and today's question is a really mind Buster remove zero some consecutive notes from link list it's a medium one but it's really has got some really pick twixs yeah it's going to bust your mind it took me so much time to debug my own code yeah seriously so we'll...
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,688
hello everyone today we're going to continue with our practice so uh the question we're discussing today is lead code 1688 count of matches in tournament okay so let's get straight into the question says that you are given an integer n the number of teams in a tournament that has strange rules right if the current numb...
Count of Matches in Tournament
the-most-recent-orders-for-each-product
You are given an integer `n`, the number of teams in a tournament that has strange rules: * If the current number of teams is **even**, each team gets paired with another team. A total of `n / 2` matches are played, and `n / 2` teams advance to the next round. * If the current number of teams is **odd**, one team ...
null
Database
Medium
1671,1735
141
Hi welcome you welcome next you do question series and here we are going to attend question number 141 which is linkless cycle meaning you have to detect here whether any cycle is being made in link less, okay what is the meaning of this linked list Let us see whether the cycle is being made or not. One question is ver...
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
253
hey everyone welcome back and let's write some more neat code today so today let's solve meeting rooms two and just like meeting rooms one we're going to solve this problem on the website called lint code because this is a premium leak code problem so if you want to be able to solve it for free you can use for free you...
Meeting Rooms II
meeting-rooms-ii
Given an array of meeting time intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of conference rooms required_. **Example 1:** **Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\] **Output:** 2 **Example 2:** **Input:** intervals = \[\[7,10\],\[2,4\]\] **Output:** 1 **Constr...
Think about how we would approach this problem in a very simplistic way. We will allocate rooms to meetings that occur earlier in the day v/s the ones that occur later on, right? If you've figured out that we have to sort the meetings by their start time, the next thing to think about is how do we do the allocation? Th...
Array,Two Pointers,Greedy,Sorting,Heap (Priority Queue)
Medium
56,252,452,1184
84
Hi My Name Is This Video In Two See The Question Largest Rectangle In Histogram Guitar Height In The Area Of Largest Intestine Heart Attack Computer Training Report Killer Position In Order To Find Out The Area In Most Popular Rectangle You Have Height Of The End Samridhi Looking Left End Right to find out all the heig...
Largest Rectangle in Histogram
largest-rectangle-in-histogram
Given an array of integers `heights` representing the histogram's bar height where the width of each bar is `1`, return _the area of the largest rectangle in the histogram_. **Example 1:** **Input:** heights = \[2,1,5,6,2,3\] **Output:** 10 **Explanation:** The above is a histogram where width of each bar is 1. The l...
null
Array,Stack,Monotonic Stack
Hard
85,1918
246
although this question is stormy grammatics number so you give me a certain none and then you want to return true if a num is a historic chromatic and then how do you do this it's pretty straightforward so the story chromatic number is the number you looked the same when you rotate 180 so one root is equal to 1 8 is eq...
Strobogrammatic Number
strobogrammatic-number
Given a string `num` which represents an integer, return `true` _if_ `num` _is a **strobogrammatic number**_. A **strobogrammatic number** is a number that looks the same when rotated `180` degrees (looked at upside down). **Example 1:** **Input:** num = "69 " **Output:** true **Example 2:** **Input:** num = "88...
null
Hash Table,Two Pointers,String
Easy
247,248,1069
1,827
let's solve lead code 1827 minimum operations to make the a increasing all right so the question goes like this you'll be given an array of integers it could be something like 1 5 3 4 2 two right it could be something like this okay and you're required to make it into and increasing you need to sort uh not sort but you...
Minimum Operations to Make the Array Increasing
invalid-tweets
You are given an integer array `nums` (**0-indexed**). In one operation, you can choose an element of the array and increment it by `1`. * For example, if `nums = [1,2,3]`, you can choose to increment `nums[1]` to make `nums = [1,**3**,3]`. Return _the **minimum** number of operations needed to make_ `nums` _**stri...
null
Database
Easy
null
416
Partition Equal Subset Sum: In this problem, Partition Equal Subset Sum: In this problem, Partition Equal Subset Sum: In this problem, we have been given an integer array. We have to divide this array into two subsets in such a way that the sum of the elements of the two subsets is the same. If we move the arrow to thi...
Partition Equal Subset Sum
partition-equal-subset-sum
Given an integer array `nums`, return `true` _if you can partition the array into two subsets such that the sum of the elements in both subsets is equal or_ `false` _otherwise_. **Example 1:** **Input:** nums = \[1,5,11,5\] **Output:** true **Explanation:** The array can be partitioned as \[1, 5, 5\] and \[11\]. **E...
null
Array,Dynamic Programming
Medium
698,2108,2135,2162
1,371
hello quick introduction to the video my name is Cameron I'm a graduate Apprentice software engineer currently studying at Glasgow University and I'm using this video as a way to sort of rubber duck a debug a l code problem just attempt to solve it talk through my thought process and hopefully someone will find it usef...
Find the Longest Substring Containing Vowels in Even Counts
minimum-remove-to-make-valid-parentheses
Given the string `s`, return the size of the longest substring containing each vowel an even number of times. That is, 'a', 'e', 'i', 'o', and 'u' must appear an even number of times. **Example 1:** **Input:** s = "eleetminicoworoep " **Output:** 13 **Explanation:** The longest substring is "leetminicowor " which c...
Each prefix of a balanced parentheses has a number of open parentheses greater or equal than closed parentheses, similar idea with each suffix. Check the array from left to right, remove characters that do not meet the property mentioned above, same idea in backward way.
String,Stack
Medium
2095,2221
290
Hi everyone, I hope it is very fine today, which is our topic, friend, in which we will talk about the topic of judge map, in which we will solve the word patterns today, how will we solve the word patterns, how easy is it going to be, in what way. If we approach then the same approach as we used for isomorphic, which ...
Word Pattern
word-pattern
Given a `pattern` and a string `s`, find if `s` follows the same pattern. Here **follow** means a full match, such that there is a bijection between a letter in `pattern` and a **non-empty** word in `s`. **Example 1:** **Input:** pattern = "abba ", s = "dog cat cat dog " **Output:** true **Example 2:** **Input:*...
null
Hash Table,String
Easy
205,291
1,832
hello everyone let's try to be a cheat code ninja today we will be solving a very easy string problem here we are given a definition of a pan gram is a sentence in which all the 26 characters of the English alphabet are present hence a pan gram must contain all the characters from a till z so given a sentence we have t...
Check if the Sentence Is Pangram
minimum-operations-to-make-a-subsequence
A **pangram** is a sentence where every letter of the English alphabet appears at least once. Given a string `sentence` containing only lowercase English letters, return `true` _if_ `sentence` _is a **pangram**, or_ `false` _otherwise._ **Example 1:** **Input:** sentence = "thequickbrownfoxjumpsoverthelazydog " **O...
The problem can be reduced to computing Longest Common Subsequence between both arrays. Since one of the arrays has distinct elements, we can consider that these elements describe an arrangement of numbers, and we can replace each element in the other array with the index it appeared at in the first array. Then the pro...
Array,Hash Table,Binary Search,Greedy
Hard
null
315
and welcome to another one of my lead code videos in this one we will do lead code number 315 count of smaller numbers after self so how the problem goes is you're given an array an input array and you need to return an output where corresponding to each element you count the number of numbers that are smaller than thi...
Count of Smaller Numbers After Self
count-of-smaller-numbers-after-self
Given an integer array `nums`, return _an integer array_ `counts` _where_ `counts[i]` _is the number of smaller elements to the right of_ `nums[i]`. **Example 1:** **Input:** nums = \[5,2,6,1\] **Output:** \[2,1,1,0\] **Explanation:** To the right of 5 there are **2** smaller elements (2 and 1). To the right of 2 the...
null
Array,Binary Search,Divide and Conquer,Binary Indexed Tree,Segment Tree,Merge Sort,Ordered Set
Hard
327,406,493,1482,2280
160
everyone welcome back and let's write some more neat code today so today let's solve another classic problem intersection of two linked lists there's quite a few solutions to this problem but we're going to be focusing most on the most optimal solution but let's read the problem first so we're given the head of two sin...
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
54
legal question 54 spiral matrix and it's a median legal question basically you have mult m multiplex and matrix written all elements of the matrix in a spiral order so you want to what you want to go through is like example the matrix you want to start from this element and go all the way to the right all the way to th...
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
149
Hello everyone welcome to my channel code story with mike so today we will do video number four of maths playlist i.e. question number four i.e. question number four i.e. question number four when we will explain it then it is ok just to understand the question I am giving the description of the question a little bit b...
Max Points on a Line
max-points-on-a-line
Given an array of `points` where `points[i] = [xi, yi]` represents a point on the **X-Y** plane, return _the maximum number of points that lie on the same straight line_. **Example 1:** **Input:** points = \[\[1,1\],\[2,2\],\[3,3\]\] **Output:** 3 **Example 2:** **Input:** points = \[\[1,1\],\[3,2\],\[5,3\],\[4,1\]...
null
Array,Hash Table,Math,Geometry
Hard
356,2287
22
Hello Friends Welcome To Step Cornice Suggestion Gender Differences And To The Problem Exam Clear Give And Import Number And You Have To Generate In Thy Soul With Jeweled Prince Is Tomato Pilot Vs Rich Value For Solution For Any One To Three Stitch On Leather Belt Vikas Chaubey Opening Dress and 14 Printers Half Inch N...
Generate Parentheses
generate-parentheses
Given `n` pairs of parentheses, write a function to _generate all combinations of well-formed parentheses_. **Example 1:** **Input:** n = 3 **Output:** \["((()))","(()())","(())()","()(())","()()()"\] **Example 2:** **Input:** n = 1 **Output:** \["()"\] **Constraints:** * `1 <= n <= 8`
null
String,Dynamic Programming,Backtracking
Medium
17,20,2221
42
so hello coders welcome to my channel and in this video i will be explaining the problem trapping rain water which is a difficult problem if you are doing it for the first time but once you understand the concept what is happening then the problem will become super easy so what the problem is basically saying is that i...
Trapping Rain Water
trapping-rain-water
Given `n` non-negative integers representing an elevation map where the width of each bar is `1`, compute how much water it can trap after raining. **Example 1:** **Input:** height = \[0,1,0,2,1,0,1,3,2,1,2,1\] **Output:** 6 **Explanation:** The above elevation map (black section) is represented by array \[0,1,0,2,1,...
null
Array,Two Pointers,Dynamic Programming,Stack,Monotonic Stack
Hard
11,238,407,756
542
hey what's up guys uh this is john here so today let's take a look at today's daily challenge problem number 542.01 matrix problem number 542.01 matrix problem number 542.01 matrix okay uh pretty straightforward right so we're given like a m by n binary matrix and we need to return the distance of the nearest zero for ...
01 Matrix
01-matrix
Given an `m x n` binary matrix `mat`, return _the distance of the nearest_ `0` _for each cell_. The distance between two adjacent cells is `1`. **Example 1:** **Input:** mat = \[\[0,0,0\],\[0,1,0\],\[0,0,0\]\] **Output:** \[\[0,0,0\],\[0,1,0\],\[0,0,0\]\] **Example 2:** **Input:** mat = \[\[0,0,0\],\[0,1,0\],\[1,1...
null
Array,Dynamic Programming,Breadth-First Search,Matrix
Medium
550,2259
237
what's up guys and they're quite here talking I do technical and stuff on twitch and YouTube check the description join the patreon join the discord and this problem is pretty I don't like to you know I almost want to dislike this one but I'm gonna like I just like everything but I don't know this problem is not very g...
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
120
hello everyone welcome to our channel code with sunny and today in this video i'm going to talk about the problem triangle of lead code index number is one two zero and the problem is of medium type of lead code okay so basically this problem is one of the good problems of or you can see the one of the good problems of...
Triangle
triangle
Given a `triangle` array, return _the minimum path sum from top to bottom_. For each step, you may move to an adjacent number of the row below. More formally, if you are on index `i` on the current row, you may move to either index `i` or index `i + 1` on the next row. **Example 1:** **Input:** triangle = \[\[2\],\[...
null
Array,Dynamic Programming
Medium
null
86
hi guys welcome to tech geek so today we are back with the daily leadput challenge problem that's a partition list that's a lead code medium question lead code medium 86 so before beginning i'd like to request you to please like share and subscribe to my channel if in case there are any queries do let me know in the co...
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
814
in this video we will solve a binary tree problem and uh in this tree we have just one and zeros so all the values are either zero or one so this is not just a binary tree but even the numbers are binary and here we have to prune some of the trees so by prune we have to chop those branches or chop the entire subtree ro...
Binary Tree Pruning
smallest-rotation-with-highest-score
Given the `root` of a binary tree, return _the same tree where every subtree (of the given tree) not containing a_ `1` _has been removed_. A subtree of a node `node` is `node` plus every node that is a descendant of `node`. **Example 1:** **Input:** root = \[1,null,0,0,1\] **Output:** \[1,null,0,null,1\] **Explanati...
null
Array,Prefix Sum
Hard
null
474
hello everyone welcome to another episode of coding decoded my name is sansa today i am working as technical architect sd4 at adobe and here i present day 23rd of may lead code challenge the question that we have in today's banks and zeros this question is based out of the concept of dynamic programming for all those w...
Ones and Zeroes
ones-and-zeroes
You are given an array of binary strings `strs` and two integers `m` and `n`. Return _the size of the largest subset of `strs` such that there are **at most**_ `m` `0`_'s and_ `n` `1`_'s in the subset_. A set `x` is a **subset** of a set `y` if all elements of `x` are also elements of `y`. **Example 1:** **Input:**...
null
Array,String,Dynamic Programming
Medium
510,600,2261
252
you guys this is just has everything going this in this video it's again about an easy problem 2 5 2 meeting rooms or it could be an array of bending times intervals consisting of start and end times uh-huh you tell me if a person could uh-huh you tell me if a person could uh-huh you tell me if a person could attend al...
Meeting Rooms
meeting-rooms
Given an array of meeting time `intervals` where `intervals[i] = [starti, endi]`, determine if a person could attend all meetings. **Example 1:** **Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\] **Output:** false **Example 2:** **Input:** intervals = \[\[7,10\],\[2,4\]\] **Output:** true **Constraints:** * ...
null
Array,Sorting
Easy
56,253
1,065
they hello there so this week I'll be practicing the question of topic of try so to start since easy I got this question times 65 index pairs of a string so we have a text string which can potentially I guess be a very large text of corpus and we have a list of words that we want to search for the occurrence inside thi...
Index Pairs of a String
binary-string-with-substrings-representing-1-to-n
Given a string `text` and an array of strings `words`, return _an array of all index pairs_ `[i, j]` _so that the substring_ `text[i...j]` _is in `words`_. Return the pairs `[i, j]` in sorted order (i.e., sort them by their first coordinate, and in case of ties sort them by their second coordinate). **Example 1:** *...
We only need to check substrings of length at most 30, because 10^9 has 30 bits.
String
Medium
null
64
so you want to know how to do minimum path sum well you came to the right place so let's get to it so it says given an m by n grid filled with non-negative numbers find a path from non-negative numbers find a path from non-negative numbers find a path from top left to bottom right which minimizes the sum of all numbers...
Minimum Path Sum
minimum-path-sum
Given a `m x n` `grid` filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path. **Note:** You can only move either down or right at any point in time. **Example 1:** **Input:** grid = \[\[1,3,1\],\[1,5,1\],\[4,2,1\]\] **Output:** 7 **Explanat...
null
Array,Dynamic Programming,Matrix
Medium
62,174,741,2067,2192
1,742
let's solve lead code 1742 maximum number of balls in a box so the question can be a little confusing but what they exactly saying I'll explain here so they are saying that you'll be given a low limit and a high limit okay and you need to take the sum of go from low to high okay and take the sum of all its digits okay ...
Maximum Number of Balls in a Box
widest-vertical-area-between-two-points-containing-no-points
You are working in a ball factory where you have `n` balls numbered from `lowLimit` up to `highLimit` **inclusive** (i.e., `n == highLimit - lowLimit + 1`), and an infinite number of boxes numbered from `1` to `infinity`. Your job at this factory is to put each ball in the box with a number equal to the sum of digits ...
Try sorting the points Think is the y-axis of a point relevant
Array,Sorting
Medium
null
1,905
alright guys welcome back to study planner theory day three problem two okay in this problem we have two great grade one and great so and we want to return the number of islands in greece that are considered as some islands okay for this island this red one is somewhat of this island because we can add one here and the...
Count Sub Islands
design-authentication-manager
You are given two `m x n` binary matrices `grid1` and `grid2` containing only `0`'s (representing water) and `1`'s (representing land). An **island** is a group of `1`'s connected **4-directionally** (horizontal or vertical). Any cells outside of the grid are considered water cells. An island in `grid2` is considered ...
Using a map, track the expiry times of the tokens. When generating a new token, add it to the map with its expiry time. When renewing a token, check if it's on the map and has not expired yet. If so, update its expiry time. To count unexpired tokens, iterate on the map and check for each token if it's not expired yet.
Hash Table,Design
Medium
null
1,642
Hua On On On discussing those symptoms, subscribe to this video channel, first and second part of A Hua has been done, anti second, we have become the account of villagers, that in the past, this is life, 427 60 to 0.5 inch lashes, 0.5 inch lashes, 0.5 inch lashes, now we are the first here. But to reduce jumping, keep...
Furthest Building You Can Reach
water-bottles
You are given an integer array `heights` representing the heights of buildings, some `bricks`, and some `ladders`. You start your journey from building `0` and move to the next building by possibly using bricks or ladders. While moving from building `i` to building `i+1` (**0-indexed**), * If the current building'...
Simulate the process until there are not enough empty bottles for even one full bottle of water.
Math,Simulation
Easy
null
6
hello friends today let's solve zigzag conversion problem we are given a string s and the integer number rows we want to convert this string to our zigzag like string and it has the num has the number rows of rows so let's see this example what is the zigzag it just we want to write a z so it's z here so how to get thi...
Zigzag Conversion
zigzag-conversion
The string `"PAYPALISHIRING "` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: `"PAHNAPLSIIGYIR "` Write the code that will take a string and make this co...
null
String
Medium
null
509
in this uh part we're going to do fibonacci number question 509 of leaked code so for fibonacci numbers uh the first two is are given here and we need to calculate the rest so each one would be dependent on the previous two um the usual normal way is recursive but i'm not doing recursive because that's going to be too ...
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
100
hey there everyone welcome back to lead coding today we are going to solve the question same trees so i was getting so many requests to start with the topic trees but before we proceed with this topic there's another important topic that you should know you should be comfortable with the topic recursion for those who d...
Same Tree
same-tree
Given the roots of two binary trees `p` and `q`, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical, and the nodes have the same value. **Example 1:** **Input:** p = \[1,2,3\], q = \[1,2,3\] **Output:** true **Example 2:** **Input:** p...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
null
4
hello guys welcome to the lead course series today's problem is medium up to sorted array we can find a million of two sorted up from array here is the sum problem given and uh also given an output and put here is the conditions we can execute in this program okay let's start first create a variable end with two number...
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
381
Do it According to Sonu Nigam's YouTube channel, in today's video, how to make your own just classification of the person who requests a friend of an insult, then in this also there are 3 options, if you want to support and you will get the tid confession of West Remo Gas Cylinder. Art it and remove it, you will get eq...
Insert Delete GetRandom O(1) - Duplicates allowed
insert-delete-getrandom-o1-duplicates-allowed
`RandomizedCollection` is a data structure that contains a collection of numbers, possibly duplicates (i.e., a multiset). It should support inserting and removing specific elements and also reporting a random element. Implement the `RandomizedCollection` class: * `RandomizedCollection()` Initializes the empty `Rand...
null
Array,Hash Table,Math,Design,Randomized
Hard
380
896
hey everyone welcome back and let's write some more neat code today so today let's solve the problem monotonic array we're given an array that is either monotone increasing or monotone decreasing and that means that either the values are strictly in greater than or equal order meaning the values are pretty much sorted ...
Monotonic Array
smallest-subtree-with-all-the-deepest-nodes
An array is **monotonic** if it is either monotone increasing or monotone decreasing. An array `nums` is monotone increasing if for all `i <= j`, `nums[i] <= nums[j]`. An array `nums` is monotone decreasing if for all `i <= j`, `nums[i] >= nums[j]`. Given an integer array `nums`, return `true` _if the given array is ...
null
Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
1,619
today we are solving questions 619 mean of array after removing some elements within lead code so let's go ahead and learn and code together in this question we are given an integer array called array and we are tasked with removing the smallest 5% and the largest 5% of the smallest 5% and the largest 5% of the smalles...
Mean of Array After Removing Some Elements
path-crossing
Given an integer array `arr`, return _the mean of the remaining integers after removing the smallest `5%` and the largest `5%` of the elements._ Answers within `10-5` of the **actual answer** will be considered accepted. **Example 1:** **Input:** arr = \[1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3\] **Output:** 2.00000 ...
Simulate the process while keeping track of visited points. Use a set to store previously visited points.
Hash Table,String
Easy
null
1,015
Hello hello everyone Topiwala doing well today im back with andheri challenge acid number-10 smallest and you will like it is number-10 smallest and you will like it is number-10 smallest and you will like it is question i don't personally don't see the question subscribe this video plz subscribe Channel and 996709 Her...
Smallest Integer Divisible by K
smallest-integer-divisible-by-k
Given a positive integer `k`, you need to find the **length** of the **smallest** positive integer `n` such that `n` is divisible by `k`, and `n` only contains the digit `1`. Return _the **length** of_ `n`. If there is no such `n`, return -1. **Note:** `n` may not fit in a 64-bit signed integer. **Example 1:** **In...
null
null
Medium
null
709
Good picture video only middling will someone to the problem me this school tour festival to return district after placing a letter with the same letter no this you daily missions to do the question Tuesday language support conversation for the person with what is the function subscribe and subscribe the Channel and su...
To Lower Case
to-lower-case
Given a string `s`, return _the string after replacing every uppercase letter with the same lowercase letter_. **Example 1:** **Input:** s = "Hello " **Output:** "hello " **Example 2:** **Input:** s = "here " **Output:** "here " **Example 3:** **Input:** s = "LOVELY " **Output:** "lovely " **Constraints:**...
null
null
Easy
null
909
Hello friends today I'm going to solve liquid problem number 909 Snakes and Ladder so in this problem we are given n by an integer Matrix board and the cells are labeled from one to any squared starting from the bottom left of the board and alternating on each row alternating directions so it starts from the bottom lef...
Snakes and Ladders
stone-game
You are given an `n x n` integer matrix `board` where the cells are labeled from `1` to `n2` in a [**Boustrophedon style**](https://en.wikipedia.org/wiki/Boustrophedon) starting from the bottom left of the board (i.e. `board[n - 1][0]`) and alternating direction each row. You start on square `1` of the board. In each ...
null
Array,Math,Dynamic Programming,Game Theory
Medium
1685,1788,1808,2002,2156
203
hey what's up guys the quite here I do tech encoding stuff on twitch and YouTube I do the premium Lea code problems on my patreon if you wanna check that out and if you want to reach out to me discord it's a good place to do that I try to get back to everyone this problem is called the remove linked list elements a lot...
Remove Linked List Elements
remove-linked-list-elements
Given the `head` of a linked list and an integer `val`, remove all the nodes of the linked list that has `Node.val == val`, and return _the new head_. **Example 1:** **Input:** head = \[1,2,6,3,4,5,6\], val = 6 **Output:** \[1,2,3,4,5\] **Example 2:** **Input:** head = \[\], val = 1 **Output:** \[\] **Example 3:**...
null
Linked List,Recursion
Easy
27,237,2216
58
in this video we'll go over lead code question number 58 length of last word given a string s consisting of words and spaces we need to return the length of the last word in the string for example if the string was Hello World then the last word is World which has a length of five characters so we would return five how...
Length of Last Word
length-of-last-word
Given a string `s` consisting of words and spaces, return _the length of the **last** word in the string._ A **word** is a maximal substring consisting of non-space characters only. **Example 1:** **Input:** s = "Hello World " **Output:** 5 **Explanation:** The last word is "World " with length 5. **Example 2:** ...
null
String
Easy
null
848
hello everyone welcome to day 8 of september eco challenge and today's question is shifting letters here we are given a string of english lowercase characters and we need to shift those characters by certain amount and the amount is given by another array so this address states that the first character needs to be shif...
Shifting Letters
shifting-letters
You are given a string `s` of lowercase English letters and an integer array `shifts` of the same length. Call the `shift()` of a letter, the next letter in the alphabet, (wrapping around so that `'z'` becomes `'a'`). * For example, `shift('a') = 'b'`, `shift('t') = 'u'`, and `shift('z') = 'a'`. Now for each `shif...
null
null
Medium
null
649
hey everybody this is Larry this is day four of the melee go daily challenge May the fourth be with you I suppose Mr button oh man hit the like button the Subscribe button join me on Discord let me know what you think about this bomb doted to send it I think this was actually one of the earliest prom I ever sold on the...
Dota2 Senate
dota2-senate
In the world of Dota2, there are two parties: the Radiant and the Dire. The Dota2 senate consists of senators coming from two parties. Now the Senate wants to decide on a change in the Dota2 game. The voting for this change is a round-based procedure. In each round, each senator can exercise **one** of the two rights:...
null
String,Greedy,Queue
Medium
495
771
hi there so we're just going to quickly talk about today's legoland challenge question it's called jewels and stones we have two input strings j and s j represents these songs that are joules s represents the stones so basically we want to count how many of the stones are joules so for each character in the string we w...
Jewels and Stones
encode-n-ary-tree-to-binary-tree
You're given strings `jewels` representing the types of stones that are jewels, and `stones` representing the stones you have. Each character in `stones` is a type of stone you have. You want to know how many of the stones you have are also jewels. Letters are case sensitive, so `"a "` is considered a different type o...
null
Tree,Depth-First Search,Breadth-First Search,Design,Binary Tree
Hard
765
443
hey everybody this is Larry this is day two of the Marshall Eco daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's Farm uh yeah string compression 443 uh I got home kind of late today so but don't know because I think I've figured out my tiredness I ...
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
145
hi everyone it's Orin today we have a problem when we are given root of a binary tree and we need to return the postorder traversal values of all nodes so let's say that we have this binary tree two one and three right and we need to return the postorder traversal values so what's the postorder traversal in the postord...
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
808
hello everyone welcome back here is when I'm saying in today's video we are going to delve into a really intriguing problem called soup serving so this problem uh is an excellent opportunity to explore a dynamic uh programming top-down approach also known as top-down approach also known as top-down approach also known ...
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
33
okay let's solve leak code 33 search and rotated sorted array so we're basically given an array that was originally sorted like this one but it then it became rotated like this one and by rotated they mean that they took a certain pivot or index of the array like right over here and then they cut it in half and then sw...
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
437
welcome to august seleco challenge today's problem is path sum three we have a binary tree which contains integer values find the number of paths that sum to a given value now a path uh does not need to start from the root but it needs to go downwards we can consider a 5 to 3 here path 5 2 1 a path negative 3 to 11 a p...
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
1,710
Hello Guys Welcome To Another Interesting Problem The Series Cup Coding Old Man Problem Vishal Maximum Unit Certificate To Understand This Problem With The Help Of Example Atishesh Truck End Subscribe Number of Units of Water Units Box Inside a Cylindrical Shells Units and the Answer is What is the energy waste from ab...
Maximum Units on a Truck
find-servers-that-handled-most-number-of-requests
You are assigned to put some amount of boxes onto **one truck**. You are given a 2D array `boxTypes`, where `boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]`: * `numberOfBoxesi` is the number of boxes of type `i`. * `numberOfUnitsPerBoxi` is the number of units in each box of the type `i`. You are also given...
To speed up the next available server search, keep track of the available servers in a sorted structure such as an ordered set. To determine if a server is available, keep track of the end times for each task in a heap and add the server to the available set once the soonest task ending time is less than or equal to th...
Array,Greedy,Heap (Priority Queue),Ordered Set
Hard
null
1,893
hello everyone so in this video let us talk about a problem from read code the problem name is check if all the integers in a Range are covered so the problem goes like this that you are given a 2d integer array as you can see range okay and also two integers left and right now each range of i as you can see each range...
Check if All the Integers in a Range Are Covered
maximum-subarray-sum-after-one-operation
You are given a 2D integer array `ranges` and two integers `left` and `right`. Each `ranges[i] = [starti, endi]` represents an **inclusive** interval between `starti` and `endi`. Return `true` _if each integer in the inclusive range_ `[left, right]` _is covered by **at least one** interval in_ `ranges`. Return `false`...
Think about dynamic programming Define an array dp[nums.length][2], where dp[i][0] is the max subarray sum including nums[i] and without squaring any element. dp[i][1] is the max subarray sum including nums[i] and having only one element squared.
Array,Dynamic Programming
Medium
53
1,017
uh this question is converted to base negative two so you are giving the integer answer return the binary string representing is representation uh and it's based negative two so um again I if the base is actually two then we will definitely know um the zero degree is definitely one uh the one degree is what two and the...
Convert to Base -2
odd-even-jump
Given an integer `n`, return _a binary string representing its representation in base_ `-2`. **Note** that the returned string should not have leading zeros unless the string is `"0 "`. **Example 1:** **Input:** n = 2 **Output:** "110 " **Explantion:** (-2)2 + (-2)1 = 2 **Example 2:** **Input:** n = 3 **Output:**...
null
Array,Dynamic Programming,Stack,Monotonic Stack,Ordered Set
Hard
null
82
hey what's up guys this is john so today lead code number 82 remove duplicate from sorted list number two so you're given like a sorted linked list and you need to delete all the nodes that have duplicate numbers and leaving only the distinct numbers from the original list return the linked list sorted as well so for e...
Remove Duplicates from Sorted List II
remove-duplicates-from-sorted-list-ii
Given the `head` of a sorted linked list, _delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list_. Return _the linked list **sorted** as well_. **Example 1:** **Input:** head = \[1,2,3,3,4,4,5\] **Output:** \[1,2,5\] **Example 2:** **Input:** head = \[1,1,1,2,3\] **Outpu...
null
Linked List,Two Pointers
Medium
83,1982
326
foreign with the lonely Dash and today we're going over leap code question number 326 power of three which states given an integer n returned true if it is a power of 3 otherwise return false an integer N is a power of three if there exists an integer X such that n equals 3 to the X so what does this mean well it just ...
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
92
Everyone Welcome Statement Reverse Link List You have not given us anything in this question but please have given us a hand note and have given us an index, meaning initially the head will be index 1 and a left index has been given and one on the right position. If the value is given then the left position is mine and...
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
450
hey there and welcome to another leak code problem it's going to be problem number 450 delete note in a BST so we're given a root node reference and a BST and a key and we need to delete that node and return the root reference possibly updated of the BST so for those of you that don't know a BST is a binary search tree...
Delete Node in a BST
delete-node-in-a-bst
Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return _the **root node reference** (possibly updated) of the BST_. Basically, the deletion can be divided into two stages: 1. Search for a node to remove. 2. If the node is found, delete the node. **Example 1:** **Inpu...
null
Tree,Binary Search Tree,Binary Tree
Medium
791
1,930
hello hi guys good morning welcome back to the new video uh I hope that you guys are doing good problem unique length three of three unique and three paric subsequence uh so like initially when I read the problem I thought it's a DP problem but it was not let's see that how we approach it and how we actually see the hi...
Unique Length-3 Palindromic Subsequences
maximum-number-of-consecutive-values-you-can-make
Given a string `s`, return _the number of **unique palindromes of length three** that are a **subsequence** of_ `s`. Note that even if there are multiple ways to obtain the same subsequence, it is still only counted **once**. A **palindrome** is a string that reads the same forwards and backwards. A **subsequence** ...
If you can make the first x values and you have a value v, then you can make all the values ≤ v + x Sort the array of coins. You can always make the value 0 so you can start with x = 0. Process the values starting from the smallest and stop when there is a value that cannot be achieved with the current x.
Array,Greedy
Medium
330
355
hi guys so let's talk about design twitter so you have to design a simplified version of twitter where user can post tweet follow unfollow another users and is able to see the 10 most recent tweets in the username feed so there are some functions you need to write inside the twitter class so there's a constructor and p...
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
611
hello everyone welcome to quartus camp we are at 15th day of july lead code challenge and the problem we are going to cover in this video is valid triangle number so the input given here is an integer array nums and we have to return the valid triplets of triangles we can form from this set so let's understand this wit...
Valid Triangle Number
valid-triangle-number
Given an integer array `nums`, return _the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle_. **Example 1:** **Input:** nums = \[2,2,3,4\] **Output:** 3 **Explanation:** Valid combinations are: 2,3,4 (using the first 2) 2,3,4 (using the second 2) 2,2,3 *...
null
Array,Two Pointers,Binary Search,Greedy,Sorting
Medium
259
1,465
hello everyone welcome to quartus camp we are at third day of june lead code challenge and the problem we are going to cover in this video is maximum area of a piece of cake after horizontal and vertical cuts so the input given here is the height and width of a piece of cake and the horizontal cuts and vertical cuts in...
Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts
maximum-product-of-splitted-binary-tree
You are given a rectangular cake of size `h x w` and two arrays of integers `horizontalCuts` and `verticalCuts` where: * `horizontalCuts[i]` is the distance from the top of the rectangular cake to the `ith` horizontal cut and similarly, and * `verticalCuts[j]` is the distance from the left of the rectangular cake ...
If we know the sum of a subtree, the answer is max( (total_sum - subtree_sum) * subtree_sum) in each node.
Tree,Depth-First Search,Binary Tree
Medium
2175
1,837
e Hello everyone love nation control and we are together again today's last name is art digit indiska A number of en is given to you. Friends, here is the number of en in base ten. By the way, the number K is given as a parameter and it asks you for the sum of the digits of this number in blood base and its representat...
Sum of Digits in Base K
daily-leads-and-partners
Given an integer `n` (in base `10`) and a base `k`, return _the **sum** of the digits of_ `n` _**after** converting_ `n` _from base_ `10` _to base_ `k`. After converting, each digit should be interpreted as a base `10` number, and the sum should be returned in base `10`. **Example 1:** **Input:** n = 34, k = 6 **Out...
null
Database
Easy
null
302
all right so let's talk about the smallest rectangle enclosing black Crystal so you are giving the metric 2D imagery zero represent a white pixel one represent that pixel so you want to find out the area of the smallest rectangle and here is the idea so you in the example one you return what the area of six because thi...
Smallest Rectangle Enclosing Black Pixels
smallest-rectangle-enclosing-black-pixels
You are given an `m x n` binary matrix `image` where `0` represents a white pixel and `1` represents a black pixel. The black pixels are connected (i.e., there is only one black region). Pixels are connected horizontally and vertically. Given two integers `x` and `y` that represents the location of one of the black p...
null
Array,Binary Search,Depth-First Search,Breadth-First Search,Matrix
Hard
null
16
um hello so today we are going to do this problem three sum closest which is part of political daily challenge so the problem says uh we get an array of numbers of Link n and we get a Target and we want to find the three integers um such that their sum is the closest as possible to Target and what we want to return is ...
3Sum Closest
3sum-closest
Given an integer array `nums` of length `n` and an integer `target`, find three integers in `nums` such that the sum is closest to `target`. Return _the sum of the three integers_. You may assume that each input would have exactly one solution. **Example 1:** **Input:** nums = \[-1,2,1,-4\], target = 1 **Output:** ...
null
Array,Two Pointers,Sorting
Medium
15,259
837
hi everyone in today Channel we have this problem new 21 game and the problem number is 837 all right guys so first of all what we are gonna do we are going to clearly understand what this is going to say after that we're going to move to the logic part we're gonna see how we can solve this problem what is the logic an...
New 21 Game
most-common-word
Alice plays the following game, loosely based on the card game **"21 "**. Alice starts with `0` points and draws numbers while she has less than `k` points. During each draw, she gains an integer number of points randomly from the range `[1, maxPts]`, where `maxPts` is an integer. Each draw is independent and the outc...
null
Hash Table,String,Counting
Easy
null
27
hyponyms so we got a problem in liquid that is remove an element okay so our problem statement is that there will be a list three two to three and we have to take off one of the words that is the target word that is three all the occurrence of these three from this list in the best efficient way so there are certain wa...
Remove Element
remove-element
Given an integer array `nums` and an integer `val`, remove all occurrences of `val` in `nums` [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm). The order of the elements may be changed. Then return _the number of elements in_ `nums` _which are not equal to_ `val`. Consider the number of elements in `nu...
The problem statement clearly asks us to modify the array in-place and it also says that the element beyond the new length of the array can be anything. Given an element, we need to remove all the occurrences of it from the array. We don't technically need to remove that element per-say, right? We can move all the occu...
Array,Two Pointers
Easy
26,203,283
1,254
hello guys welcome to deep codes and in today's video we will discuss little question 1254 that says number of close Islands so guys this question is somewhat similar to the question number of islands so if you have uh some understanding of this question then I uh insist you to solve this equation by yourself uh and if...
Number of Closed Islands
deepest-leaves-sum
Given a 2D `grid` consists of `0s` (land) and `1s` (water). An _island_ is a maximal 4-directionally connected group of `0s` and a _closed island_ is an island **totally** (all left, top, right, bottom) surrounded by `1s.` Return the number of _closed islands_. **Example 1:** **Input:** grid = \[\[1,1,1,1,1,1,1,0\],...
Traverse the tree to find the max depth. Traverse the tree again to compute the sum required.
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
283
welcome back to algojs today's question is leak code 283 move zeros so given an integer array nums move all zeros to the end of it while maintaining the relative order of non-zero elements order of non-zero elements order of non-zero elements note that you must do this in place without making a copy of this array so we...
Move Zeroes
move-zeroes
Given an integer array `nums`, move all `0`'s to the end of it while maintaining the relative order of the non-zero elements. **Note** that you must do this in-place without making a copy of the array. **Example 1:** **Input:** nums = \[0,1,0,3,12\] **Output:** \[1,3,12,0,0\] **Example 2:** **Input:** nums = \[0\]...
In-place means we should not be allocating any space for extra array. But we are allowed to modify the existing array. However, as a first step, try coming up with a solution that makes use of additional space. For this problem as well, first apply the idea discussed using an additional array and the in-place solution ...
Array,Two Pointers
Easy
27
455
hello everyone so in this video let us talk about an easy problem from lead code the problem name is assigned cookie so let's start the problem statement goes like this that assume you are an awesome parent and you want to give your children some cookies but you should give each children at most one cookie only now you...
Assign Cookies
assign-cookies
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child `i` has a greed factor `g[i]`, which is the minimum size of a cookie that the child will be content with; and each cookie `j` has a size `s[j]`. If `s[j] >= g[i]`, we can assign ...
null
Array,Greedy,Sorting
Easy
null
1,171
hey everyone today we are going to solve the daily EOD challenge of 12th March 2024 and the problem statement is remove Zer some consecutive notes from Ling list so let us first understand the problem statement so according to the problem statement we have been given a ling list and what we have to do is we have to del...
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,819
hello everyone let's take a look at this legal problem this is a last problem in the weekly context and it's um pretty hard okay let's take a look okay the problem is uh we are given a renounce that consists of positive integers and the juicing of subsequence of number is identified and defined as the greatest integer ...
Number of Different Subsequences GCDs
construct-the-lexicographically-largest-valid-sequence
You are given an array `nums` that consists of positive integers. The **GCD** of a sequence of numbers is defined as the greatest integer that divides **all** the numbers in the sequence evenly. * For example, the GCD of the sequence `[4,6,16]` is `2`. A **subsequence** of an array is a sequence that can be formed...
Heuristic algorithm may work.
Array,Backtracking
Medium
null
452
hi everyone so today I've installed bleed code problem number or daily challenge problem number 452 minimum number of arrows to post balloons so in this problem basically we have been given the x coordinate of uh balloon which is taped to a ball and we have to find out the minimum number of arrows which we need to burs...
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
312
Hello Hi Everyone Welcome To My Channel It's All The Problem And Civil Servants And Values ​​In 1000 In This Value 19 Values ​​In 1000 In This Value 19 Values ​​In 1000 In This Value 19 Printed Vidhi Number On Represented Exams Your Host Year All The Value In This New Wave United States Of You Will Get Na Pintu Were Le...
Burst Balloons
burst-balloons
You are given `n` balloons, indexed from `0` to `n - 1`. Each balloon is painted with a number on it represented by an array `nums`. You are asked to burst all the balloons. If you burst the `ith` balloon, you will get `nums[i - 1] * nums[i] * nums[i + 1]` coins. If `i - 1` or `i + 1` goes out of bounds of the array, ...
null
Array,Dynamic Programming
Hard
1042
643
I'll discussions maximum average Subaru one so you are given the integer array nums and an integer K right and you have to find out a continuously sub array Whose Line is actually equal to K so that has a maximum average value and return its value and this question is supposed to be straightforward enough so uh you wan...
Maximum Average Subarray I
maximum-average-subarray-i
You are given an integer array `nums` consisting of `n` elements, and an integer `k`. Find a contiguous subarray whose **length is equal to** `k` that has the maximum average value and return _this value_. Any answer with a calculation error less than `10-5` will be accepted. **Example 1:** **Input:** nums = \[1,12,...
null
Array,Sliding Window
Easy
644,2211
161
hey folks welcome back to another video today we're looking at question 161 uh one edit distance the way we'll be approaching this problem is by looking at the characters in each of the strings as soon as there's one character that's different we try to look at the substrings that follows um after the character that di...
One Edit Distance
one-edit-distance
Given two strings `s` and `t`, return `true` if they are both one edit distance apart, otherwise return `false`. A string `s` is said to be one distance apart from a string `t` if you can: * Insert **exactly one** character into `s` to get `t`. * Delete **exactly one** character from `s` to get `t`. * Replace *...
null
Two Pointers,String
Medium
72
32
Everyone, my name is Shashwat Tiwari and I am talking about Longest Pilot Paranthesis in today's video, so if you have not seen the old video of Stock then go and check it out. We are dealing with a very similar problem and this will be the last problem of the series of Stock, after this we will You will move to the qu...
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
120
hello friends to the rest of the triangle problem you a triangle find the minimum part some from top to bottom you step you may move to Agency numbers on the row below for example given the following triangle the minimum has some front of to bottom is two three five one so as we needed to find the minimum has some we m...
Triangle
triangle
Given a `triangle` array, return _the minimum path sum from top to bottom_. For each step, you may move to an adjacent number of the row below. More formally, if you are on index `i` on the current row, you may move to either index `i` or index `i + 1` on the next row. **Example 1:** **Input:** triangle = \[\[2\],\[...
null
Array,Dynamic Programming
Medium
null
336
hello everyone so today we will be solving talent from pairs and it is day 13 of june read code challenge and the question goes like this given a list of unique words return all the pairs of distant indices i and j in the given list so that the concatenation of the two words i and words j is a palindrome so question is...
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
84
Hello Hi Guys Welcome To Our Hazy Sea Today India Largest Is That Police Particular Example The Largest Area And This Tennyson Explosions At This Time Plot In The Same Example In This Particular Diagram With Sacrifice Will You Help Me To The Dad-Khaj Height Baje List To Suite Fiction Dad-Khaj Height Baje List To Suite ...
Largest Rectangle in Histogram
largest-rectangle-in-histogram
Given an array of integers `heights` representing the histogram's bar height where the width of each bar is `1`, return _the area of the largest rectangle in the histogram_. **Example 1:** **Input:** heights = \[2,1,5,6,2,3\] **Output:** 10 **Explanation:** The above is a histogram where width of each bar is 1. The l...
null
Array,Stack,Monotonic Stack
Hard
85,1918
1,598
hey everybody this is larry this is me going over weekly contest 208 of the leeco contest um it turns out 208 is my lucky number so we'll see how it goes um so for this problem we're gonna go over quarter log file a folder um so this one i actually don't know if you need the child photo x if you wanted to go faster and...
Crawler Log Folder
crawler-log-folder
The Leetcode file system keeps a log each time some user performs a _change folder_ operation. The operations are described below: * `"../ "` : Move to the parent folder of the current folder. (If you are already in the main folder, **remain in the same folder**). * `"./ "` : Remain in the same folder. * `"x/ "...
null
null
Easy
null
1,609
hi in today's video I'm going to solve this question of e or Tre um the question is we are given a binary tree is named even not uh a tree is binary tree when it meets the following conditions the root of binary tree is at level index zero okay so the root of or B is at zero index okay its children are at level index o...
Even Odd Tree
find-all-the-lonely-nodes
A binary tree is named **Even-Odd** if it meets the following conditions: * The root of the binary tree is at level index `0`, its children are at level index `1`, their children are at level index `2`, etc. * For every **even-indexed** level, all nodes at the level have **odd** integer values in **strictly increa...
Do a simple tree traversal, try to check if the current node is lonely or not. Node is lonely if at least one of the left/right pointers is null.
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
563,1005
989
If you have understood, then you want to try it yourself, see what is there, normally you do not have to do anything, this is the last value, just add this value completely inside it, okay, we will get it completely added. What will happen, I told him to see that the value of the last key is 34. Now there you will keep...
Add to Array-Form of Integer
largest-component-size-by-common-factor
The **array-form** of an integer `num` is an array representing its digits in left to right order. * For example, for `num = 1321`, the array form is `[1,3,2,1]`. Given `num`, the **array-form** of an integer, and an integer `k`, return _the **array-form** of the integer_ `num + k`. **Example 1:** **Input:** num ...
null
Array,Math,Union Find
Hard
2276
1,637
hello and welcome to another video in this video we're going to be doing widest vertical area between two points containing no points and this problem you're given points that are X and Y points and you want to return the widest vertical area between two points such that no two points are inside the area vertical area ...
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
9
all right we're recording let's welcome guys Nick white here so I do twitch in YouTube coding and tech stuff so if you want to check that out look in the description and you'll see it well I'm doing a leak code serious so I'm going through all of the problems on leak code and explaining them all this is the third one I...
Palindrome Number
palindrome-number
Given an integer `x`, return `true` _if_ `x` _is a_ _**palindrome**__, and_ `false` _otherwise_. **Example 1:** **Input:** x = 121 **Output:** true **Explanation:** 121 reads as 121 from left to right and from right to left. **Example 2:** **Input:** x = -121 **Output:** false **Explanation:** From left to right, i...
Beware of overflow when you reverse the integer.
Math
Easy
234,1375
272
guys welcome to my channel virginia coder if you guys are new here i pretty much do the cube style questions and explain things in the summers what pops but today we have an amazing problem today so let's quickly go ahead and read the problem statement guys so the name of the problem is called closest binary tree value...
Closest Binary Search Tree Value II
closest-binary-search-tree-value-ii
Given the `root` of a binary search tree, a `target` value, and an integer `k`, return _the_ `k` _values in the BST that are closest to the_ `target`. You may return the answer in **any order**. You are **guaranteed** to have only one unique set of `k` values in the BST that are closest to the `target`. **Example 1:*...
Consider implement these two helper functions: getPredecessor(N), which returns the next smaller node to N. getSuccessor(N), which returns the next larger node to N. Try to assume that each node has a parent pointer, it makes the problem much easier. Without parent pointer we just need to keep track of the path from ...
Two Pointers,Stack,Tree,Depth-First Search,Binary Search Tree,Heap (Priority Queue),Binary Tree
Hard
94,270
113
Hi gas welcome and welcome back to my channel so today our problem is Parth Sam you so what have you given us in this problem statement here you have given us a bounded tree okay and what we have to do is we have to find from the root. Where are the parts from the beginning till the leave notes, what is your target, th...
Path Sum II
path-sum-ii
Given the `root` of a binary tree and an integer `targetSum`, return _all **root-to-leaf** paths where the sum of the node values in the path equals_ `targetSum`_. Each path should be returned as a list of the node **values**, not node references_. A **root-to-leaf** path is a path starting from the root and ending at...
null
Backtracking,Tree,Depth-First Search,Binary Tree
Medium
112,257,437,666,2217
205
See, in this video we are going to do a question on isomorphic strings. The question is saying that you will be given two things. You have to determine whether it is isomorphic or not. Now what is the meaning of isomorphic? It is saying that is the occurrence of a character. Replaced with Andar character will be presen...
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