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
939
Hello Hi Everyone Should Specifically To ISBT Solving All This Question So Question Is Medium Will Keep Software Setup Points In Explain Demand To Know Area Of Rectangle From This Point Side First To Egg White To This Sex So 200 Report For Clarity Aa Now Return To This Point And Nandgaon 209 Disawar Looks Pride Soft Qu...
Minimum Area Rectangle
valid-permutations-for-di-sequence
You are given an array of points in the **X-Y** plane `points` where `points[i] = [xi, yi]`. Return _the minimum area of a rectangle formed from these points, with sides parallel to the X and Y axes_. If there is not any such rectangle, return `0`. **Example 1:** **Input:** points = \[\[1,1\],\[1,3\],\[3,1\],\[3,3\]...
null
Dynamic Programming
Hard
null
131
hello everyone welcome back here is my Amazon and today we will try to solve one of the top 100 likes this problem and maybe this one polynomial partitioning medium so I haven't tried it yet so I will try to solve it in Python and what it's about so it's involving palindromes and backtracking so it sounds quite interes...
Palindrome Partitioning
palindrome-partitioning
Given a string `s`, partition `s` such that every substring of the partition is a **palindrome**. Return _all possible palindrome partitioning of_ `s`. **Example 1:** **Input:** s = "aab" **Output:** \[\["a","a","b"\],\["aa","b"\]\] **Example 2:** **Input:** s = "a" **Output:** \[\["a"\]\] **Constraints:** * `1...
null
String,Dynamic Programming,Backtracking
Medium
132,1871
1,848
hello guys myself swapnil I am now telling you an answer of minimum distance to the Target element uh actually in this question they are asking their question that is a q1 and integer Arena during texture means zero to n and two integers Target and start find an index I such that Norms of I equal to G Target means When...
Minimum Distance to the Target Element
sum-of-unique-elements
Given an integer array `nums` **(0-indexed)** and two integers `target` and `start`, find an index `i` such that `nums[i] == target` and `abs(i - start)` is **minimized**. Note that `abs(x)` is the absolute value of `x`. Return `abs(i - start)`. It is **guaranteed** that `target` exists in `nums`. **Example 1:** **...
Use a dictionary to count the frequency of each number.
Array,Hash Table,Counting
Easy
null
416
Hello hello guys welcome back to back door sign in this video you will see the partition total subsidy less problem which from list number 410 six pieces variation from 90 problem and observation of subset same problem solve latest problem statement in this problem Thursday positive entries Into two subscribe so let's ...
Partition Equal Subset Sum
partition-equal-subset-sum
Given an integer array `nums`, return `true` _if you can partition the array into two subsets such that the sum of the elements in both subsets is equal or_ `false` _otherwise_. **Example 1:** **Input:** nums = \[1,5,11,5\] **Output:** true **Explanation:** The array can be partitioned as \[1, 5, 5\] and \[11\]. **E...
null
Array,Dynamic Programming
Medium
698,2108,2135,2162
956
hi everyone in today challenge we are going to solve this problem the problem name is tallestly billboard and the problem number is nine five six well it is as usual first of all we are going to clearly understand this problem statement after that we are going to move to the logic part we are going to see how we can so...
Tallest Billboard
number-of-music-playlists
You are installing a billboard and want it to have the largest height. The billboard will have two steel supports, one on each side. Each steel support must be an equal height. You are given a collection of `rods` that can be welded together. For example, if you have rods of lengths `1`, `2`, and `3`, you can weld the...
null
Math,Dynamic Programming,Combinatorics
Hard
null
347
hi everyone let's continue with today lead code problems so today we are going to solve it for problem number 347 that is top K frequent elements so let's go through the column statement first so given an interior array nums and an integer K we need to return the most frequent elements okay most frequent elements and w...
Top K Frequent Elements
top-k-frequent-elements
Given an integer array `nums` and an integer `k`, return _the_ `k` _most frequent elements_. You may return the answer in **any order**. **Example 1:** **Input:** nums = \[1,1,1,2,2,3\], k = 2 **Output:** \[1,2\] **Example 2:** **Input:** nums = \[1\], k = 1 **Output:** \[1\] **Constraints:** * `1 <= nums.lengt...
null
Array,Hash Table,Divide and Conquer,Sorting,Heap (Priority Queue),Bucket Sort,Counting,Quickselect
Medium
192,215,451,659,692,1014,1919
204
Hello friends, in my video today, I am going to tell you which prince's blog will be given a number and before that all the prime numbers will tell you their account, if one is then how many prime numbers before 10:00. Numbers are for but how many prime numbers before 10:00. Numbers are for but how many prime numbers b...
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
516
That Hello friends, welcome to the video, question number 516 loot code longest first intro mixture sequence is a medium level question, the question is the question of DP, you guys will get the internet, it was asked in LinkedIn, let's start the question said give in spring gas, okay one String is given, what is it yo...
Longest Palindromic Subsequence
longest-palindromic-subsequence
Given a string `s`, find _the longest palindromic **subsequence**'s length in_ `s`. A **subsequence** is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. **Example 1:** **Input:** s = "bbbab " **Output:** 4 **Explanation:** On...
null
String,Dynamic Programming
Medium
5,647,730,1250,1822,1897,2130
50
Jhal which hair serum will use we select bank on express new generation in hatred power function have to keep it use that power com that we have by clicking entrenchment you are and victimization is that power is x squared minus one that a score And minus one times that and minus one times can apply by applying Mata, n...
Pow(x, n)
powx-n
Implement [pow(x, n)](http://www.cplusplus.com/reference/valarray/pow/), which calculates `x` raised to the power `n` (i.e., `xn`). **Example 1:** **Input:** x = 2.00000, n = 10 **Output:** 1024.00000 **Example 2:** **Input:** x = 2.10000, n = 3 **Output:** 9.26100 **Example 3:** **Input:** x = 2.00000, n = -2 **...
null
Math,Recursion
Medium
69,372
208
hey guys welcome back to another leak code problem solving tutorial and in this tutorial I'm going to be showing you guys how to solve leak code problem 208 which is asking us to implement a data structure called a try or a prefix tree so a prefix tree is basically just a special type of tree which starts at a root nod...
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
1,706
Hello friends, today we will discuss the solution of leadcoat's daily problem 1706 Where will the ball fall, so let's see the problem statement, the statement of this problem will be. And we have to take this hypothetical man that the problem ball will be given and you can move it diagonally from any index position of ...
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
456
Hello Everyone Welcome To Krishna Buddha Osho Hindi Speech Will See The Question 56232 Pattern Solid Is The Most Electrification In Terms Of Vikas Ki Maz Par Question And Also Like Question And See The President Even A Leaf Integers Numbers The Name Of Are 132 Pattern Subsequent To This And Subsequent Stage Chief Conti...
132 Pattern
132-pattern
Given an array of `n` integers `nums`, a **132 pattern** is a subsequence of three integers `nums[i]`, `nums[j]` and `nums[k]` such that `i < j < k` and `nums[i] < nums[k] < nums[j]`. Return `true` _if there is a **132 pattern** in_ `nums`_, otherwise, return_ `false`_._ **Example 1:** **Input:** nums = \[1,2,3,4\] ...
null
Array,Binary Search,Stack,Monotonic Stack,Ordered Set
Medium
null
95
hello everyone in this video we will be solving the problem unique binary search trees 2. the problem statement is given an integer n return all structurally unique binary search trees which has exactly n nodes of unique values from 1 to n if you look at example number 1 the given n is 3 and we need to return all the p...
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,722
hi friends uh let's have a look at problem 1722 minimize Hamming distance of slap operations so in this video we're going to explain a solution based on the strategy split and comparison so first I'm going to digest the problem statement and the requirements and then we analyze um the algorthm and finally we design the...
Minimize Hamming Distance After Swap Operations
throne-inheritance
You are given two integer arrays, `source` and `target`, both of length `n`. You are also given an array `allowedSwaps` where each `allowedSwaps[i] = [ai, bi]` indicates that you are allowed to swap the elements at index `ai` and index `bi` **(0-indexed)** of array `source`. Note that you can swap elements at a specifi...
Create a tree structure of the family. Without deaths, the order of inheritance is simply a pre-order traversal of the tree. Mark the dead family members tree nodes and don't include them in the final order.
Hash Table,Tree,Depth-First Search,Design
Medium
2104
650
hey everybody this is Larry this is me trying to do an extra prom we got a couple of Yeezy proms today so we like to do something that I haven't done yet maybe it's easy but at least I haven't done yet all we're going to have a medium prom uh 650 2 key 2 Keys keyboard let's take a look hope everyone's having a good day...
2 Keys Keyboard
2-keys-keyboard
There is only one character `'A'` on the screen of a notepad. You can perform one of two operations on this notepad for each step: * Copy All: You can copy all the characters present on the screen (a partial copy is not allowed). * Paste: You can paste the characters which are copied last time. Given an integer `...
How many characters may be there in the clipboard at the last step if n = 3? n = 7? n = 10? n = 24?
Math,Dynamic Programming
Medium
651,1033
79
Day 23 years see the play list, my name is Mukesh and you are seeing the ticket, so today I will explain the question to you, take the question sample, we have been given admin 2nd grade and this board we have is Brahmeshwar Do, the question, I will bore you and both. If it is kept then I have to find ABCD and I cannot...
Word Search
word-search
Given an `m x n` grid of characters `board` and a string `word`, return `true` _if_ `word` _exists in the grid_. The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once. **Example 1:**...
null
Array,Backtracking,Matrix
Medium
212
198
it has been asked by Cisco Apple Amazon Google Microsoft Bloomberg by Dan database Yahoo infosis Walmart L micro vfo Lindon and so many companies hi guys welcome to this video good morning uh we'll see this problem House robber although it's marked as medium but if you had watched DP series or recursion series or basic...
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
1,448
Hello hello confusion problem cigarette problem which is equal good nodes in this problem this is account number of date only what is sagunwa edison old is gold and have decided to go from druitt fielder curan and isi not able to find any value greater than that Particular nodal on the 5 minute jaggery laddus identifie...
Count Good Nodes in Binary Tree
maximum-69-number
Given a binary tree `root`, a node _X_ in the tree is named **good** if in the path from root to _X_ there are no nodes with a value _greater than_ X. Return the number of **good** nodes in the binary tree. **Example 1:** **Input:** root = \[3,1,4,3,null,1,5\] **Output:** 4 **Explanation:** Nodes in blue are **good*...
Convert the number in an array of its digits. Brute force on every digit to get the maximum number.
Math,Greedy
Easy
null
89
hey guys how's everything going let's take a look at number 89 of Leach code gray code the gray code is a binary numeral system where two successive values differ only one bit hmm given a non-negative integer n representing the non-negative integer n representing the non-negative integer n representing the total number...
Gray Code
gray-code
An **n-bit gray code sequence** is a sequence of `2n` integers where: * Every integer is in the **inclusive** range `[0, 2n - 1]`, * The first integer is `0`, * An integer appears **no more than once** in the sequence, * The binary representation of every pair of **adjacent** integers differs by **exactly one ...
null
Math,Backtracking,Bit Manipulation
Medium
717
958
hey everyone welcome to Tech quiet in this video we are going to solve problem number 958 check completeness of a binary tree first we will see the explanation of the problem statement then the logic on the code now let's dive into the solution so here I have taken an example so in this problem we need to check the com...
Check Completeness of a Binary Tree
sort-array-by-parity-ii
Given the `root` of a binary tree, determine if it is a _complete binary tree_. In a **[complete binary tree](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between ...
null
Array,Two Pointers,Sorting
Easy
2271,2283,2327
1,647
hi everyone welcome to my YouTube channel and in this video we will look at problem 1647 from Lee code so here is the problem statement try to solve this on your own before we look at my solution together if you look at the official solutions for this problem I think there were some people use like priority queue and h...
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
114
what's up everybody alitomhajin here and welcome back to yet another youtube video in today's video we'll be solving another medium question number 114 also called as platinum binary tree to link list it has also been asked on day 14 of may lead code challenge so let's get started given the root of binary tree flatten ...
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
732
um hello so today we are going to do this problem my calendar 3 part of lead code um September October challenge um so um what the problem says is we We have basically it's my calendar three here um and the definition of a k booking is when K events have some an empty intersection right um and we get some events that a...
My Calendar III
my-calendar-iii
A `k`\-booking happens when `k` events have some non-empty intersection (i.e., there is some time that is common to all `k` events.) You are given some events `[startTime, endTime)`, after each given event, return an integer `k` representing the maximum `k`\-booking between all the previous events. Implement the `MyC...
Treat each interval [start, end) as two events "start" and "end", and process them in sorted order.
Design,Segment Tree,Ordered Set
Hard
729,731
1,696
foreign welcome back to my channel let's continue solving Jump game problems today we will solve lead code problem number 1696 which comes under John Kim series only let's look at the problem statement you are given a zero indexed integer array nums and an integer key initial position is index 0 in one move one can jum...
Jump Game VI
strange-printer-ii
You are given a **0-indexed** integer array `nums` and an integer `k`. You are initially standing at index `0`. In one move, you can jump at most `k` steps forward without going outside the boundaries of the array. That is, you can jump from index `i` to any index in the range `[i + 1, min(n - 1, i + k)]` **inclusive*...
Try thinking in reverse. Given the grid, how can you tell if a colour was painted last?
Array,Graph,Topological Sort,Matrix
Hard
664
1,455
welcome to my channel let's solve another problem of lead code and again i'm picking a problem in a string and obviously it's the easy question so let's see but the question is it's 1 4 double 5 check if a word occurs as a prefix of any word in a sentence all right let's read out the question given a sentence that cons...
Check If a Word Occurs As a Prefix of Any Word in a Sentence
filter-restaurants-by-vegan-friendly-price-and-distance
Given a `sentence` that consists of some words separated by a **single space**, and a `searchWord`, check if `searchWord` is a prefix of any word in `sentence`. Return _the index of the word in_ `sentence` _(**1-indexed**) where_ `searchWord` _is a prefix of this word_. If `searchWord` is a prefix of more than one wor...
Do the filtering and sort as said. Note that the id may not be the index in the array.
Array,Sorting
Medium
null
1,946
hey guys it's payne here so today when i talk about a question nicole 1946 largest number after mutating substring so this is the question from the weekly contest 251 question two in a contest i couldn't solve it but later on after the contest i try to figure out you know so that's really the description you are given ...
Largest Number After Mutating Substring
minimum-absolute-sum-difference
You are given a string `num`, which represents a large integer. You are also given a **0-indexed** integer array `change` of length `10` that maps each digit `0-9` to another digit. More formally, digit `d` maps to digit `change[d]`. You may **choose** to **mutate a single substring** of `num`. To mutate a substring, ...
Go through each element and test the optimal replacements. There are only 2 possible replacements for each element (higher and lower) that are optimal.
Array,Binary Search,Sorting,Ordered Set
Medium
null
461
today we will solve a very simple question called hamming distance is the number of bits in which two numbers differ for example this number denotes three and this denotes five this is four plus one so you see that this bit is same this bit is different so we got one this bit is also different zero and ones so we got a...
Hamming Distance
hamming-distance
The [Hamming distance](https://en.wikipedia.org/wiki/Hamming_distance) between two integers is the number of positions at which the corresponding bits are different. Given two integers `x` and `y`, return _the **Hamming distance** between them_. **Example 1:** **Input:** x = 1, y = 4 **Output:** 2 **Explanation:** 1...
null
Bit Manipulation
Easy
191,477
72
uh hello everyone today i'm solving lyrical question 72 added distance using the dynamic programming so i have uploaded a previous video solving this problem using recursive solution with memorization the top-down approach memorization the top-down approach memorization the top-down approach and then you can also see f...
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
19
hello everyone let's start with 19 today the problem is remove ends node from end of this so it's a very typical linked list problem it's not very hard for this example for example we have the enclaves one two three four five and n is two which means we need to remove the second node from the end of the list which is n...
Remove Nth Node From End of List
remove-nth-node-from-end-of-list
Given the `head` of a linked list, remove the `nth` node from the end of the list and return its head. **Example 1:** **Input:** head = \[1,2,3,4,5\], n = 2 **Output:** \[1,2,3,5\] **Example 2:** **Input:** head = \[1\], n = 1 **Output:** \[\] **Example 3:** **Input:** head = \[1,2\], n = 1 **Output:** \[1\] **C...
Maintain two pointers and update one with a delay of n steps.
Linked List,Two Pointers
Medium
528,1618,2216
417
hi guys welcome to algorithms made easy in this video we will see the question pacific atlantic water flow given an m cross n matrix of non-negative integers cross n matrix of non-negative integers cross n matrix of non-negative integers representing the height of each unit cell in the continent the pacific ocean touch...
Pacific Atlantic Water Flow
pacific-atlantic-water-flow
There is an `m x n` rectangular island that borders both the **Pacific Ocean** and **Atlantic Ocean**. The **Pacific Ocean** touches the island's left and top edges, and the **Atlantic Ocean** touches the island's right and bottom edges. The island is partitioned into a grid of square cells. You are given an `m x n` i...
null
Array,Depth-First Search,Breadth-First Search,Matrix
Medium
null
1,200
hey so welcome back and this is another Elite code problem so today it's called minimum absolute difference and it's kind of the easier version of this minimum average difference because this one's a medium problem this one's in Easy problem and so let's go ahead and implement it so basically you're just giving it an a...
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
823
hi everyone this is sunny kumar from iit vhu and welcome to my channel code with sunny and today i am going to discuss the problem binary trees with factors index number is 823 and the problem is of medium type of lead code so let's jump directly into the problem statement we have been given an array of unique integers...
Binary Trees With Factors
split-array-with-same-average
Given an array of unique integers, `arr`, where each integer `arr[i]` is strictly greater than `1`. We make a binary tree using these integers, and each number may be used for any number of times. Each non-leaf node's value should be equal to the product of the values of its children. Return _the number of binary tre...
null
Array,Math,Dynamic Programming,Bit Manipulation,Bitmask
Hard
2162
19
all right what is going on everyone uh today we are looking at lead code number 19. it's called remove the nth node from the end of the list and so here we have a list of one two three four five and the number n here is 2 so we want to take 1 2 we want to remove that nth node from the end of the list okay so we remove ...
Remove Nth Node From End of List
remove-nth-node-from-end-of-list
Given the `head` of a linked list, remove the `nth` node from the end of the list and return its head. **Example 1:** **Input:** head = \[1,2,3,4,5\], n = 2 **Output:** \[1,2,3,5\] **Example 2:** **Input:** head = \[1\], n = 1 **Output:** \[\] **Example 3:** **Input:** head = \[1,2\], n = 1 **Output:** \[1\] **C...
Maintain two pointers and update one with a delay of n steps.
Linked List,Two Pointers
Medium
528,1618,2216
35
hello everyone i'm young first welcome to my channel this is the series about the self mock technique we interview today we will solve the any problem we need code together so let's start it's 35 it's a easy problem so racing we should resolve this within 10 minutes so let's start with the description together search i...
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
23
in this video we are going to solve merging of case sorted lists it's a very popular problem and it has been asked quite a few times in facebook amazon google microsoft adobe byte dance and many more companies so it's a very important question so let's understand the problem so uh in this problem we are given a few lin...
Merge k Sorted Lists
merge-k-sorted-lists
You are given an array of `k` linked-lists `lists`, each linked-list is sorted in ascending order. _Merge all the linked-lists into one sorted linked-list and return it._ **Example 1:** **Input:** lists = \[\[1,4,5\],\[1,3,4\],\[2,6\]\] **Output:** \[1,1,2,3,4,4,5,6\] **Explanation:** The linked-lists are: \[ 1->4...
null
Linked List,Divide and Conquer,Heap (Priority Queue),Merge Sort
Hard
21,264
55
hello and welcome today we're doing a question from recoat called jump game it is a medium let's get started given an array of non-negative integers given an array of non-negative integers given an array of non-negative integers you are initially positioned at the first index of the array so that would be index 0 each ...
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
729
um hello so today we are going to do this problem which is part of um august daily challenge the problem is my calendar one so basically um what we have is we want to implement a calendar where we can add a new event if um it will not cause the double booking so if there is no conflict or there is no overlap with anoth...
My Calendar I
my-calendar-i
You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a **double booking**. A **double booking** happens when two events have some non-empty intersection (i.e., some moment is common to both events.). The event can be represented as a pair of integers `start...
Store the events as a sorted list of intervals. If none of the events conflict, then the new event can be added.
Design,Segment Tree,Ordered Set
Medium
731,732
1,748
let's solve problem 1748 of lead code sum of unique elements you're 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 so what they're saying is you'll be given an array something like this which might have...
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
232
hello everyone welcome to my channel so today we are going to do the good daily challenge queue using stats so let us pursue this question then about the constraint and finally intuition behind the scene and then the coding can a Time complexity for the same so first of all this question so I required to including the ...
Implement Queue using Stacks
implement-queue-using-stacks
Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (`push`, `peek`, `pop`, and `empty`). Implement the `MyQueue` class: * `void push(int x)` Pushes element x to the back of the queue. * `int pop()` Removes the element from th...
null
Stack,Design,Queue
Easy
225
1,765
like in actually bought the simple problem like kuju variation here oranges problems is equal to zero i less than ri plus for is equal to zero effectively is equal to q dot second dot sorry okay q dot front dot minus one comma zero okay so for int i is equal to zero i less than 4 i plus again so may i pick next coordin...
Map of Highest Peak
merge-in-between-linked-lists
You are given an integer matrix `isWater` of size `m x n` that represents a map of **land** and **water** cells. * If `isWater[i][j] == 0`, cell `(i, j)` is a **land** cell. * If `isWater[i][j] == 1`, cell `(i, j)` is a **water** cell. You must assign each cell a height in a way that follows these rules: * The...
Check which edges need to be changed. Let the next node of the (a-1)th node of list1 be the 0-th node in list 2. Let the next node of the last node of list2 be the (b+1)-th node in list 1.
Linked List
Medium
null
856
hey everybody this is larry this is day 18 of the leeco daily challenge of for march uh or 17. okay i'm wrong so what day 17 of the march league daily challenge hit the like button hit the subscribe button join me in discord let me know how you think uh how you feel what about this prime and all this other stuff uh so ...
Score of Parentheses
consecutive-numbers-sum
Given a balanced parentheses string `s`, return _the **score** of the string_. The **score** of a balanced parentheses string is based on the following rule: * `"() "` has score `1`. * `AB` has score `A + B`, where `A` and `B` are balanced parentheses strings. * `(A)` has score `2 * A`, where `A` is a balanced ...
null
Math,Enumeration
Hard
null
779
you guys let's look at this problem case symbol in grammar hmm so I'll skip description so we are given an N at 1 K oh yeah we need to the description so at the root it is 0 and then we have a rule to generate a new row which is replacing 0 with 0 1 so 0 becomes 0 M and replacing one with a 1 0 so for the next row 0 be...
K-th Symbol in Grammar
max-chunks-to-make-sorted-ii
We build a table of `n` rows (**1-indexed**). We start by writing `0` in the `1st` row. Now in every subsequent row, we look at the previous row and replace each occurrence of `0` with `01`, and each occurrence of `1` with `10`. * For example, for `n = 3`, the `1st` row is `0`, the `2nd` row is `01`, and the `3rd` r...
Each k for which some permutation of arr[:k] is equal to sorted(arr)[:k] is where we should cut each chunk.
Array,Stack,Greedy,Sorting,Monotonic Stack
Hard
780
1,609
hey guys welcome to a new video in today's video we're going to look at a lead code problem and the problem's name is even odd tree so in this question we're given a binary tree named even odd and it has to meet the following conditions the first condition states that the root of a binary tree is at level index zero an...
Even Odd Tree
find-all-the-lonely-nodes
A binary tree is named **Even-Odd** if it meets the following conditions: * The root of the binary tree is at level index `0`, its children are at level index `1`, their children are at level index `2`, etc. * For every **even-indexed** level, all nodes at the level have **odd** integer values in **strictly increa...
Do a simple tree traversal, try to check if the current node is lonely or not. Node is lonely if at least one of the left/right pointers is null.
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
563,1005
136
welcome to joey's tech my friend in this video we will look into solving an array problem known as single number the problem is there on lead code number 136 and you can find the link to its problem statement in the description box however we will now look into the problem statement ourselves without further ado let's ...
Single Number
single-number
Given a **non-empty** array of integers `nums`, every element appears _twice_ except for one. Find that single one. You must implement a solution with a linear runtime complexity and use only constant extra space. **Example 1:** **Input:** nums = \[2,2,1\] **Output:** 1 **Example 2:** **Input:** nums = \[4,1,2,1,2...
null
Array,Bit Manipulation
Easy
137,260,268,287,389
1,192
Hello Viewers Welcome To Gautam Gambhir Virat Number One Adhikari Subscribe Loot Directly Or Indirectly Subscribe Button Click Heer Voor Loot Question Free Mode Connection Between Avatars And Benefit From Nov 09 Pimples Subscription Ronit Subscribe Loot Thursday Doob Scam Id Porn Ki With Respect To Inch 9 And Definitio...
Critical Connections in a Network
divide-chocolate
There are `n` servers numbered from `0` to `n - 1` connected by undirected server-to-server `connections` forming a network where `connections[i] = [ai, bi]` represents a connection between servers `ai` and `bi`. Any server can reach other servers directly or indirectly through the network. A _critical connection_ is ...
After dividing the array into K+1 sub-arrays, you will pick the sub-array with the minimum sum. Divide the sub-array into K+1 sub-arrays such that the minimum sub-array sum is as maximum as possible. Use binary search with greedy check.
Array,Binary Search
Hard
410,1056
1,022
That Welcome To Malwa Today When With Problem Call 100 Route To Leave The Numbers Are Interesting Problem And Security Question And Technological Institute [ Question And Technological Institute [ Question And Technological Institute For Research And Values ​​Through To Values ​​Through To Values ​​Through To Front In ...
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
419
hey guys are doing this as chaser who's not bigger the outcomes I'm making these videos to prepare my interview next month actually it will be like ten days from now or nine days in this video I'm going to take a look at four one nine battleships and a board we're giving a 2d board count how many battleships are in it ...
Battleships in a Board
battleships-in-a-board
Given an `m x n` matrix `board` where each cell is a battleship `'X'` or empty `'.'`, return _the number of the **battleships** on_ `board`. **Battleships** can only be placed horizontally or vertically on `board`. In other words, they can only be made of the shape `1 x k` (`1` row, `k` columns) or `k x 1` (`k` rows, ...
null
Array,Depth-First Search,Matrix
Medium
null
29
hello everyone let's try to be a cheat code ninja today this problem is amongst the top 50 questions asked in Facebook interviews so let's look at it in this question we are given a dividend and a divisor and we have to perform the division operation without using multiplication division or the mode operator we also ha...
Divide Two Integers
divide-two-integers
Given two integers `dividend` and `divisor`, divide two integers **without** using multiplication, division, and mod operator. The integer division should truncate toward zero, which means losing its fractional part. For example, `8.345` would be truncated to `8`, and `-2.7335` would be truncated to `-2`. Return _the...
null
Math,Bit Manipulation
Medium
null
445
Hello friends welcome to code Sutra let's all lead code problem number 445 add two numbers in this problem we are given the head of tool linked list for example these are the two link lists and we have to add them and return the sum of these in the form of a language for example what is the sum of seven two four three ...
Add Two Numbers II
add-two-numbers-ii
You are given two **non-empty** linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itsel...
null
Linked List,Math,Stack
Medium
2,1774
1,903
hey everyone how's everything going this is steve today let's go through an easy problem lead code 1903 largest odd number in the stream let's take a look at the problem first you're given a string num representing a large integer written the largest valued odd integer as a string that is not empty substring of none or...
Largest Odd Number in String
design-most-recently-used-queue
You are given a string `num`, representing a large integer. Return _the **largest-valued odd** integer (as a string) that is a **non-empty substring** of_ `num`_, or an empty string_ `" "` _if no odd integer exists_. A **substring** is a contiguous sequence of characters within a string. **Example 1:** **Input:** nu...
You can store the data in an array and apply each fetch by moving the ith element to the end of the array (i.e, O(n) per operation). A better way is to use the square root decomposition technique. You can build chunks of size sqrt(n). For each fetch operation, You can search for the chunk which has the ith element and ...
Array,Hash Table,Stack,Design,Binary Indexed Tree,Ordered Set
Medium
146
114
Hello friends I'm A Cloud Solutions are great at Microsoft and my aim is to empower every single person to be better at technical interviews keeping with that goal in mind today we are going to do a very interesting lead code problem called flatten the binary tree to linked list problem and if we see some of the popula...
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
1,615
hello everyone welcome back here is vanamsen today we got a very interesting coding Challenge from lead code maximal Network rank so uh we will try to involve graph and additional logic to improve upon our recent implementation so trust me by the end of this video you are going to feel like a coding ninja so let's dive...
Maximal Network Rank
range-sum-of-sorted-subarray-sums
There is an infrastructure of `n` cities with some number of `roads` connecting these cities. Each `roads[i] = [ai, bi]` indicates that there is a bidirectional road between cities `ai` and `bi`. The **network rank** of **two different cities** is defined as the total number of **directly** connected roads to **either...
Compute all sums and save it in array. Then just go from LEFT to RIGHT index and calculate answer modulo 1e9 + 7.
Array,Two Pointers,Binary Search,Sorting
Medium
null
11
hello everybody today we're going to be doing leak code number 11 container with most water let's start by introducing the problem given n non-negative the problem given n non-negative the problem given n non-negative integers a1 a2 to a to the N where each represents a point at coordinate I comma a to the I and vertic...
Container With Most Water
container-with-most-water
You are given an integer array `height` of length `n`. There are `n` vertical lines drawn such that the two endpoints of the `ith` line are `(i, 0)` and `(i, height[i])`. Find two lines that together with the x-axis form a container, such that the container contains the most water. Return _the maximum amount of water...
The aim is to maximize the area formed between the vertical lines. The area of any container is calculated using the shorter line as length and the distance between the lines as the width of the rectangle. Area = length of shorter vertical line * distance between lines We can definitely get the maximum width ...
Array,Two Pointers,Greedy
Medium
42
230
Yes, hello developer child Gary, it's me. Today's prole problem is this 130th k-th small list 130th k-th small list 130th k-th small list element in a quest. i has a width, so the cheat lane route is given. 2 Heejin Lee This is a problem that can be passed through the kth step element in the tree. If such a tree is giv...
Kth Smallest Element in a BST
kth-smallest-element-in-a-bst
Given the `root` of a binary search tree, and an integer `k`, return _the_ `kth` _smallest value (**1-indexed**) of all the values of the nodes in the tree_. **Example 1:** **Input:** root = \[3,1,4,null,2\], k = 1 **Output:** 1 **Example 2:** **Input:** root = \[5,3,6,2,4,null,null,1\], k = 3 **Output:** 3 **Cons...
Try to utilize the property of a BST. Try in-order traversal. (Credits to @chan13) What if you could modify the BST node's structure? The optimal runtime complexity is O(height of BST).
Tree,Depth-First Search,Binary Search Tree,Binary Tree
Medium
94,671
162
hi everyone once again welcome to the channel today in this video we are solving a very famous problem find peak element this problem is almost got asked in all the top giant companies and in last six months this problem got asked itself 17 times in let go as per the lit code tagging so this is very important a peak el...
Find Peak Element
find-peak-element
A peak element is an element that is strictly greater than its neighbors. Given a **0-indexed** integer array `nums`, find a peak element, and return its index. If the array contains multiple peaks, return the index to **any of the peaks**. You may imagine that `nums[-1] = nums[n] = -∞`. In other words, an element is...
null
Array,Binary Search
Medium
882,2047,2273,2316
328
hey guys today this will L code 328 Old EV link list given the head of a single link list group all the noes with old indices together followed by the noes with even indices and return the reordered list the first no is considered OD and the second no is even and so on note that the relative order inside both the even ...
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,859
Al so this question is soled in the sentence so a sentence a list of words separated by a single space and no leading space and trailing space and every single word has the index so you just reward is based on the index so um you can use hashmap key is going to be integer and value is going to be the string so you will...
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
446
hello guys and welcome back to lead Logics this is the arithmetic slices 2 subsequence problem from lead code this is a lead code hard and the number for this is 446 so in the given problem we are having an integer AR nums and we have to return all the arithmetic subsequences of nums so what is an arithmetic subsequenc...
Arithmetic Slices II - Subsequence
arithmetic-slices-ii-subsequence
Given an integer array `nums`, return _the number of all the **arithmetic subsequences** of_ `nums`. A sequence of numbers 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 ...
null
Array,Dynamic Programming
Hard
413
1,291
hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you have not liked the video please like it subscribe to my channel so that you get notified whenever i post a new video so without any further ado let's get started problem is sequential di...
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
1,602
hey what's up everyone today the question what i'm going to say is uh 1602 the finalists well known in the binary tree said that they're giving us a root a binary tree and another u in the tree and uh from the description down be here and you'll see like units known in the binary root at the root so that there are no p...
Find Nearest Right Node in Binary Tree
find-nearest-right-node-in-binary-tree
Given the `root` of a binary tree and a node `u` in the tree, return _the **nearest** node on the **same level** that is to the **right** of_ `u`_, or return_ `null` _if_ `u` _is the rightmost node in its level_. **Example 1:** **Input:** root = \[1,2,3,null,4,5,6\], u = 4 **Output:** 5 **Explanation:** The nearest n...
null
null
Medium
null
668
Hello friends, in today's video, these problems are discussed in 61 dedicated smallest number maze problem. Before starting, I would like to tell you that this problem is a very good problem and you will find this problem or observe this problem in many places. If you do then you keep watching the video canting all, yo...
Kth Smallest Number in Multiplication Table
kth-smallest-number-in-multiplication-table
Nearly everyone has used the [Multiplication Table](https://en.wikipedia.org/wiki/Multiplication_table). The multiplication table of size `m x n` is an integer matrix `mat` where `mat[i][j] == i * j` (**1-indexed**). Given three integers `m`, `n`, and `k`, return _the_ `kth` _smallest element in the_ `m x n` _multipli...
null
Binary Search
Hard
378,719,802
326
foreign with the lonely Dash and today we're going over leap code question number 326 power of three which states given an integer n returned true if it is a power of 3 otherwise return false an integer N is a power of three if there exists an integer X such that n equals 3 to the X so what does this mean well it just ...
Power of Three
power-of-three
Given an integer `n`, return _`true` if it is a power of three. Otherwise, return `false`_. An integer `n` is a power of three, if there exists an integer `x` such that `n == 3x`. **Example 1:** **Input:** n = 27 **Output:** true **Explanation:** 27 = 33 **Example 2:** **Input:** n = 0 **Output:** false **Explanat...
null
Math,Recursion
Easy
231,342,1889
133
hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you have not liked the video please like it subscribe to my channel and hit the bell icon so that you get notified whenever i post a new video so without any further ado let's get started uh...
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
1,178
hello everyone it's november the 9th look at that we have a hot question today oops now ready to do hot question on tuesdays but i guess that's fine alrighty uh oh i've done it before damn they just recycle hard all the questions oh but this is not this might be one of the questions i've done as a contest it's likely a...
Number of Valid Words for Each Puzzle
valid-palindrome-iii
With respect to a given `puzzle` string, a `word` is _valid_ if both the following conditions are satisfied: * `word` contains the first letter of `puzzle`. * For each letter in `word`, that letter is in `puzzle`. * For example, if the puzzle is `"abcdefg "`, then valid words are `"faced "`, `"cabbage "`, an...
Can you reduce this problem to a classic problem? The problem is equivalent to finding any palindromic subsequence of length at least N-K where N is the length of the string. Try to find the longest palindromic subsequence. Use DP to do that.
String,Dynamic Programming
Hard
680
215
hello everyone welcome to coding decoded my name is sanchez i'm working as technical architect sd4 at adobe and here i present day 22 of june lead code challenge the problem that we have in today is kth largest element in an array so here there in this question we are given an array of integers we need to identify the ...
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
661
hey everyone welcome back and let's write some more neat code today so today let's solve the problem image smoother we're given a two-dimensional grid that we're given a two-dimensional grid that we're given a two-dimensional grid that can be a variable size and we just want to apply a pretty simple algorithm to every ...
Image Smoother
image-smoother
An **image smoother** is a filter of the size `3 x 3` that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding cells (i.e., the average of the nine cells in the blue smoother). If one or more of the surrounding cells of a cell is not present, we do not consider it ...
null
Array,Matrix
Easy
null
1,371
Scientist Favorable Meaning Sandeep And In This Video Showing How To Solve Problems Subscribe and Subscribe This Lungi Subscribe Seervi Don't Forget To Subscribe That Sex Recorders Underwear Naseeb Akhilesh Yadav Example String Events Is Loot Ko Disgrate So Let's See What Is The Length Of The Longest Railway Platform W...
Find the Longest Substring Containing Vowels in Even Counts
minimum-remove-to-make-valid-parentheses
Given the string `s`, return the size of the longest substring containing each vowel an even number of times. That is, 'a', 'e', 'i', 'o', and 'u' must appear an even number of times. **Example 1:** **Input:** s = "eleetminicoworoep " **Output:** 13 **Explanation:** The longest substring is "leetminicowor " which c...
Each prefix of a balanced parentheses has a number of open parentheses greater or equal than closed parentheses, similar idea with each suffix. Check the array from left to right, remove characters that do not meet the property mentioned above, same idea in backward way.
String,Stack
Medium
2095,2221
297
everyone i'm going to show you how to solve legal question 297 serialize the serialize a binary tree it's a hard illegal question serialize is a process converting a data structure or object into sequence of bits so that it can be stored in a file or memory buffer transmitted across network basically what it asks you t...
Serialize and Deserialize Binary Tree
serialize-and-deserialize-binary-tree
Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment. Design an algorithm to serialize and deserialize a bi...
null
String,Tree,Depth-First Search,Breadth-First Search,Design,Binary Tree
Hard
271,449,652,765
1,482
hello everyone welcome to codescam hope you're all doing great and we are in our binary search series where in our previous videos we have seen how binary search works the template of binary search code and we have also solved few problems using binary research logic so here we are going to solve our fourth problem usi...
Minimum Number of Days to Make m Bouquets
how-many-numbers-are-smaller-than-the-current-number
You are given an integer array `bloomDay`, an integer `m` and an integer `k`. You want to make `m` bouquets. To make a bouquet, you need to use `k` **adjacent flowers** from the garden. The garden consists of `n` flowers, the `ith` flower will bloom in the `bloomDay[i]` and then can be used in **exactly one** bouquet...
Brute force for each array element. In order to improve the time complexity, we can sort the array and get the answer for each array element.
Array,Hash Table,Sorting,Counting
Easy
315
290
hi everyone in this video we are going to solve a Lead Core problem the name is word pattern and the question number is 290 so let quickly see what this problems say given a pattern and a string as find if s follows the same pattern so here we are given with one pattern and one string and we have to check whether this ...
Word Pattern
word-pattern
Given a `pattern` and a string `s`, find if `s` follows the same pattern. Here **follow** means a full match, such that there is a bijection between a letter in `pattern` and a **non-empty** word in `s`. **Example 1:** **Input:** pattern = "abba ", s = "dog cat cat dog " **Output:** true **Example 2:** **Input:*...
null
Hash Table,String
Easy
205,291
225
hey everybody welcome back and today we'll be doing another Elite code two to five Implement stack using queues this is an easy one Implement a last in first out stack using two queues the implemented stack should support all the function of the normal stack post or pop empty so the push is just a pending value stop is...
Implement Stack using Queues
implement-stack-using-queues
Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (`push`, `top`, `pop`, and `empty`). Implement the `MyStack` class: * `void push(int x)` Pushes element x to the top of the stack. * `int pop()` Removes the element on the top...
null
Stack,Design,Queue
Easy
232
935
hey everyone welcome back and let's write some more neat code today so today let's solve the problem night dialer this is a pretty interesting one I actually like this problem a bit of backstory in the game chest there is a piece called the night and it can move in a sort of unique way it can move in an L shape it can ...
Knight Dialer
orderly-queue
The chess knight has a **unique movement**, it may move two squares vertically and one square horizontally, or two squares horizontally and one square vertically (with both forming the shape of an **L**). The possible movements of chess knight are shown in this diagaram: A chess knight can move as indicated in the che...
null
Math,String,Sorting
Hard
null
455
happy New Year everybody uh all right I mean I'm in New York technically it's a little bit early there's still like two three hours for the actual New Year's but still it's the do that counts and either way probably you are actually having a happy New Year so have okay uh this is day one of the year uh of January the C...
Assign Cookies
assign-cookies
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child `i` has a greed factor `g[i]`, which is the minimum size of a cookie that the child will be content with; and each cookie `j` has a size `s[j]`. If `s[j] >= g[i]`, we can assign ...
null
Array,Greedy,Sorting
Easy
null
315
hello everyone welcome to another short video on solving elite code problem with ipl in the last video that you can find links to in the description we solve this problem 1365. how many numbers are smaller than the current number and i noticed there's this similar question step which well shows similar questions and th...
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
1,881
hello everyone welcome to coderscamp so in this video we are going to cover this problem check if word equals summation of two words and it is one of the easy category problem which is asked in lead click on test 243 here the input given is three strings the first word second word and the target and we have to return i...
Maximum Value after Insertion
closest-subsequence-sum
You are given a very large integer `n`, represented as a string,​​​​​​ and an integer digit `x`. The digits in `n` and the digit `x` are in the **inclusive** range `[1, 9]`, and `n` may represent a **negative** number. You want to **maximize** `n`**'s numerical value** by inserting `x` anywhere in the decimal represen...
The naive solution is to check all possible subsequences. This works in O(2^n). Divide the array into two parts of nearly is equal size. Consider all subsets of one part and make a list of all possible subset sums and sort this list. Consider all subsets of the other part, and for each one, let its sum = x, do binary s...
Array,Two Pointers,Dynamic Programming,Bit Manipulation,Bitmask
Hard
2108,2162
460
Welcome back to the stylish YouTube channel, so today's problem is this question of 460 hard level, so in the description of our question we have been told that we have to design and implement data structure for list frequently used L of UKG, so for this They have given us a class, Rakhi F U K G class, so there will be...
LFU Cache
lfu-cache
Design and implement a data structure for a [Least Frequently Used (LFU)](https://en.wikipedia.org/wiki/Least_frequently_used) cache. Implement the `LFUCache` class: * `LFUCache(int capacity)` Initializes the object with the `capacity` of the data structure. * `int get(int key)` Gets the value of the `key` if the...
null
Hash Table,Linked List,Design,Doubly-Linked List
Hard
146,588
98
hello and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem 98 validate binary search tree given the root of a binary tree determine if it is a valid binary search tree is defined as follows the left subtree of a node contains only nodes with keys less than the nodes ke...
Validate Binary Search Tree
validate-binary-search-tree
Given the `root` of a binary tree, _determine if it is a valid binary search tree (BST)_. A **valid 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 keys **greater than** the node's key. * ...
null
Tree,Depth-First Search,Binary Search Tree,Binary Tree
Medium
94,501
1,518
hey guys this is just how's everything going this is an easy problem because water bottles were given uh some full water bottles we can exchange for some uh empty bottles for full one yeah we need to return the maximum waters we can drink so we have nine here we drink them it will be nine empty one we can exchange thre...
Water Bottles
total-sales-amount-by-year
There are `numBottles` water bottles that are initially full of water. You can exchange `numExchange` empty water bottles from the market with one full water bottle. The operation of drinking a full water bottle turns it into an empty bottle. Given the two integers `numBottles` and `numExchange`, return _the **maximu...
null
Database
Hard
null
287
hey guys it's iran and today we're going to solve another coding interview question the question i chose for today is find a duplicate number it is lit code 287 which is labeled as a medium difficulty and i'm going to give you a bit of a spoiler here the optimal solution will be floyd's algorithm for cycle detection bu...
Find the Duplicate Number
find-the-duplicate-number
Given an array of integers `nums` containing `n + 1` integers where each integer is in the range `[1, n]` inclusive. There is only **one repeated number** in `nums`, return _this repeated number_. You must solve the problem **without** modifying the array `nums` and uses only constant extra space. **Example 1:** **...
null
Array,Two Pointers,Binary Search,Bit Manipulation
Medium
41,136,142,268,645
277
how's it going guys today we're gonna be going over leak code problem called find the celebrity this is a question right now that's being asked by Facebook Pinterest and Microsoft accordingly code and the problem scription says suppose your Idol party with end people and among them there may exist one celebrity the def...
Find the Celebrity
find-the-celebrity
Suppose you are at a party with `n` people labeled from `0` to `n - 1` and among them, there may exist one celebrity. The definition of a celebrity is that all the other `n - 1` people know the celebrity, but the celebrity does not know any of them. Now you want to find out who the celebrity is or verify that there is...
The best hint for this problem can be provided by the following figure: Well, if you understood the gist of the above idea, you can extend it to find a candidate that can possibly be a celebrity. Why do we say a "candidate"? That is for you to think. This is clearly a greedy approach to find the answer. However, there ...
Two Pointers,Greedy,Graph,Interactive
Medium
1039
1,094
hi i am ayushi rawat and welcome to my channel today we will discuss the september lead code challenge day 21 problem car pooling now let's have a look at the problem statement you are driving a vehicle that has capacity empty seats initially available for passengers the vehicle only drives east that is it cannot turn ...
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,192
hello everyone it's april 24th ah we get a little bit early today well i'm doing this because i really want to engage in a new data visualization library that i found it's called deck well it has a python wrapper it's called pi deck it allows you to do really amazing visualization over maps and i currently have some da...
Critical Connections in a Network
divide-chocolate
There are `n` servers numbered from `0` to `n - 1` connected by undirected server-to-server `connections` forming a network where `connections[i] = [ai, bi]` represents a connection between servers `ai` and `bi`. Any server can reach other servers directly or indirectly through the network. A _critical connection_ is ...
After dividing the array into K+1 sub-arrays, you will pick the sub-array with the minimum sum. Divide the sub-array into K+1 sub-arrays such that the minimum sub-array sum is as maximum as possible. Use binary search with greedy check.
Array,Binary Search
Hard
410,1056
1,178
okay guys let's take a look at lead code 1178 number of valid words for each puzzle so the prompt is we are given a list of words and we're given a list of puzzles and for each puzzle we're going to output one number for each puzzle and uh what that number is going to be representative of is the total number of words w...
Number of Valid Words for Each Puzzle
valid-palindrome-iii
With respect to a given `puzzle` string, a `word` is _valid_ if both the following conditions are satisfied: * `word` contains the first letter of `puzzle`. * For each letter in `word`, that letter is in `puzzle`. * For example, if the puzzle is `"abcdefg "`, then valid words are `"faced "`, `"cabbage "`, an...
Can you reduce this problem to a classic problem? The problem is equivalent to finding any palindromic subsequence of length at least N-K where N is the length of the string. Try to find the longest palindromic subsequence. Use DP to do that.
String,Dynamic Programming
Hard
680
682
Hello Everyone Welcome Back To My Channel Suggested Winters Shraddha Problem Special Game Very Basic Problem So What Were Given Switch Off To Tips For Baby Doll Game Witch Can Choose Game Consist Of Several Rounds Vyas Ko Off Pass Round Me Feature Right to the very minimum cream user name here giver list off and above ...
Baseball Game
baseball-game
You are keeping the scores for a baseball game with strange rules. At the beginning of the game, you start with an empty record. You are given a list of strings `operations`, where `operations[i]` is the `ith` operation you must apply to the record and is one of the following: * An integer `x`. * Record a new...
null
Array,Stack,Simulation
Easy
1720
459
welcome back friends today we are going to solve in code uh problem 1227 repeated substring pattern so this question is one of the frequently asked questions at google and amazon so please make sure you understand this question and so let's go through the description so given a non-empty string check if it can given a ...
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
338
let's solve lead code 338 counting bits so the question goes like this that you'll be given an integer n and you need to find for every number between Z and N in their binary representation how many ones would be there so if say for example n is2 so you'll need to write return how many ones would there be in zero how m...
Counting Bits
counting-bits
Given an integer `n`, return _an array_ `ans` _of length_ `n + 1` _such that for each_ `i` (`0 <= i <= n`)_,_ `ans[i]` _is the **number of**_ `1`_**'s** in the binary representation of_ `i`. **Example 1:** **Input:** n = 2 **Output:** \[0,1,1\] **Explanation:** 0 --> 0 1 --> 1 2 --> 10 **Example 2:** **Input:** n =...
You should make use of what you have produced already. Divide the numbers in ranges like [2-3], [4-7], [8-15] and so on. And try to generate new range from previous. Or does the odd/even status of the number help you in calculating the number of 1s?
Dynamic Programming,Bit Manipulation
Easy
191
328
hey there welcome back to this video now we're going to solve a coding interview problem even odd link list you are given a singly linked list group all odd nodes together followed by the even nodes please note here we're talking about the node number and not the value in the nodes this is the problem statement for exa...
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
304
hey everybody this is larry this is day 12 of the made leco daily challenge hit the like button in the subscribe button join me on discord let me know what you think about today's prom uh and i usually stop this live so it's a little bit slow fast forward watch 2x whatever you need to do i didn't do the keyboard thing ...
Range Sum Query 2D - Immutable
range-sum-query-2d-immutable
Given a 2D matrix `matrix`, handle multiple queries of the following type: * Calculate the **sum** of the elements of `matrix` inside the rectangle defined by its **upper left corner** `(row1, col1)` and **lower right corner** `(row2, col2)`. Implement the `NumMatrix` class: * `NumMatrix(int[][] matrix)` Initial...
null
Array,Design,Matrix,Prefix Sum
Medium
303,308
1,876
what's up guys so let's solve this 1876 substring with size very distinct characters a string is good if there is a no repeat characters given string has reason number of good strings consumption lens ring s note that if there is a multiple occurrence of the sense of string every our current should be counted okay so f...
Substrings of Size Three with Distinct Characters
map-of-highest-peak
A string is **good** if there are no repeated characters. Given a string `s`​​​​​, return _the number of **good substrings** of length **three** in_ `s`​​​​​​. Note that if there are multiple occurrences of the same substring, every occurrence should be counted. A **substring** is a contiguous sequence of characters...
Set each water cell to be 0. The height of each cell is limited by its closest water cell. Perform a multi-source BFS with all the water cells as sources.
Array,Breadth-First Search,Matrix
Medium
null
212
welcome to June's LICO challenge today's problem is word search to given a 2d board and a list of words from a dictionary find all words in the board here's our word search puzzle and we're given a bunch of words and we want to return an output of all the words that exist inside the word search each word must be constr...
Word Search II
word-search-ii
Given an `m x n` `board` of characters and a list of strings `words`, return _all words on the board_. Each word must be constructed from letters of sequentially adjacent cells, where **adjacent cells** are horizontally or vertically neighboring. The same letter cell may not be used more than once in a word. **Exampl...
You would need to optimize your backtracking to pass the larger test. Could you stop backtracking earlier? If the current candidate does not exist in all words' prefix, you could stop backtracking immediately. What kind of data structure could answer such query efficiently? Does a hash table work? Why or why not? How a...
Array,String,Backtracking,Trie,Matrix
Hard
79,1022,1433
148
hello and welcome to another Elite code video today we're going to be doing problem number 148 sort list and it's an interesting problem because we are going to be doing a store but now we don't have an array we actually have a link list so we'd have to figure out like how that would work and there are common problems ...
Sort List
sort-list
Given the `head` of a linked list, return _the list after sorting it in **ascending order**_. **Example 1:** **Input:** head = \[4,2,1,3\] **Output:** \[1,2,3,4\] **Example 2:** **Input:** head = \[-1,5,3,4,0\] **Output:** \[-1,0,3,4,5\] **Example 3:** **Input:** head = \[\] **Output:** \[\] **Constraints:** * ...
null
Linked List,Two Pointers,Divide and Conquer,Sorting,Merge Sort
Medium
21,75,147,1992
1,678
Hello friends good evening everyone today we will see the L code question 1678 the question name is goal pass inter interpretation so the question say states that you own a goal parel that can interpret a string command means we have given a string command the command consist of alphabet G the parenthesis and in parent...
Goal Parser Interpretation
number-of-ways-to-split-a-string
You own a **Goal Parser** that can interpret a string `command`. The `command` consists of an alphabet of `"G "`, `"() "` and/or `"(al) "` in some order. The Goal Parser will interpret `"G "` as the string `"G "`, `"() "` as the string `"o "`, and `"(al) "` as the string `"al "`. The interpreted strings are then concat...
There is no way if the sum (number of '1's) is not divisible by the number of splits. So sum%3 should be 0. Preffix s1 , and suffix s3 should have sum/3 characters '1'. Follow up: Can you generalize the problem with numbers between [-10^9, 10^9] such the sum between subarrays s1, s2, s3 are the same?
Math,String
Medium
548
309
let's cover the fifth video of the best time to buy and sell stock Series in which you can have as many transactions as you want as long as you don't have more than one stock at the time you don't buy the stock the very next day you sell it the given concerns are the length of the prices is within 5,000 and length of t...
Best Time to Buy and Sell Stock with Cooldown
best-time-to-buy-and-sell-stock-with-cooldown
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day. Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the following restrictions: * After you sell your stock, yo...
null
Array,Dynamic Programming
Medium
121,122
1,802
Hello friends welcome to code Sutra in this video we will be solving Lead Core product number 1802 maximum value at a given index in a bounded array in this problem we are given a value of n that will be equal to the size of the array for example here we are given n is equal to 6 so the size of the array will be 6 then...
Maximum Value at a Given Index in a Bounded Array
number-of-students-unable-to-eat-lunch
You are given three positive integers: `n`, `index`, and `maxSum`. You want to construct an array `nums` (**0-indexed**) that satisfies the following conditions: * `nums.length == n` * `nums[i]` is a **positive** integer where `0 <= i < n`. * `abs(nums[i] - nums[i+1]) <= 1` where `0 <= i < n-1`. * The sum of a...
Simulate the given in the statement Calculate those who will eat instead of those who will not.
Array,Stack,Queue,Simulation
Easy
2195
287
hello everyone welcome to day 29th of march liquid challenge and i hope all of you having a great time today's solution would be 634th video of the lead code daily challenges that we have been solving from past one and a half years and the question that we have in today's find the duplicate number here in this question...
Find the Duplicate Number
find-the-duplicate-number
Given an array of integers `nums` containing `n + 1` integers where each integer is in the range `[1, n]` inclusive. There is only **one repeated number** in `nums`, return _this repeated number_. You must solve the problem **without** modifying the array `nums` and uses only constant extra space. **Example 1:** **...
null
Array,Two Pointers,Binary Search,Bit Manipulation
Medium
41,136,142,268,645
1,020
today i'm gonna show you how to solve legal question 1020 number of enclaves basically you're giving our m multiplex n binary matrix grid look like the example here and zero represents c and one represents land cell a move consists of walking from one land cell to another adjacent so it's four direction it's not like a...
Number of Enclaves
longest-turbulent-subarray
You are given an `m x n` binary matrix `grid`, where `0` represents a sea cell and `1` represents a land cell. A **move** consists of walking from one land cell to another adjacent (**4-directionally**) land cell or walking off the boundary of the `grid`. Return _the number of land cells in_ `grid` _for which we cann...
null
Array,Dynamic Programming,Sliding Window
Medium
53
1,354
That a hello everyone welcome appearing to lead us in this question has constructed with multiple sources 200 Dhanshyam Security Question Ijhaar Development Course and let's look at presentation to have created for the solution all subscribe to is band kiska table 116 magic trick apna adhir ve subscribe The Amazing To ...
Construct Target Array With Multiple Sums
find-players-with-zero-or-one-losses
You are given an array `target` of n integers. From a starting array `arr` consisting of `n` 1's, you may perform the following procedure : * let `x` be the sum of all elements currently in your array. * choose index `i`, such that `0 <= i < n` and set the value of `arr` at index `i` to `x`. * You may repeat thi...
Count the number of times a player loses while iterating through the matches.
Array,Hash Table,Sorting,Counting
Medium
236
49
Hi gas welcome back to my channel so today our problem is group anagrams so what have you given us in this problem statement here we have given an add of stings what do we have to do with this TRS name type of anagrams You have to return by grouping, this can be in any of your orders. Now we have to understand what is ...
Group Anagrams
group-anagrams
Given an array of strings `strs`, group **the anagrams** together. You can return the answer in **any order**. An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. **Example 1:** **Input:** strs = \["eat","tea","tan...
null
Hash Table,String,Sorting
Medium
242,249
256
today we're gonna be going over a leak good question called paint house paint houses a question that's commonly asked by LinkedIn so the problem description says there are our Arobin houses each house can be painted one of the three colors red blue or green the cost of painting each house with a certain color is differ...
Paint House
paint-house
There is a row of `n` houses, where each house can be painted one of three colors: red, blue, or green. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color. The cost of painting each house with a certain color is repre...
null
Array,Dynamic Programming
Medium
198,213,265,276
1,601
Hello friends welcome to code Sutra let's all lead code problem number 1601 on this beautiful Sunday morning the problem is maximum number of achievable transfer requests in this problem we are given an integer n which actually indicates the number of offices say we have three offices and the second thing is we have al...
Maximum Number of Achievable Transfer Requests
maximum-number-of-achievable-transfer-requests
We have `n` buildings numbered from `0` to `n - 1`. Each building has a number of employees. It's transfer season, and some employees want to change the building they reside in. You are given an array `requests` where `requests[i] = [fromi, toi]` represents an employee's request to transfer from building `fromi` to bu...
null
null
Hard
null