id
int64
1
2k
content
stringlengths
272
88.9k
title
stringlengths
3
77
title_slug
stringlengths
3
79
question_content
stringlengths
230
5k
question_hints
stringclasses
695 values
tag
stringclasses
618 values
level
stringclasses
3 values
similar_question_ids
stringclasses
822 values
1,695
That Hey Guys Welcome And Welcome Back To My Channel Suggestion After This Informative Video On Problem Please Like Subscribe My Channel Hai So Absolutely Beauties Notified When Ever Posting Video Songs 2018 Latest Started Problem Is Maximum Erasure Value So In This Problem Yagya One End Area Positive Teachers And Want...
Maximum Erasure Value
maximum-sum-obtained-of-any-permutation
You are given an array of positive integers `nums` and want to erase a subarray containing **unique elements**. The **score** you get by erasing the subarray is equal to the **sum** of its elements. Return _the **maximum score** you can get by erasing **exactly one** subarray._ An array `b` is called to be a subarray...
Indexes with higher frequencies should be bound with larger values
Array,Greedy,Sorting,Prefix Sum
Medium
null
39
leak code 39 combination sum they'll be very chill are you ready given an array of distinct integers candidates and a Target integer Target return a list of all unique combinations of candidates where the chosen number sums to Target you may return the combinations in any order the same number may be chosen from candid...
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
820
Hello hello everyone welcome to desktop owner 40 inch test questions protest in coding of course you will read this description different cities and motivated and look at what ever remember to understand with example of specified in soil and sandal volume music on equation in this example in Time and Energy to String a...
Short Encoding of Words
find-eventual-safe-states
A **valid encoding** of an array of `words` is any reference string `s` and array of indices `indices` such that: * `words.length == indices.length` * The reference string `s` ends with the `'#'` character. * For each index `indices[i]`, the **substring** of `s` starting from `indices[i]` and up to (but not incl...
null
Depth-First Search,Breadth-First Search,Graph,Topological Sort
Medium
null
2
another day another problem so let's Solve IT hello beautiful people I hope you are all doing well the last time I posted a solution to this problem the sound was so bad so I decided to re-upload it with a better sound and re-upload it with a better sound and re-upload it with a better sound and better explanations and...
Add Two Numbers
add-two-numbers
You are given two **non-empty** linked lists representing two non-negative integers. The digits are stored in **reverse order**, 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 ...
null
Linked List,Math,Recursion
Medium
43,67,371,415,445,1031,1774
1,356
Hello hello friends today in this video and destroys all the problems from the weekly contest pandit yaavun adhura contact for this problem definition of video all problems because solid in the contest which stopped midway today so let's start the forest officer shot dead in tears are number one developed The Amazing H...
Sort Integers by The Number of 1 Bits
minimum-number-of-moves-to-make-palindrome
You are given an integer array `arr`. Sort the integers in the array in ascending order by the number of `1`'s in their binary representation and in case of two or more integers have the same number of `1`'s you have to sort them in ascending order. Return _the array after sorting it_. **Example 1:** **Input:** arr ...
Consider a greedy strategy. Let’s start by making the leftmost and rightmost characters match with some number of swaps. If we figure out how to do that using the minimum number of swaps, then we can delete the leftmost and rightmost characters and solve the problem recursively.
Two Pointers,String,Greedy,Binary Indexed Tree
Hard
1437
834
Hello hello friends today we are going to discuss liquid problem some of the distance in ok problem main aap kya aapko under secretary Divya Gupta and number from Jio connection sal - number from Jio connection sal - number from Jio connection sal - manager diya ok subscribe our channel for sexual and everywhere. Subsc...
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,047
Hello everyone welcome back to my channel we are going to discuss the health problem the problem in Digit June challenge is remover of all ads in duplicate infection so what to do in this problem let us find extra in it Rakhe Singh latest and if anyone like us There is more here and till then, let's see how it is meant...
Remove All Adjacent Duplicates In String
maximize-sum-of-array-after-k-negations
You are given a string `s` consisting of lowercase English letters. A **duplicate removal** consists of choosing two **adjacent** and **equal** letters and removing them. We repeatedly make **duplicate removals** on `s` until we no longer can. Return _the final string after all such duplicate removals have been made_...
null
Array,Greedy,Sorting
Easy
2204
967
everybody welcome to my channel let's solve the problem numbers with same consecutive difference so in this problem it is given as a n which is like represent the number of digit in our number and k is represent like every pair of consecutive digits in our number should have absolute difference k and also the number sh...
Numbers With Same Consecutive Differences
minimum-falling-path-sum
Given two integers n and k, return _an array of all the integers of length_ `n` _where the difference between every two consecutive digits is_ `k`. You may return the answer in **any order**. Note that the integers should not have leading zeros. Integers as `02` and `043` are not allowed. **Example 1:** **Input:** n...
null
Array,Dynamic Programming,Matrix
Medium
1224
64
hello and welcome today we are doing a question from lee code called minimum path sum it is a medium let's get right into it so given a m by n grid filled with non-negative numbers find a path with non-negative numbers find a path with non-negative numbers find a path from top left to bottom right which minimizes the s...
Minimum Path Sum
minimum-path-sum
Given a `m x n` `grid` filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path. **Note:** You can only move either down or right at any point in time. **Example 1:** **Input:** grid = \[\[1,3,1\],\[1,5,1\],\[4,2,1\]\] **Output:** 7 **Explanat...
null
Array,Dynamic Programming,Matrix
Medium
62,174,741,2067,2192
79
foreign called word search it is a medium let's get right into it given an M by n creative characters board and a string word return true if word exists in the grid a word can be constructed from letters of sequentially adjacent cells where adjacent cells are horizontally or vertically neighboring the same cell may not...
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
1,281
Gas distributor to question see khair activities in the difference between subscribe appointed number subscribe my channel subscribe channel and subscribe button more to subscribe village me ki and jhal product lete hain the interactive vande the part of April You can only take 10 National Roads, if you join this less ...
Subtract the Product and Sum of Digits of an Integer
can-make-palindrome-from-substring
Given an integer number `n`, return the difference between the product of its digits and the sum of its digits. **Example 1:** **Input:** n = 234 **Output:** 15 **Explanation:** Product of digits = 2 \* 3 \* 4 = 24 Sum of digits = 2 + 3 + 4 = 9 Result = 24 - 9 = 15 **Example 2:** **Input:** n = 4421 **Output:**...
Since we can rearrange the substring, all we care about is the frequency of each character in that substring. How to find the character frequencies efficiently ? As a preprocess, calculate the accumulate frequency of all characters for all prefixes of the string. How to check if a substring can be changed to a palindro...
Hash Table,String,Bit Manipulation,Prefix Sum
Medium
2165
187
hello and welcome to another leeco problem today we're going to be doing a pretty easy problem it's going to be problem number 187 your Pia DNA sequences and so if you're ever taking um biology or chemistry or anything so you know that DNA sequence is composed of a series of nucleotides abbreviated acgt adenine cytosin...
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
581
welcome to february's lego challenge today's problem is shortest unsorted continuous subarray given an integer array you need to find one continuous subarray that if you only sort this subarray in ascending order then the whole array will be sorted return the shortest such sub array and output its length so if we had a...
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
1,170
all right so hello and welcome here we are I haven't streamed for a few hours um just give me a moment to check the audio and pop out the chat for a few hours okay yeah I kind of took something of a break sort of um I won't go into too much detail with that we'll just say that I took something of a Break um and short b...
Compare Strings by Frequency of the Smallest Character
shortest-common-supersequence
Let the function `f(s)` be the **frequency of the lexicographically smallest character** in a non-empty string `s`. For example, if `s = "dcce "` then `f(s) = 2` because the lexicographically smallest character is `'c'`, which has a frequency of 2. You are given an array of strings `words` and another array of query s...
We can find the length of the longest common subsequence between str1[i:] and str2[j:] (for all (i, j)) by using dynamic programming. We can use this information to recover the longest common supersequence.
String,Dynamic Programming
Hard
1250
689
To Ajay, welcome to polling in August and in today's video we will talk about maximum sum of non- we will talk about maximum sum of non- we will talk about maximum sum of non- rotating morning, near the top of the solution. Before this, one more time about maximum sum of two 9, but you must watch the video of morning, ...
Maximum Sum of 3 Non-Overlapping Subarrays
maximum-sum-of-3-non-overlapping-subarrays
Given an integer array `nums` and an integer `k`, find three non-overlapping subarrays of length `k` with maximum sum and return them. Return the result as a list of indices representing the starting position of each interval (**0-indexed**). If there are multiple answers, return the lexicographically smallest one. *...
null
Array,Dynamic Programming
Hard
123
76
Hello welcome you, give 9 of D practice gauge and I also came to trouble you on Sunday and here is the question which I solved today and along with it, this is the fifth question of this week before this and last week I solved four questions. His record has been broken today hopefully next week do more questions do six...
Minimum Window Substring
minimum-window-substring
Given two strings `s` and `t` of lengths `m` and `n` respectively, return _the **minimum window**_ **_substring_** _of_ `s` _such that every character in_ `t` _(**including duplicates**) is included in the window_. If there is no such substring, return _the empty string_ `" "`. The testcases will be generated such tha...
Use two pointers to create a window of letters in S, which would have all the characters from T. Since you have to find the minimum window in S which has all the characters from T, you need to expand and contract the window using the two pointers and keep checking the window for all the characters. This approach is als...
Hash Table,String,Sliding Window
Hard
30,209,239,567,632,727
1,552
hey everybody this is larry this is q3 of the recent contest a magnetic force between two bars uh hit the like button hit the subscribe button join me on discord and yeah so for this problem um to be honest when i first started working on it i didn't know how to figure out like i thought okay maybe there's a dynamic pr...
Magnetic Force Between Two Balls
build-an-array-with-stack-operations
In the universe Earth C-137, Rick discovered a special form of magnetic force between two balls if they are put in his new invented basket. Rick has `n` empty baskets, the `ith` basket is at `position[i]`, Morty has `m` balls and needs to distribute the balls into the baskets such that the **minimum magnetic force** be...
Use “Push” for numbers to be kept in target array and [“Push”, “Pop”] for numbers to be discarded.
Array,Stack,Simulation
Easy
null
1,639
hey everyone welcome back and let's write some more neat code today so today let's solve the problem number of ways to form a Target string given a dictionary so we're given a list of words where each of the words is of the same length so something like this and we're also given a Target word so let's say in this case ...
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
1,578
hello and welcome back to the cracking fan YouTube channel today we're going to be solving lead code problem 1578 minimum time to make rope colorful before we get into the question just want to ask you guys to like and comment it really helps me out the YouTube algorithm so really just leave any comment you want it rea...
Minimum Time to Make Rope Colorful
apples-oranges
Alice has `n` balloons arranged on a rope. You are given a **0-indexed** string `colors` where `colors[i]` is the color of the `ith` balloon. Alice wants the rope to be **colorful**. She does not want **two consecutive balloons** to be of the same color, so she asks Bob for help. Bob can remove some balloons from the ...
null
Database
Medium
null
739
hi everyone welcome back to the channel and today solve Le code daily challenge problem number 739 daily temperatures so it is an interesting problem in which we'll be sto uh we'll be using monotonic stack logic so we'll first check out the problem statement then we'll look into the approach which we're going to use an...
Daily Temperatures
daily-temperatures
Given an array of integers `temperatures` represents the daily temperatures, return _an array_ `answer` _such that_ `answer[i]` _is the number of days you have to wait after the_ `ith` _day to get a warmer temperature_. If there is no future day for which this is possible, keep `answer[i] == 0` instead. **Example 1:**...
If the temperature is say, 70 today, then in the future a warmer temperature must be either 71, 72, 73, ..., 99, or 100. We could remember when all of them occur next.
Array,Stack,Monotonic Stack
Medium
496,937
1,631
hello guys welcome to algorithms made easy in this video we will see the question path with minimum effort the question here states that you are a hiker preparing for an upcoming hike and you are given heights a 2d array of size rows cross column where a particular cell represents the height of that cell you are situat...
Path With Minimum Effort
number-of-sub-arrays-with-odd-sum
You are a hiker preparing for an upcoming hike. You are given `heights`, a 2D array of size `rows x columns`, where `heights[row][col]` represents the height of cell `(row, col)`. You are situated in the top-left cell, `(0, 0)`, and you hope to travel to the bottom-right cell, `(rows-1, columns-1)` (i.e., **0-indexed**...
Can we use the accumulative sum to keep track of all the odd-sum sub-arrays ? if the current accu sum is odd, we care only about previous even accu sums and vice versa.
Array,Math,Dynamic Programming,Prefix Sum
Medium
2242
1,007
Main Office How to Made Even Today Gum Road Police Problem Cheese Minimum Definitions for Equal Work for the Calling to Top and Bottom Work subscribe our YouTube Channel and subscribe to the Page if you liked The Video then subscribe to A Suite Problem Earth Lucerne Aayi Ho To Please Like and Subscribe That Suji Benefi...
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
1,641
all right let's talk about a consorted vowel string so you are given individual ends or return a number of a string length of the n that consists only vowels a l u and are less graphically sorted so this is the definition of the how you sort of screen so i will just quickly explain again so you have an au ui and then y...
Count Sorted Vowel Strings
countries-you-can-safely-invest-in
Given an integer `n`, return _the number of strings of length_ `n` _that consist only of vowels (_`a`_,_ `e`_,_ `i`_,_ `o`_,_ `u`_) and are **lexicographically sorted**._ A string `s` is **lexicographically sorted** if for all valid `i`, `s[i]` is the same as or comes before `s[i+1]` in the alphabet. **Example 1:** ...
null
Database
Medium
615
434
foreign welcome back to my channel and today we are going to solve a new lead code question that is number of segments in a string the question says give it a string as written the number of segments in a string a segment is defined to be a quantity a sequence of non-space quantity a sequence of non-space quantity a se...
Number of Segments in a String
number-of-segments-in-a-string
Given a string `s`, return _the number of segments in the string_. A **segment** is defined to be a contiguous sequence of **non-space characters**. **Example 1:** **Input:** s = "Hello, my name is John " **Output:** 5 **Explanation:** The five segments are \[ "Hello, ", "my ", "name ", "is ", "John "\] **Exam...
null
String
Easy
null
395
hey what's up guys this is chung here so today let's take a look at it called problem number 395 longest substring with at least k repeating characters i mean this is a very interesting problem to me okay so the description is pretty short like given like a string s and the integer k return the length of the longest su...
Longest Substring with At Least K Repeating Characters
longest-substring-with-at-least-k-repeating-characters
Given a string `s` and an integer `k`, return _the length of the longest substring of_ `s` _such that the frequency of each character in this substring is greater than or equal to_ `k`. **Example 1:** **Input:** s = "aaabb ", k = 3 **Output:** 3 **Explanation:** The longest substring is "aaa ", as 'a' is repeated 3...
null
Hash Table,String,Divide and Conquer,Sliding Window
Medium
2140,2209
1,710
hello everyone welcome to quartus camp we are at 14th day of june record challenge and the problem we are going to cover is maximum units on a truck so the input given here is a two dimensional integer array and an integer variable truck size where it represent the type of boxes and the number of units inside the boxes...
Maximum Units on a Truck
find-servers-that-handled-most-number-of-requests
You are assigned to put some amount of boxes onto **one truck**. You are given a 2D array `boxTypes`, where `boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]`: * `numberOfBoxesi` is the number of boxes of type `i`. * `numberOfUnitsPerBoxi` is the number of units in each box of the type `i`. You are also given...
To speed up the next available server search, keep track of the available servers in a sorted structure such as an ordered set. To determine if a server is available, keep track of the end times for each task in a heap and add the server to the available set once the soonest task ending time is less than or equal to th...
Array,Greedy,Heap (Priority Queue),Ordered Set
Hard
null
1,937
welcome to the problem 1937 from so in this problem we are given a 2d integer array where in general k the number of rows and columns equals eminent respectively and what we need to do is all about gaining as many points as we can by picking exactly one cell in each row and at this point you might say wait in order to ...
Maximum Number of Points with Cost
maximize-the-beauty-of-the-garden
You are given an `m x n` integer matrix `points` (**0-indexed**). Starting with `0` points, you want to **maximize** the number of points you can get from the matrix. To gain points, you must pick one cell in **each row**. Picking the cell at coordinates `(r, c)` will **add** `points[r][c]` to your score. However, yo...
Consider every possible beauty and its first and last index in flowers. Remove all flowers with negative beauties within those indices.
Array,Greedy,Prefix Sum
Hard
null
135
hi guys my name is khushbu and welcome to algorithms made easy in this video we will see the question candy there are n children standing in a line each child is assigned a rating value given in an integer array ratings you are given candies to these children subjected to the following requirements the first one is tha...
Candy
candy
There are `n` children standing in a line. Each child is assigned a rating value given in the integer array `ratings`. You are giving candies to these children subjected to the following requirements: * Each child must have at least one candy. * Children with a higher rating get more candies than their neighbors....
null
Array,Greedy
Hard
null
143
hello everybody welcome to my channel let's solve the lit code problem reorder list so this is very famous problem and it make use of other list problems like finding a cycle analyst reversing a list and so on so let's read the problem statement and understand the problem given a singly linked list which is has the nod...
Reorder List
reorder-list
You are given the head of a singly linked-list. The list can be represented as: L0 -> L1 -> ... -> Ln - 1 -> Ln _Reorder the list to be on the following form:_ L0 -> Ln -> L1 -> Ln - 1 -> L2 -> Ln - 2 -> ... You may not modify the values in the list's nodes. Only nodes themselves may be changed. **Example 1:** **...
null
Linked List,Two Pointers,Stack,Recursion
Medium
2216
148
hello everyone welcome to my channel coding together my name is vikar soja today we will see another lead code problem that is shortlist let's read the problem statement it's a medium type question we are given with a head of a linked list and we have to return the list after sorting it in ascending order let's see how...
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,414
Hello viewers welcome back to my channel I hope you enjoying all the problem time uploading this has been subscribe To My Channel Please subscribe and Share with your friends Problem Minimum number of members will be happy with this game Rate that alliance number will keep returns Dum minimum number of branches name bi...
Find the Minimum Number of Fibonacci Numbers Whose Sum Is K
shortest-path-in-a-grid-with-obstacles-elimination
Given an integer `k`, _return the minimum number of Fibonacci numbers whose sum is equal to_ `k`. The same Fibonacci number can be used multiple times. The Fibonacci numbers are defined as: * `F1 = 1` * `F2 = 1` * `Fn = Fn-1 + Fn-2` for `n > 2.` It is guaranteed that for the given constraints we can always fin...
Use BFS. BFS on (x,y,r) x,y is coordinate, r is remain number of obstacles you can remove.
Array,Breadth-First Search,Matrix
Hard
550
160
welcome back everyone we're gonna be solving Lee code 160 intersection of two linked lists so given the heads of two singly linked lists A and B we want to return the node at which the two lists intersect one another and if the two linked lists have no intersection at all we can just return none so they give us an exam...
Intersection of Two Linked Lists
intersection-of-two-linked-lists
Given the heads of two singly linked-lists `headA` and `headB`, return _the node at which the two lists intersect_. If the two linked lists have no intersection at all, return `null`. For example, the following two linked lists begin to intersect at node `c1`: The test cases are generated such that there are no cycle...
null
Hash Table,Linked List,Two Pointers
Easy
599
1,004
hey guys this is Alex and welcome back to my video series on solving lead code problems and now we're solving problem 104 Max consecutive Ones Part three so given the binary array nums so it's an array with integers which are either one or three or zero and an integer K which is this one return the maximum number of co...
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,945
foreign 1945 sum of digits of string after combat so basically sum of digits of string after convert so the description is that you're given string as consisting of lowercase English letters and an integer K first convert s into an integer by replacing each letter with its position in the alpha in the alphabet that is ...
Sum of Digits of String After Convert
finding-the-users-active-minutes
You are given a string `s` consisting of lowercase English letters, and an integer `k`. First, **convert** `s` into an integer by replacing each letter with its position in the alphabet (i.e., replace `'a'` with `1`, `'b'` with `2`, ..., `'z'` with `26`). Then, **transform** the integer by replacing it with the **sum ...
Try to find the number of different minutes when action happened for each user. For each user increase the value of the answer array index which matches the UAM for this user.
Array,Hash Table
Medium
null
1,583
okay yo what's up guys babybear4812 coming at you one more time uh with a problem by popular demand it's the count unhappy friends problem now uh it's only really bloomberg that's asking this one recently and i guess a lot of you are preparing for bloomberg so i figured we'd go over this one today now unlike most of th...
Count Unhappy Friends
paint-house-iii
You are given a list of `preferences` for `n` friends, where `n` is always **even**. For each person `i`, `preferences[i]` contains a list of friends **sorted** in the **order of preference**. In other words, a friend earlier in the list is more preferred than a friend later in the list. Friends in each list are denot...
Use Dynamic programming. Define dp[i][j][k] as the minimum cost where we have k neighborhoods in the first i houses and the i-th house is painted with the color j.
Array,Dynamic Programming
Hard
null
641
Hello hello everyone to Ajay, slow down the set point according, so today we are going to design a circular DQ, so let's take a look at what teachers we have to do well, here I have given the description of all the functionalities and here they are. Through a test, we understand that further work has to be done on this...
Design Circular Deque
design-circular-deque
Design your implementation of the circular double-ended queue (deque). Implement the `MyCircularDeque` class: * `MyCircularDeque(int k)` Initializes the deque with a maximum size of `k`. * `boolean insertFront()` Adds an item at the front of Deque. Returns `true` if the operation is successful, or `false` otherwi...
null
null
Medium
null
215
Hello friends today I'm going to solve liquid problem number 215 Kate's largest element in an array so here we are given an integer area numps and an integer value K we need to return kth largest element in the array so the kit largest element is in the sorted order and it's not the distinct element okay and it's askin...
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
520
hey guys how's everything going this is jay sir uh today let's uh continue our journey on lead code it's uh the first problem of uh daily challenges on august this one is detect capital uh we're given a word we need to judge whether the usage of the capitals in it is right or not we define the usage of capitals in the ...
Detect Capital
detect-capital
We define the usage of capitals in a word to be right when one of the following cases holds: * All letters in this word are capitals, like `"USA "`. * All letters in this word are not capitals, like `"leetcode "`. * Only the first letter in this word is capital, like `"Google "`. Given a string `word`, return `...
null
String
Easy
2235
94
doing analytical number 94 binary tree in order traversal so given in the root of a binary tree return the inorder traverse know its values so in order simply means visit all the left nodes first and then visit the node itself and then visit the right-hand side nodes after the words so right-hand side nodes after the w...
Binary Tree Inorder Traversal
binary-tree-inorder-traversal
Given the `root` of a binary tree, return _the inorder traversal of its nodes' values_. **Example 1:** **Input:** root = \[1,null,2,3\] **Output:** \[1,3,2\] **Example 2:** **Input:** root = \[\] **Output:** \[\] **Example 3:** **Input:** root = \[1\] **Output:** \[1\] **Constraints:** * The number of nodes i...
null
Stack,Tree,Depth-First Search,Binary Tree
Easy
98,144,145,173,230,272,285,758,799
1,535
hey everybody this is larry uh now this is find the winner of an away game uh this is q2 of the poem uh this is actually for me this was a little bit of a tricky problem i don't i think there's some mathematical proofs around it or something like that but uh but i made two optimizations that uh so basically the key not...
Find the Winner of an Array Game
build-array-where-you-can-find-the-maximum-exactly-k-comparisons
Given an integer array `arr` of **distinct** integers and an integer `k`. A game will be played between the first two elements of the array (i.e. `arr[0]` and `arr[1]`). In each round of the game, we compare `arr[0]` with `arr[1]`, the larger integer wins and remains at position `0`, and the smaller integer moves to t...
Use dynamic programming approach. Build dp table where dp[a][b][c] is the number of ways you can start building the array starting from index a where the search_cost = c and the maximum used integer was b. Recursively, solve the small sub-problems first. Optimize your answer by stopping the search if you exceeded k cha...
Dynamic Programming
Hard
null
1,252
Scientist Hi How Are You I Am O Positive Welcome To Your Friend Today Bhi Dhud Urban Migration In Illegal Playlist Sombir Widow With Values ​​In Sure Thank You For Widow With Values ​​In Sure Thank You For Widow With Values ​​In Sure Thank You For Watching My Video And Everything In Every Day You Are Really Please Like...
Cells with Odd Values in a Matrix
break-a-palindrome
There is an `m x n` matrix that is initialized to all `0`'s. There is also a 2D array `indices` where each `indices[i] = [ri, ci]` represents a **0-indexed location** to perform some increment operations on the matrix. For each location `indices[i]`, do **both** of the following: 1. Increment **all** the cells on ro...
How to detect if there is impossible to perform the replacement? Only when the length = 1. Change the first non 'a' character to 'a'. What if the string has only 'a'? Change the last character to 'b'.
String,Greedy
Medium
null
1,658
Hello Hi Everyone Welcome To My Channel It's All The Problem Minimum Operation Studio Sector-20 Se Z In One Operation You Can Sector-20 Se Z In One Operation You Can Sector-20 Se Z In One Operation You Can Remove Left Most Women From Its Value By This Modified Cars Number To Do Subscribe - 151 To 30 Celebs Subscribe Fr...
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,171
um hello so today we are going to do this problem which is part of um Elite code daily challenge remove zero Su consecutive nodes from linked list so here we have a linked list and what we want to do is repeatedly delete consecutive sequences uh that sum up to zero where the values sum up to zero until we can't anymore...
Remove Zero Sum Consecutive Nodes from Linked List
shortest-path-in-binary-matrix
Given the `head` of a linked list, we repeatedly delete consecutive sequences of nodes that sum to `0` until there are no such sequences. After doing so, return the head of the final linked list. You may return any such answer. (Note that in the examples below, all sequences are serializations of `ListNode` objects.)...
Do a breadth first search to find the shortest path.
Array,Breadth-First Search,Matrix
Medium
null
231
in this video we are going to solve problem number 231 power of two so let's read our task first given an integer n return true if it's power of two otherwise return false integer N is a power of two if there exist an integer X such that n is equal to 2 the^ of X and such that n is equal to 2 the^ of X and such that n ...
Power of Two
power-of-two
Given an integer `n`, return _`true` if it is a power of two. Otherwise, return `false`_. An integer `n` is a power of two, if there exists an integer `x` such that `n == 2x`. **Example 1:** **Input:** n = 1 **Output:** true **Explanation:** 20 = 1 **Example 2:** **Input:** n = 16 **Output:** true **Explanation:**...
null
Math,Bit Manipulation,Recursion
Easy
191,326,342
296
let's go to question number 296 best midpoint this is hard question let's guarantee it has a lot of summer a group of two or more people wants to meet and minimize the total travel distance you are given a two degree of values zero or one where each one mark the hormone of someone in the group the distance is calculate...
Best Meeting Point
best-meeting-point
Given an `m x n` binary grid `grid` where each `1` marks the home of one friend, return _the minimal **total travel distance**_. The **total travel distance** is the sum of the distances between the houses of the friends and the meeting point. The distance is calculated using [Manhattan Distance](http://en.wikipedia....
Try to solve it in one dimension first. How can this solution apply to the two dimension case?
Array,Math,Sorting,Matrix
Hard
317,462
725
Hello gas welcome to me YouTube channel so today we are going to solve problem 725 split link list in parts ok so what is this question about I have been given a head of link lift and I have to split it in the text of It is okay that it has to be divided into parts and the length of all the parts should be equal. If it...
Split Linked List in Parts
split-linked-list-in-parts
Given the `head` of a singly linked list and an integer `k`, split the linked list into `k` consecutive linked list parts. The length of each part should be as equal as possible: no two parts should have a size differing by more than one. This may lead to some parts being null. The parts should be in the order of occ...
If there are N nodes in the list, and k parts, then every part has N/k elements, except the first N%k parts have an extra one.
Linked List
Medium
61,328
1,368
hey what's up guys john here again so this time let's take a look at another lead code problem here uh number 1368 minimum cost to make at least one valid path in a grid hard problem i like it very interesting problem so basically you're given like a m times n to two-dimensional grid times n to two-dimensional grid tim...
Minimum Cost to Make at Least One Valid Path in a Grid
web-crawler-multithreaded
Given an `m x n` grid. Each cell of the grid has a sign pointing to the next cell you should visit if you are currently in this cell. The sign of `grid[i][j]` can be: * `1` which means go to the cell to the right. (i.e go from `grid[i][j]` to `grid[i][j + 1]`) * `2` which means go to the cell to the left. (i.e go ...
null
Depth-First Search,Breadth-First Search,Concurrency
Medium
1271
999
yeah okay cool 999 available captures for work on an 8 by a chess board there is one white work yeah there also may be empty squares like bishops and black points these are given as counters or B and P respectively uppercase characters represent my pieces and lowercase characters represent black pieces ok the work move...
Available Captures for Rook
regions-cut-by-slashes
On an `8 x 8` chessboard, there is **exactly one** white rook `'R'` and some number of white bishops `'B'`, black pawns `'p'`, and empty squares `'.'`. When the rook moves, it chooses one of four cardinal directions (north, east, south, or west), then moves in that direction until it chooses to stop, reaches the edge ...
null
Depth-First Search,Breadth-First Search,Union Find,Graph
Medium
null
422
hello everyone let's look at lead code question 422 valid word square at the time of recording this uh question has 407 up votes and 264 down votes and it asks given an array of strings words return true if it forms a valid word square a sequence of strings forms a valid word square if the rows and columns read the sam...
Valid Word Square
valid-word-square
Given an array of strings `words`, return `true` _if it forms a valid **word square**_. A sequence of strings forms a valid **word square** if the `kth` row and column read the same string, where `0 <= k < max(numRows, numColumns)`. **Example 1:** **Input:** words = \[ "abcd ", "bnrt ", "crmy ", "dtye "\] **Output:*...
null
Array,Matrix
Easy
425,777
3
and welcome back to the cracking paying YouTube channel today we're going to be sewing lead code problem number three longest substring without repeating characters before we get into the video If you guys enjoy this kind of content please like and leave a comment on the video it helps me out a lot with the YouTube alg...
Longest Substring Without Repeating Characters
longest-substring-without-repeating-characters
Given a string `s`, find the length of the **longest** **substring** without repeating characters. **Example 1:** **Input:** s = "abcabcbb " **Output:** 3 **Explanation:** The answer is "abc ", with the length of 3. **Example 2:** **Input:** s = "bbbbb " **Output:** 1 **Explanation:** The answer is "b ", with t...
null
Hash Table,String,Sliding Window
Medium
159,340,1034,1813,2209
347
Hello Guys Welcome To Gautam Samay Disney Today I Will Go Through The Death Sentence For July Recording Is On Top K Frequent Elements Please Like This Video And Don't Forget To Subscribe To My Channel Subha Never Miss Any Update That Given In The Refrigerator Most Frequent Elements And Give One Example 1212 Most Freque...
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
216
Hello ji welcome to week four, it is going very well man, you have come to the second last week, you guys have covered a lot of things so far, only a few things are left, will wrap up quickly, fifth week will end soon. We will do this and you will get very good preparation for DSC. Let's move towards the solution. Yes,...
Combination Sum III
combination-sum-iii
Find all valid combinations of `k` numbers that sum up to `n` such that the following conditions are true: * Only numbers `1` through `9` are used. * Each number is used **at most once**. Return _a list of all possible valid combinations_. The list must not contain the same combination twice, and the combinations...
null
Array,Backtracking
Medium
39
508
hello everyone today we are gonna solve most frequent substrate sum problem so in this problem we have a binary tree let's say our binary tree is something like s2 and what we have to do we have to find the most frequent substitution so first of all what is substitution so here you can see that this is my substrate thi...
Most Frequent Subtree Sum
most-frequent-subtree-sum
Given the `root` of a binary tree, return the most frequent **subtree sum**. If there is a tie, return all the values with the highest frequency in any order. The **subtree sum** of a node is defined as the sum of all the node values formed by the subtree rooted at that node (including the node itself). **Example 1:*...
null
Hash Table,Tree,Depth-First Search,Binary Tree
Medium
572,2126
554
hey everyone welcome back and let's write some more neat code today so today let's look at a pretty interesting problem brick wall so the premise of the problem is that we're given a two-dimensional is that we're given a two-dimensional is that we're given a two-dimensional array that is supposed to be a brick wall eve...
Brick Wall
brick-wall
There is a rectangular brick wall in front of you with `n` rows of bricks. The `ith` row has some number of bricks each of the same height (i.e., one unit) but they can be of different widths. The total width of each row is the same. Draw a vertical line from the top to the bottom and cross the least bricks. If your l...
null
Array,Hash Table
Medium
2322
1,779
so lead code 1779 find the nearest point that has the same x or y coordinate with u so you're given an x and y coordinate of your location and an array of points and you need to find the point the index of the point that is closest to you according to the manhattan distance which is this formula right here and the poin...
Find Nearest Point That Has the Same X or Y Coordinate
hopper-company-queries-i
You are given two integers, `x` and `y`, which represent your current location on a Cartesian grid: `(x, y)`. You are also given an array `points` where each `points[i] = [ai, bi]` represents that a point exists at `(ai, bi)`. A point is **valid** if it shares the same x-coordinate or the same y-coordinate as your loca...
null
Database
Hard
262,1785,1795,2376
989
all right so this question is add to a reform of integer so you are given the array integer array and then the value K so basically need to add the value K into the nums so this is the idea right so the main purpose is what you Traverse from the last digit and all the way to the what to the left right so we need to als...
Add to Array-Form of Integer
largest-component-size-by-common-factor
The **array-form** of an integer `num` is an array representing its digits in left to right order. * For example, for `num = 1321`, the array form is `[1,3,2,1]`. Given `num`, the **array-form** of an integer, and an integer `k`, return _the **array-form** of the integer_ `num + k`. **Example 1:** **Input:** num ...
null
Array,Math,Union Find
Hard
2276
287
Hello hello everyone welcome back to my channel we are going to discuss the clean money problem shape is the problem find duplicate them this necklace one in teachers show statement but given allotment teachers containing and Laxman in teacher ok a career this in this One plus one is interior and it is a lot of things,...
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,260
hey everybody this is larry this is day 11 of april uh let go daily challenge hit the like button to subscribe and join me on discord let me know what you think about today's problem shift 2d grid okay which one okay so you can k shifted k time what is one what is k so do you just move it okay so basically you i guess ...
Shift 2D Grid
day-of-the-year
Given a 2D `grid` of size `m x n` and an integer `k`. You need to shift the `grid` `k` times. In one shift operation: * Element at `grid[i][j]` moves to `grid[i][j + 1]`. * Element at `grid[i][n - 1]` moves to `grid[i + 1][0]`. * Element at `grid[m - 1][n - 1]` moves to `grid[0][0]`. Return the _2D grid_ after...
Have a integer array of how many days there are per month. February gets one extra day if its a leap year. Then, we can manually count the ordinal as day + (number of days in months before this one).
Math,String
Easy
null
1,047
hua hai hello everyone welcome to day 28jun liquid sycophant appointed as westerners remove all parts in duplicate sunscreen inspiration to give in spring of directors and want to remove all the duplicates do viravar subscribe to and hadith 220 alerts and veervar ko remove damad se 0512 subscribe To remove all parties ...
Remove All Adjacent Duplicates In String
maximize-sum-of-array-after-k-negations
You are given a string `s` consisting of lowercase English letters. A **duplicate removal** consists of choosing two **adjacent** and **equal** letters and removing them. We repeatedly make **duplicate removals** on `s` until we no longer can. Return _the final string after all such duplicate removals have been made_...
null
Array,Greedy,Sorting
Easy
2204
119
hello YouTubers in this video we're going to be going through lead code problem 119 which is pascals triangle 2 given an integer row index return the row index zero indexed row of the Pascal's triangle so in Pascal's triangle each number is the sum of two numbers directly above it as shown so 1 + 1 is directly above it...
Pascal's Triangle II
pascals-triangle-ii
Given an integer `rowIndex`, return the `rowIndexth` (**0-indexed**) row of the **Pascal's triangle**. In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown: **Example 1:** **Input:** rowIndex = 3 **Output:** \[1,3,3,1\] **Example 2:** **Input:** rowIndex = 0 **Output:** \[...
null
Array,Dynamic Programming
Easy
118,2324
204
welcome to mazelico challenge today's problem is count primes count the number of prime numbers less than a non-negative number n so if we're a non-negative number n so if we're a non-negative number n so if we're given the number 10 we're gonna return four because there's four prime numbers less than ten two three fiv...
Count Primes
count-primes
Given an integer `n`, return _the number of prime numbers that are strictly less than_ `n`. **Example 1:** **Input:** n = 10 **Output:** 4 **Explanation:** There are 4 prime numbers less than 10, they are 2, 3, 5, 7. **Example 2:** **Input:** n = 0 **Output:** 0 **Example 3:** **Input:** n = 1 **Output:** 0 **Co...
Let's start with a isPrime function. To determine if a number is prime, we need to check if it is not divisible by any number less than n. The runtime complexity of isPrime function would be O(n) and hence counting the total prime numbers up to n would be O(n2). Could we do better? As we know the number must not be div...
Array,Math,Enumeration,Number Theory
Medium
263,264,279
1,373
That a hello confusion idiots problem call maximum bases in the trees and bring to front and tasty something rich maximum of all BSC first year to that vijendra galaxy pocket despite qualities of ministry latest express and nod in this worship and point this first service team and Values ​​to the right this first servi...
Maximum Sum BST in Binary Tree
maximum-sum-bst-in-binary-tree
Given a **binary tree** `root`, return _the maximum sum of all keys of **any** sub-tree which is also a Binary Search Tree (BST)_. Assume a BST is defined as follows: * The left subtree of a node contains only nodes with keys **less than** the node's key. * The right subtree of a node contains only nodes with key...
null
null
Hard
null
101
hey everyone welcome back and let's write some more neat code today so today let's solve the problem symmetric tree we're given the root of a binary tree and we just want to check if it's a mirror of itself so what that really means is we're just comparing the left subtree of the root and the right subtree of the root ...
Symmetric Tree
symmetric-tree
Given the `root` of a binary tree, _check whether it is a mirror of itself_ (i.e., symmetric around its center). **Example 1:** **Input:** root = \[1,2,2,3,4,4,3\] **Output:** true **Example 2:** **Input:** root = \[1,2,2,null,3,null,3\] **Output:** false **Constraints:** * The number of nodes in the tree is in...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
null
501
According to Adarsh ​​Mishra, this is the According to Adarsh ​​Mishra, this is the According to Adarsh ​​Mishra, this is the nation code you are seeing and today we are going to talk about the list flight mode in binary search tree appointed to subscribe got upset there are some duplicate elements inside it village ag...
Find Mode in Binary Search Tree
find-mode-in-binary-search-tree
Given the `root` of a binary search tree (BST) with duplicates, return _all the [mode(s)](https://en.wikipedia.org/wiki/Mode_(statistics)) (i.e., the most frequently occurred element) in it_. If the tree has more than one mode, return them in **any order**. Assume a BST is defined as follows: * The left subtree of...
null
Tree,Depth-First Search,Binary Search Tree,Binary Tree
Easy
98
1,905
On do hello guys welcome to taste absolutely problem or 120 problem account all islands so let's do the problem and 315 views like what does unique Dhundhi 10111 fan more subscribe to one day some things skin hair and such a dam in this country new Version Lecture With Six Humans That Man's President Electricity Distri...
Count Sub Islands
design-authentication-manager
You are given two `m x n` binary matrices `grid1` and `grid2` containing only `0`'s (representing water) and `1`'s (representing land). An **island** is a group of `1`'s connected **4-directionally** (horizontal or vertical). Any cells outside of the grid are considered water cells. An island in `grid2` is considered ...
Using a map, track the expiry times of the tokens. When generating a new token, add it to the map with its expiry time. When renewing a token, check if it's on the map and has not expired yet. If so, update its expiry time. To count unexpired tokens, iterate on the map and check for each token if it's not expired yet.
Hash Table,Design
Medium
null
938
hey welcome back to another lady called problem and today we are going to solve an easy problem called range some of BSC is binary search trees and last time I made a video about validating at my her search tree so you know if you guys are not familiar with my newsletter you can read more about it here so it's basicall...
Range Sum of BST
numbers-at-most-n-given-digit-set
Given the `root` node of a binary search tree and two integers `low` and `high`, return _the sum of values of all nodes with a value in the **inclusive** range_ `[low, high]`. **Example 1:** **Input:** root = \[10,5,15,3,7,null,18\], low = 7, high = 15 **Output:** 32 **Explanation:** Nodes 7, 10, and 15 are in the ra...
null
Array,Math,Binary Search,Dynamic Programming
Hard
null
1,743
hello everyone so welcome back to late code 1743 problem so the problem is there is an integer arena that consists of n unique elements but you have forgotten it however you do remember every pair of patterns in the element in the line so this is the problem statement so basically what they are trying to say is suppose...
Restore the Array From Adjacent Pairs
count-substrings-that-differ-by-one-character
There is an integer array `nums` that consists of `n` **unique** elements, but you have forgotten it. However, you do remember every pair of adjacent elements in `nums`. You are given a 2D integer array `adjacentPairs` of size `n - 1` where each `adjacentPairs[i] = [ui, vi]` indicates that the elements `ui` and `vi` a...
Take every substring of s, change a character, and see how many substrings of t match that substring. Use a Trie to store all substrings of t as a dictionary.
Hash Table,String,Dynamic Programming
Medium
2256
1,961
hi friends welcome back to the channel uh today we are going to solve lead code problem 1961 check if string is a prefix of array so given a string is an array of string words determine whether s is a prefix string of words a string s is a prefix string of words if s can be made by concatenating the first k string inwa...
Check If String Is a Prefix of Array
maximum-ice-cream-bars
Given a string `s` and an array of strings `words`, determine whether `s` is a **prefix string** of `words`. A string `s` is a **prefix string** of `words` if `s` can be made by concatenating the first `k` strings in `words` for some **positive** `k` no larger than `words.length`. Return `true` _if_ `s` _is a **prefi...
It is always optimal to buy the least expensive ice cream bar first. Sort the prices so that the cheapest ice cream bar comes first.
Array,Greedy,Sorting
Medium
null
43
hey everyone welcome back and let's write some more neat code today so today let's solve the problem multiply strings so we're given two non-negative integers so we're given two non-negative integers so we're given two non-negative integers num1 and num2 but these could be extremely large numbers and because of that th...
Multiply Strings
multiply-strings
Given two non-negative integers `num1` and `num2` represented as strings, return the product of `num1` and `num2`, also represented as a string. **Note:** You must not use any built-in BigInteger library or convert the inputs to integer directly. **Example 1:** **Input:** num1 = "2", num2 = "3" **Output:** "6" **Ex...
null
Math,String,Simulation
Medium
2,66,67,415
1,419
Hello Friends Producers Question From Heat To Beat Contest 180 Minimum Number Of From English Video give From Which Represents Combination Of Strength From Subscribe To My Channel To Hai To Aadmi Logic West Indies Questions Page Will Probe And Super Soft Can Benefit from another subscribe our Channel subscribe this not...
Minimum Number of Frogs Croaking
minimum-number-of-frogs-croaking
You are given the string `croakOfFrogs`, which represents a combination of the string `"croak "` from different frogs, that is, multiple frogs can croak at the same time, so multiple `"croak "` are mixed. _Return the minimum number of_ different _frogs to finish all the croaks in the given string._ A valid `"croak "`...
null
null
Medium
null
1,048
hey what's up guys uh this is chung here so today at today's daily challenge problem number 1048 longest string chain right so you're given like a list of words right and then and this it defines like a word one is a predecessor of word two you know even only if we can add exactly one letter into word one to make it eq...
Longest String Chain
clumsy-factorial
You are given an array of `words` where each word consists of lowercase English letters. `wordA` is a **predecessor** of `wordB` if and only if we can insert **exactly one** letter anywhere in `wordA` **without changing the order of the other characters** to make it equal to `wordB`. * For example, `"abc "` is a **...
null
Math,Stack,Simulation
Medium
null
952
Hello Various Welcome 2020 - Have you moved to Mumbai Hello Various Welcome 2020 - Have you moved to Mumbai Hello Various Welcome 2020 - Have you moved to Mumbai Professor Vinod Great Time with Box Today's Question is Largest Company in Size by Common Factor in this Question Near Giddy to Identify the Price of the Larg...
Largest Component Size by Common Factor
word-subsets
You are given an integer array of unique positive integers `nums`. Consider the following graph: * There are `nums.length` nodes, labeled `nums[0]` to `nums[nums.length - 1]`, * There is an undirected edge between `nums[i]` and `nums[j]` if `nums[i]` and `nums[j]` share a common factor greater than `1`. Return _t...
null
Array,Hash Table,String
Medium
null
224
Hello friends, welcome to my YouTube channel, today we are going to discuss all the problems of the lead, you give 24 which is in the basic calculator, you do not have to do the banana function like velvet, you do not have to do it, after doing valuation and giving us the output, then like. We will call them otherwise ...
Basic Calculator
basic-calculator
Given a string `s` representing a valid expression, implement a basic calculator to evaluate it, and return _the result of the evaluation_. **Note:** You are **not** allowed to use any built-in function which evaluates strings as mathematical expressions, such as `eval()`. **Example 1:** **Input:** s = "1 + 1 " **O...
null
Math,String,Stack,Recursion
Hard
150,227,241,282,785,2147,2328
392
hello today we're going to be doing lead code problem 392 is subsequence and this is one of the top 150 questions that lead code has put together uh the most popular interview questions this problem States given two strings s and t return true if s is a subsequence of t or false otherwise a subsequence of a string is a...
Is Subsequence
is-subsequence
Given two strings `s` and `t`, return `true` _if_ `s` _is a **subsequence** of_ `t`_, or_ `false` _otherwise_. A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i...
null
Two Pointers,String,Dynamic Programming
Easy
808,1051
1,859
1859 leads with sorting the sentence so essentially the question says that we'll take the first example and understand you will be given a string as follows right s would be the string so this is what the string is that would be given to you something similar to this and we need to take these are this is a string made ...
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
1,711
hello everyone so in this video let us talk about a medium level problem from lead code the problem name is Count good meals so the problem statement goes like this that you're given a good meal and a good meal is defined to contain exactly two different food items with a sum of deliciousness equal to the power of two ...
Count Good Meals
find-valid-matrix-given-row-and-column-sums
A **good meal** is a meal that contains **exactly two different food items** with a sum of deliciousness equal to a power of two. You can pick **any** two different foods to make a good meal. Given an array of integers `deliciousness` where `deliciousness[i]` is the deliciousness of the `i​​​​​​th​​​​`​​​​ item of fo...
Find the smallest rowSum or colSum, and let it be x. Place that number in the grid, and subtract x from rowSum and colSum. Continue until all the sums are satisfied.
Array,Greedy,Matrix
Medium
1379
306
hey what's up guys this is john here again so today let's take a look at it called problem number 306 additive number it's a media level problem but it's kind of tricky you know okay so an additive number is a string whose digits can form additive sequence and a valid additive sequence should contain at least three num...
Additive Number
additive-number
An **additive number** is a string whose digits can form an **additive sequence**. A valid **additive sequence** should contain **at least** three numbers. Except for the first two numbers, each subsequent number in the sequence must be the sum of the preceding two. Given a string containing only digits, return `true...
null
String,Backtracking
Medium
872
1,664
hi everyone so i uh i'll be discussing uh date code 1664 problem we used to make a fairly so in this problem we are given input integer area numbers and we can choose exactly one index and remove the limit and arrays of fair if the sum of odd indexed values is equal to the sum of given indexed values and we have to wri...
Ways to Make a Fair Array
find-users-with-valid-e-mails
You are given an integer array `nums`. You can choose **exactly one** index (**0-indexed**) and remove the element. Notice that the index of the elements may change after the removal. For example, if `nums = [6,1,7,4,1]`: * Choosing to remove index `1` results in `nums = [6,7,4,1]`. * Choosing to remove index `2`...
null
Database
Easy
null
649
hi guys good morning welcome back to the next video so basically in this problem in this video we're gonna see this problem Dota 2 scene uh firstly I really be apologies for the inconsistent videos of our Bob graph series but for sure like it would soon pick up the speed for now like it's a too much work apart from thi...
Dota2 Senate
dota2-senate
In the world of Dota2, there are two parties: the Radiant and the Dire. The Dota2 senate consists of senators coming from two parties. Now the Senate wants to decide on a change in the Dota2 game. The voting for this change is a round-based procedure. In each round, each senator can exercise **one** of the two rights:...
null
String,Greedy,Queue
Medium
495
413
hey my friend welcome to choice dynamic programming tutorial you are watching the 100th video of dynamic programming on my channel joey's tech thanks for all your support your comments and acknowledgments really encourage me to keep going and work harder so that i can bring out instructional videos for you on programmi...
Arithmetic Slices
arithmetic-slices
An integer array is called arithmetic if it consists of **at least three elements** and if the difference between any two consecutive elements is the same. * For example, `[1,3,5,7,9]`, `[7,7,7,7]`, and `[3,-1,-5,-9]` are arithmetic sequences. Given an integer array `nums`, return _the number of arithmetic **subarr...
null
Array,Dynamic Programming
Medium
446,1752
188
hey guys welcome back to this video now we're going to solve a coding interview problem best time to buy and sell stock five this is a liquid problem you're given an integer array prices where prices i is the price of a given stock on the eighth day design an algorithm to find the maximum profit you may complete at mos...
Best Time to Buy and Sell Stock IV
best-time-to-buy-and-sell-stock-iv
You are given an integer array `prices` where `prices[i]` is the price of a given stock on the `ith` day, and an integer `k`. Find the maximum profit you can achieve. You may complete at most `k` transactions: i.e. you may buy at most `k` times and sell at most `k` times. **Note:** You may not engage in multiple tran...
null
Array,Dynamic Programming
Hard
121,122,123
4
has been asked by Facebook Amazon Bloomberg Google Tik Tok Microsoft dman sax yendex London Adobe turning Uber Oracle Apple eBay Yahoo Walmart Salesforce and the list goes on and on hi guys welcome to day eight of 100 days 100 challeng in which 100 days 100K plus local placement in this we'll see number of land Islands...
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
739
hey everyone in this video let's take a look at question 739 daily temperatures on Lee code this is part of our blind 75 list of questions so let's begin in this question we are given an array of integers called temperatures which represents the daily temperatures we want to return an array answer such that the answer ...
Daily Temperatures
daily-temperatures
Given an array of integers `temperatures` represents the daily temperatures, return _an array_ `answer` _such that_ `answer[i]` _is the number of days you have to wait after the_ `ith` _day to get a warmer temperature_. If there is no future day for which this is possible, keep `answer[i] == 0` instead. **Example 1:**...
If the temperature is say, 70 today, then in the future a warmer temperature must be either 71, 72, 73, ..., 99, or 100. We could remember when all of them occur next.
Array,Stack,Monotonic Stack
Medium
496,937
202
hello welcome back to my channel today we are going to discuss the solution to the second problem of the late code 30 days coding challenge the name of the problem is happy number the problem description says that all right it will go to them to determine if a number is happy a number is defined by the following proces...
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
387
hi my name is david and we're going to do elite code problem easy level first unique characters in a string and we're going to do it in javascript given a string find the first non-repeating character non-repeating character non-repeating character in it and return its index if it doesn't exist return negative one so f...
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
11
hello everyone let's do lead Code 11 container with most water so we're given an array of heights where each height represents a vertical line so as you can see here in example we want to find the maximum container that we can create using these vertical lines basically the maximum area we can fill with water so in thi...
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
523
Today we will talk about lead code question 523 continuous basis, all the questions are talking about one wait and whether to return true or false, but when to return true, we see that if If there is any morning whose sum is divided and if the reminder comes then zero should come, that is, if there is any morning whose...
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
63
okay hello everyone so today we're going to solve this lead code problem 63 and the name is unique paths 2 and it's the second variation and if you want to well there's the first relation as well which has the name as unique paths only unique paths for unique paths one if you want to check that problem solution then yo...
Unique Paths II
unique-paths-ii
You are given an `m x n` integer array `grid`. There is a robot initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time. An obstacle and space are marked as ...
The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be if obstacleGrid[i][j] is not an obstacle ...
Array,Dynamic Programming,Matrix
Medium
62,1022
85
Hello friends, the liquid problem we are discussing today is 830 Maximum Rectangle Problem, it is a very good problem and one of my most favorite problems. You will definitely have this problem in it because you will get a lot of money in State Bank and 1 hour. This place will be useful. Okay, if you stay till video ca...
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
211
hello everyone in this video we will be solving problem 211 design add and search words data structure the problem statement is we need to design a data structure that supports adding new words and finding if the string matches any previously added words we will be having a constructor a method for adding the words cal...
Design Add and Search Words Data Structure
design-add-and-search-words-data-structure
Design a data structure that supports adding new words and finding if a string matches any previously added string. Implement the `WordDictionary` class: * `WordDictionary()` Initializes the object. * `void addWord(word)` Adds `word` to the data structure, it can be matched later. * `bool search(word)` Returns ...
You should be familiar with how a Trie works. If not, please work on this problem: Implement Trie (Prefix Tree) first.
String,Depth-First Search,Design,Trie
Medium
208,746
283
Friends, today we are going to see the second problem of array, one move zeros which says that we have been given an integer array of numbers, we have to bring all the zeros to the end and we do not have to change the relative order of the non-zero elements, meaning. That we have to we do not have to change the relativ...
Move Zeroes
move-zeroes
Given an integer array `nums`, move all `0`'s to the end of it while maintaining the relative order of the non-zero elements. **Note** that you must do this in-place without making a copy of the array. **Example 1:** **Input:** nums = \[0,1,0,3,12\] **Output:** \[1,3,12,0,0\] **Example 2:** **Input:** nums = \[0\]...
In-place means we should not be allocating any space for extra array. But we are allowed to modify the existing array. However, as a first step, try coming up with a solution that makes use of additional space. For this problem as well, first apply the idea discussed using an additional array and the in-place solution ...
Array,Two Pointers
Easy
27
1,011
hey everybody this is Larry this is February 9th of delete co uh or Larry just doing an extra question um yeah because you know the other one was done before so let's just pick a random question let's keep it with medium and I think I could choose someone told me that I could choose a premium one right how do I choose ...
Capacity To Ship Packages Within D Days
flip-binary-tree-to-match-preorder-traversal
A conveyor belt has packages that must be shipped from one port to another within `days` days. The `ith` package on the conveyor belt has a weight of `weights[i]`. Each day, we load the ship with packages on the conveyor belt (in the order given by `weights`). We may not load more weight than the maximum weight capaci...
null
Tree,Depth-First Search,Binary Tree
Medium
null
61
Al so this question is rotate list so giving the list not the head for the single link list and then you also given a K represent number of time you need to rotate to the right and if you're on the last one you're going to replace to the you know the first one right and then let's look at this so um when k equal to two...
Rotate List
rotate-list
Given the `head` of a linked list, rotate the list to the right by `k` places. **Example 1:** **Input:** head = \[1,2,3,4,5\], k = 2 **Output:** \[4,5,1,2,3\] **Example 2:** **Input:** head = \[0,1,2\], k = 4 **Output:** \[2,0,1\] **Constraints:** * The number of nodes in the list is in the range `[0, 500]`. * ...
null
Linked List,Two Pointers
Medium
189,725
452
Hello Hi Everyone Welcome To My Channel Let's All The Problem Minimum Number Of Cost Wave Women Sudhir Video Start End Coordinator After Start End Subscribe Bhairav ​​Can Give Start End Subscribe Bhairav ​​Can Give Start End Subscribe Bhairav ​​Can Give Water From Different Long-awaited Water From Different Long-awaite...
Minimum Number of Arrows to Burst Balloons
minimum-number-of-arrows-to-burst-balloons
There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array `points` where `points[i] = [xstart, xend]` denotes a balloon whose **horizontal diameter** stretches between `xstart` and `xend`. You do not know the exact y-coordinates of the ball...
null
Array,Greedy,Sorting
Medium
253,435
110
all right this LICO question is called balanced binary tree it says given a binary tree determine if it is height balanced for this problem a height balanced binary tree is defined as a binary tree in which the left and right subtrees of every node differ in height by no more than 1 so with this binary tree just by loo...
Balanced Binary Tree
balanced-binary-tree
Given a binary tree, determine if it is **height-balanced**. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** true **Example 2:** **Input:** root = \[1,2,2,3,3,null,null,4,4\] **Output:** false **Example 3:** **Input:** root = \[\] **Output:** true **Constraints:** * The number of nodes ...
null
Tree,Depth-First Search,Binary Tree
Easy
104
285
welcome back to the cracking paying youtube channel today we're going to be solving lead code problem 285 in-order solving lead code problem 285 in-order solving lead code problem 285 in-order successor in a binary search tree given the root of a binary search tree and a node p in it return the in order successor of th...
Inorder Successor in BST
inorder-successor-in-bst
Given the `root` of a binary search tree and a node `p` in it, return _the in-order successor of that node in the BST_. If the given node has no in-order successor in the tree, return `null`. The successor of a node `p` is the node with the smallest key greater than `p.val`. **Example 1:** **Input:** root = \[2,1,3\...
null
Tree,Depth-First Search,Binary Search Tree,Binary Tree
Medium
94,173,509
237
alright this li code question is called delete node and a linked list it says write a function to delete a node except the tail in a singly linked list given only access to that node so given the linked list which has a head of four and the rest of the linked list is 5 1 9 let's say we're only given access to the node ...
Delete Node in a Linked List
delete-node-in-a-linked-list
There is a singly-linked list `head` and we want to delete a node `node` in it. You are given the node to be deleted `node`. You will **not be given access** to the first node of `head`. All the values of the linked list are **unique**, and it is guaranteed that the given node `node` is not the last node in the linke...
null
Linked List
Easy
203
260
hello and welcome to my channel so today let's look at the lead coder 260 single number three so uh given integer array norms in which exactly two elements appear only once and all the other elements appear exactly twice find the two elements that appear only once you can return the answer in any order you must write a...
Single Number III
single-number-iii
Given an integer array `nums`, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in **any order**. You must write an algorithm that runs in linear runtime complexity and uses only constant extra space. ...
null
Array,Bit Manipulation
Medium
136,137
899
hey everybody this is larry this is the 5th of september hit the like button hit the subscribe button hit join me on discord uh let's talk about these daily problems every day for the rest of the month come hang out okay so today's problem is orderly queue um before we start i just want to say that i usually start thes...
Orderly Queue
binary-gap
You are given a string `s` and an integer `k`. You can choose one of the first `k` letters of `s` and append it at the end of the string.. Return _the lexicographically smallest string you could have after applying the mentioned step any number of moves_. **Example 1:** **Input:** s = "cba ", k = 1 **Output:** "ac...
null
Math,Bit Manipulation
Easy
null
1,275
hello everyone and welcome back to another video so today we're going to be selling the lead code question find winner of a tic-tac-toe game alright so winner of a tic-tac-toe game alright so winner of a tic-tac-toe game alright so in this question we're going to be playing a tic-tac-toe game and the two playing a tic-...
Find Winner on a Tic Tac Toe Game
validate-binary-tree-nodes
**Tic-tac-toe** is played by two players `A` and `B` on a `3 x 3` grid. The rules of Tic-Tac-Toe are: * Players take turns placing characters into empty squares `' '`. * The first player `A` always places `'X'` characters, while the second player `B` always places `'O'` characters. * `'X'` and `'O'` characters a...
Find the parent of each node. A valid tree must have nodes with only one parent and exactly one node with no parent.
Tree,Depth-First Search,Breadth-First Search,Union Find,Graph,Binary Tree
Medium
null