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
282
so hello everyone this is Akshay here and welcome back to the another great day of our Beauty streak of day 2012. so today's question is a hard question so let us see what the question says and how we can solve it question name is expression add operators and given a string guess that only contains the digits from 0 to...
Expression Add Operators
expression-add-operators
Given a string `num` that contains only digits and an integer `target`, return _**all possibilities** to insert the binary operators_ `'+'`_,_ `'-'`_, and/or_ `'*'` _between the digits of_ `num` _so that the resultant expression evaluates to the_ `target` _value_. Note that operands in the returned expressions **shoul...
Note that a number can contain multiple digits. Since the question asks us to find all of the valid expressions, we need a way to iterate over all of them. (Hint: Recursion!) We can keep track of the expression string and evaluate it at the very end. But that would take a lot of time. Can we keep track of the expressio...
Math,String,Backtracking
Hard
150,224,227,241,494
84
Hello Viewers Welcome Back Door Sign In This Video You Will See The Largest Rectangle In Histogram Problem Swiss Roll Number 400 Latest The Problem Statement In This Problem Negative Entries Representing Subscribe Latest Example No Problem Thursday Triangle Thursday Subscribe The Channel subscribe 15623 for Back Repres...
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,046
and today we have this problem it's called The Lost system weight you are given an array of integral Stones where the stones of eye is the weight of eye stone we are playing the game a game with the stones on each turn we choose the heaviest two stones and smash them together suppose the heaviest two stones have weight...
Last Stone Weight
max-consecutive-ones-iii
You are given an array of integers `stones` where `stones[i]` is the weight of the `ith` stone. We are playing a game with the stones. On each turn, we choose the **heaviest two stones** and smash them together. Suppose the heaviest two stones have weights `x` and `y` with `x <= y`. The result of this smash is: * I...
One thing's for sure, we will only flip a zero if it extends an existing window of 1s. Otherwise, there's no point in doing it, right? Think Sliding Window! Since we know this problem can be solved using the sliding window construct, we might as well focus in that direction for hints. Basically, in a given window, we c...
Array,Binary Search,Sliding Window,Prefix Sum
Medium
340,424,485,487,2134
22
hello everyone welcome back to sudokudo those who all are new my name is raveena I am a software engineer and I solved algorithm uh problems I also have a data structure Series so be sure to check it out if you are new to coding or just want to learn how to apply those data structures in competitive programming or just...
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
133
welcome back to our js today's question is leak code 133 clone graph so given a reference of a node in a connected undirected graph return a deep copy of the graph each node in the graph contains a value and a list of its neighbors so with the test case format for simplicity each node's value is the same as the node's ...
Clone Graph
clone-graph
Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph. Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph. Each node in the graph contains a value (`int`) and a list (`List[Node]`)...
null
Hash Table,Depth-First Search,Breadth-First Search,Graph
Medium
138,1624,1634
174
hey everybody this is Larry this is day 21st of the June midco daily challenge let's get started hit the like button to subscribe one let me know what you think join a discord for a chat and dungeon game the demons had captured the princess p.m. put imprisoned her in the princess p.m. put imprisoned her in the princess...
Dungeon Game
dungeon-game
The demons had captured the princess and imprisoned her in **the bottom-right corner** of a `dungeon`. The `dungeon` consists of `m x n` rooms laid out in a 2D grid. Our valiant knight was initially positioned in **the top-left room** and must fight his way through `dungeon` to rescue the princess. The knight has an i...
null
Array,Dynamic Programming,Matrix
Hard
62,64,741,2354
244
how's it going guys down here in this video we're going to do number 244 shorts or distance number two so we're asked to design a data structure that'll be initialized with the string array and it shouldn't answer queries to the shortest distance between do two different strings from the array so we want to implement t...
Shortest Word Distance II
shortest-word-distance-ii
Design a data structure that will be initialized with a string array, and then it should answer queries of the shortest distance between two different strings from the array. Implement the `WordDistance` class: * `WordDistance(String[] wordsDict)` initializes the object with the strings array `wordsDict`. * `int ...
null
Array,Hash Table,Two Pointers,String,Design
Medium
21,243,245
429
hi friends welcome back today we are going to solve it code problem for 29 in early 3 level order traversal so given an n retrieve written level order traversal of it nodes values nr3 input serialization is represented in their level order traversal each group of children is separated by the null value see examples bel...
N-ary Tree Level Order Traversal
n-ary-tree-level-order-traversal
Given an n-ary tree, return the _level order_ traversal of its nodes' values. _Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples)._ **Example 1:** **Input:** root = \[1,null,3,2,4,null,5,6\] **Output:** \[\[1\],\[3,2,4\],\...
null
null
Medium
null
114
hey guys welcome to algorithms made easy my name is khushbu and today we are going to see the question flatten binary tree to a linked list given the root of a binary tree we need to flatten the tree into a linked list the linked list should use the same tree node class wherein the right child pointer will point to the...
Flatten Binary Tree to Linked List
flatten-binary-tree-to-linked-list
Given the `root` of a binary tree, flatten the tree into a "linked list ": * The "linked list " should use the same `TreeNode` class where the `right` child pointer points to the next node in the list and the `left` child pointer is always `null`. * The "linked list " should be in the same order as a [**pre-order*...
If you notice carefully in the flattened tree, each node's right child points to the next node of a pre-order traversal.
Linked List,Stack,Tree,Depth-First Search,Binary Tree
Medium
766,1796
76
now I will just try to solve the minimum window substring profit give us doing s and the string G find the minimum window yes which will contain all the characters in T internment camp in capacity pick an example include s equal to the he equal to the output note there is no such window in a circus uncapped in t that w...
Minimum Window Substring
minimum-window-substring
Given two strings `s` and `t` of lengths `m` and `n` respectively, return _the **minimum window**_ **_substring_** _of_ `s` _such that every character in_ `t` _(**including duplicates**) is included in the window_. If there is no such substring, return _the empty string_ `" "`. The testcases will be generated such tha...
Use two pointers to create a window of letters in S, which would have all the characters from T. Since you have to find the minimum window in S which has all the characters from T, you need to expand and contract the window using the two pointers and keep checking the window for all the characters. This approach is als...
Hash Table,String,Sliding Window
Hard
30,209,239,567,632,727
1,221
okay let's go ahead and all right welcome friends to this video we are going to solve a leak code problem in python today's problem is called a split a string in balance strings all right let's take a look and read through the problem and then go through some examples make sense out of what they're asking and then we c...
Split a String in Balanced Strings
element-appearing-more-than-25-in-sorted-array
**Balanced** strings are those that have an equal quantity of `'L'` and `'R'` characters. Given a **balanced** string `s`, split it into some number of substrings such that: * Each substring is balanced. Return _the **maximum** number of balanced strings you can obtain._ **Example 1:** **Input:** s = "RLRRLLRLR...
Divide the array in four parts [1 - 25%] [25 - 50 %] [50 - 75 %] [75% - 100%] The answer should be in one of the ends of the intervals. In order to check which is element is the answer we can count the frequency with binarySearch.
Array
Easy
null
1,022
uh hi everyone uh recently i come across this problem 1022 sum of root to leaf binary numbers so uh actually in this problem they have given us a binary tree that contains one and zeros only and we have to actually find the sum of all the paths in this binary tree so for example uh i'll just you know show you the paths...
Sum of Root To Leaf Binary Numbers
unique-paths-iii
You are given the `root` of a binary tree where each node has a value `0` or `1`. Each root-to-leaf path represents a binary number starting with the most significant bit. * For example, if the path is `0 -> 1 -> 1 -> 0 -> 1`, then this could represent `01101` in binary, which is `13`. For all leaves in the tree, c...
null
Array,Backtracking,Bit Manipulation,Matrix
Hard
37,63,212
77
So hello gas today is fast August and today we are going to solve lead which is number 77 question is combination so if you understand this question then it is said here that we have one two wait one N is one K and we have to return. If the possible combination of care number will work then it is from one to four so it...
Combinations
combinations
Given two integers `n` and `k`, return _all possible combinations of_ `k` _numbers chosen from the range_ `[1, n]`. You may return the answer in **any order**. **Example 1:** **Input:** n = 4, k = 2 **Output:** \[\[1,2\],\[1,3\],\[1,4\],\[2,3\],\[2,4\],\[3,4\]\] **Explanation:** There are 4 choose 2 = 6 total combin...
null
Backtracking
Medium
39,46
848
all right guys welcome to our channel food with sunny and in this video i will be talking about the medium type problem called shifting letters its index is 848 of the lead code okay so this problem is really very simple one and it involves simple operations on array or you can say the suffix sum or you can say the ope...
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
1,456
Hello everyone welcome to my channel is quite a classic problem printed note medium at which it is cute easy if you understand it then ok before that let me tell you the date of done on Instagram also this is my handle you can follow me also ok so question ka The name is Maximum Number of Vowels in a Substring of Lengt...
Maximum Number of Vowels in a Substring of Given Length
find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance
Given a string `s` and an integer `k`, return _the maximum number of vowel letters in any substring of_ `s` _with length_ `k`. **Vowel letters** in English are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`. **Example 1:** **Input:** s = "abciiidef ", k = 3 **Output:** 3 **Explanation:** The substring "iii " contains 3 vow...
Use Floyd-Warshall's algorithm to compute any-point to any-point distances. (Or can also do Dijkstra from every node due to the weights are non-negative). For each city calculate the number of reachable cities within the threshold, then search for the optimal city.
Dynamic Programming,Graph,Shortest Path
Medium
2171
368
Welcome back to our new video and today we are going to see the largest divisible subset, this is the problem of the lead code, today is the date, what is the date, this is not the question, first we will see our test case. There is one two three array and the answer is also in some array type like there is one two ch ...
Largest Divisible Subset
largest-divisible-subset
Given a set of **distinct** positive integers `nums`, return the largest subset `answer` such that every pair `(answer[i], answer[j])` of elements in this subset satisfies: * `answer[i] % answer[j] == 0`, or * `answer[j] % answer[i] == 0` If there are multiple solutions, return any of them. **Example 1:** **Inp...
null
Array,Math,Dynamic Programming,Sorting
Medium
null
632
hello friends so today in this video we will be going through another problem from lead code which is a hard problem the problem name is smallest range covering elements from k list so i'll go through the problem statement first and then we're going to discuss the approach and the good part the problem statement states...
Smallest Range Covering Elements from K Lists
smallest-range-covering-elements-from-k-lists
You have `k` lists of sorted integers in **non-decreasing order**. Find the **smallest** range that includes at least one number from each of the `k` lists. We define the range `[a, b]` is smaller than range `[c, d]` if `b - a < d - c` **or** `a < c` if `b - a == d - c`. **Example 1:** **Input:** nums = \[\[4,10,15,...
null
Array,Hash Table,Greedy,Sliding Window,Sorting,Heap (Priority Queue)
Hard
76
662
hey everyone today we are going to service a little calculation maximum width of binary tree so you are given a root of binary tree return the maximum width of the given tree so the maximum width of 3 is a maximum width among all levels the width of one level is defined as the length between the end nodes of the leftmo...
Maximum Width of Binary Tree
maximum-width-of-binary-tree
Given the `root` of a binary tree, return _the **maximum width** of the given tree_. The **maximum width** of a tree is the maximum **width** among all levels. The **width** of one level is defined as the length between the end-nodes (the leftmost and rightmost non-null nodes), where the null nodes between the end-no...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
328
hi everybody welcome back to another algorithm problem hi uh future michael here so i'm currently editing this video and i realized that it's been about six months since i posted my last video and a lot has been going on in the last six months tldr moved across the country switched jobs and i haven't really had time to...
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,094
hey guys welcome back to my channel and I'm back again with another really interesting coding interview question video this time guys we are going to solve question number 1094 carpooling before I start with the video guys just want to request you that if you have not yet subscribed to my channel then please do subscri...
Car Pooling
matrix-cells-in-distance-order
There is a car with `capacity` empty seats. The vehicle only drives east (i.e., it cannot turn around and drive west). You are given the integer `capacity` and an array `trips` where `trips[i] = [numPassengersi, fromi, toi]` indicates that the `ith` trip has `numPassengersi` passengers and the locations to pick them u...
null
Array,Math,Geometry,Sorting,Matrix
Easy
2304
3
in this video we'll go over lead code question number three longest substring without repeating characters given a string we have to return the length of the longest substring without any repeating characters for example if the string is hello then the longest substring is hel so we'd return three there is no other way...
Longest Substring Without Repeating Characters
longest-substring-without-repeating-characters
Given a string `s`, find the length of the **longest** **substring** without repeating characters. **Example 1:** **Input:** s = "abcabcbb " **Output:** 3 **Explanation:** The answer is "abc ", with the length of 3. **Example 2:** **Input:** s = "bbbbb " **Output:** 1 **Explanation:** The answer is "b ", with t...
null
Hash Table,String,Sliding Window
Medium
159,340,1034,1813,2209
1,870
hey everybody this is larry just me going with q2 and you can see that i struggle out of this one uh minimum speed to arrive on time so this one conceptually is not that hard but for me i had issues with uh precision i think to be honest if they're going to do something like all these weird hours stuff with two digits ...
Minimum Speed to Arrive on Time
minimum-speed-to-arrive-on-time
You are given a floating-point number `hour`, representing the amount of time you have to reach the office. To commute to the office, you must take `n` trains in sequential order. You are also given an integer array `dist` of length `n`, where `dist[i]` describes the distance (in kilometers) of the `ith` train ride. E...
null
null
Medium
null
329
Hello hello guys appeared in girl shot today is not another google interview question to solve your friend has been recently interviewed by google and this question has been lost to him long standing bath in the recent sea inverter companies question appears for this question appears in google prayer Times Facebook at ...
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
1,793
what's up everyone myself Aditi and today I'm back with lead codes another daily challenge problem so today in this question we are asked to find maximum score of a good subar okay let's see the overview of the question you are given an array of integers nums which is zero index you are also given an integer K and they...
Maximum Score of a Good Subarray
minimum-moves-to-make-array-complementary
You are given an array of integers `nums` **(0-indexed)** and an integer `k`. The **score** of a subarray `(i, j)` is defined as `min(nums[i], nums[i+1], ..., nums[j]) * (j - i + 1)`. A **good** subarray is a subarray where `i <= k <= j`. Return _the maximum possible **score** of a **good** subarray._ **Example 1:**...
Given a target sum x, each pair of nums[i] and nums[n-1-i] would either need 0, 1, or 2 modifications. Can you find the optimal target sum x value such that the sum of modifications is minimized? Create a difference array to efficiently sum all the modifications.
Array,Hash Table,Prefix Sum
Medium
null
39
hi everyone it's Orkin welcome to my channel uh today we are gonna solve Elite code 39 problem a combination sum so first let's read the description so um we are given an input array of integers and we need to find the all combination that in some give us the target for example in this case we have the input array 2367...
Combination Sum
combination-sum
Given an array of **distinct** integers `candidates` and a target integer `target`, return _a list of all **unique combinations** of_ `candidates` _where the chosen numbers sum to_ `target`_._ You may return the combinations in **any order**. The **same** number may be chosen from `candidates` an **unlimited number of...
null
Array,Backtracking
Medium
17,40,77,216,254,377
1,320
hey what's up guys this is sean here so today uh let's take a look at this uh problem number one thousand three hundred and twenty minimum distance to type a word using two fingers okay so you're given like a keyboard layout as shown about like this right there are like 26 buttons on top of it right they're sorted like...
Minimum Distance to Type a Word Using Two Fingers
remove-all-adjacent-duplicates-in-string-ii
You have a keyboard layout as shown above in the **X-Y** plane, where each English uppercase letter is located at some coordinate. * For example, the letter `'A'` is located at coordinate `(0, 0)`, the letter `'B'` is located at coordinate `(0, 1)`, the letter `'P'` is located at coordinate `(2, 3)` and the letter `...
Use a stack to store the characters, when there are k same characters, delete them. To make it more efficient, use a pair to store the value and the count of each character.
String,Stack
Medium
1128,2307
515
hello everyone next unsolved question we have in our bfs playlist is find largest value in h3ro let's go to the question so given the root of binary to return an array of the largest value in each row of the tree zero industry okay so a pretty straightforward question if you know like we can do it as it is a tree binar...
Find Largest Value in Each Tree Row
find-largest-value-in-each-tree-row
Given the `root` of a binary tree, return _an array of the largest value in each row_ of the tree **(0-indexed)**. **Example 1:** **Input:** root = \[1,3,2,5,3,null,9\] **Output:** \[1,3,9\] **Example 2:** **Input:** root = \[1,2,3\] **Output:** \[1,3\] **Constraints:** * The number of nodes in the tree will be...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
135
hey everybody this is larry this is june 27 of the june decode daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's prom loading candy uh usually i saw these live so it's a little bit slow um just fast forward and sometimes i even talk about uh like a ...
Candy
candy
There are `n` children standing in a line. Each child is assigned a rating value given in the integer array `ratings`. You are giving candies to these children subjected to the following requirements: * Each child must have at least one candy. * Children with a higher rating get more candies than their neighbors....
null
Array,Greedy
Hard
null
1,319
hey everybody this is Larry this is uh was it day 23 of the legal day challenge hit the like button hit the Subscribe button drop me on Discord let me know what you think about today's poem so uh and also for people celebrating uh hopefully I'm saying it right uh um uh yeah hopefully I'm saying that correctly if not my...
Number of Operations to Make Network Connected
unique-number-of-occurrences
There are `n` computers numbered from `0` to `n - 1` connected by ethernet cables `connections` forming a network where `connections[i] = [ai, bi]` represents a connection between computers `ai` and `bi`. Any computer can reach any other computer directly or indirectly through the network. You are given an initial com...
Find the number of occurrences of each element in the array using a hash map. Iterate through the hash map and check if there is a repeated value.
Array,Hash Table
Easy
null
658
Hi gas welcome and welcome back to my channel so today our problem is find the closest element so what have you given us in this problem statement here we have given a sorted era from the arena is ok and two integer k and x have been given. And what we have to find is that A is the closest integer to It would be less t...
Find K Closest Elements
find-k-closest-elements
Given a **sorted** integer array `arr`, two integers `k` and `x`, return the `k` closest integers to `x` in the array. The result should also be sorted in ascending order. An integer `a` is closer to `x` than an integer `b` if: * `|a - x| < |b - x|`, or * `|a - x| == |b - x|` and `a < b` **Example 1:** **Input:...
null
Array,Two Pointers,Binary Search,Sorting,Heap (Priority Queue)
Medium
374,375,719
1,921
friends uh welcome to follow up let's have a look at problem 1921 eliminate maximum number of moners this problem is yesterday's Daily challenge problem we are going to explain a solution based on the following strategy so we are going to count how many monsters we can eliminate from the interval this is a left close a...
Eliminate Maximum Number of Monsters
eliminate-maximum-number-of-monsters
You are playing a video game where you are defending your city from a group of `n` monsters. You are given a **0-indexed** integer array `dist` of size `n`, where `dist[i]` is the **initial distance** in kilometers of the `ith` monster from the city. The monsters walk toward the city at a **constant** speed. The speed...
null
null
Medium
null
32
hello everyone let's take a look at lethal 32 longest valley parenthesis it's a very good problem and it can be solved by multiple solutions for example we can solve it for dynamic programming or we can solve it by stack okay let's take a look at this problem so the problem is given string containing just the character...
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
957
hi everyone my name is Steve today we're going to go through a legal problem 957 prison cells after n days let's take a look at the problem first there are eight prison cells in a row so it's a definite number and each cell is either occupied or vacant how do we denote occupied or vacant it says so here it says we desc...
Prison Cells After N Days
minimum-add-to-make-parentheses-valid
There are `8` prison cells in a row and each cell is either occupied or vacant. Each day, whether the cell is occupied or vacant changes according to the following rules: * If a cell has two adjacent neighbors that are both occupied or both vacant, then the cell becomes occupied. * Otherwise, it becomes vacant. ...
null
String,Stack,Greedy
Medium
2095
95
hey everybody this is Larry this is day five of the Lego August daily challenge when it loads anyway uh hit the like button hit the Subscribe button join me on Discord let me know what you think about today's problem why is my internet slow is it my computer all this money all this technology and it's just having fun b...
Unique Binary Search Trees II
unique-binary-search-trees-ii
Given an integer `n`, return _all the structurally unique **BST'**s (binary search trees), which has exactly_ `n` _nodes of unique values from_ `1` _to_ `n`. Return the answer in **any order**. **Example 1:** **Input:** n = 3 **Output:** \[\[1,null,2,null,3\],\[1,null,3,2\],\[2,1,3\],\[3,1,null,null,2\],\[3,2,null,1\...
null
Dynamic Programming,Backtracking,Tree,Binary Search Tree,Binary Tree
Medium
96,241
283
chances are that you have already found a solution that works in an order of n time complexity and now you're struggling to find a solution that is space efficient as well i am talking about the problem move0s or lead code this is one of the classic problems where you realize that to enhance your problem solving skills...
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
300
hello friends my name is Tushar and today we are going to discuss a question longest increasing subsequence length what does this mean it means that given a sequence find the longest subsequence such that all the elements in the subsequence are in the sorted order so for this example our longest increasing subsequence ...
Longest Increasing Subsequence
longest-increasing-subsequence
Given an integer array `nums`, return _the length of the longest **strictly increasing**_ _**subsequence**_. **Example 1:** **Input:** nums = \[10,9,2,5,3,7,101,18\] **Output:** 4 **Explanation:** The longest increasing subsequence is \[2,3,7,101\], therefore the length is 4. **Example 2:** **Input:** nums = \[0,1,...
null
Array,Binary Search,Dynamic Programming
Medium
334,354,646,673,712,1766,2096,2234
207
welcome to midnight coding today we will solve leap code problem 207 course schedule this is a graph problem but before we continue please like this video as it will give you all the luck you need to land your dream job and just as an extra measure subscribe to the channel and i promise you will succeed in your endeavo...
Course Schedule
course-schedule
There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`. * For example, the pair `[0, 1]`, indicates that to take cou...
This problem is equivalent to finding if a cycle exists in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topologica...
Depth-First Search,Breadth-First Search,Graph,Topological Sort
Medium
210,261,310,630
1,910
Hello, this question is given in 1910, so whatever part we have to delete in it, like ABC, first I have to edit something, I will get that, then I have to delete this text, in the last I have to return it Because I need it, then I created a variable and the find function I am doing in it is a string function, if you gi...
Remove All Occurrences of a Substring
check-if-binary-string-has-at-most-one-segment-of-ones
Given two strings `s` and `part`, perform the following operation on `s` until **all** occurrences of the substring `part` are removed: * Find the **leftmost** occurrence of the substring `part` and **remove** it from `s`. Return `s` _after removing all occurrences of_ `part`. A **substring** is a contiguous seque...
It's guaranteed to have at least one segment The string size is small so you can count all segments of ones with no that have no adjacent ones.
String
Easy
1999
1,816
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 ducky debug a Le Cod problem just attempt to solve it talk through my thought process and hopefully it's useful to someone on ...
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
144
hey everyone welcome back in this video I'll show you how to solve preorder traversal of a binary tree using a stack in a pre-order traversal as you know we in a pre-order traversal as you know we in a pre-order traversal as you know we visit the root node first process it then with the left child and finally the right...
Binary Tree Preorder Traversal
binary-tree-preorder-traversal
Given the `root` of a binary tree, return _the preorder traversal of its nodes' values_. **Example 1:** **Input:** root = \[1,null,2,3\] **Output:** \[1,2,3\] **Example 2:** **Input:** root = \[\] **Output:** \[\] **Example 3:** **Input:** root = \[1\] **Output:** \[1\] **Constraints:** * The number of nodes ...
null
Stack,Tree,Depth-First Search,Binary Tree
Easy
94,255,775
1,871
hello guys welcome to algorithms made easy my name is rijad and today we will be discussing the question jump game part 7. in this question we are given a binary string and two integers min jump and max jump in the beginning we are standing at index 0 which is equal to 0 we can move from index i to index j in the follo...
Jump Game VII
palindrome-partitioning-iv
You are given a **0-indexed** binary string `s` and two integers `minJump` and `maxJump`. In the beginning, you are standing at index `0`, which is equal to `'0'`. You can move from index `i` to index `j` if the following conditions are fulfilled: * `i + minJump <= j <= min(i + maxJump, s.length - 1)`, and * `s[j]...
Preprocess checking palindromes in O(1) Note that one string is a prefix and another one is a suffix you can try brute forcing the rest
String,Dynamic Programming
Hard
131,132,1403
144
this lead code question is binary tree pre-order traversal it's lead code pre-order traversal it's lead code pre-order traversal it's lead code question 144. it's also one of the Google interview questions it's very similar to the previous one that we did just yesterday so here we have the roots of a binary tree and we...
Binary Tree Preorder Traversal
binary-tree-preorder-traversal
Given the `root` of a binary tree, return _the preorder traversal of its nodes' values_. **Example 1:** **Input:** root = \[1,null,2,3\] **Output:** \[1,2,3\] **Example 2:** **Input:** root = \[\] **Output:** \[\] **Example 3:** **Input:** root = \[1\] **Output:** \[1\] **Constraints:** * The number of nodes ...
null
Stack,Tree,Depth-First Search,Binary Tree
Easy
94,255,775
925
Hello everyone welcome back you me channel Polity keyboard ok so let's see what is the question from you ok we have to print the name Pappu t a double p u ok now what have we typed double t double a Double P Okay, now look here, who wants to type this name, okay, what name we want to type, can it be? The name we have t...
Long Pressed Name
construct-binary-tree-from-preorder-and-postorder-traversal
Your friend is typing his `name` into a keyboard. Sometimes, when typing a character `c`, the key might get _long pressed_, and the character will be typed 1 or more times. You examine the `typed` characters of the keyboard. Return `True` if it is possible that it was your friends name, with some characters (possibly ...
null
Array,Hash Table,Divide and Conquer,Tree,Binary Tree
Medium
null
152
in this video we're going to look at a legal problem called maximum product subarray so we're given an integer array nums find a contiguous subarray that has the maximum product and return that product value so subarray is basically a contiguous subsequence of the array so basically this question is kind of similar to ...
Maximum Product Subarray
maximum-product-subarray
Given an integer array `nums`, find a subarray that has the largest product, and return _the product_. The test cases are generated so that the answer will fit in a **32-bit** integer. **Example 1:** **Input:** nums = \[2,3,-2,4\] **Output:** 6 **Explanation:** \[2,3\] has the largest product 6. **Example 2:** **I...
null
Array,Dynamic Programming
Medium
53,198,238,628,713
83
hi everyone today we are going to solve the ritual problem uh remove duplicates from a sorted list so you are given head of sorted list delete all duplicates such that each element appears only once return the linked list sorted as well so let's see the example so you are given one two so one is a duplicate number so r...
Remove Duplicates from Sorted List
remove-duplicates-from-sorted-list
Given the `head` of a sorted linked list, _delete all duplicates such that each element appears only once_. Return _the linked list **sorted** as well_. **Example 1:** **Input:** head = \[1,1,2\] **Output:** \[1,2\] **Example 2:** **Input:** head = \[1,1,2,3,3\] **Output:** \[1,2,3\] **Constraints:** * The numb...
null
Linked List
Easy
82,1982
1,304
yeahyeah Hi everyone, I'm a programmer. Today I'll introduce to you a problem with the following title: Find n you a problem with the following title: Find n you a problem with the following title: Find n unique integers whose sum is 0. The problem asks as follows, given an integer n, return any array containing n uniq...
Find N Unique Integers Sum up to Zero
longest-happy-string
Given an integer `n`, return **any** array containing `n` **unique** integers such that they add up to `0`. **Example 1:** **Input:** n = 5 **Output:** \[-7,-1,1,3,4\] **Explanation:** These arrays also are accepted \[-5,-1,1,2,3\] , \[-3,-1,2,-2,4\]. **Example 2:** **Input:** n = 3 **Output:** \[-1,0,1\] **Exampl...
Use a greedy approach. Use the letter with the maximum current limit that can be added without breaking the condition.
String,Greedy,Heap (Priority Queue)
Medium
778
709
what's up guys welcome to tech grant do like and share the video subscribe to the channel and watch out for the data structure beginner playlist so that if you are new to the data structure you can learn something from there so here we need to solve the problem where we are given a string and we need to convert it into...
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
31
hey everyone welcome back and let's write some more neat code today and don't forget to like the video it supports the channel a lot today let's look at leak code 46 permutation and this is more of a math problem than it is actually like a coding problem which makes it kind of difficult so we're given an array of numbe...
Next Permutation
next-permutation
A **permutation** of an array of integers is an arrangement of its members into a sequence or linear order. * For example, for `arr = [1,2,3]`, the following are all the permutations of `arr`: `[1,2,3], [1,3,2], [2, 1, 3], [2, 3, 1], [3,1,2], [3,2,1]`. The **next permutation** of an array of integers is the next le...
null
Array,Two Pointers
Medium
46,47,60,267,1978
623
hey everybody this is Larry this is day five day 55th day of October hit the League Cup what hit delete Go Button hit the Subscribe button uh hit the like button hit the Subscribe button join me in this car let me know what you think about today's pop add one more to chewy okay so given a word and two integers why in d...
Add One Row to Tree
add-one-row-to-tree
Given the `root` of a binary tree and two integers `val` and `depth`, add a row of nodes with value `val` at the given depth `depth`. Note that the `root` node is at depth `1`. The adding rule is: * Given the integer `depth`, for each not null tree node `cur` at the depth `depth - 1`, create two tree nodes with va...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
421
Ratan Tata Cars Suggestion Who Is This At The Same Time Interest Prominent Maximum Two Numbers In A Relaxed Way In Clear Flats Reader Problem Government And Jerry Tom Maximum Result Of Not Equal Numbers Gomez And Online Witnesses 100 Problem Statement Quite Simple What To Do In This We Like This To suck the limits, if ...
Maximum XOR of Two Numbers in an Array
maximum-xor-of-two-numbers-in-an-array
Given an integer array `nums`, return _the maximum result of_ `nums[i] XOR nums[j]`, where `0 <= i <= j < n`. **Example 1:** **Input:** nums = \[3,10,5,25,2,8\] **Output:** 28 **Explanation:** The maximum result is 5 XOR 25 = 28. **Example 2:** **Input:** nums = \[14,70,53,83,49,91,36,80,92,51,66,70\] **Output:** 1...
null
Array,Hash Table,Bit Manipulation,Trie
Medium
1826
145
Have Fennel Laga Study Baikunth Chaudas Question of List Code Special Poster Colors Life Mein Entry Ok So in the last two videos I had turned on inverter free mode and ordered these ok Logic is exact same The only difference is that pre quarter What were I doing, first keep returning the value, okay, what did I do in t...
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
468
Hello Hi Guys Mandir Gaye Jamsetji Today Will Go Through The Sixteen Problems Validate IP Address Please Like You Don't Forget To Subscribe To R Channel Darshan Even Supposed To Check Weather And Represented In Decimal To Decimal Numbers From 500 600 800 Id Group Representing With Printed All Over In the middle and low...
Validate IP Address
validate-ip-address
Given a string `queryIP`, return `"IPv4 "` if IP is a valid IPv4 address, `"IPv6 "` if IP is a valid IPv6 address or `"Neither "` if IP is not a correct IP of any type. **A valid IPv4** address is an IP in the form `"x1.x2.x3.x4 "` where `0 <= xi <= 255` and `xi` **cannot contain** leading zeros. For example, `"192.16...
null
String
Medium
752
210
hello friends and welcome back to another discussion on a lead code problem so the problem for today is course schedule too let's go through the problem description there are a total of n courses you have to take they built from 0 to n minus 1 some courses may have prerequisites for example to take Co 0 you have to fir...
Course Schedule II
course-schedule-ii
There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`. * For example, the pair `[0, 1]`, indicates that to take cou...
This problem is equivalent to finding the topological order in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topolo...
Depth-First Search,Breadth-First Search,Graph,Topological Sort
Medium
207,269,310,444,630,1101,2220
692
hello and welcome back to the cracking Fang YouTube channel today we're solving lead code problem 692 top K frequent words given an array of strings words and an integer K return the K most frequent strings return the answer sorted by the frequency from highest to lowest and sort the words with the same frequency by th...
Top K Frequent Words
top-k-frequent-words
Given an array of strings `words` and an integer `k`, return _the_ `k` _most frequent strings_. Return the answer **sorted** by **the frequency** from highest to lowest. Sort the words with the same frequency by their **lexicographical order**. **Example 1:** **Input:** words = \[ "i ", "love ", "leetcode ", "i ", "...
null
Hash Table,String,Trie,Sorting,Heap (Priority Queue),Bucket Sort,Counting
Medium
347,1014,1919
380
today we're gonna be working on it code question number 300. and 80. uh insert delete and get random we can Implement these three functions uh for this randomized set class so randomized set initializes the randomizer class uh Boolean cell is gonna insert an item value into the set if not present return row if the item...
Insert Delete GetRandom O(1)
insert-delete-getrandom-o1
Implement the `RandomizedSet` class: * `RandomizedSet()` Initializes the `RandomizedSet` object. * `bool insert(int val)` Inserts an item `val` into the set if not present. Returns `true` if the item was not present, `false` otherwise. * `bool remove(int val)` Removes an item `val` from the set if present. Retur...
null
Array,Hash Table,Math,Design,Randomized
Medium
381
3
welcome to Lee codes blind created 75 where I'll be solving the 75 essential legal questions this question is the longest substring without repeating characters given a string find the length of the longest substring without repeating characters say we're given a string like this ABC BB we want to return 3 because the ...
Longest Substring Without Repeating Characters
longest-substring-without-repeating-characters
Given a string `s`, find the length of the **longest** **substring** without repeating characters. **Example 1:** **Input:** s = "abcabcbb " **Output:** 3 **Explanation:** The answer is "abc ", with the length of 3. **Example 2:** **Input:** s = "bbbbb " **Output:** 1 **Explanation:** The answer is "b ", with t...
null
Hash Table,String,Sliding Window
Medium
159,340,1034,1813,2209
112
a binary tree is such an amazing data structure right it is formed in so many ways it can have so many variations and hence you can have so many different kind of problems on it as well right in this particular problem on lead code what you are given is you are given a sum and this binary tree has some values now you h...
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
332
what is going on everybody it's your boy average leader here with another video and today we are tackling number 332 reconstruct itinerary as you can see this is the second most asked graph problem out there and uh in fact it's commonly asked by uber amazon twilio bloomberg facebook microsoft intuit expedia and a few o...
Reconstruct Itinerary
reconstruct-itinerary
You are given a list of airline `tickets` where `tickets[i] = [fromi, toi]` represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it. All of the tickets belong to a man who departs from `"JFK "`, thus, the itinerary must begin with `"JFK "`. If there are multiple...
null
Depth-First Search,Graph,Eulerian Circuit
Hard
2051,2201
139
hey everybody this is larry this is day 29 of the league code daily challenge uh hit the like button hit the subscribe button join me on discord let me know what you think about today's prom and today's problem is uh let's see my neck feels a little better by the way because you're wondering ah okay one week uh did i c...
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
7
one welcome back and let's write some more neat code today so today let's solve the problem reverse integer even though this is marked as an easy question i would say that this is definitely more of a medium question and that's probably why this question has so many different uh so many dislikes but i don't think it's ...
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
146
hey guys has been good mrs. J sir who's not do the algorithms in this video I'm going to take a look at 1:46 LRU cache going to take a look at 1:46 LRU cache going to take a look at 1:46 LRU cache design an implemented instructor for lists recent used cash well issue support following operators get input get a key get ...
LRU Cache
lru-cache
Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**. Implement the `LRUCache` class: * `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`. * `int get(int key)` Return the valu...
null
Hash Table,Linked List,Design,Doubly-Linked List
Medium
460,588,604,1903
1,800
Ajay in New Delhi, member Shivani Gupta from on coding and suggestions or bunkers solution of class loss middling all exams of birth point 233 ok to jhal ki sari efforts kya hai to discuss we are discussing come watch Android our WhatsApp. After discussing, we go quickly and bring the question, okay, what will we do wi...
Maximum Ascending Subarray Sum
concatenation-of-consecutive-binary-numbers
Given an array of positive integers `nums`, return the _maximum possible sum of an **ascending** subarray in_ `nums`. A subarray is defined as a contiguous sequence of numbers in an array. A subarray `[numsl, numsl+1, ..., numsr-1, numsr]` is **ascending** if for all `i` where `l <= i < r`, `numsi < numsi+1`. Note th...
Express the nth number value in a recursion formula and think about how we can do a fast evaluation.
Math,Bit Manipulation,Simulation
Medium
null
274
Hai gas welcome back to me channel and this video they are going to solve the next problem of top interview 150 So what is the problem is our index so let us see what has been given to us in this problem statement here we have one Hey Citizens of India have kept a serial where your side is representing three numbers of...
H-Index
h-index
Given an array of integers `citations` where `citations[i]` is the number of citations a researcher received for their `ith` paper, return _the researcher's h-index_. According to the [definition of h-index on Wikipedia](https://en.wikipedia.org/wiki/H-index): The h-index is defined as the maximum value of `h` such th...
An easy approach is to sort the array first. What are the possible values of h-index? A faster approach is to use extra space.
Array,Sorting,Counting Sort
Medium
275
336
Prompt OK 200 E-mail Tum Baat To Hai Nahi Stream A Limited Check If Stream Has Started Or Not A Strange Block So Do We Like Share And We Complete's Body Will Just Tell Me That Any Disturbance Any People Volume Anti- Oxidant is the giver, Any People Volume Anti- Oxidant is the giver, Any People Volume Anti- Oxidant is t...
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
352
Hello everyone welcome, my channel is going to do my video number 37 of Good Story. Do n't know I think it should have been called a medium question today because when I will tell its solution either medium is fine, it should have been medium because the solution when If I tell you then you will really feel that this i...
Data Stream as Disjoint Intervals
data-stream-as-disjoint-intervals
Given a data stream input of non-negative integers `a1, a2, ..., an`, summarize the numbers seen so far as a list of disjoint intervals. Implement the `SummaryRanges` class: * `SummaryRanges()` Initializes the object with an empty stream. * `void addNum(int value)` Adds the integer `value` to the stream. * `int...
null
Binary Search,Design,Ordered Set
Hard
228,436,715
72
hey everyone welcome back and let's write some more neat code today so today let's solve edit distance so this is a dynamic programming problem and this is very similar to the problem longest common subsequence which is a problem i've solved on this channel so this problem is basically an extension of that problem so w...
Edit Distance
edit-distance
Given two strings `word1` and `word2`, return _the minimum number of operations required to convert `word1` to `word2`_. You have the following three operations permitted on a word: * Insert a character * Delete a character * Replace a character **Example 1:** **Input:** word1 = "horse ", word2 = "ros " **O...
null
String,Dynamic Programming
Hard
161,583,712,1105,2311
31
hello everyone let's take a look at the code city one next permutation it's um it's a very plastic problem in the code and this program is um a little bit tricky since there are some good solutions and it would be best if we could remember so as solutions okay so let me go through some examples and let's enhance this p...
Next Permutation
next-permutation
A **permutation** of an array of integers is an arrangement of its members into a sequence or linear order. * For example, for `arr = [1,2,3]`, the following are all the permutations of `arr`: `[1,2,3], [1,3,2], [2, 1, 3], [2, 3, 1], [3,1,2], [3,2,1]`. The **next permutation** of an array of integers is the next le...
null
Array,Two Pointers
Medium
46,47,60,267,1978
1,219
this is RIT go to question number 20 19 pass with maximum cord this is medium question less guarantee in a coalmine grid of site m-by-n each cell in their grid of site m-by-n each cell in their grid of site m-by-n each cell in their mind as an integer representing amount of gold in a cell generally is empty little maxi...
Path with Maximum Gold
longest-well-performing-interval
In a gold mine `grid` of size `m x n`, each cell in this mine has an integer representing the amount of gold in that cell, `0` if it is empty. Return the maximum amount of gold you can collect under the conditions: * Every time you are located in a cell you will collect all the gold in that cell. * From your posi...
Make a new array A of +1/-1s corresponding to if hours[i] is > 8 or not. The goal is to find the longest subarray with positive sum. Using prefix sums (PrefixSum[i+1] = A[0] + A[1] + ... + A[i]), you need to find for each j, the smallest i < j with PrefixSum[i] + 1 == PrefixSum[j].
Array,Hash Table,Stack,Monotonic Stack,Prefix Sum
Medium
null
56
hey hope you're doing good back to solving more problems on arrays and today's question is merge intervals it's quite a popular question and has an interesting solution as well you could pause the video and quickly go through the question we have a list of intervals where each interval has a start comma end index and w...
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
1,376
Hello everyone welcome to me channel's video number 'Tu karne raha hai', video number 'Tu karne raha hai', video number 'Tu karne raha hai', got a very good response on video number one, this playlist got more than 1500 views and more than 100 likes also say, so I hope this video is also richer than that. Do and help y...
Time Needed to Inform All Employees
time-needed-to-inform-all-employees
A company has `n` employees with a unique ID for each employee from `0` to `n - 1`. The head of the company is the one with `headID`. Each employee has one direct manager given in the `manager` array where `manager[i]` is the direct manager of the `i-th` employee, `manager[headID] = -1`. Also, it is guaranteed that th...
null
null
Medium
null
135
hello everyone so today we're going to we are going to solve a question candy this is of lead code and a difficulty level for this problem is hard so in the question we have been given as there are n children standing in a line each children is assigned a rating value given in the rating integer array ratings so we hav...
Candy
candy
There are `n` children standing in a line. Each child is assigned a rating value given in the integer array `ratings`. You are giving candies to these children subjected to the following requirements: * Each child must have at least one candy. * Children with a higher rating get more candies than their neighbors....
null
Array,Greedy
Hard
null
1,373
hi friends welcome back today we are going to solve one of the hard coding interview problem on lead code which is frequently asked by big fan companies it's on lead code 1373 maximum some bst in binary tree so this is a hard coding problem related to binary tree so if you are preparing for coding interviews make sure ...
Maximum Sum BST in Binary Tree
maximum-sum-bst-in-binary-tree
Given a **binary tree** `root`, return _the maximum sum of all keys of **any** sub-tree which is also a Binary Search Tree (BST)_. Assume a BST is defined as follows: * The left subtree of a node contains only nodes with keys **less than** the node's key. * The right subtree of a node contains only nodes with key...
null
null
Hard
null
1,269
hey welcome back today we're discussing problem number 1269 number of ways to stay in the same place after some steps we are given two integers steps and array length we need to uh calculate the number of ways possible so that uh you will end up being at the same place where you started after taking the given number of...
Number of Ways to Stay in the Same Place After Some Steps
market-analysis-ii
You have a pointer at index `0` in an array of size `arrLen`. At each step, you can move 1 position to the left, 1 position to the right in the array, or stay in the same place (The pointer should not be placed outside the array at any time). Given two integers `steps` and `arrLen`, return the number of ways such that...
null
Database
Hard
null
32
Loot gayi welcome back to my channel and you were going to year longest white paint is so is this voucher mein giving kya hai that aapse ek team de rakah aur us add tyother in the self less hai aapko yahan par karna kya hai find karna hai dil length Of the longest valid value from different this substance ok fennel sep...
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
993
Hello hello guys welcome back two years in this video will see the present in every problem which date of the match of the problem 9099 half plus one note subscribe must be unique and different return true values ​​will find weather to give one unique and different return true values ​​will find weather to give one uni...
Cousins in Binary Tree
tallest-billboard
Given the `root` of a binary tree with unique values and the values of two different nodes of the tree `x` and `y`, return `true` _if the nodes corresponding to the values_ `x` _and_ `y` _in the tree are **cousins**, or_ `false` _otherwise._ Two nodes of a binary tree are **cousins** if they have the same depth with d...
null
Array,Dynamic Programming
Hard
2162
875
Hello Hi Everyone Welcome To My Channel And We Are Going To Solve Very Important Interview Problem Making Meeting So Let's Move With His Problems Very Important Co * Move With His Problems Very Important Co * Move With His Problems Very Important Co * Company Subscribe Important Meeting Is Company Subscribe Problem Sol...
Koko Eating Bananas
longest-mountain-in-array
Koko loves to eat bananas. There are `n` piles of bananas, the `ith` pile has `piles[i]` bananas. The guards have gone and will come back in `h` hours. Koko can decide her bananas-per-hour eating speed of `k`. Each hour, she chooses some pile of bananas and eats `k` bananas from that pile. If the pile has less than `k...
null
Array,Two Pointers,Dynamic Programming,Enumeration
Medium
1766,2205
1,575
hello everybody in today's video we are going to be looking at lead code problem number one five seven five count all possible routes so the problem description says you are given an array of distinct positive integers where the locations at each index represent the position of a city at that index we're also given thr...
Count All Possible Routes
maximum-area-of-a-piece-of-cake-after-horizontal-and-vertical-cuts
You are given an array of **distinct** positive integers locations where `locations[i]` represents the position of city `i`. You are also given integers `start`, `finish` and `fuel` representing the starting city, ending city, and the initial amount of fuel you have, respectively. At each step, if you are at city `i`,...
Sort the arrays, then compute the maximum difference between two consecutive elements for horizontal cuts and vertical cuts. The answer is the product of these maximum values in horizontal cuts and vertical cuts.
Array,Greedy,Sorting
Medium
null
115
hello everybody Isabelle and today I'm gonna teach you how to solve the summer left Leafs problem find the sum of all left leaves in a given binary tree as an example they give you this binary tree so the output is 24 because there are two left leaves so because there are two you add them up so 9 plus 15 equals 24 how ...
Distinct Subsequences
distinct-subsequences
Given two strings `s` and `t`, return _the number of distinct_ **_subsequences_** _of_ `s` _which equals_ `t`. The test cases are generated so that the answer fits on a 32-bit signed integer. **Example 1:** **Input:** s = "rabbbit ", t = "rabbit " **Output:** 3 **Explanation:** As shown below, there are 3 ways you...
null
String,Dynamic Programming
Hard
2115
451
hey everyone today we'll be solving lead problem number 451 sort characters by frequency in this problem we will be given a string s and we have to sort in the decreasing order based on the frequency of each character and the frequency of character is the number of times it is appearing the string and we have to return...
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
62
so hello everyone i am straight i am a software development engineer so we are starting with this lead code premium top interview problem series we will be discussing each and every problem which are mentioned on the lead code top interviews and also this will help you to crack your next coding interview in the top not...
Unique Paths
unique-paths
There is a robot on an `m x n` grid. The robot is initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time. Given the two integers `m` and `n`, return _the nu...
null
Math,Dynamic Programming,Combinatorics
Medium
63,64,174,2192
1,094
I always Calvin here so today we will discuss about a problem called carpooling from weekly contents 142 so let's start so this problem we are given an array so this array is a number of passenger that the first thing that is the number of passenger that take a ride on our car and start position and punch it and positi...
Car Pooling
matrix-cells-in-distance-order
There is a car with `capacity` empty seats. The vehicle only drives east (i.e., it cannot turn around and drive west). You are given the integer `capacity` and an array `trips` where `trips[i] = [numPassengersi, fromi, toi]` indicates that the `ith` trip has `numPassengersi` passengers and the locations to pick them u...
null
Array,Math,Geometry,Sorting,Matrix
Easy
2304
1,751
Hello everyone, welcome to me, we are going to channel 44 and you must know that I also have a separate playlist of DP concession questions, you can read it. To understand DP from scratch, just like, we had once made a playlist of questions on graphs and concepts. Okay. And our page is available separately on Facebook,...
Maximum Number of Events That Can Be Attended II
slowest-key
You are given an array of `events` where `events[i] = [startDayi, endDayi, valuei]`. The `ith` event starts at `startDayi` and ends at `endDayi`, and if you attend this event, you will receive a value of `valuei`. You are also given an integer `k` which represents the maximum number of events you can attend. You can o...
Get for each press its key and amount of time taken. Iterate on the presses, maintaining the answer so far. The current press will change the answer if and only if its amount of time taken is longer than that of the previous answer, or they are equal but the key is larger than that of the previous answer.
Array,String
Easy
null
778
hello everyone welcome to kodus camp we are at 20th day of june liquid challenge and the problem we are going to cover in this video is when in rising water so this is another interesting problem where the input given here is a two dimensional array grid and we have to return the amount of time we take to reach from th...
Swim in Rising Water
reorganize-string
You are given an `n x n` integer matrix `grid` where each value `grid[i][j]` represents the elevation at that point `(i, j)`. The rain starts to fall. At time `t`, the depth of the water everywhere is `t`. You can swim from a square to another 4-directionally adjacent square if and only if the elevation of both square...
Alternate placing the most common letters.
Hash Table,String,Greedy,Sorting,Heap (Priority Queue),Counting
Medium
358,621,1304
1,816
e Hello everyone, we are together again with another question, today we are together again with this last picture trunk and sandals A sound given to you String Friends it is given as a sentence mind keijiro Everyone English letters and it is stated that it is just white-space It is stated that there is no dress at the ...
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
28
find the index of the first occurrence inside of a string we need an INT H is equal to hashtag.length and n is equal to hashtag.length and n is equal to hashtag.length and n is equal to needle dot length an end to n index is equal to zero or end I is equals zero I is less than H and I plus if Haystack dot Char I is equ...
Find the Index of the First Occurrence in a String
implement-strstr
Given two strings `needle` and `haystack`, return the index of the first occurrence of `needle` in `haystack`, or `-1` if `needle` is not part of `haystack`. **Example 1:** **Input:** haystack = "sadbutsad ", needle = "sad " **Output:** 0 **Explanation:** "sad " occurs at index 0 and 6. The first occurrence is at ...
null
Two Pointers,String,String Matching
Easy
214,459
463
Island perimeter so you're given a matter of grid rows into columns representing a map where bit of I comma J equal to 1 if it's representing that and the get rid of I comma J will be 0 if it is representing water so if it is land then one if it is water then it is zero so grid cells are connected horizontally or verti...
Island Perimeter
island-perimeter
You are given `row x col` `grid` representing a map where `grid[i][j] = 1` represents land and `grid[i][j] = 0` represents water. Grid cells are connected **horizontally/vertically** (not diagonally). The `grid` is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells)...
null
Array,Depth-First Search,Breadth-First Search,Matrix
Easy
695,733,1104
926
hey everyone welcome back and let's write some more neat code today so today let's solve the problem flip string to monotonic increasing so we're given a binary string and it's defined as being monotonic increasing if it consists of some zeros or possibly none and some ones possibly none but all of the zeros are on the...
Flip String to Monotone Increasing
find-and-replace-pattern
A binary string is monotone increasing if it consists of some number of `0`'s (possibly none), followed by some number of `1`'s (also possibly none). You are given a binary string `s`. You can flip `s[i]` changing it from `0` to `1` or from `1` to `0`. Return _the minimum number of flips to make_ `s` _monotone increa...
null
Array,Hash Table,String
Medium
null
410
hey everybody this is larry this is me doing the oh the last day of march hit the like button hit the subscribe button join me on discord let me know what you think it's been a whole month uh congratulate yourself you made it this far and if you haven't that's okay too i mean uh sometimes you go at your own pace and so...
Split Array Largest Sum
split-array-largest-sum
Given an integer array `nums` and an integer `k`, split `nums` into `k` non-empty subarrays such that the largest sum of any subarray is **minimized**. Return _the minimized largest sum of the split_. A **subarray** is a contiguous part of the array. **Example 1:** **Input:** nums = \[7,2,5,10,8\], k = 2 **Output:*...
null
Array,Binary Search,Dynamic Programming,Greedy
Hard
1056,1192,2242,2330
208
hello guys my name is lazaro and today we're going to be doing a lee code problem this problem is called implement try aka prefix tree a try pronounced as try as i just said it a prefix tree is a tree data structure used to efficiently store and retrieve keys in a data set of strings there are various applications of t...
Implement Trie (Prefix Tree)
implement-trie-prefix-tree
A [**trie**](https://en.wikipedia.org/wiki/Trie) (pronounced as "try ") or **prefix tree** is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker. Implement the Trie class: * `Trie()` ...
null
Hash Table,String,Design,Trie
Medium
211,642,648,676,1433,1949
404
hello everyone welcome back to the channel so friends in this particular video we'll be solving this problem that is some of left leaves so friends what we are given is we are given the root of a binary tree and we have to return the sum of all left leaves and Friends Leaf is a note with no children so this is the exam...
Sum of Left Leaves
sum-of-left-leaves
Given the `root` of a binary tree, return _the sum of all left leaves._ A **leaf** is a node with no children. A **left leaf** is a leaf that is the left child of another node. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** 24 **Explanation:** There are two left leaves in the binary tree, wit...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
null
562
and welcome back to the cracking vein YouTube channel today we're going to be solving lead code problem 562 longest line of consecutive ones in a matrix before we get into it I know you guys enjoy these Google questions you watch them the most so please leave a like and a comment on the video it really helps me out wit...
Longest Line of Consecutive One in Matrix
longest-line-of-consecutive-one-in-matrix
Given an `m x n` binary matrix `mat`, return _the length of the longest line of consecutive one in the matrix_. The line could be horizontal, vertical, diagonal, or anti-diagonal. **Example 1:** **Input:** mat = \[\[0,1,1,0\],\[0,1,1,0\],\[0,0,0,1\]\] **Output:** 3 **Example 2:** **Input:** mat = \[\[1,1,1,1\],\[0...
One solution is to count ones in each direction separately and find the longest line. Don't you think it will take too much lines of code? Is it possible to use some extra space to make the solution simple? Can we use dynamic programming to make use of intermediate results? Think of a 3D array which can be used to sto...
Array,Dynamic Programming,Matrix
Medium
null
771
hey guys welcome back to my channel and i'm back again with another really interesting coding interview question video today we are going to solve question number 771 jewels and stones in late code before i start with the video guys if you have not yet subscribed to my channel then please do subscribe and hit the bell ...
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
190
hey everyone welcome back and let's write some more neat code today so today let's solve the problem reverse bits and this happens to be another problem from the blind 75 list or list of common leak code problems that we've been tracking in this spreadsheet we have a solution for the vast majority of them and i'll be d...
Reverse Bits
reverse-bits
Reverse bits of a given 32 bits unsigned integer. **Note:** * Note that in some languages, such as Java, there is no unsigned integer type. In this case, both input and output will be given as a signed integer type. They should not affect your implementation, as the integer's internal binary representation is the s...
null
Divide and Conquer,Bit Manipulation
Easy
7,191,2238
1,643
hey everybody this is larry this is me going with q4 of the recently code contest uh 213 cave smartest instructions so hit the like button to subscribe and join me in discord so i actually end up taking a really long time for this problem mostly due to stupidness um a couple of times i'm gonna explain it i also wanna e...
Kth Smallest Instructions
number-of-nodes-in-the-sub-tree-with-the-same-label
Bob is standing at cell `(0, 0)`, and he wants to reach `destination`: `(row, column)`. He can only travel **right** and **down**. You are going to help Bob by providing **instructions** for him to reach `destination`. The **instructions** are represented as a string, where each character is either: * `'H'`, meanin...
Start traversing the tree and each node should return a vector to its parent node. The vector should be of length 26 and have the count of all the labels in the sub-tree of this node.
Hash Table,Tree,Depth-First Search,Breadth-First Search,Counting
Medium
null
587
welcome to League of JavaScript Channel where we solve every single little question is in JavaScript today we have Vibe 87 erect defense this is a hard question so you're given a retreat which result contains an array with an x on my coordinator representing the location of a tree in the garden we'll ask to fence the e...
Erect the Fence
erect-the-fence
You are given an array `trees` where `trees[i] = [xi, yi]` represents the location of a tree in the garden. Fence the entire garden using the minimum length of rope, as it is expensive. The garden is well-fenced only if **all the trees are enclosed**. Return _the coordinates of trees that are exactly located on the f...
null
Array,Math,Geometry
Hard
2074
43
today we're gonna be working on lead code question number 43 multiply strings given two non-negative integers num1 and given two non-negative integers num1 and given two non-negative integers num1 and num2 represented as strings return the product of num1 and num2 uh you must not use any built-in bit integer library or...
Multiply Strings
multiply-strings
Given two non-negative integers `num1` and `num2` represented as strings, return the product of `num1` and `num2`, also represented as a string. **Note:** You must not use any built-in BigInteger library or convert the inputs to integer directly. **Example 1:** **Input:** num1 = "2", num2 = "3" **Output:** "6" **Ex...
null
Math,String,Simulation
Medium
2,66,67,415
103
hey guys welcome or welcome back to my YouTube channel so today we are going to discuss another problem is binary tree zigzag level order traversal so in this problem we are given root of binary tree and we need to return the zigzag level order traversal so it's level order traversal so that means it's breadth first se...
Binary Tree Zigzag Level Order Traversal
binary-tree-zigzag-level-order-traversal
Given the `root` of a binary tree, return _the zigzag level order traversal of its nodes' values_. (i.e., from left to right, then right to left for the next level and alternate between). **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** \[\[3\],\[20,9\],\[15,7\]\] **Example 2:** **Input:** roo...
null
Tree,Breadth-First Search,Binary Tree
Medium
102
1,658
hey everybody this is larry this is day 11 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 i hope you enjoy the intro as much as i'm uh showing you the intro aruba is kind of fun so definitely check it out if you have a cha...
Minimum Operations to Reduce X to Zero
minimum-swaps-to-arrange-a-binary-grid
You are given an integer array `nums` and an integer `x`. In one operation, you can either remove the leftmost or the rightmost element from the array `nums` and subtract its value from `x`. Note that this **modifies** the array for future operations. Return _the **minimum number** of operations to reduce_ `x` _to **e...
For each row of the grid calculate the most right 1 in the grid in the array maxRight. To check if there exist answer, sort maxRight and check if maxRight[i] ≤ i for all possible i's. If there exist an answer, simulate the swaps.
Array,Greedy,Matrix
Medium
null
1,293
hello friends today life so shortest path in a grid with obstacles elimination given M times and grid wage there is either zero empty or one obstacle it one step you can move up down left or right thrown in the - an down left or right thrown in the - an down left or right thrown in the - an empty cell returned the mini...
Shortest Path in a Grid with Obstacles Elimination
three-consecutive-odds
You are given an `m x n` integer matrix `grid` where each cell is either `0` (empty) or `1` (obstacle). You can move up, down, left, or right from and to an empty cell in **one step**. Return _the minimum number of **steps** to walk from the upper left corner_ `(0, 0)` _to the lower right corner_ `(m - 1, n - 1)` _giv...
Check every three consecutive numbers in the array for parity.
Array
Easy
null
198
in this problem there is a rover and his task is to rob some houses in a locality and there are houses in the locality in a row and each house has some money in it so maybe this house has five billion dollars this has 10 billion dollars this has 2 billion dollars 7 billion and so on the condition is that the robber can...
House Robber
house-robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and **it will automatically contact the police if two adjacent houses were broken into...
null
Array,Dynamic Programming
Medium
152,213,256,276,337,600,656,740,2262