id
int64
1
2k
content
stringlengths
272
88.9k
title
stringlengths
3
77
title_slug
stringlengths
3
79
question_content
stringlengths
230
5k
question_hints
stringclasses
695 values
tag
stringclasses
618 values
level
stringclasses
3 values
similar_question_ids
stringclasses
822 values
1,638
That Today Kasam Solved List Question Number is dear by 0.5 inch by one Question Number is dear by 0.5 inch by one Question Number is dear by 0.5 inch by one character is Properly statement given two strings like 1000 number of but you can choose and 1m 3 sub string of these and replace single character by different ch...
Count Substrings That Differ by One Character
best-position-for-a-service-centre
Given two strings `s` and `t`, find the number of ways you can choose a non-empty substring of `s` and replace a **single character** by a different character such that the resulting substring is a substring of `t`. In other words, find the number of substrings in `s` that differ from some substring in `t` by **exactly...
The problem can be reworded as, giving a set of points on a 2d-plane, return the geometric median. Loop over each triplet of points (positions[i], positions[j], positions[k]) where i < j < k, get the centre of the circle which goes throw the 3 points, check if all other points lie in this circle.
Math,Geometry,Randomized
Hard
null
282
so hello everyone this is Deepak Joshi and we are back with uh another gfg problem that is expressions and AD operators so uh we are back with a very long interval of time because I was having um some health issues now I am fit and I'm back so we are going to solve this particular question of today's DFT problem that i...
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
127
given two words begin word and end word and the dictionary's word list find the length of shortest transformation sequence from begin word to end word such that only one letter can be changed at a time and each transformed word must exist in the word list note return 0 if there is no such transformation sequence all wo...
Word Ladder
word-ladder
A **transformation sequence** from word `beginWord` to word `endWord` using a dictionary `wordList` is a sequence of words `beginWord -> s1 -> s2 -> ... -> sk` such that: * Every adjacent pair of words differs by a single letter. * Every `si` for `1 <= i <= k` is in `wordList`. Note that `beginWord` does not need ...
null
Hash Table,String,Breadth-First Search
Hard
126,433
884
Hello friends welcome to a new video in this video I'm going to discuss another Lead Core problem and this problem is based on string okay so the question is uncommon words from two sentences okay so a sentence is a string of single space separate words where each word consists only of lowercase letters okay so now you...
Uncommon Words from Two Sentences
k-similar-strings
A **sentence** is a string of single-space separated words where each word consists only of lowercase letters. A word is **uncommon** if it appears exactly once in one of the sentences, and **does not appear** in the other sentence. Given two **sentences** `s1` and `s2`, return _a list of all the **uncommon words**_....
null
String,Breadth-First Search
Hard
770
344
Turn the flash light Vaikuntha Questions and here the question which attends us is number 34 which is reverse bank meaning simple sa meaning dimple key explain that you have to reverse the screen here easy level difficulty question is very high for song here Depend vote affair is question, you have said here that I giv...
Reverse String
reverse-string
Write a function that reverses a string. The input string is given as an array of characters `s`. You must do this by modifying the input array [in-place](https://en.wikipedia.org/wiki/In-place_algorithm) with `O(1)` extra memory. **Example 1:** **Input:** s = \["h","e","l","l","o"\] **Output:** \["o","l","l","e","h...
The entire logic for reversing a string is based on using the opposite directional two-pointer approach!
Two Pointers,String,Recursion
Easy
345,541
215
question 215 ks largest element in an array from bitcoin let's jump to the question given an integer array nodes and integer k you return the case largest element so let's see what this question is asking us so the question is saying an integer array is given and integer k is given and we are supposed to return the ks ...
Kth Largest Element in an Array
kth-largest-element-in-an-array
Given an integer array `nums` and an integer `k`, return _the_ `kth` _largest element in the array_. Note that it is the `kth` largest element in the sorted order, not the `kth` distinct element. You must solve it in `O(n)` time complexity. **Example 1:** **Input:** nums = \[3,2,1,5,6,4\], k = 2 **Output:** 5 **Ex...
null
Array,Divide and Conquer,Sorting,Heap (Priority Queue),Quickselect
Medium
324,347,414,789,1014,2113,2204,2250
575
welcome to march's leeco challenge today's problem is distribute candies alice has n candies where the ice candy is of type candy type i alice noticed she started to gain weight so she visited doctor the doctor advised alice to eat only and divide by two of the candies she has so half and n is always easier even alice ...
Distribute Candies
distribute-candies
Alice has `n` candies, where the `ith` candy is of type `candyType[i]`. Alice noticed that she started to gain weight, so she visited a doctor. The doctor advised Alice to only eat `n / 2` of the candies she has (`n` is always even). Alice likes her candies very much, and she wants to eat the maximum number of differe...
To maximize the number of kinds of candies, we should try to distribute candies such that sister will gain all kinds. What is the upper limit of the number of kinds of candies sister will gain? Remember candies are to distributed equally. Which data structure is the most suitable for finding the number of kinds of cand...
Array,Hash Table
Easy
null
204
all right so this leap code question is called count primes it says count the number of prime numbers less than a non-negative number n so their example non-negative number n so their example non-negative number n so their example is the input of 10 and the output of 4 because there are 4 prime numbers less than 10 the...
Count Primes
count-primes
Given an integer `n`, return _the number of prime numbers that are strictly less than_ `n`. **Example 1:** **Input:** n = 10 **Output:** 4 **Explanation:** There are 4 prime numbers less than 10, they are 2, 3, 5, 7. **Example 2:** **Input:** n = 0 **Output:** 0 **Example 3:** **Input:** n = 1 **Output:** 0 **Co...
Let's start with a isPrime function. To determine if a number is prime, we need to check if it is not divisible by any number less than n. The runtime complexity of isPrime function would be O(n) and hence counting the total prime numbers up to n would be O(n2). Could we do better? As we know the number must not be div...
Array,Math,Enumeration,Number Theory
Medium
263,264,279
1,038
hello everyone so this question is binary search tree to a grid or some tree so the question is the census 538 so if you didn't watch the 538 video just please go to watch it and i'm going to just talk really quick on this video so you have a global sum and the and this value is going to update for every single element...
Binary Search Tree to Greater Sum Tree
number-of-squareful-arrays
Given the `root` of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus the sum of all keys greater than the original key in BST. As a reminder, a _binary search tree_ is a tree that satisfies these constraints: * The left subtree of a...
null
Array,Math,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask
Hard
47
1,706
hi guys hope you're fine and doing well so today we will be discussing this problem from the lead code which is where will the ball fall so this is the 20th problem of the dynamic programming series so if you haven't watched the previous videos you can consider watching them since it will be really helpful for you to u...
Where Will the Ball Fall
min-cost-to-connect-all-points
You have a 2-D `grid` of size `m x n` representing a box, and you have `n` balls. The box is open on the top and bottom sides. Each cell in the box has a diagonal board spanning two corners of the cell that can redirect a ball to the right or to the left. * A board that redirects the ball to the right spans the top...
Connect each pair of points with a weighted edge, the weight being the manhattan distance between those points. The problem is now the cost of minimum spanning tree in graph with above edges.
Array,Union Find,Minimum Spanning Tree
Medium
2287
151
hi everybody how are you all doing and how's your interview preparation going let me know in the comments below and let's dive into today's problem so we are given an input string s and we have to reverse the order of the words so we need to return a string of words in reverse order concatenated by a single space they'...
Reverse Words in a String
reverse-words-in-a-string
Given an input string `s`, reverse the order of the **words**. A **word** is defined as a sequence of non-space characters. The **words** in `s` will be separated by at least one space. Return _a string of the words in reverse order concatenated by a single space._ **Note** that `s` may contain leading or trailing s...
null
Two Pointers,String
Medium
186
1,721
hey everyone this is hope you're doing well so let's start with the question so the question is swiping notes in a linked list okay so you are given the head of the linked list and an integer k what you have to do you have to return the head of the linked list after swapping the value of kth node from the beginning and...
Swapping Nodes in a Linked List
maximum-profit-of-operating-a-centennial-wheel
You are given the `head` of a linked list, and an integer `k`. Return _the head of the linked list after **swapping** the values of the_ `kth` _node from the beginning and the_ `kth` _node from the end (the list is **1-indexed**)._ **Example 1:** **Input:** head = \[1,2,3,4,5\], k = 2 **Output:** \[1,4,3,2,5\] **Ex...
Think simulation Note that the number of turns will never be more than 50 / 4 * n
Array,Simulation
Medium
null
88
hello everyone today we're going to be going over a leak code question our lead code question for today is merge sorted erase essentially we're given two integer arrays and they want us to um put them together so it's kind of easy and make sure they're sorted as well so for example one we're given one two three zero m ...
Merge Sorted Array
merge-sorted-array
You are given two integer arrays `nums1` and `nums2`, sorted in **non-decreasing order**, and two integers `m` and `n`, representing the number of elements in `nums1` and `nums2` respectively. **Merge** `nums1` and `nums2` into a single array sorted in **non-decreasing order**. The final sorted array should not be re...
You can easily solve this problem if you simply think about two elements at a time rather than two arrays. We know that each of the individual arrays is sorted. What we don't know is how they will intertwine. Can we take a local decision and arrive at an optimal solution? If you simply consider one element each at a ti...
Array,Two Pointers,Sorting
Easy
21,1019,1028
975
okay I'd even jump 975 you're given an image of a from some starting index you can make a series of jump the first third fifth jump in the series I call odd number jumps in the second four six jumps in series I call you even double jumps you may win the sniffles you may from index I jump forward to index J with i desti...
Odd Even Jump
range-sum-of-bst
You are given an integer array `arr`. From some starting index, you can make a series of jumps. The (1st, 3rd, 5th, ...) jumps in the series are called **odd-numbered jumps**, and the (2nd, 4th, 6th, ...) jumps in the series are called **even-numbered jumps**. Note that the **jumps** are numbered, not the indices. You...
null
Tree,Depth-First Search,Binary Search Tree,Binary Tree
Easy
null
1,029
hello everyone today's question is to city scheduling there are 20 people a company is planning to interview the cost of flying the I person to CTA is costs I zero and the cost applying the I person to city B is costs i won return the minimum cost to fly every person to a city such that exactly n people arrive in its c...
Two City Scheduling
vertical-order-traversal-of-a-binary-tree
A company is planning to interview `2n` people. Given the array `costs` where `costs[i] = [aCosti, bCosti]`, the cost of flying the `ith` person to city `a` is `aCosti`, and the cost of flying the `ith` person to city `b` is `bCosti`. Return _the minimum cost to fly every person to a city_ such that exactly `n` people...
null
Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Hard
null
284
Hello hello everyone welcome to lotus camp and today also let us cover seeking it in this problem the are going to implement the interference from operation theater interface in java subscribe to do half of such scams and this morning you can see water operations can be Performed during and after this is his next and r...
Peeking Iterator
peeking-iterator
Design an iterator that supports the `peek` operation on an existing iterator in addition to the `hasNext` and the `next` operations. Implement the `PeekingIterator` class: * `PeekingIterator(Iterator nums)` Initializes the object with the given integer iterator `iterator`. * `int next()` Returns the next element...
Think of "looking ahead". You want to cache the next element. Is one variable sufficient? Why or why not? Test your design with call order of peek() before next() vs next() before peek(). For a clean implementation, check out Google's guava library source code.
Array,Design,Iterator
Medium
173,251,281
1,732
That Aapke Ajay Ko Hua Hai Hello Everyone Welcome to New Video in This Video By Going Towards Another Problem from Any Problem as Final Beatitude Problem Subscribe Subscription for 100 Countries Are Given in This Point E Plus One for All IS WELL WISHES RETURN COMED WE HAVE THIS A Now the role is not our selection but s...
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
389
hey everyone today we are going to solve the video for the question find the difference so you are given two strings s and t string s is generated by random shuffling string s and the 10 to add one more later at a random position returns a letter that was added to T so let's see the example so s is a b c d t is a b c d...
Find the Difference
find-the-difference
You are given two strings `s` and `t`. String `t` is generated by random shuffling string `s` and then add one more letter at a random position. Return the letter that was added to `t`. **Example 1:** **Input:** s = "abcd ", t = "abcde " **Output:** "e " **Explanation:** 'e' is the letter that was added. **Exam...
null
Hash Table,String,Bit Manipulation,Sorting
Easy
136
86
hello welcome back today let's try to solve another little problem from the lead code delayed silencer it is 6 partition list so we are giving a link to list so we're gonna to output another linked list but it should have some conditions so the partition yeah should be like this the not less than x come before the note...
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
1,071
um hello so today we are going to do this problem which is part of Fleet code daily challenge so the problem asks us to do the greatest common divisor of two strings so we have S and T and we have the concept where T divides s if and if only s is a series of concatenation of T so basically um concatenating as some valu...
Greatest Common Divisor of Strings
binary-prefix-divisible-by-5
For two strings `s` and `t`, we say "`t` divides `s` " if and only if `s = t + ... + t` (i.e., `t` is concatenated with itself one or more times). Given two strings `str1` and `str2`, return _the largest string_ `x` _such that_ `x` _divides both_ `str1` _and_ `str2`. **Example 1:** **Input:** str1 = "ABCABC ", str2...
If X is the first i digits of the array as a binary number, then 2X + A[i] is the first i+1 digits.
Array
Easy
null
1,704
hey everybody this is Larry this is day 12 of the Leo d challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's problem today we're getting a Yeezy problem 1704 determine if string halves are alike and it seems like we've done this problem before and maybe I gu...
Determine if String Halves Are Alike
special-positions-in-a-binary-matrix
You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half. Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppe...
Keep track of 1s in each row and in each column. Then while iterating over matrix, if the current position is 1 and current row as well as current column contains exactly one occurrence of 1.
Array,Matrix
Easy
null
368
hello and welcome to my channel so today let's look at the daily challenging question they call the 368 largest the visible subset given such subset of distinct pos positive integers norms return the largest subset answer such that every pair answer i answer j of elements in this subset satisfy the answer i um more the...
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
125
hey what's up guys it's a nick white tear new attack and coding stuff on twitch and youtube I'm in the libraries there's a lot of people talking around me right now but we're gonna try and do one of these videos really quickly this one this problem is called valenpac valid to palindrome and you'd think it's pretty easy...
Valid Palindrome
valid-palindrome
A phrase is a **palindrome** if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. Given a string `s`, return `true` _if it is a **palindrome**, or_ `false` _otherwise_...
null
Two Pointers,String
Easy
234,680,2130,2231
7
guys so in this video we'll look at reverse integer problem so uh in this problem we are given a third bit sign integer and we need to return the reverse of that integer so let's look at these examples so if we are given one two three four five then we need to return five four three two one if we are given minus six se...
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
55
Hello friends, today's question is jump game. In this question, we are given an object named Namas and inside it we have to find whether we can go out of the index from Eric's last index while jumping or not. So if from the first index we have to start from zero and the value of zero index is 2 minutes how many jumps c...
Jump Game
jump-game
You are given an integer array `nums`. You are initially positioned at the array's **first index**, and each element in the array represents your maximum jump length at that position. Return `true` _if you can reach the last index, or_ `false` _otherwise_. **Example 1:** **Input:** nums = \[2,3,1,1,4\] **Output:** t...
null
Array,Dynamic Programming,Greedy
Medium
45,1428,2001
1,888
hey everyone welcome back and let's write some more neat code today so today let's solve minimum number of flips to make the binary string alternating so this is a problem from today's leak code contest and i'm going to show you the big o of n squared time complexity solution and i'm going to show you how you can take ...
Minimum Number of Flips to Make the Binary String Alternating
find-nearest-point-that-has-the-same-x-or-y-coordinate
You are given a binary string `s`. You are allowed to perform two types of operations on the string in any sequence: * **Type-1: Remove** the character at the start of the string `s` and **append** it to the end of the string. * **Type-2: Pick** any character in `s` and **flip** its value, i.e., if its value is `'...
Iterate through each point, and keep track of the current point with the smallest Manhattan distance from your current location.
Array
Easy
1014
78
today's question the code78 subsets given an integer array numbers of unique elements return all possible subsets the power set the solution set must not contain duplicate subsets return the solution in any order so here we have an example we have a nums array which is one two three and then we just want to output all ...
Subsets
subsets
Given an integer array `nums` of **unique** elements, return _all possible_ _subsets_ _(the power set)_. The solution set **must not** contain duplicate subsets. Return the solution in **any order**. **Example 1:** **Input:** nums = \[1,2,3\] **Output:** \[\[\],\[1\],\[2\],\[1,2\],\[3\],\[1,3\],\[2,3\],\[1,2,3\]\] ...
null
Array,Backtracking,Bit Manipulation
Medium
90,320,800,2109,2170
188
hello everyone welcome to learn overflow in this video we'll discuss today's liquid problem that is the best time to buy sell stock four okay so this is a fourth level problem and obviously there are other three levels problem and i will make a videos on them as well so this is a hard level problem and we'll understand...
Best Time to Buy and Sell Stock IV
best-time-to-buy-and-sell-stock-iv
You are given an integer array `prices` where `prices[i]` is the price of a given stock on the `ith` day, and an integer `k`. Find the maximum profit you can achieve. You may complete at most `k` transactions: i.e. you may buy at most `k` times and sell at most `k` times. **Note:** You may not engage in multiple tran...
null
Array,Dynamic Programming
Hard
121,122,123
331
Hello hello everyone welcome to day 26th August previous notification is amazing free mode of realization of minority in this question Thursday subscribe and subscribe the Channel Distic will need not mean that not interested and moving from the president of tree not to withdraw The Candy Crush look at presentation at ...
Verify Preorder Serialization of a Binary Tree
verify-preorder-serialization-of-a-binary-tree
One way to serialize a binary tree is to use **preorder traversal**. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as `'#'`. For example, the above binary tree can be serialized to the string `"9,3,4,#,#,1,#,#,2,#,6,#,# "`, where `'#'` repres...
null
String,Stack,Tree,Binary Tree
Medium
null
589
hey everyone welcome back and today we will be doing another lead code problem five eight nine and array three P or the traversal so this is an easy one given the root of an energy return the prior traversal of its node values and array tree input serialization is represented in the lower order traversal each group of ...
N-ary Tree Preorder Traversal
n-ary-tree-preorder-traversal
Given the `root` of an n-ary tree, return _the preorder 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,5,6,2...
null
null
Easy
null
1,727
um hello so summary of largest submatrix with rearrangement summary of the solution um The Main Idea here is that we can do prefix sum with resetting when we get a zero right because for a submatrix we need consecutive ones and so and what we want to do next is maximize the number of ones in each column and so we sort ...
Largest Submatrix With Rearrangements
cat-and-mouse-ii
You are given a binary matrix `matrix` of size `m x n`, and you are allowed to rearrange the **columns** of the `matrix` in any order. Return _the area of the largest submatrix within_ `matrix` _where **every** element of the submatrix is_ `1` _after reordering the columns optimally._ **Example 1:** **Input:** matri...
Try working backward: consider all trivial states you know to be winning or losing, and work backward to determine which other states can be labeled as winning or losing.
Math,Dynamic Programming,Breadth-First Search,Graph,Memoization,Game Theory
Hard
805,949
37
Loot hello everyone welcome to difficult channel and definition of what do soul and justice should avoid you listen to there problems without it's subscribe and subscribe the Video then subscribe to the Page if you liked The Video then subscribe to the will the observance is destroyed to solve This question on the news...
Sudoku Solver
sudoku-solver
Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy **all of the following rules**: 1. Each of the digits `1-9` must occur exactly once in each row. 2. Each of the digits `1-9` must occur exactly once in each column. 3. Each of the digits `1-9` must occur exactly onc...
null
Array,Backtracking,Matrix
Hard
36,1022
1,748
hi my name is david and today we're going to start an exciting new series where we're going to pair program to solve algorithm problems i know that preparing for interviews solving algorithm problems can be a very frustrating and learning process so my vision for this is to show how fun and exciting solving these algor...
Sum of Unique Elements
best-team-with-no-conflicts
You are given an integer array `nums`. The unique elements of an array are the elements that appear **exactly once** in the array. Return _the **sum** of all the unique elements of_ `nums`. **Example 1:** **Input:** nums = \[1,2,3,2\] **Output:** 4 **Explanation:** The unique elements are \[1,3\], and the sum is 4. ...
First, sort players by age and break ties by their score. You can now consider the players from left to right. If you choose to include a player, you must only choose players with at least that score later on.
Array,Dynamic Programming,Sorting
Medium
null
1,859
hello guys today we are going to discuss the lead code problem which is sorting the sentence which is a very easy problem so first of all we will read the prompt and then we will try to understand what the problem is about it says a sentence is a list of words that are separated by a single space with no leading or tra...
Sorting the Sentence
change-minimum-characters-to-satisfy-one-of-three-conditions
A **sentence** is a list of words that are separated by a single space with no leading or trailing spaces. Each word consists of lowercase and uppercase English letters. A sentence can be **shuffled** by appending the **1-indexed word position** to each word then rearranging the words in the sentence. * For example...
Iterate on each letter in the alphabet, and check the smallest number of operations needed to make it one of the following: the largest letter in a and smaller than the smallest one in b, vice versa, or let a and b consist only of this letter. For the first 2 conditions, take care that you can only change characters to...
Hash Table,String,Counting,Prefix Sum
Medium
null
103
hey everybody how's it going so today we're going to solve the code 103 binary tree is the exact level order traversal so this question wants you to iterate through a binary tree and return the order of the nodes at each level in its exact matter so for example this is what the question wants us to do so we're going to...
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,647
hello and welcome to another video today we're going to be working on minimum deletions to make character frequencies unique and so in this problem you have a string s that's called good if there are no two different characters in s that have the same frequency given a string s return the minimum number of characters y...
Minimum Deletions to Make Character Frequencies Unique
can-convert-string-in-k-moves
A string `s` is called **good** if there are no two different characters in `s` that have the same **frequency**. Given a string `s`, return _the **minimum** number of characters you need to delete to make_ `s` _**good**._ The **frequency** of a character in a string is the number of times it appears in the string. F...
Observe that shifting a letter x times has the same effect of shifting the letter x + 26 times. You need to check whether k is large enough to cover all shifts with the same remainder after modulo 26.
Hash Table,String
Medium
null
9
in this video we're going to solve the palindrome number problem on lead code so the problem says given an integer X return true if x is a palindrome and follows otherwise so for example the number 121 is a palindrome because when you reverse it is still 121. 456 is not a pattern draw because when you reverse it is 654...
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
459
hello everyone in this lecture i am going to explain you about repeated substring pattern so here coming to a question given a string as check if it can be constructed by taking a substring of it and appending multiple copies of the substring together so coming to example one here they give an input for the string a b ...
Repeated Substring Pattern
repeated-substring-pattern
Given a string `s`, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. **Example 1:** **Input:** s = "abab " **Output:** true **Explanation:** It is the substring "ab " twice. **Example 2:** **Input:** s = "aba " **Output:** false **Example 3:** ...
null
String,String Matching
Easy
28,686
1,305
hey guys welcome back to another video and today we're going to be solving the leakout question all elements in two binary search trees all right so in this question we're given two binary search trees uh one of them is root one and then root two and we return a list containing all integers from both trees sorted in as...
All Elements in Two Binary Search Trees
number-of-visible-people-in-a-queue
Given two binary search trees `root1` and `root2`, return _a list containing all the integers from both trees sorted in **ascending** order_. **Example 1:** **Input:** root1 = \[2,1,4\], root2 = \[1,0,3\] **Output:** \[0,1,1,2,3,4\] **Example 2:** **Input:** root1 = \[1,null,8\], root2 = \[8,1\] **Output:** \[1,1,8...
How to solve this problem in quadratic complexity ? For every subarray start at index i, keep finding new maximum values until a value larger than arr[i] is found. Since the limits are high, you need a linear solution. Use a stack to keep the values of the array sorted as you iterate the array from the end to the start...
Array,Stack,Monotonic Stack
Hard
1909,2227
1,902
guys welcome back to another video this is educational code forces R 159 du2 and we're going to solve the first problem that is binary imbalance let's see what the problem States so we were given a string s it is consisting of uh only numbers like 0o and one so they are also telling that uh like 0 and 1 means it can be...
Depth of BST Given Insertion Order
car-fleet-ii
You are given a **0-indexed** integer array `order` of length `n`, a **permutation** of integers from `1` to `n` representing the **order** of insertion into a **binary search tree**. A binary search tree is defined as follows: * The left subtree of a node contains only nodes with keys **less than** the node's key....
We can simply ignore the merging of any car fleet, simply assume they cross each other. Now the aim is to find the first car to the right, which intersects with the current car before any other. Assume we have already considered all cars to the right already, now the current car is to be considered. Let’s ignore all ca...
Array,Math,Stack,Heap (Priority Queue),Monotonic Stack
Hard
883,2317
413
hey everybody this is larry this is day three of the leeco daddy march challenge hit the like button hit the subscribe button join me on discord let me know what you think what is this huh um but yeah uh so today it's been a little bit of a hectic day so hope you don't mind the weird setup i'm in a new place again beca...
Arithmetic Slices
arithmetic-slices
An integer array is called arithmetic if it consists of **at least three elements** and if the difference between any two consecutive elements is the same. * For example, `[1,3,5,7,9]`, `[7,7,7,7]`, and `[3,-1,-5,-9]` are arithmetic sequences. Given an integer array `nums`, return _the number of arithmetic **subarr...
null
Array,Dynamic Programming
Medium
446,1752
1,898
hey what's up guys uh this is chung here so this time uh lead code 1898 maximum number of removable characters i'm gonna upload this one okay so you're given like two strings s and p right where p is a subsequence of s and you're also given like a distinct zero index integer array removable containing a subset of indic...
Maximum Number of Removable Characters
leetflex-banned-accounts
You are given two strings `s` and `p` where `p` is a **subsequence** of `s`. You are also given a **distinct 0-indexed** integer array `removable` containing a subset of indices of `s` (`s` is also **0-indexed**). You want to choose an integer `k` (`0 <= k <= removable.length`) such that, after removing `k` characters...
null
Database
Medium
null
206
so we are given a linked list and we are given the hair of the singly linked list and we act are asked to reverse the list so basically what I'll be doing is we are flipping the arrows here so we flip the arrows from five to four from four to three to two to one then we get our reverse link list now what's what could b...
Reverse Linked List
reverse-linked-list
Given the `head` of a singly linked list, reverse the list, and return _the reversed list_. **Example 1:** **Input:** head = \[1,2,3,4,5\] **Output:** \[5,4,3,2,1\] **Example 2:** **Input:** head = \[1,2\] **Output:** \[2,1\] **Example 3:** **Input:** head = \[\] **Output:** \[\] **Constraints:** * The number...
null
Linked List,Recursion
Easy
92,156,234,2196,2236
152
we are going to solve maximum products sub array problem today it's a medium kind of problem on lead course it's a problem related to array so let's look for our problem statement we are given an integer array nums and we need to find out a sub array within the array that is the largest product and we need to return th...
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
309
hello and welcome back to the channel so today we are discussing lead code problem 309 and this is one of the many variations of stock Buy sell problem I've also added one hard level variation of stock buy and sell on the website so I added on the website because it is a blog post type of a tutorial and it is not possi...
Best Time to Buy and Sell Stock with Cooldown
best-time-to-buy-and-sell-stock-with-cooldown
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day. Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the following restrictions: * After you sell your stock, yo...
null
Array,Dynamic Programming
Medium
121,122
278
welcome ladies and gentlemen boys and girls today we're going to solve one of the coolest questions which is first bad person so basically what the question is saying like you are working in a product manager company okay you develop a new product unfortunately the version is not good it fails the quality check okay so...
First Bad Version
first-bad-version
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad. Suppose you have `n` versions `[1, 2, ..., n]` an...
null
Binary Search,Interactive
Easy
34,35,374
5
hello friends welcome to joy of life so today we are going to look at another medium level problem from lead code the problem number is 5 longest palindromic substring so given a string s return the longest palindromic substring in s so you'll be given with a string as you see in the example over here so here is one of...
Longest Palindromic Substring
longest-palindromic-substring
Given a string `s`, return _the longest_ _palindromic_ _substring_ in `s`. **Example 1:** **Input:** s = "babad " **Output:** "bab " **Explanation:** "aba " is also a valid answer. **Example 2:** **Input:** s = "cbbd " **Output:** "bb " **Constraints:** * `1 <= s.length <= 1000` * `s` consist of only dig...
How can we reuse a previously computed palindrome to compute a larger palindrome? If “aba” is a palindrome, is “xabax” a palindrome? Similarly is “xabay” a palindrome? Complexity based hint: If we use brute-force and check whether for every start and end position a substring is a palindrome we have O(n^2) start - end ...
String,Dynamic Programming
Medium
214,266,336,516,647
930
hey everybody this is Larry this is day 14 of the Leo day challenge hit the like button hit the Subscribe button join me on Discord if I could click on it uh let me know what you think about today's prom binary subarray with sum H seems like I haven't done this one before and we get to do it on this new UI where I will...
Binary Subarrays With Sum
all-possible-full-binary-trees
Given a binary array `nums` and an integer `goal`, return _the number of non-empty **subarrays** with a sum_ `goal`. A **subarray** is a contiguous part of the array. **Example 1:** **Input:** nums = \[1,0,1,0,1\], goal = 2 **Output:** 4 **Explanation:** The 4 subarrays are bolded and underlined below: \[**1,0,1**,0...
null
Dynamic Programming,Tree,Recursion,Memoization,Binary Tree
Medium
null
763
hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you've not liked the video please like it subscribe to my channel and hit the bell icon so that you get notified whenever post a new video so without any further ado let's get started proble...
Partition Labels
special-binary-string
You are given a string `s`. We want to partition the string into as many parts as possible so that each letter appears in at most one part. Note that the partition is done so that after concatenating all the parts in order, the resultant string should be `s`. Return _a list of integers representing the size of these ...
Draw a line from (x, y) to (x+1, y+1) if we see a "1", else to (x+1, y-1). A special substring is just a line that starts and ends at the same y-coordinate, and that is the lowest y-coordinate reached. Call a mountain a special substring with no special prefixes - ie. only at the beginning and end is the lowest y-coo...
String,Recursion
Hard
678
114
hello guys welcome back to take those and in this video we will see how to flatten a binary to a linked list this is from tree and a linked list problem based on tree traversal this is from lead code number 114 we will discuss all the important interview follow-up the important interview follow-up the important intervi...
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
62
hi everyone today we are going to describe the question unique pass so there are robots on M by n uh grid and then the robot is initially located at the top left corner here and then agree to zero and the robot tries to move to the bottom right corner here and that the robot can only move either down or right at any po...
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,291
Hello everyone welcome to my channel code sari with mike so today we are going to do video number 81 of our playlist lead code number 91 is ok medium mark but very simple two approachable look sequential digits name is question ka n integer zar has sequential Digits If and only if each digit in the number is one more t...
Sequential Digits
immediate-food-delivery-i
An integer has _sequential digits_ if and only if each digit in the number is one more than the previous digit. Return a **sorted** list of all the integers in the range `[low, high]` inclusive that have sequential digits. **Example 1:** **Input:** low = 100, high = 300 **Output:** \[123,234\] **Example 2:** **Inp...
null
Database
Easy
null
299
hello guys today we are going to look at the problem called poles and cows on lead code it is a famous google question so the question says you are playing the following bulls and cows game with your friend you write down a number and ask your friend to guess what the number is each time your friend makes a guess you p...
Bulls and Cows
bulls-and-cows
You are playing the **[Bulls and Cows](https://en.wikipedia.org/wiki/Bulls_and_Cows)** game with your friend. You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint with the following info: * The number of "bulls ", which are digits in the ...
null
Hash Table,String,Counting
Medium
null
930
Hello Everyone And Welcome Back To My Channel Algorithm Why Today I Am Going To Write The Core And Also Explain You All The Algorithm To Solve This Binary All Are With Some Problem Which Is There In Lead Code It Is Also Present In The Sliding Window And Two Pointer Section of Too Many DSA Sheet Which Makes It a Pretty ...
Binary Subarrays With Sum
all-possible-full-binary-trees
Given a binary array `nums` and an integer `goal`, return _the number of non-empty **subarrays** with a sum_ `goal`. A **subarray** is a contiguous part of the array. **Example 1:** **Input:** nums = \[1,0,1,0,1\], goal = 2 **Output:** 4 **Explanation:** The 4 subarrays are bolded and underlined below: \[**1,0,1**,0...
null
Dynamic Programming,Tree,Recursion,Memoization,Binary Tree
Medium
null
733
hey there so today's li coding challenge question it's called flat fill so what we have here is an image represented by a 2d array of integers it's a two-dimensional matrix and the integer two-dimensional matrix and the integer two-dimensional matrix and the integer represents the pixel value of the image from 0 to 65,...
Flood Fill
flood-fill
An image is represented by an `m x n` integer grid `image` where `image[i][j]` represents the pixel value of the image. You are also given three integers `sr`, `sc`, and `color`. You should perform a **flood fill** on the image starting from the pixel `image[sr][sc]`. To perform a **flood fill**, consider the startin...
Write a recursive function that paints the pixel if it's the correct color, then recurses on neighboring pixels.
Array,Depth-First Search,Breadth-First Search,Matrix
Easy
463
1,832
hello everyone so in this video we'll solve liquid problem number 1832 that is check if the sentence is pan gram so a pan gram is a sentence in which every letter of the English alphabet appears at least once so we are given a sentence or a string and we have to check if the sentence is pan gram or not and if it is a p...
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
48
Hands Free MP3 Like Problem Gets From Different Challenge Give The Problem Saint Petersburg President Of Russia Rooted S Ki Tempering Chaudhary Chalte Cement To Samhar Problem Special Dhatu Ko 200 The Year To Convert Matrix To Single Fold The Video then subscribe to the Page if you liked The Video then subscribe to the...
Rotate Image
rotate-image
You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise). You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati...
null
Array,Math,Matrix
Medium
2015
1,935
hey everybody it's payne here so today we're going to talk about the first question from nico weekly contest 250 it's called maximum number of words you can type so basically the question is there's a malfunction keyboard where some letter key do not work or the key on key will work properly you have a string text a wo...
Maximum Number of Words You Can Type
minimum-number-of-operations-to-reinitialize-a-permutation
There is a malfunctioning keyboard where some letter keys do not work. All other keys on the keyboard work properly. Given a string `text` of words separated by a single space (no leading or trailing spaces) and a string `brokenLetters` of all **distinct** letter keys that are broken, return _the **number of words** i...
It is safe to assume the number of operations isn't more than n The number is small enough to apply a brute force solution.
Array,Math,Simulation
Medium
null
1,367
Hua Hai Hua Hai Hello Everyone 2014 Linked List In Minority In This Problem Play List Specific Medicinal Uses And Have To Find The Meaning Of This Point To Sid Jaisi Na Liye Subscribe And To-Do List Play List Do A New Vihar To Things Which Have Any Five Years Two Things One Ever Held In One Hour Root And Root Par Stop ...
Linked List in Binary Tree
maximum-height-by-stacking-cuboids
Given a binary tree `root` and a linked list with `head` as the first node. Return True if all the elements in the linked list starting from the `head` correspond to some _downward path_ connected in the binary tree otherwise return False. In this context downward path means a path that starts at some node and goes d...
Does the dynamic programming sound like the right algorithm after sorting? Let's say box1 can be placed on top of box2. No matter what orientation box2 is in, we can rotate box1 so that it can be placed on top. Why don't we orient everything such that height is the biggest?
Array,Dynamic Programming,Sorting
Hard
2123
881
hey so welcome back in this another daily code problem so today is April 3rd and we got a question called boats to save people so let's take a look at it and so today's question is a medium level question and you're given a people array along with a corresponding limit and what you want to do is you are given an infini...
Boats to Save People
loud-and-rich
You are given an array `people` where `people[i]` is the weight of the `ith` person, and an **infinite number of boats** where each boat can carry a maximum weight of `limit`. Each boat carries at most two people at the same time, provided the sum of the weight of those people is at most `limit`. Return _the minimum n...
null
Array,Depth-First Search,Graph,Topological Sort
Medium
null
1,727
hello and welcome to another video in this problem we're going to be working on largest submatrix with rearrangements and in the problem you're given a binary Matrix of size M * n and given a binary Matrix of size M * n and given a binary Matrix of size M * n and you're allowed to rearrange The Columns of the Matrix in...
Largest Submatrix With Rearrangements
cat-and-mouse-ii
You are given a binary matrix `matrix` of size `m x n`, and you are allowed to rearrange the **columns** of the `matrix` in any order. Return _the area of the largest submatrix within_ `matrix` _where **every** element of the submatrix is_ `1` _after reordering the columns optimally._ **Example 1:** **Input:** matri...
Try working backward: consider all trivial states you know to be winning or losing, and work backward to determine which other states can be labeled as winning or losing.
Math,Dynamic Programming,Breadth-First Search,Graph,Memoization,Game Theory
Hard
805,949
654
all right guys so let's talk about maximum binary tree so you are given an array but integer already numbs with no duplicated and a maximum binary tree can be built recursively from nums using the following algorithm so you can actually just know this is pretty standard binary tree so the idea is you find the maximum a...
Maximum Binary Tree
maximum-binary-tree
You are given an integer array `nums` with no duplicates. A **maximum binary tree** can be built recursively from `nums` using the following algorithm: 1. Create a root node whose value is the maximum value in `nums`. 2. Recursively build the left subtree on the **subarray prefix** to the **left** of the maximum val...
null
Array,Divide and Conquer,Stack,Tree,Monotonic Stack,Binary Tree
Medium
1040
1,463
welcome let's continue to solve another lead code problem 1463 Cherry pickup two if you've solved Cherry pickup one problem normally this one should be easier for you can just copy and paste the template yeah uh the only difference is that we have two robot number one the number two so the number one will be stting at ...
Cherry Pickup II
the-k-weakest-rows-in-a-matrix
You are given a `rows x cols` matrix `grid` representing a field of cherries where `grid[i][j]` represents the number of cherries that you can collect from the `(i, j)` cell. You have two robots that can collect cherries for you: * **Robot #1** is located at the **top-left corner** `(0, 0)`, and * **Robot #2** is...
Sort the matrix row indexes by the number of soldiers and then row indexes.
Array,Binary Search,Sorting,Heap (Priority Queue),Matrix
Easy
null
1,816
hey guys welcome back to the channel in today's video we're going to look at a lead code problem and the problem's name is truncate sentence in this question we're given a string s which contains a list of words that are separated by a single space each word consists of only lowercase or uppercase english letters there...
Truncate Sentence
lowest-common-ancestor-of-a-binary-tree-iv
A **sentence** is a list of words that are separated by a single space with no leading or trailing spaces. Each of the words consists of **only** uppercase and lowercase English letters (no punctuation). * For example, `"Hello World "`, `"HELLO "`, and `"hello world hello world "` are all sentences. You are given a...
Starting from the root, traverse the left and the right subtrees, checking if one of the nodes exist there. If one of the subtrees doesn't contain any given node, the LCA can be the node returned from the other subtree If both subtrees contain nodes, the LCA node is the current node.
Tree,Depth-First Search,Binary Tree
Medium
235,236,1218,1780,1790,1816
1,622
hey what's up guys this is john here again so uh so let's take a look at uh the last problem of this week's bi-weekly contest bi-weekly contest bi-weekly contest which is number 1622 fancy sequence so this one is like a design type problem you know i figured it's a pretty it's pretty nice problem okay so you're given l...
Fancy Sequence
max-value-of-equation
Write an API that generates fancy sequences using the `append`, `addAll`, and `multAll` operations. Implement the `Fancy` class: * `Fancy()` Initializes the object with an empty sequence. * `void append(val)` Appends an integer `val` to the end of the sequence. * `void addAll(inc)` Increments all existing value...
Use a priority queue to store for each point i, the tuple [yi-xi, xi] Loop through the array and pop elements from the heap if the condition xj - xi > k, where j is the current index and i is the point on top the queue. After popping elements from the queue. If the queue is not empty, calculate the equation with the cu...
Array,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue
Hard
2036
841
in this video i will show you how to solve keys and rooms from lead code so the question says there are n rooms labeled from 0 2 and -1 and all the rooms are locked except -1 and all the rooms are locked except -1 and all the rooms are locked except for room 0. your goal is to visit all the rooms however you cannot ent...
Keys and Rooms
shortest-distance-to-a-character
There are `n` rooms labeled from `0` to `n - 1` and all the rooms are locked except for room `0`. Your goal is to visit all the rooms. However, you cannot enter a locked room without having its key. When you visit a room, you may find a set of **distinct keys** in it. Each key has a number on it, denoting which room i...
null
Array,Two Pointers,String
Easy
null
784
welcome to february's leeco challenge today's problem is letter case permutation given a string s we can transform every letter individually to be lowercase or uppercase to create another string return a list of all possible strings we could create you could return the output in any order so we had string a1 b2 we can ...
Letter Case Permutation
insert-into-a-binary-search-tree
Given a string `s`, you can transform every letter individually to be lowercase or uppercase to create another string. Return _a list of all possible strings we could create_. Return the output in **any order**. **Example 1:** **Input:** s = "a1b2 " **Output:** \[ "a1b2 ", "a1B2 ", "A1b2 ", "A1B2 "\] **Example 2:*...
null
Tree,Binary Search Tree,Binary Tree
Medium
783
65
thank you morning YouTubers so here it's about 8 A.M at your place it might be like 2 A.M A.M at your place it might be like 2 A.M A.M at your place it might be like 2 A.M and you're facing this difficult issue and you just want to get out of the office what are you doing in the office at 2 am anyway um this video will...
Valid Number
valid-number
A **valid number** can be split up into these components (in order): 1. A **decimal number** or an **integer**. 2. (Optional) An `'e'` or `'E'`, followed by an **integer**. A **decimal number** can be split up into these components (in order): 1. (Optional) A sign character (either `'+'` or `'-'`). 2. One of the...
null
String
Hard
8
795
Scientist Dr Hello Hi Guys And How Are You I Am Positive In Good Saunf Ballu Number Of Resident Maximum Kar 119 To Send A Deep Into The Behavior When They Are And Have Left Bhavnagar Oil Bond We Have To Return The Number Of Continuous And Not S Well a survey research labs maximum element in there is at least left most ...
Number of Subarrays with Bounded Maximum
k-th-symbol-in-grammar
Given an integer array `nums` and two integers `left` and `right`, return _the number of contiguous non-empty **subarrays** such that the value of the maximum array element in that subarray is in the range_ `[left, right]`. The test cases are generated so that the answer will fit in a **32-bit** integer. **Example 1:...
Try to represent the current (N, K) in terms of some (N-1, prevK). What is prevK ?
Math,Bit Manipulation,Recursion
Medium
null
353
okay so lead code practice question design snake game so in this video i'm going to introduce the solution for this specific question and i'm also going to go through uh the general procedure we should follow in a real code interview so let's get started so remember the first step in the ryokoni interview is try to und...
Design Snake Game
design-snake-game
Design a [Snake game](https://en.wikipedia.org/wiki/Snake_(video_game)) that is played on a device with screen size `height x width`. [Play the game online](http://patorjk.com/games/snake/) if you are not familiar with the game. The snake is initially positioned at the top left corner `(0, 0)` with a length of `1` uni...
null
Array,Design,Queue,Matrix
Medium
null
879
Hello gas I am Lalita Agarwal welcome tu jo on your on coding challenge made by you made on you so late na start tu days late tomorrow problem today's late problem kya bol rahi hai achcha before going tu problem na 1 minutes station par dose jinko This problem has been understood well and there are six questions to try...
Profitable Schemes
maximize-distance-to-closest-person
There is a group of `n` members, and a list of various crimes they could commit. The `ith` crime generates a `profit[i]` and requires `group[i]` members to participate in it. If a member participates in one crime, that member can't participate in another crime. Let's call a **profitable scheme** any subset of these cr...
null
Array
Medium
885
383
welcome ladies and gentlemen boys and girls today we're going to solve another coolest problem which is ransom north so basically this problem is awesome so basically what we're doing this problem so we have given a magazine and using that magazine we have to generate our random node okay so what did i mean by that by ...
Ransom Note
ransom-note
Given two strings `ransomNote` and `magazine`, return `true` _if_ `ransomNote` _can be constructed by using the letters from_ `magazine` _and_ `false` _otherwise_. Each letter in `magazine` can only be used once in `ransomNote`. **Example 1:** **Input:** ransomNote = "a", magazine = "b" **Output:** false **Example ...
null
Hash Table,String,Counting
Easy
691
735
On Collision And this is a daily challenge problem for the lead and we will talk about this. The problem is to understand the problem. What the problem is that you are given the area of ​​an asteroid you are given the area of ​​an asteroid you are given the area of ​​an asteroid and what you have to do with the asteroi...
Asteroid Collision
asteroid-collision
We are given an array `asteroids` of integers representing asteroids in a row. For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed. Find out the state of the asteroids after all collisio...
Say a row of asteroids is stable. What happens when a new asteroid is added on the right?
Array,Stack
Medium
605,2245,2317
259
what's up guys give Iran here today is gonna be helping us and drawing and wanted some attention so giving them it okay so today I'm going over a three some smaller I've been doing a lot of raised problems I'm gonna finish like three some for some and three some closest and I'm probably gonna move on to harder linked l...
3Sum Smaller
3sum-smaller
Given an array of `n` integers `nums` and an integer `target`, find the number of index triplets `i`, `j`, `k` with `0 <= i < j < k < n` that satisfy the condition `nums[i] + nums[j] + nums[k] < target`. **Example 1:** **Input:** nums = \[-2,0,1,3\], target = 2 **Output:** 2 **Explanation:** Because there are two tri...
null
Array,Two Pointers,Binary Search,Sorting
Medium
15,16,611,1083
936
Hello guys welcome subscribe Gautam Saeed subscribe And subscribe The Amazing subscribe quote zero commando fuel subsidy subscribe problem nuvve subscribe and subscribe the Channel subscribe final patience with video remove the photo in this direction Veronique watching this point subscribe my channel subscribe must su...
Stamping The Sequence
rle-iterator
You are given two strings `stamp` and `target`. Initially, there is a string `s` of length `target.length` with all `s[i] == '?'`. In one turn, you can place `stamp` over `s` and replace every letter in the `s` with the corresponding letter from `stamp`. * For example, if `stamp = "abc "` and `target = "abcba "`, t...
null
Array,Design,Counting,Iterator
Medium
null
73
two so uh today we're doing actually the first medium problem um i've done it's number 73 set matrix is zeros and the concept behind it is you are given a matrix which is you know x and y rows and columns and you have to set the adjacent rows and columns of that zero to be zero for this one it's like top and bottom lef...
Set Matrix Zeroes
set-matrix-zeroes
Given an `m x n` integer matrix `matrix`, if an element is `0`, set its entire row and column to `0`'s. You must do it [in place](https://en.wikipedia.org/wiki/In-place_algorithm). **Example 1:** **Input:** matrix = \[\[1,1,1\],\[1,0,1\],\[1,1,1\]\] **Output:** \[\[1,0,1\],\[0,0,0\],\[1,0,1\]\] **Example 2:** **In...
If any cell of the matrix has a zero we can record its row and column number using additional memory. But if you don't want to use extra memory then you can manipulate the array instead. i.e. simulating exactly what the question says. Setting cell values to zero on the fly while iterating might lead to discrepancies. ...
Array,Hash Table,Matrix
Medium
289,2244,2259,2314
219
hey everyone welcome back and let's write some more neat code today so today let's solve the problem contains duplicate two we're given an integer array of nums and an integer K we want to return true if there are two distinct indices I and J such that the two values at those indices are equal and the absolute value di...
Contains Duplicate II
contains-duplicate-ii
Given an integer array `nums` and an integer `k`, return `true` _if there are two **distinct indices**_ `i` _and_ `j` _in the array such that_ `nums[i] == nums[j]` _and_ `abs(i - j) <= k`. **Example 1:** **Input:** nums = \[1,2,3,1\], k = 3 **Output:** true **Example 2:** **Input:** nums = \[1,0,1,1\], k = 1 **Outp...
null
Array,Hash Table,Sliding Window
Easy
217,220
383
okay 383 ransom note given an arbitrary ransom note string and another string containing that is from all the magazines write a function that returns true if the ransom note can be constructed for magazines otherwise it will return for us each letter and the magazine string can be used to once in your ransom note you m...
Ransom Note
ransom-note
Given two strings `ransomNote` and `magazine`, return `true` _if_ `ransomNote` _can be constructed by using the letters from_ `magazine` _and_ `false` _otherwise_. Each letter in `magazine` can only be used once in `ransomNote`. **Example 1:** **Input:** ransomNote = "a", magazine = "b" **Output:** false **Example ...
null
Hash Table,String,Counting
Easy
691
239
Hello everyone welcome to my channel weed, question number 239 of Azamgarh whose name is Sliding window maximum, this question is asked in Amazon and Microsoft and if you want to read these hard marks then what is the meaning and take some sliding window in it, this is of free size. If there is a window then it will al...
Sliding Window Maximum
sliding-window-maximum
You are given an array of integers `nums`, there is a sliding window of size `k` which is moving from the very left of the array to the very right. You can only see the `k` numbers in the window. Each time the sliding window moves right by one position. Return _the max sliding window_. **Example 1:** **Input:** nums...
How about using a data structure such as deque (double-ended queue)? The queue size need not be the same as the window’s size. Remove redundant elements and the queue should store only elements that need to be considered.
Array,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue
Hard
76,155,159,265,1814
1,942
That today we will discuss aa list ko problem 194 so 18 smallest number of small extent that chair so what is given here is a party where in fur and wide web 000 and last date - one okay zero inductor last date - one okay zero inductor last date - one okay zero inductor after that In the party with infinite number of c...
The Number of the Smallest Unoccupied Chair
primary-department-for-each-employee
There is a party where `n` friends numbered from `0` to `n - 1` are attending. There is an **infinite** number of chairs in this party that are numbered from `0` to `infinity`. When a friend arrives at the party, they sit on the unoccupied chair with the **smallest number**. * For example, if chairs `0`, `1`, and `5...
null
Database
Easy
null
43
That a Hello Everyone Welcome Debit Challenge And IF YOU ARE WRONG WITH LAST YADAV AND SUBSCRIBE subscribe to the Video then subscribe to the Page if you liked The Video then subscribe to subscribe our THIS IS WORLD'S QUESTION PROXIMITY ESSAY SUBSCRIBE PLACEMENT SESSION INCOMPLETE LONG INTERESTED Subscribe to Multiply ...
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
885
welcome to my channel so in this video i'm going to introduce a solution for this lead code question called spiral matrix 3 and also at the same time i'm going to introduce briefly about the steps we should follow in the real interview so let's get started remember the first thing here in the real interview is always t...
Spiral Matrix III
exam-room
You start at the cell `(rStart, cStart)` of an `rows x cols` grid facing east. The northwest corner is at the first row and column in the grid, and the southeast corner is at the last row and column. You will walk in a clockwise spiral shape to visit every position in this grid. Whenever you move outside the grid's bo...
null
Design,Ordered Set
Medium
879
929
yeahyeah Hi everyone, I'm a programmer. Today I'll introduce to you a few math problems with the following titles, email addresses, and detailed lyrics as follows for each email. then we will contain two components, one is local Nam which is the local name and do ta me wedge which is the domain name and is separated by...
Unique Email Addresses
groups-of-special-equivalent-strings
Every **valid email** consists of a **local name** and a **domain name**, separated by the `'@'` sign. Besides lowercase letters, the email may contain one or more `'.'` or `'+'`. * For example, in `"alice@leetcode.com "`, `"alice "` is the **local name**, and `"leetcode.com "` is the **domain name**. If you add pe...
null
Array,Hash Table,String
Medium
null
326
this liquid challenge is power of 3 and it's number 326. giving an integer n we have to return true if it's a power of 3. otherwise we have to return false an integer N is a power of 3 if there exists an integer called X such that 3 to the power of x equals n this is an example if n is 27 then 3 to the power of 3 is eq...
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
315
three 15 count of smaller numbers after self you're giving it an integer away numbers you have to return new counter way the counter where has the probably where it counts up I is the number of smaller elements to the right of number supply okay hmm my intuition is that there's some sort of stack things here no maybe n...
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
64
64 minimum pass sum from let's go given and by n grade 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 bottom right which minimize the sum of all numbers along the past you can only move either down or right so let's see how this que...
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
95
difference welcome to follow up let's have a look at problem 95 unique binary search tree is 2. so here we're going to explain a solution based on recursion so here we are given an integer in so we want to return all the structurally unique binary search trees so which has exactly nodes of unique values from in the eve...
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
1,359
Channel on Jhal Hello and Welcome so today we will question 1359 account all valid points delivery option is enjoyable what has been happening so basically it is given that so I will be Android this and at that minute its pickup and delivery will have been done okay means years was If it is opposed then its pickup has ...
Count All Valid Pickup and Delivery Options
circular-permutation-in-binary-representation
Given `n` orders, each order consist in pickup and delivery services. Count all valid pickup/delivery possible sequences such that delivery(i) is always after of pickup(i). Since the answer may be too large, return it modulo 10^9 + 7. **Example 1:** **Input:** n = 1 **Output:** 1 **Explanation:** Unique order (P1, ...
Use gray code to generate a n-bit sequence. Rotate the sequence such that its first element is start.
Math,Backtracking,Bit Manipulation
Medium
null
406
hey hello there uh today's liquid in challenge question it's called q reconstruction by height suppose we have a random list of people standing in a queue so since it's killed there's the notion of franken front and back each person is described by the pair of numbers h and k h is the height of the person k is the numb...
Queue Reconstruction by Height
queue-reconstruction-by-height
You are given an array of people, `people`, which are the attributes of some people in a queue (not necessarily in order). Each `people[i] = [hi, ki]` represents the `ith` person of height `hi` with **exactly** `ki` other people in front who have a height greater than or equal to `hi`. Reconstruct and return _the queu...
What can you say about the position of the shortest person? If the position of the shortest person is i, how many people would be in front of the shortest person? Once you fix the position of the shortest person, what can you say about the position of the second shortest person?
Array,Greedy,Binary Indexed Tree,Segment Tree,Sorting
Medium
315
1,846
so hello everyone today we will be solving the lead code daily challenge problem that is uh 1846 maximum element after decreasing and rearranging so we will be given an array of positive integers uh we have to perform some operations on the array so that it satisfies the given conditions we are given the conditions the...
Maximum Element After Decreasing and Rearranging
maximum-element-after-decreasing-and-rearranging
You are given an array of positive integers `arr`. Perform some operations (possibly none) on `arr` so that it satisfies these conditions: * The value of the **first** element in `arr` must be `1`. * The absolute difference between any 2 adjacent elements must be **less than or equal to** `1`. In other words, `abs...
null
null
Medium
null
378
hi everyone welcome to tech geek so today we are back with the daily lead code challenge problem that's skate smallest element in a sorted matrix apparently this is a medium question of lead code that's a medium 378 if you ask me this question is quite common in your always and specifically your pr one so if you're app...
Kth Smallest Element in a Sorted Matrix
kth-smallest-element-in-a-sorted-matrix
Given an `n x n` `matrix` where each of the rows and columns is sorted in ascending order, return _the_ `kth` _smallest element in the matrix_. Note that it is the `kth` smallest element **in the sorted order**, not the `kth` **distinct** element. You must find a solution with a memory complexity better than `O(n2)`....
null
Array,Binary Search,Sorting,Heap (Priority Queue),Matrix
Medium
373,668,719,802
35
and welcome back to the cracking fan YouTube channel today we're going to be solving lead code problem number 35 search insert index let's read the question prompt given a sorted array of distinct integers and a Target value return the index if the target is found if not return the index where it would be if it were in...
Search Insert Position
search-insert-position
Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You must write an algorithm with `O(log n)` runtime complexity. **Example 1:** **Input:** nums = \[1,3,5,6\], target = 5 **Output:** 2 **Exa...
null
Array,Binary Search
Easy
278
1,488
Hello Everyone Welcome To Disseminate Now That's This Video Channel And Asked Question This Account Good Notes In Binary Tree In Desperation Video Subscribe Definition More Notes Printed Subscribe Must Click Subscribe Button 9 We Were Best Friend Advisory Services Sample This 3453 The Good Road Tarzan Ki UNAUTHORIZED P...
Avoid Flood in The City
sort-integers-by-the-power-value
Your country has an infinite number of lakes. Initially, all the lakes are empty, but when it rains over the `nth` lake, the `nth` lake becomes full of water. If it rains over a lake that is **full of water**, there will be a **flood**. Your goal is to avoid floods in any lake. Given an integer array `rains` where: *...
Use dynamic programming to get the power of each integer of the intervals. Sort all the integers of the interval by the power value and return the k-th in the sorted list.
Dynamic Programming,Memoization,Sorting
Medium
null
1,200
Hello friends so today I'm going to solve the minimum absolute difference question in this question we have been given an array distinct integers a r we have to find all the pair of elements with the minimum absolute difference of any two elements and return a list of pairs in ascending order with respect to each pair ...
Minimum Absolute Difference
remove-interval
Given an array of **distinct** integers `arr`, find all pairs of elements with the minimum absolute difference of any two elements. Return a list of pairs in ascending order(with respect to pairs), each pair `[a, b]` follows * `a, b` are from `arr` * `a < b` * `b - a` equals to the minimum absolute difference o...
Solve the problem for every interval alone. Divide the problem into cases according to the position of the two intervals.
Array
Medium
null
1,024
all right let's talk about the video stitching so uh you are giving a clip array and a clip array contains starting time and ending time so you also have a time uh which is from zero to time interval and you want to know how many minimum clip you can add right so for example from zero to ten right uh i can have zero tw...
Video Stitching
triples-with-bitwise-and-equal-to-zero
You are given a series of video clips from a sporting event that lasted `time` seconds. These video clips can be overlapping with each other and have varying lengths. Each video clip is described by an array `clips` where `clips[i] = [starti, endi]` indicates that the ith clip started at `starti` and ended at `endi`. ...
null
Array,Hash Table,Bit Manipulation
Hard
null
153
liquid problem 153 find minimum in rotated sorted array so this problem gives us an array that could be rotated something like this right so in this case the left side is sorted and the right side is sorted but the right side sorted array is smaller than the left sides of that array and then our goal is to find the min...
Find Minimum in Rotated Sorted Array
find-minimum-in-rotated-sorted-array
Suppose an array of length `n` sorted in ascending order is **rotated** between `1` and `n` times. For example, the array `nums = [0,1,2,4,5,6,7]` might become: * `[4,5,6,7,0,1,2]` if it was rotated `4` times. * `[0,1,2,4,5,6,7]` if it was rotated `7` times. Notice that **rotating** an array `[a[0], a[1], a[2], ....
Array was originally in ascending order. Now that the array is rotated, there would be a point in the array where there is a small deflection from the increasing sequence. eg. The array would be something like [4, 5, 6, 7, 0, 1, 2]. You can divide the search space into two and see which direction to go. Can you think ...
Array,Binary Search
Medium
33,154
763
Hello hello everybody welcome to my channel let's all the record problem partition labels 100 spring fest of lower case english letters give you want to partition this string into as many people as possible so that is latest updates in the most one part and return list of Business reduce size of this can be divided int...
Partition Labels
special-binary-string
You are given a string `s`. We want to partition the string into as many parts as possible so that each letter appears in at most one part. Note that the partition is done so that after concatenating all the parts in order, the resultant string should be `s`. Return _a list of integers representing the size of these ...
Draw a line from (x, y) to (x+1, y+1) if we see a "1", else to (x+1, y-1). A special substring is just a line that starts and ends at the same y-coordinate, and that is the lowest y-coordinate reached. Call a mountain a special substring with no special prefixes - ie. only at the beginning and end is the lowest y-coo...
String,Recursion
Hard
678
1,220
Hello hello everyone welcome back on the chain itself is going to call the next problems liquid July challenge has a problem account top sperm station so what to do in this problem is given to us and we can make and which this after that similarly around And by subscribing to us, we can see the total as many as they ca...
Count Vowels Permutation
smallest-sufficient-team
Given an integer `n`, your task is to count how many strings of length `n` can be formed under the following rules: * Each character is a lower case vowel (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`) * Each vowel `'a'` may only be followed by an `'e'`. * Each vowel `'e'` may only be followed by an `'a'` or an `'i'`. * ...
Do a bitmask DP. For each person, for each set of skills, we can update our understanding of a minimum set of people needed to perform this set of skills.
Array,Dynamic Programming,Bit Manipulation,Bitmask
Hard
2105,2114
155
lead code problem 155 means stack so this problem asks us to design a stack that supports push pop top and retrieving the minimum element in constant time which is o1 right so for what is mean stack I am using a vector as a stack inside the vector I'm storing a pair right so the most important thing to note is this get...
Min Stack
min-stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the `MinStack` class: * `MinStack()` initializes the stack object. * `void push(int val)` pushes the element `val` onto the stack. * `void pop()` removes the element on the top of the stack. * `int top(...
Consider each node in the stack having a minimum value. (Credits to @aakarshmadhavan)
Stack,Design
Easy
239,716
377
Hello hello hi guys welcome to the video desi beats folding padegi to sab problem school combination complete selection are distributed more than possible combinations for example total number of element points 142 200 how to use element to make for support yash let's check first year using one To Make For So How Can Y...
Combination Sum IV
combination-sum-iv
Given an array of **distinct** integers `nums` and a target integer `target`, return _the number of possible combinations that add up to_ `target`. The test cases are generated so that the answer can fit in a **32-bit** integer. **Example 1:** **Input:** nums = \[1,2,3\], target = 4 **Output:** 7 **Explanation:** Th...
null
Array,Dynamic Programming
Medium
39