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
25
So hi gas welcome tu code of our next question is reverse notes group of these so in the question I understand gas so the question is something like that we iron has a link list given HDK is given with integer value. Look here, a wait value is given. What do we have to do? Basically, we have to reverse the notes of thi...
Reverse Nodes in k-Group
reverse-nodes-in-k-group
Given the `head` of a linked list, reverse the nodes of the list `k` at a time, and return _the modified list_. `k` is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of `k` then left-out nodes, in the end, should remain as it is. You may not alt...
null
Linked List,Recursion
Hard
24,528,2196
329
Hey guys welcome back to my channel in this video we are going to solve longest increasing path in a matrix so what is given in this problem your admin has given a matrix of two end sizes and you have to find here longest increasing path so long What is this increasing path that if you go from one end to the other then...
Longest Increasing Path in a Matrix
longest-increasing-path-in-a-matrix
Given an `m x n` integers `matrix`, return _the length of the longest increasing path in_ `matrix`. From each cell, you can either move in four directions: left, right, up, or down. You **may not** move **diagonally** or move **outside the boundary** (i.e., wrap-around is not allowed). **Example 1:** **Input:** matr...
null
Dynamic Programming,Depth-First Search,Breadth-First Search,Graph,Topological Sort,Memoization
Hard
null
1,286
hey everybody this is larry this is me going over day 14 of the november league daily challenge hit the like button to subscribe and join me in discord let me know what you how you know how you've been doing in november so far two weeks in almost halfway there and let's get started today's problem is iterated for combi...
Iterator for Combination
constrained-subsequence-sum
Design the `CombinationIterator` class: * `CombinationIterator(string characters, int combinationLength)` Initializes the object with a string `characters` of **sorted distinct** lowercase English letters and a number `combinationLength` as arguments. * `next()` Returns the next combination of length `combinationL...
Use dynamic programming. Let dp[i] be the solution for the prefix of the array that ends at index i, if the element at index i is in the subsequence. dp[i] = nums[i] + max(0, dp[i-k], dp[i-k+1], ..., dp[i-1]) Use a heap with the sliding window technique to optimize the dp.
Array,Dynamic Programming,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue
Hard
null
1,576
uh hey everybody this is larry this is me going uh over q1 of the weekly contest 205 replays all question marks to avoid consecutive repeating characters so this one um this one's a little bit tricky it's brute force in a way but it's um it's a tricky way to do brute force but um the way that i did my code is a little ...
Replace All ?'s to Avoid Consecutive Repeating Characters
reorder-routes-to-make-all-paths-lead-to-the-city-zero
Given a string `s` containing only lowercase English letters and the `'?'` character, convert **all** the `'?'` characters into lowercase letters such that the final string does not contain any **consecutive repeating** characters. You **cannot** modify the non `'?'` characters. It is **guaranteed** that there are no ...
Treat the graph as undirected. Start a dfs from the root, if you come across an edge in the forward direction, you need to reverse the edge.
Depth-First Search,Breadth-First Search,Graph
Medium
null
1,696
hello everyone welcome to quartus camp we are at ninth day of june eco challenge and the problem we are going to cover in this video is jump game six so already we have solved jump games seven and two in our channel you can check the links in my description and this problem is again very similar to jump game seven we h...
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
37
hi everyone welcome back again one more session today we are going to discuss my favorite problem with it code number 37 solver so this is the sudoku server is one of the very famous everybody knows what is sudoku what's the game and how we to play it and solve it today we are going to solve this sudoku problem with th...
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
124
a legal problem called binary maximum half sum so path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them a node can only appear in a sequence at most once note that the path does not need to pass through the root the past sum of a path is the sum of no...
Binary Tree Maximum Path Sum
binary-tree-maximum-path-sum
A **path** in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence **at most once**. Note that the path does not need to pass through the root. The **path sum** of a path is the sum of the node's values in the path. ...
null
Dynamic Programming,Tree,Depth-First Search,Binary Tree
Hard
112,129,666,687,1492
46
hey and welcome today we will solve permutations interview question in a recursive way soon there will be a backtracking version as well so let's Jump Right In First example here just a disclaimer this video will be a bit mathematics involved but if you landed to this video I hope you already understand what permutatio...
Permutations
permutations
Given an array `nums` of distinct integers, return _all the possible permutations_. You can return the answer in **any order**. **Example 1:** **Input:** nums = \[1,2,3\] **Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,1\],\[3,1,2\],\[3,2,1\]\] **Example 2:** **Input:** nums = \[0,1\] **Output:** \[\[0,1\],\[1,0\...
null
Array,Backtracking
Medium
31,47,60,77
97
hey what's up guys this is chung here again so today's daily challenge problem right number 97 interleaving stream okay cool so this one is a very classic you know dp problem so you're given like uh three strings right s1 s2 and s3 and you need to find out if i3 is formed by interleaving of s1 or s2 okay so an interlea...
Interleaving String
interleaving-string
Given strings `s1`, `s2`, and `s3`, find whether `s3` is formed by an **interleaving** of `s1` and `s2`. An **interleaving** of two strings `s` and `t` is a configuration where `s` and `t` are divided into `n` and `m` substrings respectively, such that: * `s = s1 + s2 + ... + sn` * `t = t1 + t2 + ... + tm` * `|...
null
String,Dynamic Programming
Medium
null
240
uh hey everybody this is larry uh this is me going over day 23 of the february lego challenge searched a 2d matrix 2. uh hit the like button to subscribe and join me in discord so today i'm going to do this out a little bit of a funky order i actually spent some time solving this already and i was i actually came up wi...
Search a 2D Matrix II
search-a-2d-matrix-ii
Write an efficient algorithm that searches for a value `target` in an `m x n` integer matrix `matrix`. This matrix has the following properties: * Integers in each row are sorted in ascending from left to right. * Integers in each column are sorted in ascending from top to bottom. **Example 1:** **Input:** matri...
null
Array,Binary Search,Divide and Conquer,Matrix
Medium
74
387
hey everyone today we are going to solve Le problem number 387 first unique character in a string here in this problem statement we are given a string s and we have to find the first non- repeating character in it and first non- repeating character in it and first non- repeating character in it and return the index of ...
First Unique Character in a String
first-unique-character-in-a-string
Given a string `s`, _find the first non-repeating character in it and return its index_. If it does not exist, return `-1`. **Example 1:** **Input:** s = "leetcode" **Output:** 0 **Example 2:** **Input:** s = "loveleetcode" **Output:** 2 **Example 3:** **Input:** s = "aabb" **Output:** -1 **Constraints:** * `...
null
Hash Table,String,Queue,Counting
Easy
451
1,027
hello everyone welcome back here is vanamsen and today we are going to tackle a very interesting problem from Elite code longest arithmetic subsequence so it's a medium difficulty problem we will try to implement it in C plus and we will use dynamic programming approach and also uh take a look at constraints that might...
Longest Arithmetic Subsequence
sum-of-even-numbers-after-queries
Given an array `nums` of integers, return _the length of the longest arithmetic subsequence in_ `nums`. **Note** that: * A **subsequence** is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements. * A sequence `seq` is arithmetic if `s...
null
Array,Simulation
Medium
null
1,818
absolute some difference so I've solved this problem yesterday so I think today I can still solve it let me first explain the problem so we are giving two positive integer arrays nums one and nums two both of less than so they have the same length the absolute Su difference of arrays nums one and num two is divid as th...
Minimum Absolute Sum Difference
maximum-score-from-removing-substrings
You are given two positive integer arrays `nums1` and `nums2`, both of length `n`. The **absolute sum difference** of arrays `nums1` and `nums2` is defined as the **sum** of `|nums1[i] - nums2[i]|` for each `0 <= i < n` (**0-indexed**). You can replace **at most one** element of `nums1` with **any** other element in ...
Note that it is always more optimal to take one type of substring before another You can use a stack to handle erasures
String,Stack,Greedy
Medium
2256
373
hello and welcome to another Elite code video today we're going to be doing the problem of the day for um June 27th it's fine K pairs of small sums it's definitely an interesting problem it's a it shows you how to use a bunch of different data structures which is kind of nice and so and it's super it's not super hard b...
Find K Pairs with Smallest Sums
find-k-pairs-with-smallest-sums
You are given two integer arrays `nums1` and `nums2` sorted in **ascending order** and an integer `k`. Define a pair `(u, v)` which consists of one element from the first array and one element from the second array. Return _the_ `k` _pairs_ `(u1, v1), (u2, v2), ..., (uk, vk)` _with the smallest sums_. **Example 1:**...
null
Array,Heap (Priority Queue)
Medium
378,719,2150
104
hey what's up guys it's been a while but it is Nick white back with another little coding video it's still grinding through all the way code problems got to do all of them pretty soon deadlines rolling up for job applications so just getting ready for that this is just max depth of a binary tree if you guys don't know ...
Maximum Depth of Binary Tree
maximum-depth-of-binary-tree
Given the `root` of a binary tree, return _its maximum depth_. A binary tree's **maximum depth** is the number of nodes along the longest path from the root node down to the farthest leaf node. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** 3 **Example 2:** **Input:** root = \[1,null,2\] **...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
110,111,774,1492
321
hey everybody this is Larry this is January 4th um is me doing a bonus question and yes I forgot to click did this in the other video but hopefully you know if you're doing it with Mia here uh you'll see that you know there's an unboxed surprise uh if you click on it you get 10 Bitcoins and a little closer that to a fr...
Create Maximum Number
create-maximum-number
You are given two integer arrays `nums1` and `nums2` of lengths `m` and `n` respectively. `nums1` and `nums2` represent the digits of two numbers. You are also given an integer `k`. Create the maximum number of length `k <= m + n` from digits of the two numbers. The relative order of the digits from the same array mus...
null
Stack,Greedy,Monotonic Stack
Hard
402,670
1,004
hey guys welcome back to my Channel today we're going to be doing an other leak code in our Elite code 75 study plan series uh so today we will continue with the sliding window category uh we're going to be moving on to another medium problem and this one is called Max consecutive ones uh three so uh for the instructio...
Max Consecutive Ones III
least-operators-to-express-number
Given a binary array `nums` and an integer `k`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most_ `k` `0`'s. **Example 1:** **Input:** nums = \[1,1,1,0,0,0,1,1,1,1,0\], k = 2 **Output:** 6 **Explanation:** \[1,1,1,0,0,**1**,1,1,1,1,**1**\] Bolded numbers were flipped from 0 to 1....
null
Math,Dynamic Programming
Hard
null
1,268
hello friends today let's of search suggestions system given an array of strings products industry in search would we want to design assistance there suggests air to most story product names from products after each character of search water is typed suggested products should have common prefix with the search water if...
Search Suggestions System
market-analysis-i
You are given an array of strings `products` and a string `searchWord`. Design a system that suggests at most three product names from `products` after each character of `searchWord` is typed. Suggested products should have common prefix with `searchWord`. If there are more than three products with a common prefix ret...
null
Database
Medium
null
376
hello everyone so in this video we are going to solve a question complete code it is because subsequence is 376th question read code and this comes under medium category all right so let's start with the problem statement a regular subsequence is a sequence where the difference between successive numbers is strictly al...
Wiggle Subsequence
wiggle-subsequence
A **wiggle sequence** is a sequence where the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with one element and a sequence with two non-equal elements are trivially wiggle sequences. * For ...
null
Array,Dynamic Programming,Greedy
Medium
2271
834
Meaning, you will be able to understand it completely from top to bottom, it is ok to make it so easy, so what is there in this question, basically, we have given you notes from zero to and minus one, ok and you have made its graph in it. Okay and how is the graph made, so I have given the same errors, so what is given...
Sum of Distances in Tree
ambiguous-coordinates
There is an undirected connected tree with `n` nodes labeled from `0` to `n - 1` and `n - 1` edges. You are given the integer `n` and the array `edges` where `edges[i] = [ai, bi]` indicates that there is an edge between nodes `ai` and `bi` in the tree. Return an array `answer` of length `n` where `answer[i]` is the s...
null
String,Backtracking
Medium
null
1,833
Hello viewers welcome to the video desi ghee sub heading today bhi us here problem Dard ko maximum ice cream 2210 boy want maya is cream and let's start with example suggested to ₹ 90 cost start with example suggested to ₹ 90 cost start with example suggested to ₹ 90 cost cutting 12345 volume maximum number of ice crea...
Maximum Ice Cream Bars
find-the-highest-altitude
It is a sweltering summer day, and a boy wants to buy some ice cream bars. At the store, there are `n` ice cream bars. You are given an array `costs` of length `n`, where `costs[i]` is the price of the `ith` ice cream bar in coins. The boy initially has `coins` coins to spend, and he wants to buy as many ice cream bar...
Let's note that the altitude of an element is the sum of gains of all the elements behind it Getting the altitudes can be done by getting the prefix sum array of the given array
Array,Prefix Sum
Easy
null
132
hello everyone this is your a real world and today I'm back with another series of lectures so I've seen people finding it really hard to solve palindrome partitioning problems which are basically solved by DP so I mean this coming three four lectures will be discussing all the palindrome partitioning problems which ar...
Palindrome Partitioning II
palindrome-partitioning-ii
Given a string `s`, partition `s` such that every substring of the partition is a palindrome. Return _the **minimum** cuts needed for a palindrome partitioning of_ `s`. **Example 1:** **Input:** s = "aab " **Output:** 1 **Explanation:** The palindrome partitioning \[ "aa ", "b "\] could be produced using 1 cut. **...
null
String,Dynamic Programming
Hard
131,1871
1,615
hi everyone it's Oren today we have a problem when we are given a when we are given CDs for example in this case we are given four CDs and Roads which means that the connection from one CD to another so for example CD Z is connected to cd1 and the three cd1 is connected to cd2 right and the cd1 also connected to CD3 so...
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
1,971
hello welcome back today let's try to solve another lead good problem 1971 find its past exists in growth this means we are giving a graph yeah the component may be connected or may not be connected what we're going to do we first needed to attack if we have a source like this number one to a destination like this numb...
Find if Path Exists in Graph
incremental-memory-leak
There is a **bi-directional** graph with `n` vertices, where each vertex is labeled from `0` to `n - 1` (**inclusive**). The edges in the graph are represented as a 2D integer array `edges`, where each `edges[i] = [ui, vi]` denotes a bi-directional edge between vertex `ui` and vertex `vi`. Every vertex pair is connecte...
What is the upper bound for the number of seconds? Simulate the process of allocating memory.
Simulation
Medium
null
1,318
Hello everyone welcome to my channel with Mike, so today we are going to start a new playlist of beat manipulation and please note that this is a playlist of questions, here I will teach and explain the questions and a playlist of concepts of bit manipulation will also come in the future in which I will tell you the co...
Minimum Flips to Make a OR b Equal to c
tournament-winners
Given 3 positives numbers `a`, `b` and `c`. Return the minimum flips required in some bits of `a` and `b` to make ( `a` OR `b` == `c` ). (bitwise OR operation). Flip operation consists of change **any** single bit 1 to 0 or change the bit 0 to 1 in their binary representation. **Example 1:** **Input:** a = 2, b = 6...
null
Database
Hard
null
785
yo what's up nerd it's your favorite alpha male programmer today i'm going to be going over is graph by apartheid i actually already shot this video but um obs came out really laggy for some reason so i like have to completely redo it i'm actually going to do this in segments so if it's like you notice skips it's becau...
Is Graph Bipartite?
basic-calculator-iii
There is an **undirected** graph with `n` nodes, where each node is numbered between `0` and `n - 1`. You are given a 2D array `graph`, where `graph[u]` is an array of nodes that node `u` is adjacent to. More formally, for each `v` in `graph[u]`, there is an undirected edge between node `u` and node `v`. The graph has ...
null
Math,String,Stack,Recursion
Hard
224,227,781,1736
1,649
i think this is definitely a good question for a whiteboard interview okay and if you don't know bit your interview is timed that means you don't have all day to come up with a perfect solution done is better than perfect your first priority is to implement a working solution you can always optimize it later if you hav...
Create Sorted Array through Instructions
maximum-number-of-non-overlapping-subarrays-with-sum-equals-target
Given an integer array `instructions`, you are asked to create a sorted array from the elements in `instructions`. You start with an empty container `nums`. For each element from **left to right** in `instructions`, insert it into `nums`. The **cost** of each insertion is the **minimum** of the following: * The numb...
Keep track of prefix sums to quickly look up what subarray that sums "target" can be formed at each step of scanning the input array. It can be proved that greedily forming valid subarrays as soon as one is found is optimal.
Array,Hash Table,Greedy,Prefix Sum
Medium
null
357
uh today we are going over the lead code problem count numbers with unique digits including whiteboarding approaches and solutions count numbers with unique digits is a dynamic programming problem that requires some knowledge of combinatorics specifically the multiplication principle so hopefully you've attempted a sol...
Count Numbers with Unique Digits
count-numbers-with-unique-digits
Given an integer `n`, return the count of all numbers with unique digits, `x`, where `0 <= x < 10n`. **Example 1:** **Input:** n = 2 **Output:** 91 **Explanation:** The answer should be the total numbers in the range of 0 <= x < 100, excluding 11,22,33,44,55,66,77,88,99 **Example 2:** **Input:** n = 0 **Output:** 1...
A direct way is to use the backtracking approach. Backtracking should contains three states which are (the current number, number of steps to get that number and a bitmask which represent which number is marked as visited so far in the current number). Start with state (0,0,0) and count all valid number till we reach n...
Math,Dynamic Programming,Backtracking
Medium
null
958
hey everybody this is Larry this is day 15 of the legal daily challenge hit the like button hit the Subscribe button join my Discord let me know what you think about 958 uh check completeness of a binary tree apparently I haven't done this farm so I'm excited uh yeah let's get into it hope everyone's having a great wee...
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,025
foreign and today we will be solving a new lead chord question that is divisor game and just before starting to solve this question guys do subscribe to the channel hit the like button press the Bell icon button and bookmark the playlist so that you can get the updates from the channel let's read out the question what ...
Divisor Game
minimum-cost-for-tickets
Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a number `n` on the chalkboard. On each player's turn, that player makes a move consisting of: * Choosing any `x` with `0 < x < n` and `n % x == 0`. * Replacing the number `n` on the chalkboard with `n - x`. Also, if a player...
null
Array,Dynamic Programming
Medium
322
354
Hello Viewers Welcome Padegi Tak Hum Dr Niswat Khushveer Who Can Be Seen That State Government Yadav A Bluetooth Settings Ko Band Shamil Aircraft Enrique Nominee Loot Website Introduce This Subject 1111 Minor One Busy Schedule And Always Person 125 This Question From Electronic Media 2006 123 Likes This point and subsc...
Russian Doll Envelopes
russian-doll-envelopes
You are given a 2D array of integers `envelopes` where `envelopes[i] = [wi, hi]` represents the width and the height of an envelope. One envelope can fit into another if and only if both the width and height of one envelope are greater than the other envelope's width and height. Return _the maximum number of envelope...
null
Array,Binary Search,Dynamic Programming,Sorting
Hard
300,2123
1,796
welcome back guys today we are going to solve lit code problems 17 96 second largest digit in a string given an alpha numeric string s return the second largest numerical digit that appears in s or minus 1 if it does not exist an alphanumeric string is a string consisting of lowercase english letters and digits so for ...
Second Largest Digit in a String
correct-a-binary-tree
Given an alphanumeric string `s`, return _the **second largest** numerical digit that appears in_ `s`_, or_ `-1` _if it does not exist_. An **alphanumeric** string is a string consisting of lowercase English letters and digits. **Example 1:** **Input:** s = "dfa12321afd " **Output:** 2 **Explanation:** The digits t...
If you traverse the tree from right to left, the invalid node will point to a node that has already been visited.
Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
114,766
189
what's going on everyone so today we are looking at lead code number 189 it is a question called rotate array and so here we're given an array and we want to rotate the array to the right by k steps where k is non-negative so here we have one two is non-negative so here we have one two is non-negative so here we have o...
Rotate Array
rotate-array
Given an integer array `nums`, rotate the array to the right by `k` steps, where `k` is non-negative. **Example 1:** **Input:** nums = \[1,2,3,4,5,6,7\], k = 3 **Output:** \[5,6,7,1,2,3,4\] **Explanation:** rotate 1 steps to the right: \[7,1,2,3,4,5,6\] rotate 2 steps to the right: \[6,7,1,2,3,4,5\] rotate 3 steps to...
The easiest solution would use additional memory and that is perfectly fine. The actual trick comes when trying to solve this problem without using any additional memory. This means you need to use the original array somehow to move the elements around. Now, we can place each element in its original location and shift ...
Array,Math,Two Pointers
Medium
61,186
1,658
hey everybody this is Larry this is day 20th of the Lego day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's farm and type why did they do this that's not even like a referral thing that's very weird all right uh oops today's problem is 1658 minimum ope...
Minimum Operations to Reduce X to Zero
minimum-swaps-to-arrange-a-binary-grid
You are given an integer array `nums` and an integer `x`. In one operation, you can either remove the leftmost or the rightmost element from the array `nums` and subtract its value from `x`. Note that this **modifies** the array for future operations. Return _the **minimum number** of operations to reduce_ `x` _to **e...
For each row of the grid calculate the most right 1 in the grid in the array maxRight. To check if there exist answer, sort maxRight and check if maxRight[i] ≤ i for all possible i's. If there exist an answer, simulate the swaps.
Array,Greedy,Matrix
Medium
null
1,832
um hello so today we are going to do this problem called check if the synth sentence is um pentagram um lead code number 1832 um 1832 so a panorama is a sentence where every letter of the english alphabet appears at least once so every letter appears at least once of the english alphabet given a string sentence contain...
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
1,639
all right what is up here back and uh we're gonna be doing today's uh liko daily challenge uh so it reads the number of ways to form a Target string given a dictionary so you're given a list of strings of these same length words and a string Target your task is to form Target using the given words under the following r...
Number of Ways to Form a Target String Given a Dictionary
friendly-movies-streamed-last-month
You are given a list of strings of the **same length** `words` and a string `target`. Your task is to form `target` using the given `words` under the following rules: * `target` should be formed from left to right. * To form the `ith` character (**0-indexed**) of `target`, you can choose the `kth` character of th...
null
Database
Easy
null
201
okay are we live i think so what's up stream hello world let's just make sure we're live hello sweet okay so welcome we are going to take a look at another question for lee code right try to spend not too much time on this rather yeah another medium question 201 bit wise and of numbers range given a range m n where zer...
Bitwise AND of Numbers Range
bitwise-and-of-numbers-range
Given two integers `left` and `right` that represent the range `[left, right]`, return _the bitwise AND of all numbers in this range, inclusive_. **Example 1:** **Input:** left = 5, right = 7 **Output:** 4 **Example 2:** **Input:** left = 0, right = 0 **Output:** 0 **Example 3:** **Input:** left = 1, right = 2147...
null
Bit Manipulation
Medium
null
148
Okay so let's start possible what is life you have life d head of a linked list return d list after sorting it you have sorted it in ascending order ok so Every you can see it date is life you one four you one three give you have sorted in one you three four okay so let's start with example so this example in the worst...
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
658
okay so lead code practice time so in this video there are two goals the first goal is to see how to solve this problem and then you're going to do some coding work and the second one is to see how you should behave during a real interview so let's get started the in the real interview the first step is always try to u...
Find K Closest Elements
find-k-closest-elements
Given a **sorted** integer array `arr`, two integers `k` and `x`, return the `k` closest integers to `x` in the array. The result should also be sorted in ascending order. An integer `a` is closer to `x` than an integer `b` if: * `|a - x| < |b - x|`, or * `|a - x| == |b - x|` and `a < b` **Example 1:** **Input:...
null
Array,Two Pointers,Binary Search,Sorting,Heap (Priority Queue)
Medium
374,375,719
40
hello friends today the softer combination some to profit the first seed a statement given a connection of candidate to numbers candidates and their target number target find all unique combinations in candidates whether candles numbers sums to target each number in tenders may only be used once in the combination note...
Combination Sum II
combination-sum-ii
Given a collection of candidate numbers (`candidates`) and a target number (`target`), find all unique combinations in `candidates` where the candidate numbers sum to `target`. Each number in `candidates` may only be used **once** in the combination. **Note:** The solution set must not contain duplicate combinations....
null
Array,Backtracking
Medium
39
217
hey guys welcome to lead programmer today let's look at the problem contains duplicate so this problem is fairly simple we return true if any number appears at least twice in the array else we return false that is the every element in the array is distinct so as we can see here there is no element that repeats hence we...
Contains Duplicate
contains-duplicate
Given an integer array `nums`, return `true` if any value appears **at least twice** in the array, and return `false` if every element is distinct. **Example 1:** **Input:** nums = \[1,2,3,1\] **Output:** true **Example 2:** **Input:** nums = \[1,2,3,4\] **Output:** false **Example 3:** **Input:** nums = \[1,1,1,...
null
Array,Hash Table,Sorting
Easy
219,220
389
hey everybody welcome back and today we'll be doing another lead code 3920 subsequence this is an easy one given two strings as Sentry return true if s is the subsequence of tree t or false otherwise so that's it so let's scroll it down first of all we will be just comparing the lens if the lens of both of these string...
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
33
hello and welcome back to the cracking fan youtube channel today we're going to be solving lead code problem 33 search in rotated sorted array before we read the question prompt just want to kindly ask you guys to subscribe it really helps the channel grow so please do that all right there is an integer array nums sort...
Search in Rotated Sorted Array
search-in-rotated-sorted-array
There is an integer array `nums` sorted in ascending order (with **distinct** values). Prior to being passed to your function, `nums` is **possibly rotated** at an unknown pivot index `k` (`1 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]]` ...
null
Array,Binary Search
Medium
81,153,2273
39
looking at lead code number 39 it's called combination sum this is a series of three different problem problems that deal with combinations combination sums one two and three now if you have not done combination some three or two i highly suggest going over those videos before you try to do this one it's just gonna mak...
Combination Sum
combination-sum
Given an array of **distinct** integers `candidates` and a target integer `target`, return _a list of all **unique combinations** of_ `candidates` _where the chosen numbers sum to_ `target`_._ You may return the combinations in **any order**. The **same** number may be chosen from `candidates` an **unlimited number of...
null
Array,Backtracking
Medium
17,40,77,216,254,377
1,594
hi everyone it's albert here today let's solve the contest question maximum non-negative product in the maximum non-negative product in the maximum non-negative product in the matrix the question statement so given a matrix grid and initially we are standing at the top left corner and each step we are only allowed to m...
Maximum Non Negative Product in a Matrix
maximum-non-negative-product-in-a-matrix
You are given a `m x n` matrix `grid`. Initially, you are located at the top-left corner `(0, 0)`, and in each step, you can only **move right or down** in the matrix. Among all possible paths starting from the top-left corner `(0, 0)` and ending in the bottom-right corner `(m - 1, n - 1)`, find the path with the **ma...
null
null
Medium
null
853
Hello Everyone Welcome Back To That Kareena Player Discuss Get Another Very Interesting Problem And List Code Which Is Quite Not Practical Locator Problem Solve This Problem Has Been Given And Cars That Point To The Same Destination Owen Rodhe And All Movie In The Same Direction To WhatsApp Particular Target Na Dheer A...
Car Fleet
most-profit-assigning-work
There are `n` cars going to the same destination along a one-lane road. The destination is `target` miles away. You are given two integer array `position` and `speed`, both of length `n`, where `position[i]` is the position of the `ith` car and `speed[i]` is the speed of the `ith` car (in miles per hour). A car can n...
null
Array,Two Pointers,Binary Search,Greedy,Sorting
Medium
2180
907
hello everyone today we are going to solve sum of sub-array minimums problem solve sum of sub-array minimums problem solve sum of sub-array minimums problem so in this problem we are given an array and we have to find all these sub arrays and after finding all the sub array we have to find the minimum of all the sub ar...
Sum of Subarray Minimums
koko-eating-bananas
Given an array of integers arr, find the sum of `min(b)`, where `b` ranges over every (contiguous) subarray of `arr`. Since the answer may be large, return the answer **modulo** `109 + 7`. **Example 1:** **Input:** arr = \[3,1,2,4\] **Output:** 17 **Explanation:** Subarrays are \[3\], \[1\], \[2\], \[4\], \[3,1\], \...
null
Array,Binary Search
Medium
788,1335,2188
1,383
hey what's up guys this is Jim here and so this time let's take a look at another lead code problem number 1383 maximum performance of a team okay so you're given like an engineer's number from 1 to N and the two arrays speed and efficiency and write and you need to and then another one k is the number of a team you ne...
Maximum Performance of a Team
number-of-single-divisor-triplets
You are given two integers `n` and `k` and two integer arrays `speed` and `efficiency` both of length `n`. There are `n` engineers numbered from `1` to `n`. `speed[i]` and `efficiency[i]` represent the speed and efficiency of the `ith` engineer respectively. Choose **at most** `k` different engineers out of the `n` en...
The maximum value of nums.length is very large, but the maximum value of nums[i] is not. Count the number of times each value appears in nums. Brute force through every possible combination of values and count how many single divisor triplets can be made with that combination of values.
Math
Medium
2301
1,044
hey-ho there today sleep coding hey-ho there today sleep coding hey-ho there today sleep coding challenge question it's called longest the duplicated a substring so the definition for substring is that time it's a continuous chunk of characters inside the string so it's a window inside the string duplicated window is b...
Longest Duplicate Substring
find-common-characters
Given a string `s`, consider all _duplicated substrings_: (contiguous) substrings of s that occur 2 or more times. The occurrences may overlap. Return **any** duplicated substring that has the longest possible length. If `s` does not have a duplicated substring, the answer is `" "`. **Example 1:** **Input:** s = "ba...
null
Array,Hash Table,String
Easy
350
1,306
That Today Also Volume Jump Game 3 Strengthen List Problem Number 130 Hole C The Problem Statement [ Problem Statement [ Problem Statement Suryavanshi Host Negative in Tears and Were Given at Index for Example Let's Check the Are Nominated Winters This is Last Updated on The Sweets Zero 12345 Setting Text Five key and ...
Jump Game III
minimum-absolute-difference
Given an array of non-negative integers `arr`, you are initially positioned at `start` index of the array. When you are at index `i`, you can jump to `i + arr[i]` or `i - arr[i]`, check if you can reach to **any** index with value 0. Notice that you can not jump outside of the array at any time. **Example 1:** **Inp...
Find the minimum absolute difference between two elements in the array. The minimum absolute difference must be a difference between two consecutive elements in the sorted array.
Array,Sorting
Easy
2248
1,345
hey everybody this is larry this is me going over day 27 of the december league daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about this farm ask me questions and usually myself and explain these lives so if it goes a little slow just go fast forward through ...
Jump Game IV
perform-string-shifts
Given an array of integers `arr`, you are initially positioned at the first index of the array. In one step you can jump from index `i` to index: * `i + 1` where: `i + 1 < arr.length`. * `i - 1` where: `i - 1 >= 0`. * `j` where: `arr[i] == arr[j]` and `i != j`. Return _the minimum number of steps_ to reach the...
Intuitively performing all shift operations is acceptable due to the constraints. You may notice that left shift cancels the right shift, so count the total left shift times (may be negative if the final result is right shift), and perform it once.
Array,Math,String
Easy
null
581
hey what's up guys uh this is jung here so today uh let's take a look at today's daily challenge problem number 581 shortest unsorted on a continuous summary so this one is a very interesting problem so basically you're given like an integer array of nums here and you need to find one continuous sub array that you only...
Shortest Unsorted Continuous Subarray
shortest-unsorted-continuous-subarray
Given an integer array `nums`, you need to find one **continuous subarray** that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order. Return _the shortest such subarray and output its length_. **Example 1:** **Input:** nums = \[2,6,4,8,10,9,15\] **Output:** 5 **E...
null
Array,Two Pointers,Stack,Greedy,Sorting,Monotonic Stack
Medium
null
7
so this is my little section called the reverse integer okay so this problem is simple someone gives you a 33 bit sine integer suppose one two three then you just reverse three to one reverse each digit minus one to three you just return minus three to one and if input is one to zero then you just return to one okay so...
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
187
I will come back today we are going to solve list problem 197 repeated dna sequence aa default start looking details of the problem and its implementation is one to medium buried create list code of voting solution videos edison videos to help people in preparing for java j2ee Interview journey preparing for J2 intervi...
Repeated DNA Sequences
repeated-dna-sequences
The **DNA sequence** is composed of a series of nucleotides abbreviated as `'A'`, `'C'`, `'G'`, and `'T'`. * For example, `"ACGAATTCCG "` is a **DNA sequence**. When studying **DNA**, it is useful to identify repeated sequences within the DNA. Given a string `s` that represents a **DNA sequence**, return all the *...
null
Hash Table,String,Bit Manipulation,Sliding Window,Rolling Hash,Hash Function
Medium
null
85
hey guys how's everything going let's forget about the coronavirus and continue our trip to meet colt today let's take a look at number 85 maximal rectangle Oh before this video out I'd like to say something about this channel one day I received a feedback comment from some of our viewers said that I should do some edi...
Maximal Rectangle
maximal-rectangle
Given a `rows x cols` binary `matrix` filled with `0`'s and `1`'s, find the largest rectangle containing only `1`'s and return _its area_. **Example 1:** **Input:** matrix = \[\[ "1 ", "0 ", "1 ", "0 ", "0 "\],\[ "1 ", "0 ", "1 ", "1 ", "1 "\],\[ "1 ", "1 ", "1 ", "1 ", "1 "\],\[ "1 ", "0 ", "0 ", "1 ", "0 "\]\] **Ou...
null
Array,Dynamic Programming,Stack,Matrix,Monotonic Stack
Hard
84,221
864
Hello everyone welcome to me channel course mike so today you have to understand the instruction patiently after that it will be solved from question to story point only ok and liquid number 864 the name of the question is shortest path tu get which kiss ok and me page is no also available On Facebook and Instagram I t...
Shortest Path to Get All Keys
image-overlap
You are given an `m x n` grid `grid` where: * `'.'` is an empty cell. * `'#'` is a wall. * `'@'` is the starting point. * Lowercase letters represent keys. * Uppercase letters represent locks. You start at the starting point and one move consists of walking one space in one of the four cardinal directions. ...
null
Array,Matrix
Medium
null
435
in this problem we have to find the number of intervals that we remove in order to make them non overlapping so we are given a series of intervals so interval has a begin time and time so you can represent it as a pair and we have intervals like this some of them are overlapping some of them are non overlapping so let'...
Non-overlapping Intervals
non-overlapping-intervals
Given an array of intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping_. **Example 1:** **Input:** intervals = \[\[1,2\],\[2,3\],\[3,4\],\[1,3\]\] **Output:** 1 **Explanation:** \[1,3\] can be removed ...
null
Array,Dynamic Programming,Greedy,Sorting
Medium
452
28
foreign in a string so this is a very simple question we are given a string and a substring we will have to find the first occurrence of the substring in the string that's basically the question but it's given as a little complicated here let's get to read this question try it out to find a logic for this question in o...
Find the Index of the First Occurrence in a String
implement-strstr
Given two strings `needle` and `haystack`, return the index of the first occurrence of `needle` in `haystack`, or `-1` if `needle` is not part of `haystack`. **Example 1:** **Input:** haystack = "sadbutsad ", needle = "sad " **Output:** 0 **Explanation:** "sad " occurs at index 0 and 6. The first occurrence is at ...
null
Two Pointers,String,String Matching
Easy
214,459
17
hello everyone I hope you are all doing well in the last video we used the recursion approach to solve the problem of leather combination and the phone numbers but the space complexity was of three to the power n so how we can reduce the space complexity and this word is by using the iterative approach so in this video...
Letter Combinations of a Phone Number
letter-combinations-of-a-phone-number
Given a string containing digits from `2-9` inclusive, return all possible letter combinations that the number could represent. Return the answer in **any order**. A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters. **Example 1:** **Input:** di...
null
Hash Table,String,Backtracking
Medium
22,39,401
367
welcome guys so welcome to my lego section and uh be sure to subscribe to my channel before watching it okay so this paragraph is very easy called the valley perfect square so basically just ask about some positive numbers uh you can write it as perfect square okay i should have write and the computation is very easy w...
Valid Perfect Square
valid-perfect-square
Given a positive integer num, return `true` _if_ `num` _is a perfect square or_ `false` _otherwise_. A **perfect square** is an integer that is the square of an integer. In other words, it is the product of some integer with itself. You must not use any built-in library function, such as `sqrt`. **Example 1:** **In...
null
Math,Binary Search
Easy
69,633
39
hello everyone welcome back here is vanamsen and today we have a very fun on this combination time so we will be tackling this time uh in JavaScript so let's jump to our task so uh this is a medium level program and we are given an array of distinct integer and a Target integer and our task is to find all unique combin...
Combination Sum
combination-sum
Given an array of **distinct** integers `candidates` and a target integer `target`, return _a list of all **unique combinations** of_ `candidates` _where the chosen numbers sum to_ `target`_._ You may return the combinations in **any order**. The **same** number may be chosen from `candidates` an **unlimited number of...
null
Array,Backtracking
Medium
17,40,77,216,254,377
113
lead code Challenge and this would be my approximately 900th video on lead code we have been solving lead code daily problems from approximately 2 years now and let's quickly walk through the question says you are given a binary tree and you are also given a Target sum value what do you need to return all the root to l...
Path Sum II
path-sum-ii
Given the `root` of a binary tree and an integer `targetSum`, return _all **root-to-leaf** paths where the sum of the node values in the path equals_ `targetSum`_. Each path should be returned as a list of the node **values**, not node references_. A **root-to-leaf** path is a path starting from the root and ending at...
null
Backtracking,Tree,Depth-First Search,Binary Tree
Medium
112,257,437,666,2217
11
So friends, our container with most water today will not reduce the pen writing on the copy because there is not much need. Let me explain the question a little, so what I am trying to say is that you have all these pillars, it is okay and you have to add water. Meaning, if you pour water, where will it fill the maximu...
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
284
hello everyone welcome to day 25th of april elite code challenge and i hope all of you are having a great time my name is sanchez i am working as a software developer for adobe and today i present day 667 of daily lead good question the problem that we have in today's peaking iterator again it's a design level question...
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
920
most didn't chart so this is a hard problem 920 number of music plays and less musical plays music playlist your music player contains and different songs and she wants to listen to L not necessary different songs during your trip you create a pointer so that every song is played at least once a song can only be played...
Number of Music Playlists
uncommon-words-from-two-sentences
Your music player contains `n` different songs. You want to listen to `goal` songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that: * Every song is played **at least once**. * A song can only be played again only if `k` other songs have been played. Given `n`, `g...
null
Hash Table,String
Easy
2190
1,007
everyone welcome back and let's write some more neat code today so today let's solve the problem minimum domino rotations for an equal row so basically a domino has two sides the top side and the bottom side so we're given an array called tops which represents you know all the values of the top array and another array ...
Minimum Domino Rotations For Equal Row
numbers-with-same-consecutive-differences
In a row of dominoes, `tops[i]` and `bottoms[i]` represent the top and bottom halves of the `ith` domino. (A domino is a tile with two numbers from 1 to 6 - one on each half of the tile.) We may rotate the `ith` domino, so that `tops[i]` and `bottoms[i]` swap values. Return the minimum number of rotations so that all...
null
Backtracking,Breadth-First Search
Medium
null
131
welcome back guys to the cool show this is harvest and today we are going to resolve palindrome partitioning problem on liquid so first we are going to explain the problem and second we are going to digging down to the hood level so what they are expecting to get input as a string like aab and then you they are expecti...
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,879
hey what's up guys uh this is chung here again so uh design number eight number 1879 right minimum x or sum of two arrays uh so this one you're given like two integer arrays right number one num2 of the same length and the xor sum of the two integers is for each corresponding index we do xor for those two numbers and t...
Minimum XOR Sum of Two Arrays
maximum-score-from-removing-stones
You are given two integer arrays `nums1` and `nums2` of length `n`. The **XOR sum** of the two integer arrays is `(nums1[0] XOR nums2[0]) + (nums1[1] XOR nums2[1]) + ... + (nums1[n - 1] XOR nums2[n - 1])` (**0-indexed**). * For example, the **XOR sum** of `[1,2,3]` and `[3,2,1]` is equal to `(1 XOR 3) + (2 XOR 2) +...
It's optimal to always remove one stone from the biggest 2 piles Note that the limits are small enough for simulation
Math,Greedy,Heap (Priority Queue)
Medium
null
1,822
oh hey everybody this is Larry this is day two of the medical day challenge hit the like button hit the Subscribe and join me on Discord let me know what you think about today's poem so you're given a function that returns one of X is positive negative one return sign of okay I mean yeah I think we just multiply them a...
Sign of the Product of an Array
longest-palindromic-subsequence-ii
There is a function `signFunc(x)` that returns: * `1` if `x` is positive. * `-1` if `x` is negative. * `0` if `x` is equal to `0`. You are given an integer array `nums`. Let `product` be the product of all values in the array `nums`. Return `signFunc(product)`. **Example 1:** **Input:** nums = \[-1,-2,-3,-4,...
As with any good dp problem that uses palindromes, try building the palindrome from the edges The prime point is to check that no two adjacent characters are equal, so save the past character while building the palindrome.
String,Dynamic Programming
Medium
516
242
is valid anagrams from lead code and this question is also listed in the blind 75 given two strings s and t we want to return true if t is an anagram of s and false if it isn't so anagram is different than what you might have heard from in the past compared to a palindrome so palindrome reads the same from left to righ...
Valid Anagram
valid-anagram
Given two strings `s` and `t`, return `true` _if_ `t` _is an anagram of_ `s`_, and_ `false` _otherwise_. 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:** s = "anagram", t = "nagaram" **...
null
Hash Table,String,Sorting
Easy
49,266,438
36
let's solve valid sidoku number 36 on leak code we want to determine if a 9x9 sidoku board is valid so here for the first row all of the numbers we have placed there must be no repetition and they all must be numbers between 1 and n and we're also guaranteed that each element is a digit 1 to N9 or it's a period saying ...
Valid Sudoku
valid-sudoku
Determine if a `9 x 9` Sudoku board is valid. Only the filled cells need to be validated **according to the following rules**: 1. Each row must contain the digits `1-9` without repetition. 2. Each column must contain the digits `1-9` without repetition. 3. Each of the nine `3 x 3` sub-boxes of the grid must contain...
null
Array,Hash Table,Matrix
Medium
37,2254
1,675
hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you not like 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 so probl...
Minimize Deviation in Array
magnetic-force-between-two-balls
You are given an array `nums` of `n` positive integers. You can perform two types of operations on any element of the array any number of times: * If the element is **even**, **divide** it by `2`. * For example, if the array is `[1,2,3,4]`, then you can do this operation on the last element, and the array wil...
If you can place balls such that the answer is x then you can do it for y where y < x. Similarly if you cannot place balls such that the answer is x then you can do it for y where y > x. Binary search on the answer and greedily see if it is possible.
Array,Binary Search,Sorting
Medium
2188
1,514
hey everyone welcome back today we are going to solve problem number 1514 path with maximum probability first we'll see the exponential of the problem statement in the logic on the code now let's dive into the solution so in this problem we are given an undirected weighted graph of n nodes so here n is 3 so we have thr...
Path with Maximum Probability
minimum-value-to-get-positive-step-by-step-sum
You are given an undirected weighted graph of `n` nodes (0-indexed), represented by an edge list where `edges[i] = [a, b]` is an undirected edge connecting the nodes `a` and `b` with a probability of success of traversing that edge `succProb[i]`. Given two nodes `start` and `end`, find the path with the maximum probab...
Find the minimum prefix sum.
Array,Prefix Sum
Easy
null
1,092
all right let's talk about shortest common super sequence so you are using the idea for longest comma sequence and i'm not going to just explain what's longest common sequence because you can just go on my video to check it check out the longest comment sequence video so it's built build a table list your table and the...
Shortest Common Supersequence
maximum-difference-between-node-and-ancestor
Given two strings `str1` and `str2`, return _the shortest string that has both_ `str1` _and_ `str2` _as **subsequences**_. If there are multiple valid strings, return **any** of them. A string `s` is a **subsequence** of string `t` if deleting some number of characters from `t` (possibly `0`) results in the string `s`...
For each subtree, find the minimum value and maximum value of its descendants.
Tree,Depth-First Search,Binary Tree
Medium
null
334
foreign level question okay let's discuss the question briefly here given an integration array nums written true if there exists a triple indices ijk such that I use result J and less than K and the next condition also is nums of I should be less than um J should be less than um uh we should just return false if there ...
Increasing Triplet Subsequence
increasing-triplet-subsequence
Given an integer array `nums`, return `true` _if there exists a triple of indices_ `(i, j, k)` _such that_ `i < j < k` _and_ `nums[i] < nums[j] < nums[k]`. If no such indices exists, return `false`. **Example 1:** **Input:** nums = \[1,2,3,4,5\] **Output:** true **Explanation:** Any triplet where i < j < k is valid. ...
null
Array,Greedy
Medium
300,2122,2280
406
Hello hello friends today speech that sprang its problem number forces construction institute subscribe to hai ya given at least in wich every question side issue on number panel veer ahead of the acquisition se say no liquid the subscribe like subscribe and this channel subscribe Must subscribe and subscirbe ki 24 kar...
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,629
Ko Same Everyone Welcome Back To Recording In This Video Badminton Kabaddi Question Number One Offbeat Ko Bhi Contest 21 Ki Dashi Problems Have Already Been Uploaded You Can Find A Solution To All Problems And Provide Drinking Description Oil Gauge Cloud Channel And Find These Videos Nor Its Processes in Fact to Where ...
Slowest Key
minimum-possible-integer-after-at-most-k-adjacent-swaps-on-digits
A newly designed keypad was tested, where a tester pressed a sequence of `n` keys, one at a time. You are given a string `keysPressed` of length `n`, where `keysPressed[i]` was the `ith` key pressed in the testing sequence, and a sorted list `releaseTimes`, where `releaseTimes[i]` was the time the `ith` key was releas...
We want to make the smaller digits the most significant digits in the number. For each index i, check the smallest digit in a window of size k and append it to the answer. Update the indices of all digits in this range accordingly.
String,Greedy,Binary Indexed Tree,Segment Tree
Hard
null
139
hello welcome back this is logic coding today we're going to look at two world break problem the first is medium the second is a hard so the first medium we are given a string and a dictionary of string world dict and we want to return true if s can be segmented into space separated sequence of one or more dictionary w...
Word Break
word-break
Given a string `s` and a dictionary of strings `wordDict`, return `true` if `s` can be segmented into a space-separated sequence of one or more dictionary words. **Note** that the same word in the dictionary may be reused multiple times in the segmentation. **Example 1:** **Input:** s = "leetcode ", wordDict = \[ "...
null
Hash Table,String,Dynamic Programming,Trie,Memoization
Medium
140
201
hi everyone welcome to my channel let's talk about today's lead code daily challenge um today's problem is about beat wise operations yeah and it's about and the problem is like uh you are given two integers from left to right you should and all the numbers in that range and return the answer for example if uh the firs...
Bitwise AND of Numbers Range
bitwise-and-of-numbers-range
Given two integers `left` and `right` that represent the range `[left, right]`, return _the bitwise AND of all numbers in this range, inclusive_. **Example 1:** **Input:** left = 5, right = 7 **Output:** 4 **Example 2:** **Input:** left = 0, right = 0 **Output:** 0 **Example 3:** **Input:** left = 1, right = 2147...
null
Bit Manipulation
Medium
null
68
okay let's code 68 text justification welcome to the shitty tasks so straightforward problem very straightforward it has a rating of two to one the likes and the dislikes and the straightforwardness of this is this a text a sequence of words a width and we want to get something like this so the current with lines as ma...
Text Justification
text-justification
Given an array of strings `words` and a width `maxWidth`, format the text such that each line has exactly `maxWidth` characters and is fully (left and right) justified. You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces `' '` when necessary so that ea...
null
Array,String,Simulation
Hard
1714,2260
250
lead code 250 account unit value subtrees so let's see what this question is the root give a binary tree and then return the number of uni values of trees so here for example if we have five here this node and this node their post leave their uni value the leaf is always unique value some trees here the five is also bu...
Count Univalue Subtrees
count-univalue-subtrees
Given the `root` of a binary tree, return _the number of **uni-value**_ _subtrees_. A **uni-value subtree** means all nodes of the subtree have the same value. **Example 1:** **Input:** root = \[5,1,5,5,5,null,5\] **Output:** 4 **Example 2:** **Input:** root = \[\] **Output:** 0 **Example 3:** **Input:** root = ...
null
Tree,Depth-First Search,Binary Tree
Medium
572,687
1,254
hey everyone welcome back and let's write some more neat code today so today let's solve the problem number of closed Islands we're given a 2d grid consisting of zeros and ones I'll magnify the example a little bit over here it's a little bit opposite this time because zeros actually are land and the ones are water an ...
Number of Closed Islands
deepest-leaves-sum
Given a 2D `grid` consists of `0s` (land) and `1s` (water). An _island_ is a maximal 4-directionally connected group of `0s` and a _closed island_ is an island **totally** (all left, top, right, bottom) surrounded by `1s.` Return the number of _closed islands_. **Example 1:** **Input:** grid = \[\[1,1,1,1,1,1,1,0\],...
Traverse the tree to find the max depth. Traverse the tree again to compute the sum required.
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
122
let's cover the second video of the best time to buy and sell stock series on Leo today if you haven't seen the first video please go take a look at Leo question 121 video different from that question this time you can trade as many times as you want to with at most one share of stock and your goal is still to maximize...
Best Time to Buy and Sell Stock II
best-time-to-buy-and-sell-stock-ii
You are given an integer array `prices` where `prices[i]` is the price of a given stock on the `ith` day. On each day, you may decide to buy and/or sell the stock. You can only hold **at most one** share of the stock at any time. However, you can buy it then immediately sell it on the **same day**. Find and return _t...
null
Array,Dynamic Programming,Greedy
Medium
121,123,188,309,714
396
hey what's up guys so it's always a simple question called rotate function okay so uh basically you have an array and there are k portions which is clockwise and you can define rotation function which f of k becomes 0 times a k over k 0 and k 1 of the minus k in and they return the maximum value of 0 1 and n minus 1. h...
Rotate Function
rotate-function
You are given an integer array `nums` of length `n`. Assume `arrk` to be an array obtained by rotating `nums` by `k` positions clock-wise. We define the **rotation function** `F` on `nums` as follow: * `F(k) = 0 * arrk[0] + 1 * arrk[1] + ... + (n - 1) * arrk[n - 1].` Return _the maximum value of_ `F(0), F(1), ...,...
null
Array,Math,Dynamic Programming
Medium
null
1,685
Hello everyone welcome to my channel Quote Sorry with Mike So today we are going to do video number 72 of Hey's playlist, it is a very easy question, actually it is 1685, a little observation is needed, it will be a very easy question, okay the name of the question is sum of. By saying absolute differences in a sorted,...
Sum of Absolute Differences in a Sorted Array
stone-game-v
You are given an integer array `nums` sorted in **non-decreasing** order. Build and return _an integer array_ `result` _with the same length as_ `nums` _such that_ `result[i]` _is equal to the **summation of absolute differences** between_ `nums[i]` _and all the other elements in the array._ In other words, `result[i...
We need to try all possible divisions for the current row to get the max score. As calculating all possible divisions will lead us to calculate some sub-problems more than once, we need to think of dynamic programming.
Array,Math,Dynamic Programming,Game Theory
Hard
909,1240,1522,1617,1788,1808,2002,2156
202
hi everyone today we are going to talk the little question happy number so write the algorithm to determine if a number n is happy so happy number is a number defined by following process so starting with any positive integer replace the number by the sum of squares of its digits repeat the process until the number equ...
Happy Number
happy-number
Write an algorithm to determine if a number `n` is happy. A **happy number** is a number defined by the following process: * Starting with any positive integer, replace the number by the sum of the squares of its digits. * Repeat the process until the number equals 1 (where it will stay), or it **loops endlessly ...
null
Hash Table,Math,Two Pointers
Easy
141,258,263,2076
373
Hello everyone welcome back to me channel once again so here we are going to talk today about the daily problems of the court, NDA question is of medium level and also in this question you will see implementation on priority, okay so because I am in this I was thinking of a simple iterative type solution to the questio...
Find K Pairs with Smallest Sums
find-k-pairs-with-smallest-sums
You are given two integer arrays `nums1` and `nums2` sorted in **ascending order** and an integer `k`. Define a pair `(u, v)` which consists of one element from the first array and one element from the second array. Return _the_ `k` _pairs_ `(u1, v1), (u2, v2), ..., (uk, vk)` _with the smallest sums_. **Example 1:**...
null
Array,Heap (Priority Queue)
Medium
378,719,2150
87
what's up guys so let's solve this decode problem 97 called scrambling string scramble string okay so all these problems are very uh strange that uh so given the string i'll given the string at length one then you have two ways right the first if the string is one stop the length of a quadrant one then you can separate...
Scramble String
scramble-string
We can scramble a string s to get a string t using the following algorithm: 1. If the length of the string is 1, stop. 2. If the length of the string is > 1, do the following: * Split the string into two non-empty substrings at a random index, i.e., if the string is `s`, divide it to `x` and `y` where `s = x +...
null
String,Dynamic Programming
Hard
null
808
Hello everyone, welcome, you are going to do the 50th question of my channel. Okay and you will know that in this playlist of mine, you can read the DP from the scrap in the section of DP Consider Questions. Okay, today's problem is the date of lead 08. Okay. It is quite doubting, it has this statement which is not a p...
Soup Servings
number-of-matching-subsequences
There are two types of soup: **type A** and **type B**. Initially, we have `n` ml of each type of soup. There are four kinds of operations: 1. Serve `100` ml of **soup A** and `0` ml of **soup B**, 2. Serve `75` ml of **soup A** and `25` ml of **soup B**, 3. Serve `50` ml of **soup A** and `50` ml of **soup B**, an...
null
Hash Table,String,Trie,Sorting
Medium
392,1051,2186
4
today we're going to solve a tricky coding interview problem median of two sorted arrays you're given two sorted arrays namson and nums to upside m and in respectively return the median of the two sorted arrays we can solve this problem pretty easily by merging the two sorted arrays but the constraint to this problem i...
Median of Two Sorted Arrays
median-of-two-sorted-arrays
Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays. The overall run time complexity should be `O(log (m+n))`. **Example 1:** **Input:** nums1 = \[1,3\], nums2 = \[2\] **Output:** 2.00000 **Explanation:** merged array = \[1,2,3\] and median is ...
null
Array,Binary Search,Divide and Conquer
Hard
null
258
hey this is tover with a lonely Dash and today we're going over leap code question 258 add digits which says given an integer num repeatedly add all its digits until the result has only one digit and return it for example if you're given a number 38 we know that the output is going to be 2 because 3 + the output is goi...
Add Digits
add-digits
Given an integer `num`, repeatedly add all its digits until the result has only one digit, and return it. **Example 1:** **Input:** num = 38 **Output:** 2 **Explanation:** The process is 38 --> 3 + 8 --> 11 11 --> 1 + 1 --> 2 Since 2 has only one digit, return it. **Example 2:** **Input:** num = 0 **Output:** 0 *...
A naive implementation of the above process is trivial. Could you come up with other methods? What are all the possible results? How do they occur, periodically or randomly? You may find this Wikipedia article useful.
Math,Simulation,Number Theory
Easy
202,1082,2076,2264
81
so there were no duplicates but today in the question the second part of it does not necessarily connecting with the distant value so they say that it's like I need the tickets as well so here you could say array sorted zero one two five six so two is similarly in this example also array need not to contain duplicate e...
Search in Rotated Sorted Array II
search-in-rotated-sorted-array-ii
There is an integer array `nums` sorted in non-decreasing order (not necessarily with **distinct** values). Before being passed to your function, `nums` is **rotated** at an unknown pivot index `k` (`0 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nu...
null
Array,Binary Search
Medium
33
162
hello everyone so in this video let us talk about a very standard and very important problem the problem name is find Peak element so let us talk about the problem shipment first and then understand how we can solve it out problem shipment goes like this that you given a peak element is an element that is strictly grea...
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
122
in this video we're going to take a look at a legal problem called best time to buy and sell stock so say you have an array prices for um i element is the price of the given stock on day i design an algorithm to find define find the maximum profit that uh you might complete as many transactions possible um and sorry as...
Best Time to Buy and Sell Stock II
best-time-to-buy-and-sell-stock-ii
You are given an integer array `prices` where `prices[i]` is the price of a given stock on the `ith` day. On each day, you may decide to buy and/or sell the stock. You can only hold **at most one** share of the stock at any time. However, you can buy it then immediately sell it on the **same day**. Find and return _t...
null
Array,Dynamic Programming,Greedy
Medium
121,123,188,309,714
523
Hi gas welcome and welcome back you have given my channel and have given a wait okay what we have to do is to find a morning whose size what should be the list you are ok it can be more than you and all its elements Ka Sam is your multiple of KV. If you find someone like this in the morning then you will return true an...
Continuous Subarray Sum
continuous-subarray-sum
Given an integer array nums and an integer k, return `true` _if_ `nums` _has a **good subarray** or_ `false` _otherwise_. A **good subarray** is a subarray where: * its length is **at least two**, and * the sum of the elements of the subarray is a multiple of `k`. **Note** that: * A **subarray** is a contiguo...
null
Array,Hash Table,Math,Prefix Sum
Medium
560,2119,2240
169
hello everyone and welcome to python programming practice in this episode we're going to be covering elite code number 169 majority element this is classified as an easy problem now i'll start with the problem description here given an array of size n find the majority element is the element that appears more than n di...
Majority Element
majority-element
Given an array `nums` of size `n`, return _the majority element_. The majority element is the element that appears more than `⌊n / 2⌋` times. You may assume that the majority element always exists in the array. **Example 1:** **Input:** nums = \[3,2,3\] **Output:** 3 **Example 2:** **Input:** nums = \[2,2,1,1,1,2,...
null
Array,Hash Table,Divide and Conquer,Sorting,Counting
Easy
229,1102
430
in this video we're going to look at a legal problem called flatten a multi-level doubly linked list so we're multi-level doubly linked list so we're multi-level doubly linked list so we're given a doubly linked list we want to flatten this multi-level double-a link list into a multi-level double-a link list into a mul...
Flatten a Multilevel Doubly Linked List
flatten-a-multilevel-doubly-linked-list
You are given a doubly linked list, which contains nodes that have a next pointer, a previous pointer, and an additional **child pointer**. This child pointer may or may not point to a separate doubly linked list, also containing these special nodes. These child lists may have one or more children of their own, and so ...
null
null
Medium
null
1,759
hey welcome guys welcome to miley consuming section so one seven five nine a town number of homogeneous substrings yeah so uh yeah written number of homogeneous substring s thinks the answer may be too large it's a modularity so i type in module and homogeneous if all the characters of string are the same so a substrin...
Count Number of Homogenous Substrings
find-the-missing-ids
Given a string `s`, return _the number of **homogenous** substrings of_ `s`_._ Since the answer may be too large, return it **modulo** `109 + 7`. A string is **homogenous** if all the characters of the string are the same. A **substring** is a contiguous sequence of characters within a string. **Example 1:** **Inpu...
null
Database
Medium
1357,1420,1467
374
problem and the problems name is guess number higher or lower so I pick a number from 1 to n and you have to guess which number I picked so every time you make a wrong guess I will tell you whether the number I picked is higher or lower than your guess so in this we are given a predefined API the api's name is guess wh...
Guess Number Higher or Lower
guess-number-higher-or-lower
We are playing the Guess Game. The game is as follows: I pick a number from `1` to `n`. You have to guess which number I picked. Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess. You call a pre-defined API `int guess(int num)`, which returns three possible re...
null
Binary Search,Interactive
Easy
278,375,658
1,680
hey everybody this is Larry this is me going with Q three of the uh weekly contest 218 as you can see had three wrong answers here which make made me really sad um but we'll go over it anyway so conation of consecutive binary numbers to be honest I don't understand why this is Q3 when I first got it in Python uh I actu...
Concatenation of Consecutive Binary Numbers
count-all-possible-routes
Given an integer `n`, return _the **decimal value** of the binary string formed by concatenating the binary representations of_ `1` _to_ `n` _in order, **modulo**_ `109 + 7`. **Example 1:** **Input:** n = 1 **Output:** 1 **Explanation: ** "1 " in binary corresponds to the decimal value 1. **Example 2:** **Input:**...
Use dynamic programming to solve this problem with each state defined by the city index and fuel left. Since the array contains distinct integers fuel will always be spent in each move and so there can be no cycles.
Array,Dynamic Programming,Memoization
Hard
null