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
682
hey everybody this is larry this is day 10 of delico daily challenge hit the like button to subscribe and join me on discord let me know what you think about today's prom keeping in mind that there's a contest soonish at least in my time so if you did that or if you're going to do it good luck uh and let's get started ...
Baseball Game
baseball-game
You are keeping the scores for a baseball game with strange rules. At the beginning of the game, you start with an empty record. You are given a list of strings `operations`, where `operations[i]` is the `ith` operation you must apply to the record and is one of the following: * An integer `x`. * Record a new...
null
Array,Stack,Simulation
Easy
1720
329
3:29 longest increasing path in the 3:29 longest increasing path in the 3:29 longest increasing path in the matrix given an integer matrix find a length of the longest increasing path I guess this is actually a one the name suggests me so you can move up down that way no idea no diagonals or move outside okay start one...
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
791
hello everyone welcome to chorus camp we are at 14th day of july let's go challenge and the problem we are going to cover in this video is custom sort string so the input given here is a two strings order and string so we have to sort the string str based on the order they have given uh in the string order so let's und...
Custom Sort String
split-bst
You are given two strings order and s. All the characters of `order` are **unique** and were sorted in some custom order previously. Permute the characters of `s` so that they match the order that `order` was sorted. More specifically, if a character `x` occurs before a character `y` in `order`, then `x` should occur ...
Use recursion. If root.val <= V, you split root.right into two halves, then join it's left half back on root.right.
Tree,Binary Search Tree,Recursion,Binary Tree
Medium
450
451
hello everyone welcome to my channel so today we are going to do Lego TV channel short characters by frequency so basically let us first read this question and about the constraint and about examples and then finally the coding part of the thing so here given a string is sort it in decreasing order based on frequency o...
Sort Characters By Frequency
sort-characters-by-frequency
Given a string `s`, sort it in **decreasing order** based on the **frequency** of the characters. The **frequency** of a character is the number of times it appears in the string. Return _the sorted string_. If there are multiple answers, return _any of them_. **Example 1:** **Input:** s = "tree " **Output:** "eer...
null
Hash Table,String,Sorting,Heap (Priority Queue),Bucket Sort,Counting
Medium
347,387,1741
347
hello welcome to my channel today we have nico 347 top k frequent uh elements so given a non-empty array uh elements so given a non-empty array uh elements so given a non-empty array of integer return k most frequent elements so you can see example one numbers have one two three so one we have three uh frequency two ha...
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
1,678
Hello everyone welcome back tu disrespect video and this is the third question of the string series Goal Parcel Interpretation so we try to understand this question from the example, we copy the example from here and bring it to our dashboard then if in the constant If you read, there are only three types of elements h...
Goal Parser Interpretation
number-of-ways-to-split-a-string
You own a **Goal Parser** that can interpret a string `command`. The `command` consists of an alphabet of `"G "`, `"() "` and/or `"(al) "` in some order. The Goal Parser will interpret `"G "` as the string `"G "`, `"() "` as the string `"o "`, and `"(al) "` as the string `"al "`. The interpreted strings are then concat...
There is no way if the sum (number of '1's) is not divisible by the number of splits. So sum%3 should be 0. Preffix s1 , and suffix s3 should have sum/3 characters '1'. Follow up: Can you generalize the problem with numbers between [-10^9, 10^9] such the sum between subarrays s1, s2, s3 are the same?
Math,String
Medium
548
1,066
hey everybody this is Larry this is me doing the weekly premium challenge a and it's one that I've done before don't it's a we it's a premium PR why don't they just do one of the many premium PRS I haven't done before all right let's take a look anyway today uh this week's uh premium prom which apparently I paid for uh...
Campus Bikes II
fixed-point
On a campus represented as a 2D grid, there are `n` workers and `m` bikes, with `n <= m`. Each worker and bike is a 2D coordinate on this grid. We assign one unique bike to each worker so that the sum of the **Manhattan distances** between each worker and their assigned bike is minimized. Return `the minimum possible...
Loop over the array and check the first index i such A[i] == i
Array,Binary Search
Easy
null
1,309
hey how you doing guys it's ilya bell here i record your stuff on youtube chat description for all my information i do all political problems make sure you um subscribe to our channel give me a big thumbs up to support it and this is called decrypt string from alphabet to integer mapping given a string s formed by digi...
Decrypt String from Alphabet to Integer Mapping
sort-items-by-groups-respecting-dependencies
You are given a string `s` formed by digits and `'#'`. We want to map `s` to English lowercase characters as follows: * Characters (`'a'` to `'i'`) are represented by (`'1'` to `'9'`) respectively. * Characters (`'j'` to `'z'`) are represented by (`'10#'` to `'26#'`) respectively. Return _the string formed after ...
Think of it as a graph problem. We need to find a topological order on the dependency graph. Build two graphs, one for the groups and another for the items.
Depth-First Search,Breadth-First Search,Graph,Topological Sort
Hard
null
944
cool 944 delete columns to make sorted we are given an array of array a of n lowercase letter strings are of the same length now may choose any of the any set of the deleted deletion in this is ivory string we delete all the gouges in those indices for example of a is equal to some sharing and duration is 0 to 20 then ...
Delete Columns to Make Sorted
smallest-range-i
You are given an array of `n` strings `strs`, all of the same length. The strings can be arranged such that there is one on each line, making a grid. * For example, `strs = [ "abc ", "bce ", "cae "]` can be arranged as follows: abc bce cae You want to **delete** the columns that are **not sorted lexicographically...
null
Array,Math
Easy
null
128
foreign and welcome back to another video So today we're going to be solving the leaf code question longest consecutive sequence okay so in this question we have a unsorted array of integers called nums the goal is to return the length of the longest consecutive element sequence okay and they wanted to do this in Big O...
Longest Consecutive Sequence
longest-consecutive-sequence
Given an unsorted array of integers `nums`, return _the length of the longest consecutive elements sequence._ You must write an algorithm that runs in `O(n)` time. **Example 1:** **Input:** nums = \[100,4,200,1,3,2\] **Output:** 4 **Explanation:** The longest consecutive elements sequence is `[1, 2, 3, 4]`. Therefor...
null
Array,Hash Table,Union Find
Medium
298,2278
1,535
Hello everyone welcome to my channel Quote Story with Mike So today we are going to do video number 67 of our playlist. Ok it is marked medium but it is quite easy, this question was prepared very quickly by me, it is ok, you can understand it in a few minutes. I was asked whether you are hiding behind this question, y...
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
139
hey everybody this is Larry this is day fourth of the August vehicle day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about these problems today's problem is 139 word break let's take a look to see what's up uh chemistry and S and the dictionary string of vertex r...
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
1,177
all righty so hello again here we are so the idea is that I like to restart the stream of each question um audio the idea audio is working and I've got the chat all right this question is going to be number 1177 which is going to be can make palindrome from substring on leite code um and it's going to be I can make pal...
Can Make Palindrome from Substring
tree-diameter
You are given a string `s` and array `queries` where `queries[i] = [lefti, righti, ki]`. We may rearrange the substring `s[lefti...righti]` for each query and then choose up to `ki` of them to replace with any lowercase English letter. If the substring is possible to be a palindrome string after the operations above, ...
Start at any node A and traverse the tree to find the furthest node from it, let's call it B. Having found the furthest node B, traverse the tree from B to find the furthest node from it, lets call it C. The distance between B and C is the tree diameter.
Tree,Depth-First Search,Breadth-First Search
Medium
1740
249
hey hello there so today I'm going to talk about the 249 group I shifted strings so for the question is as follows given a string we can shift each of its letter to the letters successive letter for example if I have if we have ABC we will transform that into BCD because b is the successive letter for a C is the succes...
Group Shifted Strings
group-shifted-strings
We can shift a string by shifting each of its letters to its successive letter. * For example, `"abc "` can be shifted to be `"bcd "`. We can keep shifting the string to form a sequence. * For example, we can keep shifting `"abc "` to form the sequence: `"abc " -> "bcd " -> ... -> "xyz "`. Given an array of str...
null
Array,Hash Table,String
Medium
49
421
welcome to september's lego challenge today's problem is maximum xor of two numbers in an array given a non-empty array of numbers where given a non-empty array of numbers where given a non-empty array of numbers where a i is going to be between 0 and 2 to the 31 power find the maximum result of an a i xor aj can you d...
Maximum XOR of Two Numbers in an Array
maximum-xor-of-two-numbers-in-an-array
Given an integer array `nums`, return _the maximum result of_ `nums[i] XOR nums[j]`, where `0 <= i <= j < n`. **Example 1:** **Input:** nums = \[3,10,5,25,2,8\] **Output:** 28 **Explanation:** The maximum result is 5 XOR 25 = 28. **Example 2:** **Input:** nums = \[14,70,53,83,49,91,36,80,92,51,66,70\] **Output:** 1...
null
Array,Hash Table,Bit Manipulation,Trie
Medium
1826
1,288
everyone welcome back and let's write some more neat code today so today let's solve the problem remove covered intervals we're given an array of intervals and each interval is basically a two points a left point and a right point so basically if we had suppose a number line like this one then you know let's take these...
Remove Covered Intervals
maximum-subarray-sum-with-one-deletion
Given an array `intervals` where `intervals[i] = [li, ri]` represent the interval `[li, ri)`, remove all intervals that are covered by another interval in the list. The interval `[a, b)` is covered by the interval `[c, d)` if and only if `c <= a` and `b <= d`. Return _the number of remaining intervals_. **Example 1:...
How to solve this problem if no deletions are allowed ? Try deleting each element and find the maximum subarray sum to both sides of that element. To do that efficiently, use the idea of Kadane's algorithm.
Array,Dynamic Programming
Medium
null
319
hello everyone so in this video let us talk about one more medium level problem from lead code the problem name is bulb switch up so let's start so as you can see there are N Bulbs that are initially off now you first turn on all the bulbs then you turn off every second bulb on a third round you toggle every third one ...
Bulb Switcher
bulb-switcher
There are `n` bulbs that are initially off. You first turn on all the bulbs, then you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it's off or turning off if it's on). For the `ith` round, you toggle every `i` bulb. For the `nth` round, you only toggle the last bulb. Retu...
null
Math,Brainteaser
Medium
672,1037,1491
85
Hello Everyone Welcome to Last Tip Normally Some Thursday Every Time His Weekly Lottery Today Is Challenge and Dance Just As Well As Maximum Rectangle Question Read Nand subscribe The Channel and subscribe this Video subscribe this Light is The Amazing Subscribe Maximum Do A Label Question Read However Be Noted That Wi...
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
485
hey guys welcome back to my channel and i'm back again with another really interesting coding interview question video this time guys we are going to solve question number 485 of the code called max consecutive ones before i start with the video guys if you have not yet subscribed to my channel then please do subscribe...
Max Consecutive Ones
max-consecutive-ones
Given a binary array `nums`, return _the maximum number of consecutive_ `1`_'s in the array_. **Example 1:** **Input:** nums = \[1,1,0,1,1,1\] **Output:** 3 **Explanation:** The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s is 3. **Example 2:** **Input:** nums = ...
You need to think about two things as far as any window is concerned. One is the starting point for the window. How do you detect that a new window of 1s has started? The next part is detecting the ending point for this window. How do you detect the ending point for an existing window? If you figure these two things...
Array
Easy
487,1046,1542,1999
1,923
hey what's up guys this is chung here uh it's been a while okay so this time lead code number uh not 1920 23 longest common sub path okay so this time there's like we have uncities numbered from zero to n minus one in this country uh okay so i'm going to skip this long description right so what so in the end what we ha...
Longest Common Subpath
sentence-similarity-iii
There is a country of `n` cities numbered from `0` to `n - 1`. In this country, there is a road connecting **every pair** of cities. There are `m` friends numbered from `0` to `m - 1` who are traveling through the country. Each one of them will take a path consisting of some cities. Each path is represented by an inte...
One way to look at it is to find one sentence as a concatenation of a prefix and suffix from the other sentence. Get the longest common prefix between them and the longest common suffix.
Array,Two Pointers,String
Medium
null
4
hello friends welcome to coding host youtube channel in this video i will explain your elite code problem median of two sorted arrays so in this question we will get two sorted arrays num seven and nums two of size m and n so we have to return the median of this two sorted arrays and the overall runtime complexity shou...
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
241
so this question is lead code 241 different ways to add parenthesis so we are given an expression and we have to return all possible values of that expression when evaluated we can evaluate 2 minus 1 first this portion first which will give us 1 and then this portion which will give us minus 1 which returns 0 so which ...
Different Ways to Add Parentheses
different-ways-to-add-parentheses
Given a string `expression` of numbers and operators, return _all possible results from computing all the different possible ways to group numbers and operators_. You may return the answer in **any order**. The test cases are generated such that the output values fit in a 32-bit integer and the number of different res...
null
Math,String,Dynamic Programming,Recursion,Memoization
Medium
95,224,282,2147,2328
345
hello everyone so in this video let us talk about an easy problem from lead code the problem name is reverse vowels of a string so you're given a string s you have to reverse only the vowels in the string and you just have to return the string after doing this reversal now let's take an example so as you can see in the...
Reverse Vowels of a String
reverse-vowels-of-a-string
Given a string `s`, reverse only all the vowels in the string and return it. The vowels are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`, and they can appear in both lower and upper cases, more than once. **Example 1:** **Input:** s = "hello" **Output:** "holle" **Example 2:** **Input:** s = "leetcode" **Output:** "leotc...
null
Two Pointers,String
Easy
344,1089
147
Soon Hello Everyone Welcome Back To My Channel Swad Has Very Interesting Problems Discussing Problems Instructions For At Least To Exam Clear And Short Social Site When We Do We Repair And In It We Have To Fold This Information Shot here, what is objective, the difference here is that here we have an increase and on th...
Insertion Sort List
insertion-sort-list
Given the `head` of a singly linked list, sort the list using **insertion sort**, and return _the sorted list's head_. The steps of the **insertion sort** algorithm: 1. Insertion sort iterates, consuming one input element each repetition and growing a sorted output list. 2. At each iteration, insertion sort removes...
null
Linked List,Sorting
Medium
148,850
779
what's up everyone myself additi and today I'm back with lead codes another daily challenge problems so in this video um we are going to solve question number 779 that is scates symbol and grammar so we have to build a table of n rows which is one index and we start by writing zero in the first row now in every subsequ...
K-th Symbol in Grammar
max-chunks-to-make-sorted-ii
We build a table of `n` rows (**1-indexed**). We start by writing `0` in the `1st` row. Now in every subsequent row, we look at the previous row and replace each occurrence of `0` with `01`, and each occurrence of `1` with `10`. * For example, for `n = 3`, the `1st` row is `0`, the `2nd` row is `01`, and the `3rd` r...
Each k for which some permutation of arr[:k] is equal to sorted(arr)[:k] is where we should cut each chunk.
Array,Stack,Greedy,Sorting,Monotonic Stack
Hard
780
1,085
hey everybody this is Larry it's January 29th here in New York uh hit the like button hit the Subscribe button join me on Discord let me know what you think about uh whatever I'm doing I'm basically going to do an extra bonus question determined by ing hopefully it's not too difficult don't this is a little bit too eas...
Sum of Digits in the Minimum Number
the-earliest-moment-when-everyone-become-friends
Given an integer array `nums`, return `0` _if the sum of the digits of the minimum integer in_ `nums` _is odd, or_ `1` _otherwise_. **Example 1:** **Input:** nums = \[34,23,1,24,75,33,54,8\] **Output:** 0 **Explanation:** The minimal element is 1, and the sum of those digits is 1 which is odd, so the answer is 0. **...
Sort the log items by their timestamp. How can we model this problem as a graph problem? Let's use a union-find data structure. At the beginning we have a graph with N nodes but no edges. Then we loop through the events and if unite each node until the number of connected components reach to 1. Notice that each time tw...
Array,Union Find
Medium
547
834
everyone welcome to my channel so in this video i'm going to cover the solution to this question called sum of distance in the tree uh so before we start the real content for today i would really appreciate that if you can help subscribe the channel because it can help this channel to grow so thanks the other ones so l...
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
374
hello quick introduction to the video my name is Cameron I'm a graduate Apprentice software engineer currently studying at Glasgow University and I'm using this video as a way to sort of rubber ducky debug a late code problem just attempt to solve it talk through my thought process and hopefully it's useful to someone ...
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,980
Hello everyone Welcome to my channel here we solve problems Lead code today task number 1980 find a unique binary string we are given an array of strings nums containing N unique binary strings each of length N we need to return a binary string also of length N which is not in the nums array if there are several possib...
Find Unique Binary String
faulty-sensor
Given an array of strings `nums` containing `n` **unique** binary strings each of length `n`, return _a binary string of length_ `n` _that **does not appear** in_ `nums`_. If there are multiple answers, you may return **any** of them_. **Example 1:** **Input:** nums = \[ "01 ", "10 "\] **Output:** "11 " **Explanatio...
Check for a common prefix of the two arrays. After this common prefix, there should be one array similar to the other but shifted by one. If both arrays can be shifted, return -1.
Array,Two Pointers
Easy
null
165
hello everyone welcome to our channel code with sunny and in this video we will be talking about the problem medium problem compare version numbers its index is 165 and it is the medium problem the lead code given two words the numbers version one and version two we have to compare them okay uh so also before moving on...
Compare Version Numbers
compare-version-numbers
Given two version numbers, `version1` and `version2`, compare them. Version numbers consist of **one or more revisions** joined by a dot `'.'`. Each revision consists of **digits** and may contain leading **zeros**. Every revision contains **at least one character**. Revisions are **0-indexed from left to right**, wit...
null
Two Pointers,String
Medium
null
48
welcome to april's lego challenge today's problem is rotate image you are given an n times n2d matrix representing an image now rotate the image by 90 degrees clockwise but you have to rotate the image in place which means you have to modify the input directly so don't allocate another 2d matrix and then do the rotatio...
Rotate Image
rotate-image
You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise). You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati...
null
Array,Math,Matrix
Medium
2015
1,095
B is a better question, it is a heart problem, but friend, if I say that a medium problem is okay, a little bit somewhere, whatever our previous concept is, we are going to use it on this, so let's see basically what we have been told, we have a question. The name of this is find the mountain array this problem is this...
Find in Mountain Array
two-city-scheduling
_(This problem is an **interactive problem**.)_ You may recall that an array `arr` is a **mountain array** if and only if: * `arr.length >= 3` * There exists some `i` with `0 < i < arr.length - 1` such that: * `arr[0] < arr[1] < ... < arr[i - 1] < arr[i]` * `arr[i] > arr[i + 1] > ... > arr[arr.length ...
null
Array,Greedy,Sorting
Medium
null
43
Jhaal Hello friends, today we will see the program of multiplication twisting in C plus that your program on the left is formed in a condition here, you cannot multiply this trick by converting it into an interior function, first of all we two Let's take the history, get input from it, give it in a test or variable and...
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
678
hey yo what's up my little coders let me show you in this tutorial how to solve the lithgow question number 678 valid parentheses string basically given a string s contain only three types of characters left parenthesis right parenthesis and a star return true if s is valid the following rules define a valid string any...
Valid Parenthesis String
valid-parenthesis-string
Given a string `s` containing only three types of characters: `'('`, `')'` and `'*'`, return `true` _if_ `s` _is **valid**_. The following rules define a **valid** string: * Any left parenthesis `'('` must have a corresponding right parenthesis `')'`. * Any right parenthesis `')'` must have a corresponding left p...
null
String,Dynamic Programming,Stack,Greedy
Medium
763,2221
406
406 from Bitkom, which is called low connections, this is the program that looks complicated, it was said in the description itself that it was very far-fetched. What it is about was very far-fetched. What it is about was very far-fetched. What it is about is that they are going to give us a rule of arrangements where ...
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
334
hello everyone welcome back here it's my name is and today we are tackling an exciting algorithmic challenge the increasing triplet subsequence so it's a medium level problem on lit code but the solution is pure Elegance so stick with me and let's unravel it together so the problem is simple yet intriguing given an int...
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
140
hey yo what's up guys babybear4812 coming at you one more time uh this time not actually not dressed like a 12 year old boy i uh unfortunately i got a funeral to run to after this which explains the fancy dress but it's the way the cookie crumbles um so problem 140 word break two it's a really good problem it's an old ...
Word Break II
word-break-ii
Given a string `s` and a dictionary of strings `wordDict`, add spaces in `s` to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in **any order**. **Note** that the same word in the dictionary may be reused multiple times in the segmentation. **Example 1:** **Input:...
null
Hash Table,String,Dynamic Programming,Backtracking,Trie,Memoization
Hard
139,472
402
hi everyone today we are going to solve the little question uh remove K digits so you are given string num representing non-negative integer num and the integer non-negative integer num and the integer non-negative integer num and the integer K Returns the smallest possible integer after removing K digits from num so l...
Remove K Digits
remove-k-digits
Given string num representing a non-negative integer `num`, and an integer `k`, return _the smallest possible integer after removing_ `k` _digits from_ `num`. **Example 1:** **Input:** num = "1432219 ", k = 3 **Output:** "1219 " **Explanation:** Remove the three digits 4, 3, and 2 to form the new number 1219 which ...
null
String,Stack,Greedy,Monotonic Stack
Medium
321,738,1792,2305
1,996
Hello Hi Everyone, today we are going to update the list of twelve verses of number of characters in the game show Zindagi A Great Place question, what has been said to us about the unlimited property, salary and properties, what is it, we have two things, one. Attack and active friends, then this attack becomes differ...
The Number of Weak Characters in the Game
number-of-ways-to-rearrange-sticks-with-k-sticks-visible
You are playing a game that contains multiple characters, and each of the characters has **two** main properties: **attack** and **defense**. You are given a 2D integer array `properties` where `properties[i] = [attacki, defensei]` represents the properties of the `ith` character in the game. A character is said to be...
Is there a way to build the solution from a base case? How many ways are there if we fix the position of one stick?
Math,Dynamic Programming,Combinatorics
Hard
null
85
hello guys this is zohaim over here and today we are going to solve a heart problem from lead code according to lead code this is a very frequently asked question by google so in this question we need to calculate the maximum area of the rectangles that can be formed so the rectangle with the maximum area and in this c...
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
965
Who is the meaning of but due to return to happen only is loot-loot what do happen only is loot-loot what do ki pur is alternative fuel interest click do the first india first form into electronic loot gaye loot In this and Indian track is a new dance definitely w amazon vacancy dot is arundhati lost and route from obs...
Univalued Binary Tree
unique-email-addresses
A binary tree is **uni-valued** if every node in the tree has the same value. Given the `root` of a binary tree, return `true` _if the given tree is **uni-valued**, or_ `false` _otherwise._ **Example 1:** **Input:** root = \[1,1,1,1,1,null,1\] **Output:** true **Example 2:** **Input:** root = \[2,2,2,5,2\] **Outpu...
null
Array,Hash Table,String
Easy
null
1,470
hey everyone welcome back and let's write some more neat code today so today let's solve the problem Shuffle the array we're given an input array nums which could be divided into two halves so we have a bunch of X values and we have a bunch of Y values and we have equally half and half so we say we have n x values and ...
Shuffle the Array
tweet-counts-per-frequency
Given the array `nums` consisting of `2n` elements in the form `[x1,x2,...,xn,y1,y2,...,yn]`. _Return the array in the form_ `[x1,y1,x2,y2,...,xn,yn]`. **Example 1:** **Input:** nums = \[2,5,1,3,4,7\], n = 3 **Output:** \[2,3,5,4,1,7\] **Explanation:** Since x1\=2, x2\=5, x3\=1, y1\=3, y2\=4, y3\=7 then the answer ...
null
Hash Table,Binary Search,Design,Sorting,Ordered Set
Medium
null
413
hello everyone and welcome back to another video so today we're going to be taking a look at the leak code question arithmetic slices all right so let's first go over the question real quickly so over here a sequence of numbers is called arithmetic if it consists of at least three elements and if the difference between...
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
82
Double Tumne Din Statement Food Ko Students And Andhra Police Problem Ise Gym Victims At Least You To Remove Duplicate From Last Time Most Loud The First Feature Is Problem Signal System In History Uchai Tak Play List In Registration Certificate And Complexes Are Also You Will Find The Equation For the end proportion o...
Remove Duplicates from Sorted List II
remove-duplicates-from-sorted-list-ii
Given the `head` of a sorted linked list, _delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list_. Return _the linked list **sorted** as well_. **Example 1:** **Input:** head = \[1,2,3,3,4,4,5\] **Output:** \[1,2,5\] **Example 2:** **Input:** head = \[1,1,1,2,3\] **Outpu...
null
Linked List,Two Pointers
Medium
83,1982
746
Ajay Ko's Record Scan Samadhi of Falling and today let's do 146 Sour Regulation Method. I had explained its message to you in the previous video and in this video you will mix it and see the tablet message. Okay, let's start. Then it happened that half So this was the problem, observation tablet and laptop were left, l...
Min Cost Climbing Stairs
prefix-and-suffix-search
You are given an integer array `cost` where `cost[i]` is the cost of `ith` step on a staircase. Once you pay the cost, you can either climb one or two steps. You can either start from the step with index `0`, or the step with index `1`. Return _the minimum cost to reach the top of the floor_. **Example 1:** **Input...
For a word like "test", consider "#test", "t#test", "st#test", "est#test", "test#test". Then if we have a query like prefix = "te", suffix = "t", we can find it by searching for something we've inserted starting with "t#te".
String,Design,Trie
Hard
211
234
The name of the question is Palindrome Link List. You will find this question in the lead code. Question number 234. If you can solve it by going there, the link list has been given to you in the input in the question and if you have to give the answer in the asked and false, then this is our problem statement. So for ...
Palindrome Linked List
palindrome-linked-list
Given the `head` of a singly linked list, return `true` _if it is a_ _palindrome_ _or_ `false` _otherwise_. **Example 1:** **Input:** head = \[1,2,2,1\] **Output:** true **Example 2:** **Input:** head = \[1,2\] **Output:** false **Constraints:** * The number of nodes in the list is in the range `[1, 105]`. * ...
null
Linked List,Two Pointers,Stack,Recursion
Easy
9,125,206,2236
676
foreign welcome back to the channels so today in this video lecture will be solving this problem Implement magic dictionary so this problem is the next problem in the try series and in this problem we just have to implement try actually just Implement try with a little bit modification so basically you design a data st...
Implement Magic Dictionary
implement-magic-dictionary
Design a data structure that is initialized with a list of **different** words. Provided a string, you should determine if you can change exactly one character in this string to match any word in the data structure. Implement the `MagicDictionary` class: * `MagicDictionary()` Initializes the object. * `void build...
null
Hash Table,String,Design,Trie
Medium
208,720
1,737
hey what's up guys this is john here again so this time let's take a look at this problem number 1.13 this problem number 1.13 this problem number 1.13 737 change minimum characters to satisfy one of three conditions um this one regards a lot of downloads because of the uh ambiguous uh description so you're given like ...
Change Minimum Characters to Satisfy One of Three Conditions
maximum-nesting-depth-of-the-parentheses
You are given two strings `a` and `b` that consist of lowercase letters. In one operation, you can change any character in `a` or `b` to **any lowercase letter**. Your goal is to satisfy **one** of the following three conditions: * **Every** letter in `a` is **strictly less** than **every** letter in `b` in the alp...
The depth of any character in the VPS is the ( number of left brackets before it ) - ( number of right brackets before it )
String,Stack
Easy
1208
240
My device welcome to take to raipur nivedita and this video we are going to solve search to remedies to so this problem statement by giving here is a matriculation given to you jogi provide is started tanning is sorted in the hotel by length send in a quarter Okay and what we have to do here is to search for a target v...
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
552
all right today we have a viewer requested video student attendance record 2 lead code 552 so the problem is as follows we're asked to create some sort of attendance record using just the letters a l and p and basically they're going to give us an n value which is the length of this attendance record or length of this ...
Student Attendance Record II
student-attendance-record-ii
An attendance record for a student can be represented as a string where each character signifies whether the student was absent, late, or present on that day. The record only contains the following three characters: * `'A'`: Absent. * `'L'`: Late. * `'P'`: Present. Any student is eligible for an attendance awar...
null
Dynamic Programming
Hard
551
1,254
hello and welcome to another video on the graph Series today we are going to cover a very important question that interestingly most of the other graph playerlist or boot camps do not cover and I will tell you why this question is a small variation of the question that we did last which is number of Island question now...
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
387
Subscribe to our channel Computer Sibble and press the bell icon to get updated with all the important questions of C plus python and rice Prince, today we will see the program of Python's first unit character is a string, I have fast character in a string so If it is not repeated, we have to print it. If there is even...
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
473
hey everybody this is larry this is me going over june 15th uh leeco daily challenge uh so hit the like button to subscribe and join me on discord uh let me know what you think about this prom so you're gonna hit the intro twice and you know if i skip forward a little bit i'll put some timer markers on the end uh or in...
Matchsticks to Square
matchsticks-to-square
You are given an integer array `matchsticks` where `matchsticks[i]` is the length of the `ith` matchstick. You want to use **all the matchsticks** to make one square. You **should not break** any stick, but you can link them up, and each matchstick must be used **exactly one time**. Return `true` if you can make this ...
Treat the matchsticks as an array. Can we split the array into 4 equal halves? Every matchstick can belong to either of the 4 sides. We don't know which one. Maybe try out all options! For every matchstick, we have to try out each of the 4 options i.e. which side it can belong to. We can make use of recursion for this....
Array,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask
Medium
null
888
hi guys myself getting this video which is different number of candies and you're giving two integer arrays unless his and Bobs is an H having the candies so this uh two boxes it has a list and each box has one candy then Bob also has two boxes each box has two candies and since my friends they would like to exchange o...
Fair Candy Swap
mirror-reflection
Alice and Bob have a different total number of candies. You are given two integer arrays `aliceSizes` and `bobSizes` where `aliceSizes[i]` is the number of candies of the `ith` box of candy that Alice has and `bobSizes[j]` is the number of candies of the `jth` box of candy that Bob has. Since they are friends, they wo...
null
Math,Geometry
Medium
null
477
how's it going guys today we're gonna be going over a problem called Hamming distance is a problem on leaked code that's commonly asked by Adobe over in Facebook problem description said is the Hamming distance between two integers is a number of positions at which the corresponding bits are different given two integer...
Total Hamming Distance
total-hamming-distance
The [Hamming distance](https://en.wikipedia.org/wiki/Hamming_distance) between two integers is the number of positions at which the corresponding bits are different. Given an integer array `nums`, return _the sum of **Hamming distances** between all the pairs of the integers in_ `nums`. **Example 1:** **Input:** num...
null
Array,Math,Bit Manipulation
Medium
461
142
hey everybody this is Larry this is day eight uh ninth of delete code daily challenge hit the like button hit the Subscribe button drop me on Discord let me know what you think about today's Forum today's problem is 142. uh linked list psycho two hit the like button hit the Subscribe button join me on Discord let me kn...
Linked List Cycle II
linked-list-cycle-ii
Given the `head` of a linked list, return _the node where the cycle begins. If there is no cycle, return_ `null`. There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that ta...
null
Hash Table,Linked List,Two Pointers
Medium
141,287
313
today we're gonna be working on lead code question number 313 uh super ugly number a super ugly number is a positive integer whose prime factors are in the array primes and given an ugly number n and an array of integers primes return the nth super ugly number and the end super clean number is guaranteed to fit in a 32...
Super Ugly Number
super-ugly-number
A **super ugly number** is a positive integer whose prime factors are in the array `primes`. Given an integer `n` and an array of integers `primes`, return _the_ `nth` _**super ugly number**_. The `nth` **super ugly number** is **guaranteed** to fit in a **32-bit** signed integer. **Example 1:** **Input:** n = 12, ...
null
Array,Hash Table,Math,Dynamic Programming,Heap (Priority Queue)
Medium
264
523
hi everyone so let's talk about continuous of a reason so basically you need well you have integer array numbers and in your decay return true if the nouns has a continuous sub array of sets at least two whose elements are not to the both k and both other squares right and there is always the multiple of a right so uh ...
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
853
As-Salaam Alaikum friends, today we look at a medium As-Salaam Alaikum friends, today we look at a medium As-Salaam Alaikum friends, today we look at a medium difficulty problem which is going to the destination and the most important thing to remember is that if two vehicles are going to the destination and the rear v...
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
1,091
welcome to cold Sutra in this video we'll be solving lead code problem number 1091 shortest path in a binary Matrix in this problem we are given a square Matrix of size n that is we'll be having a n cross n Matrix and we have to move from the starting point that is 0 comma 0 to the end point that is n minus 1 comma n m...
Shortest Path in Binary Matrix
maximum-average-subtree
Given an `n x n` binary matrix `grid`, return _the length of the shortest **clear path** in the matrix_. If there is no clear path, return `-1`. A **clear path** in a binary matrix is a path from the **top-left** cell (i.e., `(0, 0)`) to the **bottom-right** cell (i.e., `(n - 1, n - 1)`) such that: * All the visite...
Can you find the sum of values and the number of nodes for every sub-tree ? Can you find the sum of values and the number of nodes for a sub-tree given the sum of values and the number of nodes of it's left and right sub-trees ? Use depth first search to recursively find the solution for the children of a node then use...
Tree,Depth-First Search,Binary Tree
Medium
2126
246
now let's go over question number 246 showable grammatic numbers given a string num which represents an integer so we're going to be giving a string number which is going to be representing an integer return true if it is a showable grammatic number so what is a strobogrammatic number it's a number that looks the same ...
Strobogrammatic Number
strobogrammatic-number
Given a string `num` which represents an integer, return `true` _if_ `num` _is a **strobogrammatic number**_. A **strobogrammatic number** is a number that looks the same when rotated `180` degrees (looked at upside down). **Example 1:** **Input:** num = "69 " **Output:** true **Example 2:** **Input:** num = "88...
null
Hash Table,Two Pointers,String
Easy
247,248,1069
435
Hello everyone and welcome back to my channel Algorithm H today I am going to write the code and also explain you all the algorithm to solve this non overlapping intervals problem which is there in lead code it is a medium level problem and we are going to Solve it using a greedy algorithm but before all of this please...
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
491
good evening everyone today we are going to do the daily read code challenge of 20 January 2023 that is question number 491 non-decreasing subsequences so what 491 non-decreasing subsequences so what 491 non-decreasing subsequences so what the question is saying we are given an integer array in terms written all the di...
Non-decreasing Subsequences
increasing-subsequences
Given an integer array `nums`, return _all the different possible non-decreasing subsequences of the given array with at least two elements_. You may return the answer in **any order**. **Example 1:** **Input:** nums = \[4,6,7,7\] **Output:** \[\[4,6\],\[4,6,7\],\[4,6,7,7\],\[4,7\],\[4,7,7\],\[6,7\],\[6,7,7\],\[7,7\]...
null
Array,Hash Table,Backtracking,Bit Manipulation
Medium
646
295
hey everyone welcome back and let's write some more neat code today so today let's solve find median from a data stream so this is another hard problem but it's not super difficult if you know the data structure behind it so they basically tell us we know the median is defined as the middle value in a sorted integer li...
Find Median from Data Stream
find-median-from-data-stream
The **median** is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two middle values. * For example, for `arr = [2,3,4]`, the median is `3`. * For example, for `arr = [2,3]`, the median is `(2 + 3) / 2 = 2.5`. Implement the M...
null
Two Pointers,Design,Sorting,Heap (Priority Queue),Data Stream
Hard
480,1953,2207
697
hello everyone so in this video let us talk about one more problem from lead code the problem name is degree of an array so the problem goes like this that you are given a non-empty array of you are given a non-empty array of you are given a non-empty array of non-negative integers nums such that the non-negative integ...
Degree of an Array
degree-of-an-array
Given a non-empty array of non-negative integers `nums`, the **degree** of this array is defined as the maximum frequency of any one of its elements. Your task is to find the smallest possible length of a (contiguous) subarray of `nums`, that has the same degree as `nums`. **Example 1:** **Input:** nums = \[1,2,2,3,...
Say 5 is the only element that occurs the most number of times - for example, nums = [1, 5, 2, 3, 5, 4, 5, 6]. What is the answer?
Array,Hash Table
Easy
53
1,668
let's solve the problem 1668 maximum repeating substring of late code so what the question is that you will be given two strings one is called sequence and other is called word and sequence is the longer potentially longer string okay and word is the string you need to find in sequence okay not just that you need to fi...
Maximum Repeating Substring
find-longest-awesome-substring
For a string `sequence`, a string `word` is **`k`\-repeating** if `word` concatenated `k` times is a substring of `sequence`. The `word`'s **maximum `k`\-repeating value** is the highest value `k` where `word` is `k`\-repeating in `sequence`. If `word` is not a substring of `sequence`, `word`'s maximum `k`\-repeating v...
Given the character counts, under what conditions can a palindrome be formed ? From left to right, use bitwise xor-operation to compute for any prefix the number of times modulo 2 of each digit. (mask ^= (1<<(s[i]-'0')). Expected complexity is O(n*A) where A is the alphabet (10).
Hash Table,String,Bit Manipulation
Hard
null
215
hello everyone welcome to clashy code so in this video we will see the question 215 that is kth largest element in an array and this is a medium level question on lead code platform and also the one of most like questions in this platform and it has been asked in various interviews for the amazon google facebook etc so...
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
452
Ajay gets this absolutely free closed channel, this portion comes, so let's get a small minimum numbers of the roles, gourmet, just balance chicken question is very easy, tomorrow is central, this type of this type easy, tomorrow is central, this type of portion, first now this which is its seats, you will find it in t...
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
1,690
hey everybody this is larry this is day 11 of the june eco daily challenge uh hit the like button in the subscribe button join me on discord let me know what you think about today's problem uh stone game seven uh just like ff7 okay and yeah usually i solve these problems live so it's a little bit slow or whatever and w...
Stone Game VII
maximum-length-of-subarray-with-positive-product
Alice and Bob take turns playing a game, with **Alice starting first**. There are `n` stones arranged in a row. On each player's turn, they can **remove** either the leftmost stone or the rightmost stone from the row and receive points equal to the **sum** of the remaining stones' values in the row. The winner is the ...
Split the whole array into subarrays by zeroes since a subarray with positive product cannot contain any zero. If the subarray has even number of negative numbers, the whole subarray has positive product. Otherwise, we have two choices, either - remove the prefix till the first negative element in this subarray, or rem...
Array,Dynamic Programming,Greedy
Medium
null
1,750
so I got this question that I recently did for today another one of those U videos where I'm testing out new different formats as I'm trying to accumulate my equipment that's F anyway so you have a question here Min what is the minimum length of string after deleting similar ends read the question it will tell you uh i...
Minimum Length of String After Deleting Similar Ends
check-if-two-expression-trees-are-equivalent
Given a string `s` consisting only of characters `'a'`, `'b'`, and `'c'`. You are asked to apply the following algorithm on the string any number of times: 1. Pick a **non-empty** prefix from the string `s` where all the characters in the prefix are equal. 2. Pick a **non-empty** suffix from the string `s` where all...
Count for each variable how many times it appeared in the first tree. Do the same for the second tree and check if the count is the same for both tree.
Tree,Depth-First Search,Binary Tree
Medium
1736
412
hey everybody welcome back and today we'll be doing another lead code 412 Fizz Buzz this is an easy one and also a very famous one given a teacher and return a string array answer index one so if it is divisible if we are given a number uh you can say a list basically but not a list just a number and we have to from on...
Fizz Buzz
fizz-buzz
Given an integer `n`, return _a string array_ `answer` _(**1-indexed**) where_: * `answer[i] == "FizzBuzz "` if `i` is divisible by `3` and `5`. * `answer[i] == "Fizz "` if `i` is divisible by `3`. * `answer[i] == "Buzz "` if `i` is divisible by `5`. * `answer[i] == i` (as a string) if none of the above condit...
null
Math,String,Simulation
Easy
1316
895
back to the cracking fang youtube channel today we're going to be solving lead code problem 895 maximum frequency stack design a stack like data structure to push elements to the stack and pop the most frequent element from the stack we want to be implementing the frequency stack class whose initializer frequency stack...
Maximum Frequency Stack
shortest-path-to-get-all-keys
Design a stack-like data structure to push elements to the stack and pop the most frequent element from the stack. Implement the `FreqStack` class: * `FreqStack()` constructs an empty frequency stack. * `void push(int val)` pushes an integer `val` onto the top of the stack. * `int pop()` removes and returns the...
null
Bit Manipulation,Breadth-First Search
Hard
null
1,833
welcome to Pomodoro Joe for Friday January 6 2023 let's see what we got today looks like today's lead code is 1833 maximum ice cream bars it's a medium problem and the problem statement says it's a sweltering summer day and a boy wants to buy some ice cream bars at the store there are n ice cream bars you're given an a...
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
1,462
hey everyone welcome back and let's write some more neat code today so today let's solve the problem course schedule four we're given a total number of courses let's say that's n then those courses are going to be numbered from 0 to n minus one this is a pretty standard way of representing a graph so these are going to...
Course Schedule IV
list-the-products-ordered-in-a-period
There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `ai` first if you want to take course `bi`. * For example, the pair `[0, 1]` indicates that you have to ...
null
Database
Easy
null
114
hello everybody welcome to another video on problem solving in this video we're going to be solving another problem on lead code which is flatten binary tree to link list so let's quickly go through the description try to understand what the problem is and then we'll see how we'll be solving it so we've been given the ...
Flatten Binary Tree to Linked List
flatten-binary-tree-to-linked-list
Given the `root` of a binary tree, flatten the tree into a "linked list ": * The "linked list " should use the same `TreeNode` class where the `right` child pointer points to the next node in the list and the `left` child pointer is always `null`. * The "linked list " should be in the same order as a [**pre-order*...
If you notice carefully in the flattened tree, each node's right child points to the next node of a pre-order traversal.
Linked List,Stack,Tree,Depth-First Search,Binary Tree
Medium
766,1796
893
cool a 93 groups have special equivalent strengths you are given an array a of strengths to be showing a sentir special equivalent if after any number of moves s is equal to T I'm gonna consist of choosing two indices and swapping them now a group special equivalent strings from a is a non-empty subset s of a such from...
Groups of Special-Equivalent Strings
all-nodes-distance-k-in-binary-tree
You are given an array of strings of the same length `words`. In one **move**, you can swap any two even indexed characters or any two odd indexed characters of a string `words[i]`. Two strings `words[i]` and `words[j]` are **special-equivalent** if after any number of moves, `words[i] == words[j]`. * For example,...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
77
hey everybody this is Larry this is day one of the August Lego daily challenge hit the like button and the Subscribe button join me on Discord let me know what you think about this farm and yeah with what is our streak is 12 17 uh which is 1217 days so we'll keep on going let's start with together that's kind of uh you...
Combinations
combinations
Given two integers `n` and `k`, return _all possible combinations of_ `k` _numbers chosen from the range_ `[1, n]`. You may return the answer in **any order**. **Example 1:** **Input:** n = 4, k = 2 **Output:** \[\[1,2\],\[1,3\],\[1,4\],\[2,3\],\[2,4\],\[3,4\]\] **Explanation:** There are 4 choose 2 = 6 total combin...
null
Backtracking
Medium
39,46
1,051
Have I Hope And This Is Doing Good Welcome To The Langoti Asli Songs Play List Year Movie Show Today Will Do Height Chakkar And You Have Drawn In Question Life Sentence Something Show Laddu It's On This Is It Is Given In This Way Have A Height And Width Share Height And Weight That Those Students Of St Stand In A Line ...
Height Checker
shortest-way-to-form-string
A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in **non-decreasing order** by height. Let this ordering be represented by the integer array `expected` where `expected[i]` is the expected height of the `ith` student in line. You are given an integer...
Which conditions have to been met in order to be impossible to form the target string? If there exists a character in the target string which doesn't exist in the source string then it will be impossible to form the target string. Assuming we are in the case which is possible to form the target string, how can we assur...
String,Dynamic Programming,Greedy
Medium
392,808
215
foreign okay and this is important note element for example you can see for the first example their values are three two one five six four K is two first largest element is six second largest element is five it is pretty straightforward okay the no issues but you can see this example so three two three one two four fiv...
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
1,927
hi everyone in this question we are given a string num of even lens consisting of digits and question mark and for the question mark alice and bob is playing a game they can replace the question mark with any digit between 0 and 9 in the end we are checking the sum of left half and the right half if they are equal then...
Sum Game
maximum-ascending-subarray-sum
Alice and Bob take turns playing a game, with **Alice** **starting first**. You are given a string `num` of **even length** consisting of digits and `'?'` characters. On each turn, a player will do the following if there is still at least one `'?'` in `num`: 1. Choose an index `i` where `num[i] == '?'`. 2. Replace ...
It is fast enough to check all possible subarrays The end of each ascending subarray will be the start of the next
Array
Easy
2205
122
hires of your doing great our today's question is best time to buy and sell stock too so the question says that you have an array prices for which the ayat element of the is the price of a given stock one day I design an algorithm to find the maximum profit you may complete as many transactions as you like that is buy ...
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
300
hi and welcome to algorithms Made Easy in this video we are going to see the concept of longest increasing subsequence in detail along with this question that is there on the lead code so let's not waste the time and dive into the question given an integer array nums return the length of the longest strictly increasing...
Longest Increasing Subsequence
longest-increasing-subsequence
Given an integer array `nums`, return _the length of the longest **strictly increasing**_ _**subsequence**_. **Example 1:** **Input:** nums = \[10,9,2,5,3,7,101,18\] **Output:** 4 **Explanation:** The longest increasing subsequence is \[2,3,7,101\], therefore the length is 4. **Example 2:** **Input:** nums = \[0,1,...
null
Array,Binary Search,Dynamic Programming
Medium
334,354,646,673,712,1766,2096,2234
216
Hello Hi Everyone Welcome Back To Meet Coding Ambrose This Morning Solid Combination Someone Problem AB Combination To This Challenge Shadow Plays A Shot At Bed Time Date VCD Combination Other Problems And It's Quite Similar Ventures With Decision Arrested With Only Used Sakhya Numbers' Arrested With Only Used Sakhya N...
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
230
hey everyone welcome back and let's write some more neat code today so today let's solve kth smallest element in a binary search tree so we're given the root of a binary search tree and an integer k and we want to return the kth smallest element in the binary search tree right and so remember a binary search tree by de...
Kth Smallest Element in a BST
kth-smallest-element-in-a-bst
Given the `root` of a binary search tree, and an integer `k`, return _the_ `kth` _smallest value (**1-indexed**) of all the values of the nodes in the tree_. **Example 1:** **Input:** root = \[3,1,4,null,2\], k = 1 **Output:** 1 **Example 2:** **Input:** root = \[5,3,6,2,4,null,null,1\], k = 3 **Output:** 3 **Cons...
Try to utilize the property of a BST. Try in-order traversal. (Credits to @chan13) What if you could modify the BST node's structure? The optimal runtime complexity is O(height of BST).
Tree,Depth-First Search,Binary Search Tree,Binary Tree
Medium
94,671
487
hey guys how's everything going mrs. J sir in this video I'm going to take a look at a four a seven max consecutive ones - I've done the first version which ones - I've done the first version which ones - I've done the first version which is very simple one now this is a little slight change to that we're given a binar...
Max Consecutive Ones II
max-consecutive-ones-ii
Given a binary array `nums`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most one_ `0`. **Example 1:** **Input:** nums = \[1,0,1,1,0\] **Output:** 4 **Explanation:** - If we flip the first zero, nums becomes \[1,1,1,1,0\] and we have 4 consecutive ones. - If we flip the second z...
null
Array,Dynamic Programming,Sliding Window
Medium
485,1046,2261
145
hello everyone in this video we're going to be going through leak code problem 145 which is binary tree postorder traversal so this problem States given the root of a binary tree return the postorder traversal of its nodes values so if you remember post order traversal starts with the left node the left Leaf node and m...
Binary Tree Postorder Traversal
binary-tree-postorder-traversal
Given the `root` of a binary tree, return _the postorder traversal of its nodes' values_. **Example 1:** **Input:** root = \[1,null,2,3\] **Output:** \[3,2,1\] **Example 2:** **Input:** root = \[\] **Output:** \[\] **Example 3:** **Input:** root = \[1\] **Output:** \[1\] **Constraints:** * The number of the n...
null
Stack,Tree,Depth-First Search,Binary Tree
Easy
94,776
1,413
Loot Hello Everyone Welcome To Electronic Subscribe The Amazing Subscribe - - - - - - - - - - - - 4 Subscribe To The Word You See What Is The Minimum Person If Split Of Bus - 49 - 49 - 49 - Positive Thursday Subscribe Were Selected Started To Minimum Pilot Positive Subscribe 1413 Vids U ki sholay is an example of meeti...
Minimum Value to Get Positive Step by Step Sum
maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold
Given an array of integers `nums`, you start with an initial **positive** value _startValue__._ In each iteration, you calculate the step by step sum of _startValue_ plus elements in `nums` (from left to right). Return the minimum **positive** value of _startValue_ such that the step by step sum is never less than 1....
Store prefix sum of all grids in another 2D array. Try all possible solutions and if you cannot find one return -1. If x is a valid answer then any y < x is also valid answer. Use binary search to find answer.
Array,Binary Search,Matrix,Prefix Sum
Medium
null
763
in this problem we have to split a string into different partitions so let's say we have a string it has 12 characters and all the characters are small english case letters from small a to small g so let's say we split it into three parts first part has six characters second has four third has five so total it has 15 s...
Partition Labels
special-binary-string
You are given a string `s`. We want to partition the string into as many parts as possible so that each letter appears in at most one part. Note that the partition is done so that after concatenating all the parts in order, the resultant string should be `s`. Return _a list of integers representing the size of these ...
Draw a line from (x, y) to (x+1, y+1) if we see a "1", else to (x+1, y-1). A special substring is just a line that starts and ends at the same y-coordinate, and that is the lowest y-coordinate reached. Call a mountain a special substring with no special prefixes - ie. only at the beginning and end is the lowest y-coo...
String,Recursion
Hard
678
108
given an array where the admins sorted ascending order how can you write a program to convert it into a height balanced binary search tree that's today's video let's get into it hi everyone my name is Steve today we're coming through an equal problem 108 converts solid array to binary search tree let's take a look at t...
Convert Sorted Array to Binary Search Tree
convert-sorted-array-to-binary-search-tree
Given an integer array `nums` where the elements are sorted in **ascending order**, convert _it to a_ **_height-balanced_** _binary search tree_. **Example 1:** **Input:** nums = \[-10,-3,0,5,9\] **Output:** \[0,-3,9,-10,null,5\] **Explanation:** \[0,-10,5,null,-3,null,9\] is also accepted: **Example 2:** **Input...
null
Array,Divide and Conquer,Tree,Binary Search Tree,Binary Tree
Easy
109
1,797
hey there and welcome to the next part of the random prom challenge So today we're going to be doing another medium problem and I'm going to pick a random one now if we did it before then we are going to find something else let's take a look here oh this is actually an SQL so I think we're going to skip we don't want t...
Design Authentication Manager
goal-parser-interpretation
There is an authentication system that works with authentication tokens. For each session, the user will receive a new authentication token that will expire `timeToLive` seconds after the `currentTime`. If the token is renewed, the expiry time will be **extended** to expire `timeToLive` seconds after the (potentially d...
You need to check at most 2 characters to determine which character comes next.
String
Easy
null
168
hey everybody this is Larry this is day 22nd of the legal daily challenge and looks like there's a weekly one later on uh hit the like button hit the Subscribe button join me in Discord let me know what you think about today's form uh Excel sheet column title ah seems like it's a new problem for me so okay let's take a...
Excel Sheet Column Title
excel-sheet-column-title
Given an integer `columnNumber`, return _its corresponding column title as it appears in an Excel sheet_. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 ... **Example 1:** **Input:** columnNumber = 1 **Output:** "A " **Example 2:** **Input:** columnNumber = 28 **Output:** "AB " **Example 3:**...
null
Math,String
Easy
171,2304
312
hi welcome to my youtube channel and this is the second series on dynamic programming so these problems are difficult and so please don't get discouraged if you can't solve these problems under 45 minutes for the record i it took me more than an hour and two attempts to get this problem right so yeah let's get started ...
Burst Balloons
burst-balloons
You are given `n` balloons, indexed from `0` to `n - 1`. Each balloon is painted with a number on it represented by an array `nums`. You are asked to burst all the balloons. If you burst the `ith` balloon, you will get `nums[i - 1] * nums[i] * nums[i + 1]` coins. If `i - 1` or `i + 1` goes out of bounds of the array, ...
null
Array,Dynamic Programming
Hard
1042
1,711
hey everybody this is larry this is me going with you two uh of the weekly coconuts 222 count good meals uh hit the like button to subscribe and join me on discord let me know if you have any issues with this prom um about a thousand people's health did it seems like a thousand two thousand um but yeah but this one is ...
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
1,569
Hello everyone welcome to my channel but mathematical concepts are used in it is ok and it also has logic but I thought it was about maths so I have included it in the playlist of maths. It is ok, it does not matter which play, if you understand it then it means problem. Liquid number 1569 is hard mark but it is going ...
Number of Ways to Reorder Array to Get Same BST
max-dot-product-of-two-subsequences
Given an array `nums` that represents a permutation of integers from `1` to `n`. We are going to construct a binary search tree (BST) by inserting the elements of `nums` in order into an initially empty BST. Find the number of different ways to reorder `nums` so that the constructed BST is identical to that formed from...
Use dynamic programming, define DP[i][j] as the maximum dot product of two subsequences starting in the position i of nums1 and position j of nums2.
Array,Dynamic Programming
Hard
null
129
Hello hello everyone welcome to my channel today's date 26th june recording challenge angry problem in assam route to leaf numbers don is veer and problem samru to lift special rule number 90 problem statement and problem visit from not only at least for example is the boat lift 123 100 Total sum of two numbers notice ...
Sum Root to Leaf Numbers
sum-root-to-leaf-numbers
You are given the `root` of a binary tree containing digits from `0` to `9` only. Each root-to-leaf path in the tree represents a number. * For example, the root-to-leaf path `1 -> 2 -> 3` represents the number `123`. Return _the total sum of all root-to-leaf numbers_. Test cases are generated so that the answer w...
null
Tree,Depth-First Search,Binary Tree
Medium
112,124,1030
1,007
Hello Everyone Welcome Back To My Channel Suggestion Or 120 The Problem Of It's Not Like This Video Please Like It Subscribe To My Channel The Bell Icon Below Industrial Modified Whenever Possible Video So Without Any Further Delay Started Problem Is Minimal Domino Rotation Follicular Form What were given in dropdown s...
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
277
hello and welcome back to the cracking fan YouTube channel today we're going to be solving lead code problem 287 find the celebrity suppose you are at a party with n people labeled from 0 to n minus 1 and among them there may exist One Celebrity the definition of a celebrity is that all of the other n minus one people ...
Find the Celebrity
find-the-celebrity
Suppose you are at a party with `n` people labeled from `0` to `n - 1` and among them, there may exist one celebrity. The definition of a celebrity is that all the other `n - 1` people know the celebrity, but the celebrity does not know any of them. Now you want to find out who the celebrity is or verify that there is...
The best hint for this problem can be provided by the following figure: Well, if you understood the gist of the above idea, you can extend it to find a candidate that can possibly be a celebrity. Why do we say a "candidate"? That is for you to think. This is clearly a greedy approach to find the answer. However, there ...
Two Pointers,Greedy,Graph,Interactive
Medium
1039
1,592
hey everybody this is larry just me going over q1 of delete code weekly contest 207 uh seven hit the like button hit the subscribe button join me in discord and let's go over rearrange space between words so this is relatively straightforward it's just about figure it's just all implementation right and um what i mean ...
Rearrange Spaces Between Words
rearrange-spaces-between-words
You are given a string `text` of words that are placed among some number of spaces. Each word consists of one or more lowercase English letters and are separated by at least one space. It's guaranteed that `text` **contains at least one word**. Rearrange the spaces so that there is an **equal** number of spaces betwee...
null
null
Easy
null
474
hello everyone welcome to quartus camp so we are today at the second day of april lead code challenge and the problem today we are going to cover is ones and zeros so the input given here is a string array which consisting of binary strings that is zeros and ones and we are given m and n that represent the number of ze...
Ones and Zeroes
ones-and-zeroes
You are given an array of binary strings `strs` and two integers `m` and `n`. Return _the size of the largest subset of `strs` such that there are **at most**_ `m` `0`_'s and_ `n` `1`_'s in the subset_. A set `x` is a **subset** of a set `y` if all elements of `x` are also elements of `y`. **Example 1:** **Input:**...
null
Array,String,Dynamic Programming
Medium
510,600,2261
485
That a today full talker appointment on liquid problem maximum subscribe subscribe [ subscribe [ subscribe if you subscribe can your then come now we our cross for that we this we now free closed slide here And here click subscribe button and subscribe my channel subscribe the channel so support and your jo length if y...
Max Consecutive Ones
max-consecutive-ones
Given a binary array `nums`, return _the maximum number of consecutive_ `1`_'s in the array_. **Example 1:** **Input:** nums = \[1,1,0,1,1,1\] **Output:** 3 **Explanation:** The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s is 3. **Example 2:** **Input:** nums = ...
You need to think about two things as far as any window is concerned. One is the starting point for the window. How do you detect that a new window of 1s has started? The next part is detecting the ending point for this window. How do you detect the ending point for an existing window? If you figure these two things...
Array
Easy
487,1046,1542,1999