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
542
Hello guys welcome song video mein ceo sudhir wa problem hai koi 80 tricks let's get started se given in the remix marathi to the distance of the nearest to for its a distance between two stations as one selected in this particular example pe thadi example all the self Baitha Values ​​Us Have A Distance Zero Baitha Val...
01 Matrix
01-matrix
Given an `m x n` binary matrix `mat`, return _the distance of the nearest_ `0` _for each cell_. The distance between two adjacent cells is `1`. **Example 1:** **Input:** mat = \[\[0,0,0\],\[0,1,0\],\[0,0,0\]\] **Output:** \[\[0,0,0\],\[0,1,0\],\[0,0,0\]\] **Example 2:** **Input:** mat = \[\[0,0,0\],\[0,1,0\],\[1,1...
null
Array,Dynamic Programming,Breadth-First Search,Matrix
Medium
550,2259
665
hello guide line weak hot mean that they will discuss in nod in this question Thursday do subscribe my channel must subscribe button video do subscribe button more your and not supposed to give vent there video person chain more seen in liquid you are not being Increasingly Difficult Subscribe Suv Thursday Bihar Day Sp...
Non-decreasing Array
non-decreasing-array
Given an array `nums` with `n` integers, your task is to check if it could become non-decreasing by modifying **at most one element**. We define an array is non-decreasing if `nums[i] <= nums[i + 1]` holds for every `i` (**0-based**) such that (`0 <= i <= n - 2`). **Example 1:** **Input:** nums = \[4,2,3\] **Output:...
null
Array
Medium
2205
456
hi everyone today we are going to start with a little called question one three two pattern so you are given an array of n integers nums uh one three two pattern is a subsequence of three integers times I numbers J and the numbers K such that I is less than J is less than K and the announce I is less than numbers K les...
132 Pattern
132-pattern
Given an array of `n` integers `nums`, a **132 pattern** is a subsequence of three integers `nums[i]`, `nums[j]` and `nums[k]` such that `i < j < k` and `nums[i] < nums[k] < nums[j]`. Return `true` _if there is a **132 pattern** in_ `nums`_, otherwise, return_ `false`_._ **Example 1:** **Input:** nums = \[1,2,3,4\] ...
null
Array,Binary Search,Stack,Monotonic Stack,Ordered Set
Medium
null
1,046
cool okay 10:46 last dumb way we have a 10:46 last dumb way we have a 10:46 last dumb way we have a collections of wild siege vodkas a positive integer way each time we choose to heaviest walks as fashion together suppose the stomach separate weights X Y with X is the Neko lesson why do we solve the smashes if X is you...
Last Stone Weight
max-consecutive-ones-iii
You are given an array of integers `stones` where `stones[i]` is the weight of the `ith` stone. We are playing a game with the stones. On each turn, we choose the **heaviest two stones** and smash them together. Suppose the heaviest two stones have weights `x` and `y` with `x <= y`. The result of this smash is: * I...
One thing's for sure, we will only flip a zero if it extends an existing window of 1s. Otherwise, there's no point in doing it, right? Think Sliding Window! Since we know this problem can be solved using the sliding window construct, we might as well focus in that direction for hints. Basically, in a given window, we c...
Array,Binary Search,Sliding Window,Prefix Sum
Medium
340,424,485,487,2134
1,055
hey everybody this is Larry this is me going to do the week two of the weekly premium challenge yep hit the like button hit the Subscribe button join me in the Discord let me know what you think about this poem I haven't done it before yay newcomer 10 55 shortest way to form string a subsequence of a strain is a new st...
Shortest Way to Form String
pairs-of-songs-with-total-durations-divisible-by-60
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.e., `"ace "` is a subsequence of `"abcde "` while `"aec "` is not). Given two strings `source` and `target`, r...
We only need to consider each song length modulo 60. We can count the number of songs with (length % 60) equal to r, and store that in an array of size 60.
Array,Hash Table,Counting
Medium
null
322
before we actually jump into the code let's walk through a visualization of what an example looks like so here we're given a list of valid coins we can use and we're also given the target amount that we want to create and what we need to do is create a dp array where each element corresponds to the minimum number of co...
Coin Change
coin-change
You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money. Return _the fewest number of coins that you need to make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `-1`. You may a...
null
Array,Dynamic Programming,Breadth-First Search
Medium
1025,1393,2345
338
The The name of the next question that we are going to do is counting return of i, so what to do in it, we are given an n number, so i is n+1, what is the size? Hey, what do number, so i is n+1, what is the size? Hey, what do number, so i is n+1, what is the size? Hey, what do we have to return in it, from zero to n + ...
Counting Bits
counting-bits
Given an integer `n`, return _an array_ `ans` _of length_ `n + 1` _such that for each_ `i` (`0 <= i <= n`)_,_ `ans[i]` _is the **number of**_ `1`_**'s** in the binary representation of_ `i`. **Example 1:** **Input:** n = 2 **Output:** \[0,1,1\] **Explanation:** 0 --> 0 1 --> 1 2 --> 10 **Example 2:** **Input:** n =...
You should make use of what you have produced already. Divide the numbers in ranges like [2-3], [4-7], [8-15] and so on. And try to generate new range from previous. Or does the odd/even status of the number help you in calculating the number of 1s?
Dynamic Programming,Bit Manipulation
Easy
191
1,026
hello friends so today in this video we're gonna discuss another problem from lead code on trees the problem name is maximum difference between node and the ancestor so as you can see i'll tell you in simple terms it says that you are given a binary tree in this format and then you actually have to find out what is the...
Maximum Difference Between Node and Ancestor
string-without-aaa-or-bbb
Given the `root` of a binary tree, find the maximum value `v` for which there exist **different** nodes `a` and `b` where `v = |a.val - b.val|` and `a` is an ancestor of `b`. A node `a` is an ancestor of `b` if either: any child of `a` is equal to `b` or any child of `a` is an ancestor of `b`. **Example 1:** **Input...
null
String,Greedy
Medium
null
1,541
hi everyone my name is steve today we're going to go through a little problem 1541 minimum insertions to balance a parenthesis stream let's take a look at the problem description first given a parenthesis a string s containing only the captures open and close parenthesis a parenthesis string is balanced if it meets the...
Minimum Insertions to Balance a Parentheses String
top-travellers
Given a parentheses string `s` containing only the characters `'('` and `')'`. A parentheses string is **balanced** if: * Any left parenthesis `'('` must have a corresponding two consecutive right parenthesis `'))'`. * Left parenthesis `'('` must go before the corresponding two consecutive right parenthesis `'))'`...
null
Database
Easy
null
225
Dream II car has a family If I knew I was in this row I would wear it and solve a math problem to say well for more detailed information please go to the book I don't like available Mine you will go to the first question First, to understand how we work, welcome to 32 of the Daily, so today we will decide on the card w...
Implement Stack using Queues
implement-stack-using-queues
Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (`push`, `top`, `pop`, and `empty`). Implement the `MyStack` class: * `void push(int x)` Pushes element x to the top of the stack. * `int pop()` Removes the element on the top...
null
Stack,Design,Queue
Easy
232
1,293
hey everybody this is Larry this is day three of almost uh Halloween and almost the end of the month of the Lego day challenge hit the like button hit the Subscribe when join me on Discord let me know what you think about today's Palm uh I try to celebrate my victories and as you know on my contest I've been doing poor...
Shortest Path in a Grid with Obstacles Elimination
three-consecutive-odds
You are given an `m x n` integer matrix `grid` where each cell is either `0` (empty) or `1` (obstacle). You can move up, down, left, or right from and to an empty cell in **one step**. Return _the minimum number of **steps** to walk from the upper left corner_ `(0, 0)` _to the lower right corner_ `(m - 1, n - 1)` _giv...
Check every three consecutive numbers in the array for parity.
Array
Easy
null
513
we are going to solve the problem find bottom left tree value in this question given the root of Bin return the leftmost value in last row of the tree so basically question what is saying question is left most value in the last row of the tree what is last row there is in level water travor in the last level is the las...
Find Bottom Left Tree Value
find-bottom-left-tree-value
Given the `root` of a binary tree, return the leftmost value in the last row of the tree. **Example 1:** **Input:** root = \[2,1,3\] **Output:** 1 **Example 2:** **Input:** root = \[1,2,3,4,null,5,6,null,null,7\] **Output:** 7 **Constraints:** * The number of nodes in the tree is in the range `[1, 104]`. * `-...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
440
are you stuck on a coding challenge don't worry we've got your back let's dive in and solve the KF smallest in lexicographical order problem together the problem is to find the KF smallest number in the lexicographic order of 1 to n this code is using a binary search approach to find the KF smallest number in lexicogra...
K-th Smallest in Lexicographical Order
k-th-smallest-in-lexicographical-order
Given two integers `n` and `k`, return _the_ `kth` _lexicographically smallest integer in the range_ `[1, n]`. **Example 1:** **Input:** n = 13, k = 2 **Output:** 10 **Explanation:** The lexicographical order is \[1, 10, 11, 12, 13, 2, 3, 4, 5, 6, 7, 8, 9\], so the second smallest number is 10. **Example 2:** **Inp...
null
Trie
Hard
null
905
hello guys and welcome to a teacher before we get started I like to thank everybody that has left a comment or subscribe on my channel if you haven't please do so they're going to be solving problem 905 sort array by parity this is an easy problem by a classification it states given an array a of non-negative states gi...
Sort Array By Parity
length-of-longest-fibonacci-subsequence
Given an integer array `nums`, move all the even integers at the beginning of the array followed by all the odd integers. Return _**any array** that satisfies this condition_. **Example 1:** **Input:** nums = \[3,1,2,4\] **Output:** \[2,4,3,1\] **Explanation:** The outputs \[4,2,3,1\], \[2,4,1,3\], and \[4,2,1,3\] w...
null
Array,Hash Table,Dynamic Programming
Medium
1013
895
Hello hello everyone welcome to my channel it's all latest hot problem send maximum text message happy implement the frequency of clans between two methoded such and population will addicts number in tracks in to-do list acid to design tracks in to-do list acid to design tracks in to-do list acid to design and I hope t...
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
787
hi everyone it's Orin today we have a problem when we are given n CDs for example in this example one CD 0 1 2 and three and we need to find the cheapest way go from The Source City to the destination in our case the source city is zero the destination is three so to go from zero to three with the cheapest price and an...
Cheapest Flights Within K Stops
sliding-puzzle
There are `n` cities connected by some number of flights. You are given an array `flights` where `flights[i] = [fromi, toi, pricei]` indicates that there is a flight from city `fromi` to city `toi` with cost `pricei`. You are also given three integers `src`, `dst`, and `k`, return _**the cheapest price** from_ `src` _...
Perform a breadth-first-search, where the nodes are the puzzle boards and edges are if two puzzle boards can be transformed into one another with one move.
Array,Breadth-First Search,Matrix
Hard
null
3
hello web developers this is pg web dev and welcome to another lead code challenge solution and in this episode i'm gonna explain the longest substring without repeating characters problem and in this problem we need to find the longest substring with our repeating characters in a given string i will also explain the s...
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
134
hi friends welcome to my channel i was exhausted last week as i switched from array to linked list for race the most difficult part is to understand the problem to come up with a solution but for linkedlist the easiest part is to understand the problem and coming up with a solution i have no problem understanding the p...
Gas Station
gas-station
There are `n` gas stations along a circular route, where the amount of gas at the `ith` station is `gas[i]`. You have a car with an unlimited gas tank and it costs `cost[i]` of gas to travel from the `ith` station to its next `(i + 1)th` station. You begin the journey with an empty tank at one of the gas stations. Gi...
null
Array,Greedy
Medium
1346
155
hi fellow alcohols today we're going to have a look at the problem called mean stack so the problem description is the following so we need to design a stack that supports push pop top and retrieving the minimum element in constant time so let's have a look at the example provided we want to follow the following instru...
Min Stack
min-stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the `MinStack` class: * `MinStack()` initializes the stack object. * `void push(int val)` pushes the element `val` onto the stack. * `void pop()` removes the element on the top of the stack. * `int top(...
Consider each node in the stack having a minimum value. (Credits to @aakarshmadhavan)
Stack,Design
Easy
239,716
1,800
This is all it's discuss question of written test question is button of maximum setting to the you who have doubt then this issue national to find and replace trick like share and tricks Mirwaiz entertain registry will do a question on that this is sexual enhancement on maximum till final [Praise] Director Shyam's That...
Maximum Ascending Subarray Sum
concatenation-of-consecutive-binary-numbers
Given an array of positive integers `nums`, return the _maximum possible sum of an **ascending** subarray in_ `nums`. A subarray is defined as a contiguous sequence of numbers in an array. A subarray `[numsl, numsl+1, ..., numsr-1, numsr]` is **ascending** if for all `i` where `l <= i < r`, `numsi < numsi+1`. Note th...
Express the nth number value in a recursion formula and think about how we can do a fast evaluation.
Math,Bit Manipulation,Simulation
Medium
null
1,926
show you how to solve legal question 1926 nearest the exit from entrance in maze it's a median legal question so basically you're given our m multiplex and matrix mace something look like this and it's zero indexed which meaning is index starting from zero with empty cells represented as this dot so like empty cell her...
Nearest Exit from Entrance in Maze
products-price-for-each-store
You are given an `m x n` matrix `maze` (**0-indexed**) with empty cells (represented as `'.'`) and walls (represented as `'+'`). You are also given the `entrance` of the maze, where `entrance = [entrancerow, entrancecol]` denotes the row and column of the cell you are initially standing at. In one step, you can move o...
null
Database
Easy
1948
232
one so today we are looking at lead code number 232 it's called implement a queue using stacks okay so here we have uh we want to implement first in first out q using only two stacks the implemented queue should support all the functions of a normal queue so we have push peak pop and empty and so here we can see that t...
Implement Queue using Stacks
implement-queue-using-stacks
Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (`push`, `peek`, `pop`, and `empty`). Implement the `MyQueue` class: * `void push(int x)` Pushes element x to the back of the queue. * `int pop()` Removes the element from th...
null
Stack,Design,Queue
Easy
225
944
If there are as many stings inside it, if I represent them in the form of grid and then in the form of matters, okay, then basically I have to find out in which column all the alphabets which are not in luxury sorted hotter, okay? I basically need to know which one I have to treat then @ I have to find out then @ I hav...
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
1,046
hey so welcome back in this another daily Eco problem so today it was called last stone weight and it's an easy level problem um it's a Max Heap solution um for this actually I think that's the most common way I don't think yeah I don't think anyone really solves it any other way um so that's what I did was using a max...
Last Stone Weight
max-consecutive-ones-iii
You are given an array of integers `stones` where `stones[i]` is the weight of the `ith` stone. We are playing a game with the stones. On each turn, we choose the **heaviest two stones** and smash them together. Suppose the heaviest two stones have weights `x` and `y` with `x <= y`. The result of this smash is: * I...
One thing's for sure, we will only flip a zero if it extends an existing window of 1s. Otherwise, there's no point in doing it, right? Think Sliding Window! Since we know this problem can be solved using the sliding window construct, we might as well focus in that direction for hints. Basically, in a given window, we c...
Array,Binary Search,Sliding Window,Prefix Sum
Medium
340,424,485,487,2134
499
hey let's continue our journey to bfs and let's stop the maze three go ahead and read the question so there's a ball in the maze with the empty spaces and the walls and the ball can go through the empty spaces by rolling up down left or right but it won't stop rolling until hitting a wall and when the ball stops you co...
The Maze III
the-maze-iii
There is a ball in a `maze` with empty spaces (represented as `0`) and walls (represented as `1`). The ball can go through the empty spaces by rolling **up, down, left or right**, but it won't stop rolling until hitting a wall. When the ball stops, it could choose the next direction. There is also a hole in this maze. ...
null
Depth-First Search,Breadth-First Search,Graph,Heap (Priority Queue),Shortest Path
Hard
490,505
33
hello and welcome to this video today we're gonna solve the problem search and rotated sorted array so in order to understand the solution of this problem it is necessary to know how to implement binary search and how to find the minimum element and a rotated sorted array but luckily for you I have made two video about...
Search in Rotated Sorted Array
search-in-rotated-sorted-array
There is an integer array `nums` sorted in ascending order (with **distinct** values). Prior to being passed to your function, `nums` is **possibly rotated** at an unknown pivot index `k` (`1 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]]` ...
null
Array,Binary Search
Medium
81,153,2273
551
this one is question number 551 student attendance record one so you're given a string yes and it's an attendance record for a student where each character signifies whether the student was absent late or present on that day the record only contains the following three characters a for absent l for late and p for prese...
Student Attendance Record I
student-attendance-record-i
You are given a string `s` representing an attendance record for a student 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. The student is eligible for an attend...
null
String
Easy
552
643
Hello Hi Friends Welcome Back Today We Are Going To Solid Problem 868 Maximum Average Saver 110 Problems Prevented Previously Was By Google S You Can See Date Of Birth Details Of The Problem Is Want To Mention The Type Of Account Created Has Videos For Live Today People While Preparing for Coding and Java Interview Act...
Maximum Average Subarray I
maximum-average-subarray-i
You are given an integer array `nums` consisting of `n` elements, and an integer `k`. Find a contiguous subarray whose **length is equal to** `k` that has the maximum average value and return _this value_. Any answer with a calculation error less than `10-5` will be accepted. **Example 1:** **Input:** nums = \[1,12,...
null
Array,Sliding Window
Easy
644,2211
986
hey guys persistent programmer here and today we're going to do another leak quick question interval list intersections and this is an awesome question and this question reminds me of the meeting room's question in lee code so let me know down below if you want me to do a video about that as well but um the theme of th...
Interval List Intersections
largest-time-for-given-digits
You are given two lists of closed intervals, `firstList` and `secondList`, where `firstList[i] = [starti, endi]` and `secondList[j] = [startj, endj]`. Each list of intervals is pairwise **disjoint** and in **sorted order**. Return _the intersection of these two interval lists_. A **closed interval** `[a, b]` (with `a...
null
String,Enumeration
Medium
null
1,031
hey guys this is jayster how does everything going uh in this video i'm going to go guys one zero three one maximal sum of two non-overlapping sub arrays are during non-overlapping sub arrays are during non-overlapping sub arrays are during the array we need to return maximum sum of elements into non-overlapping elemen...
Maximum Sum of Two Non-Overlapping Subarrays
add-to-array-form-of-integer
Given an integer array `nums` and two integers `firstLen` and `secondLen`, return _the maximum sum of elements in two non-overlapping **subarrays** with lengths_ `firstLen` _and_ `secondLen`. The array with length `firstLen` could occur before or after the array with length `secondLen`, but they have to be non-overlap...
null
Array,Math
Easy
2,66,67,415
123
hey guys welcome back to another video and today we're going to be solving the lead code question best time to buy and sell stock version 3. so normally these type the stock based questions i personally find them a little bit confusing but one thing once you understand the concept of how to utilize uh state machines to...
Best Time to Buy and Sell Stock III
best-time-to-buy-and-sell-stock-iii
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day. Find the maximum profit you can achieve. You may complete **at most two transactions**. **Note:** You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again). **Exampl...
null
Array,Dynamic Programming
Hard
121,122,188,689
473
okay guys welcome to our channel with sunny and in this video i will be talking about the problem matchsticks to square index is 473 and problem is one of the medium type problems of the lead code okay so let me give it a like over here because this problem has explained me or you can also say taught me a very new good...
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
378
hello everyone aaron here and welcome back to leat code today we are doing the kth smallest element in assorted matrix problem so let's jump into the instructions given an n by n matrix where each of the rows and columns is sorted in ascending order return the kth smallest element in the matrix note that it is the kth ...
Kth Smallest Element in a Sorted Matrix
kth-smallest-element-in-a-sorted-matrix
Given an `n x n` `matrix` where each of the rows and columns is sorted in ascending order, return _the_ `kth` _smallest element in the matrix_. Note that it is the `kth` smallest element **in the sorted order**, not the `kth` **distinct** element. You must find a solution with a memory complexity better than `O(n2)`....
null
Array,Binary Search,Sorting,Heap (Priority Queue),Matrix
Medium
373,668,719,802
292
today we're going to solve lead code 292 nim game so the question says that you are playing the following game with your friend initially there is a heap of stones on the table you and your friend will alternate taking turns and you take the first turn on each turn the person whose turn it is will remove one to three s...
Nim Game
nim-game
You are playing the following Nim Game with your friend: * Initially, there is a heap of stones on the table. * You and your friend will alternate taking turns, and **you go first**. * On each turn, the person whose turn it is will remove 1 to 3 stones from the heap. * The one who removes the last stone is the...
If there are 5 stones in the heap, could you figure out a way to remove the stones such that you will always be the winner?
Math,Brainteaser,Game Theory
Easy
294
399
morning everyone how are you all I hope you are doing extremely good so today let's solve this problem evaluate division this is Elite code daily challenge problem so it is a medium level I think you can able to solve this uh try to keep some sort of Pomodoro Technique like 25 minutes you try the problem and after 25 m...
Evaluate Division
evaluate-division
You are given an array of variable pairs `equations` and an array of real numbers `values`, where `equations[i] = [Ai, Bi]` and `values[i]` represent the equation `Ai / Bi = values[i]`. Each `Ai` or `Bi` is a string that represents a single variable. You are also given some `queries`, where `queries[j] = [Cj, Dj]` rep...
Do you recognize this as a graph problem?
Array,Depth-First Search,Breadth-First Search,Union Find,Graph,Shortest Path
Medium
null
172
hi my name is Rish and I am a student of function of School of Technology and I'm in the second semester of my college and we are learning DSA through lead cot platform in Java language and practicing problems on lead Cod so I was going through the question 172 on lead code factorial trailing zero so maybe you maybe fi...
Factorial Trailing Zeroes
factorial-trailing-zeroes
Given an integer `n`, return _the number of trailing zeroes in_ `n!`. Note that `n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1`. **Example 1:** **Input:** n = 3 **Output:** 0 **Explanation:** 3! = 6, no trailing zero. **Example 2:** **Input:** n = 5 **Output:** 1 **Explanation:** 5! = 120, one trailing zero. **Exa...
null
Math
Medium
233,809,2222
39
hey everyone in this video let's take a look at question 39 combination sum on leak code this is part of our blind 75 list of questions so let's begin this question we are given an array of distinct integers candidates and a Target integer called Target we want to return a list of all unique combinations of candidates ...
Combination Sum
combination-sum
Given an array of **distinct** integers `candidates` and a target integer `target`, return _a list of all **unique combinations** of_ `candidates` _where the chosen numbers sum to_ `target`_._ You may return the combinations in **any order**. The **same** number may be chosen from `candidates` an **unlimited number of...
null
Array,Backtracking
Medium
17,40,77,216,254,377
1,704
hello and welcome to another video in this video we're going to be working on determine if string halves are alike and in this one you're given a string of even length putl the string into two halves and let a be the first half and B be the second half two strings are alike if they have the same number of vals so they ...
Determine if String Halves Are Alike
special-positions-in-a-binary-matrix
You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half. Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppe...
Keep track of 1s in each row and in each column. Then while iterating over matrix, if the current position is 1 and current row as well as current column contains exactly one occurrence of 1.
Array,Matrix
Easy
null
40
hey everyone welcome back and let's write some more neat code today so today let's solve the problem combination sum two we've already solved combination sum one and this is a pretty similar problem to the first one we're given a collection of candidates and these are always going to be positive numbers and we're given...
Combination Sum II
combination-sum-ii
Given a collection of candidate numbers (`candidates`) and a target number (`target`), find all unique combinations in `candidates` where the candidate numbers sum to `target`. Each number in `candidates` may only be used **once** in the combination. **Note:** The solution set must not contain duplicate combinations....
null
Array,Backtracking
Medium
39
349
hi everyone welcome back to the channel Android all code daily challenge problem number 349 intersection of two arrays so it's a very simple problem to solve and this can be solved using multiple ways uh and you know we will look into the problem statement first then we'll check out the approach which we're going to us...
Intersection of Two Arrays
intersection-of-two-arrays
Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must be **unique** and you may return the result in **any order**. **Example 1:** **Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\] **Output:** \[2\] **Example 2:** **Input:** nums1 = \[4,9,5\], nums2 = \...
null
Array,Hash Table,Two Pointers,Binary Search,Sorting
Easy
350,1149,1392,2190,2282
1,910
hi texas tim here back with you for more elite code grinding and uh let's see where we stand now i have done 420 of the easy and that actually is all the algorithm ones i'm pretty sure let's double check difficulty easy yep no available um easy ones that i have not started so we're working on medium and i like to sort ...
Remove All Occurrences of a Substring
check-if-binary-string-has-at-most-one-segment-of-ones
Given two strings `s` and `part`, perform the following operation on `s` until **all** occurrences of the substring `part` are removed: * Find the **leftmost** occurrence of the substring `part` and **remove** it from `s`. Return `s` _after removing all occurrences of_ `part`. A **substring** is a contiguous seque...
It's guaranteed to have at least one segment The string size is small so you can count all segments of ones with no that have no adjacent ones.
String
Easy
1999
1,337
hi guys welcome to algorithms made easy in this video we will see the question k weakest rows in a matrix given a m cross n matrix of ones and zeros where one represents soldier and zero represent the civilians return the indexes of k weakest rows in the matrix ordered from weakest to strongest the row i is weaker than...
The K Weakest Rows in a Matrix
design-skiplist
You are given an `m x n` binary matrix `mat` of `1`'s (representing soldiers) and `0`'s (representing civilians). The soldiers are positioned **in front** of the civilians. That is, all the `1`'s will appear to the **left** of all the `0`'s in each row. A row `i` is **weaker** than a row `j` if one of the following is...
null
Linked List,Design
Hard
816,817,838
31
Hello guys welcome to another interesting problem not only coding behavior after match for exploitation festival dates for meditation which basically rearrange from this number to lexicographic le next day termination of numbers in question are as per possible at Mussoorie arrange details below as possible order and re...
Next Permutation
next-permutation
A **permutation** of an array of integers is an arrangement of its members into a sequence or linear order. * For example, for `arr = [1,2,3]`, the following are all the permutations of `arr`: `[1,2,3], [1,3,2], [2, 1, 3], [2, 3, 1], [3,1,2], [3,2,1]`. The **next permutation** of an array of integers is the next le...
null
Array,Two Pointers
Medium
46,47,60,267,1978
232
so hello everyone so welcome to today's lead code daily question that is Implement you using stacks so the question is quite clear to us we have to implement the queue using stats so for that the hint given to us is that we can use two stack and uh for maintaining a queue so uh as you can see here the question will be ...
Implement Queue using Stacks
implement-queue-using-stacks
Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (`push`, `peek`, `pop`, and `empty`). Implement the `MyQueue` class: * `void push(int x)` Pushes element x to the back of the queue. * `int pop()` Removes the element from th...
null
Stack,Design,Queue
Easy
225
337
hello everyone welcome to my channel coding together my name is vikas oja today we will see another lead code problem that is House robber 3. it's a medium level question and it's a very popular question as you can see from the likes the let's read the problem statement the thief has found himself a new place for his t...
House Robber III
house-robber-iii
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called `root`. Besides the `root`, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will automatically contact the police if ...
null
Dynamic Programming,Tree,Depth-First Search,Binary Tree
Medium
198,213
1,192
all right i'm gonna explain how to do the critical connections in a network problem on leak code so i have an undirected graph here and first of all what is a critical connection so critical connection is just any edge part or movement will prevent some nodes from reaching each other so for example if i were to remove ...
Critical Connections in a Network
divide-chocolate
There are `n` servers numbered from `0` to `n - 1` connected by undirected server-to-server `connections` forming a network where `connections[i] = [ai, bi]` represents a connection between servers `ai` and `bi`. Any server can reach other servers directly or indirectly through the network. A _critical connection_ is ...
After dividing the array into K+1 sub-arrays, you will pick the sub-array with the minimum sum. Divide the sub-array into K+1 sub-arrays such that the minimum sub-array sum is as maximum as possible. Use binary search with greedy check.
Array,Binary Search
Hard
410,1056
39
hi everyone today we are going to solve the readable question combination sum so you are given array of distinct integers candidates and integer Target return a list of unique combinations of candidates where the chosen number some to Target you may return the combination in any order the same number may be chosen from...
Combination Sum
combination-sum
Given an array of **distinct** integers `candidates` and a target integer `target`, return _a list of all **unique combinations** of_ `candidates` _where the chosen numbers sum to_ `target`_._ You may return the combinations in **any order**. The **same** number may be chosen from `candidates` an **unlimited number of...
null
Array,Backtracking
Medium
17,40,77,216,254,377
1,712
hey what's up guys this is zhong so 1712 ways to split array into three subarrays um so you're given like a array right consisting of i believe they're all positive yeah non-negative numbers positive yeah non-negative numbers positive yeah non-negative numbers and it asks you to split those arrays into three parts left...
Ways to Split Array Into Three Subarrays
unique-orders-and-customers-per-month
A split of an integer array is **good** if: * The array is split into three **non-empty** contiguous subarrays - named `left`, `mid`, `right` respectively from left to right. * The sum of the elements in `left` is less than or equal to the sum of the elements in `mid`, and the sum of the elements in `mid` is less ...
null
Database
Easy
null
399
Jhaal Hello Hi Guys Welcome to Question Today's Question Is Your Devotion in This Question Also Aryan Equations in the format K Divider Par Pimpal Bhi Are Very Well Represented S Strings And K Is The Real Number Details Of Lord Floating Point Number Jeevan Sambhav Is Return Given answers in the answer did not exist ret...
Evaluate Division
evaluate-division
You are given an array of variable pairs `equations` and an array of real numbers `values`, where `equations[i] = [Ai, Bi]` and `values[i]` represent the equation `Ai / Bi = values[i]`. Each `Ai` or `Bi` is a string that represents a single variable. You are also given some `queries`, where `queries[j] = [Cj, Dj]` rep...
Do you recognize this as a graph problem?
Array,Depth-First Search,Breadth-First Search,Union Find,Graph,Shortest Path
Medium
null
206
hey everyone welcome back and let's write some more neat code today it's actually raining outside right now pretty hard so hopefully you can't hear it too well so today let's solve an easy question reverse a linked list and this question is actually like a sub problem that's needed in a lot of other questions like link...
Reverse Linked List
reverse-linked-list
Given the `head` of a singly linked list, reverse the list, and return _the reversed list_. **Example 1:** **Input:** head = \[1,2,3,4,5\] **Output:** \[5,4,3,2,1\] **Example 2:** **Input:** head = \[1,2\] **Output:** \[2,1\] **Example 3:** **Input:** head = \[\] **Output:** \[\] **Constraints:** * The number...
null
Linked List,Recursion
Easy
92,156,234,2196,2236
1,583
hello this was uh this is the second question of the 206 with code uh contests it was a little bit hard for me to figure out how to do this uh in a satisfied manner and it started hard by just by uh the question itself okay i took some time to understand exactly what they are asking and i will try to explain in the eas...
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
1,929
hello everyone so in this video let us talk about a problem from lead code the problem name is concatenation of array so you're given that you are given an array as you can see nums uh in the input and you want to create an array answer of double the length of nums that is 2N and what you want to see is that you want t...
Concatenation of Array
maximum-value-at-a-given-index-in-a-bounded-array
Given an integer array `nums` of length `n`, you want to create an array `ans` of length `2n` where `ans[i] == nums[i]` and `ans[i + n] == nums[i]` for `0 <= i < n` (**0-indexed**). Specifically, `ans` is the **concatenation** of two `nums` arrays. Return _the array_ `ans`. **Example 1:** **Input:** nums = \[1,2,1\...
What if the problem was instead determining if you could generate a valid array with nums[index] == target? To generate the array, set nums[index] to target, nums[index-i] to target-i, and nums[index+i] to target-i. Then, this will give the minimum possible sum, so check if the sum is less than or equal to maxSum. n is...
Binary Search,Greedy
Medium
null
28
hello guys myself Amrita welcome back to our Channel techno Siege so this is our lead code Series in which we'll be solving lead code problems one by one I have already discussed some of the problems you can check that out as well so now let's move forward with today's problem so today's problem is question number 28 t...
Find the Index of the First Occurrence in a String
implement-strstr
Given two strings `needle` and `haystack`, return the index of the first occurrence of `needle` in `haystack`, or `-1` if `needle` is not part of `haystack`. **Example 1:** **Input:** haystack = "sadbutsad ", needle = "sad " **Output:** 0 **Explanation:** "sad " occurs at index 0 and 6. The first occurrence is at ...
null
Two Pointers,String,String Matching
Easy
214,459
242
does this problem need another video yeah I think it does there's a lot of confusion around the performance especially the space complexity and I think we should clear that up this is leak code 242 valid anagram so given two strings s and t return true if T is an anagram of s and false otherwise an anagram is a word or...
Valid Anagram
valid-anagram
Given two strings `s` and `t`, return `true` _if_ `t` _is an anagram of_ `s`_, and_ `false` _otherwise_. An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. **Example 1:** **Input:** s = "anagram", t = "nagaram" **...
null
Hash Table,String,Sorting
Easy
49,266,438
1,903
hey everyone today we are going to solve decod problem number 1 1903 largest or number in a string so in this problem statement we are given a string num representing a very large integer and we have to return the largest value or integer as a string that is non empty substring of num or if we are not able to form that...
Largest Odd Number in String
design-most-recently-used-queue
You are given a string `num`, representing a large integer. Return _the **largest-valued odd** integer (as a string) that is a **non-empty substring** of_ `num`_, or an empty string_ `" "` _if no odd integer exists_. A **substring** is a contiguous sequence of characters within a string. **Example 1:** **Input:** nu...
You can store the data in an array and apply each fetch by moving the ith element to the end of the array (i.e, O(n) per operation). A better way is to use the square root decomposition technique. You can build chunks of size sqrt(n). For each fetch operation, You can search for the chunk which has the ith element and ...
Array,Hash Table,Stack,Design,Binary Indexed Tree,Ordered Set
Medium
146
307
uh today we're gonna be working on lead code question number three zero seven uh range some query mutable uh given an integer array nums handle multiple queries of the following types so we're going to be update we're going to be updating uh the value of an element in nums and calculate the sum of the elements of nums ...
Range Sum Query - Mutable
range-sum-query-mutable
Given an integer array `nums`, handle multiple queries of the following types: 1. **Update** the value of an element in `nums`. 2. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`. Implement the `NumArray` class: * `NumArray(int[] nums)` Initi...
null
Array,Design,Binary Indexed Tree,Segment Tree
Medium
303,308
937
hi guys welcome to the channel if you are new to the channel please consider subscribing because we sold a lot of into the questions here and that can definitely help you with your interview so let's start with the question says do you have an array of logs each log is space delimited string of words for each lobe the ...
Reorder Data in Log Files
online-stock-span
You are given an array of `logs`. Each log is a space-delimited string of words, where the first word is the **identifier**. There are two types of logs: * **Letter-logs**: All words (except the identifier) consist of lowercase English letters. * **Digit-logs**: All words (except the identifier) consist of digits...
null
Stack,Design,Monotonic Stack,Data Stream
Medium
739
208
in this video we're going to take a look at a data structure called tri so try is a data type of enary tree so unlike binary tree where each node can maximally have two nodes energy can have multiple children right so we used to try to store strains and each trinode represents a string so and each node in the tribe we ...
Implement Trie (Prefix Tree)
implement-trie-prefix-tree
A [**trie**](https://en.wikipedia.org/wiki/Trie) (pronounced as "try ") or **prefix tree** is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker. Implement the Trie class: * `Trie()` ...
null
Hash Table,String,Design,Trie
Medium
211,642,648,676,1433,1949
106
So hi gas, we came to this question, we started the series of tree, then inside it we came to construct binary tree on this question, from these order and post order driver, there is basically nothing in the question, what life do we have in the question? This is life that we have been given an order driver cell and we...
Construct Binary Tree from Inorder and Postorder Traversal
construct-binary-tree-from-inorder-and-postorder-traversal
Given two integer arrays `inorder` and `postorder` where `inorder` is the inorder traversal of a binary tree and `postorder` is the postorder traversal of the same tree, construct and return _the binary tree_. **Example 1:** **Input:** inorder = \[9,3,15,20,7\], postorder = \[9,15,7,20,3\] **Output:** \[3,9,20,null,n...
null
Array,Hash Table,Divide and Conquer,Tree,Binary Tree
Medium
105
1,513
Hello hello everybody welcome to my channel it's all the problem numbers of serving with only one show consisting of 400 number of birth all characters vansh or answer me to do the power plus 76 example2 90 can for subscription form example subscribe number 520 can form number one One one can we number 212 subscribe nu...
Number of Substrings With Only 1s
find-all-good-strings
Given a binary string `s`, return _the number of substrings with all characters_ `1`_'s_. Since the answer may be too large, return it modulo `109 + 7`. **Example 1:** **Input:** s = "0110111 " **Output:** 9 **Explanation:** There are 9 substring in total with only 1's characters. "1 " -> 5 times. "11 " -> 3 times...
Use DP with 4 states (pos: Int, posEvil: Int, equalToS1: Bool, equalToS2: Bool) which compute the number of valid strings of size "pos" where the maximum common suffix with string "evil" has size "posEvil". When "equalToS1" is "true", the current valid string is equal to "S1" otherwise it is greater. In a similar way w...
String,Dynamic Programming,String Matching
Hard
null
279
hello everyone let's start today's lead code problem perfect squares we are given an integer n we will make a combination of perfect scare for example 149 and 16 are perfect squares but 3 and 11 are not the sum of the combination will be equal to n and we will return the list number of it for example we are given 12 th...
Perfect Squares
perfect-squares
Given an integer `n`, return _the least number of perfect square numbers that sum to_ `n`. A **perfect square** is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, `1`, `4`, `9`, and `16` are perfect squares while `3` and `11` are not. **Example ...
null
Math,Dynamic Programming,Breadth-First Search
Medium
204,264
337
hello everyone uh today we're gonna go over uh lead code problem 337 uh house robber three so basically what's going on in this problem is uh it's a bi it's a tree a binary tree problem um so i'm just going to go over the problem statement here uh so the thief has found himself a new place um like a neighborhood and he...
House Robber III
house-robber-iii
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called `root`. Besides the `root`, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will automatically contact the police if ...
null
Dynamic Programming,Tree,Depth-First Search,Binary Tree
Medium
198,213
48
hello welcome to my channel i'm here to do my 100 lego challenge today we have question record 48 and rotate image so you're given an n time n 2d matrix representing an image rotate the image by 90 degree clockwise so you have to rotate the image in place which means you have to modify the input 2d array i mean to inpu...
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
76
That fans, in this video, we friends, so I want to tell you the smallest submission of the first Singh in which I am the example of all the characters of Joshi. Everyone can see what is this question that we have, like the example we have is, the first one is string one and the second one is Rintu, we have to tell the ...
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,496
See, in this video we are going to do a question, the lesson of lead code, crossing, you will be given a string like this is a beautiful string, Jas and means North e4 East S force South, if blue comes then West is ok brother, it was very good, now this In currently starting, you are standing at zero comma 0, it is a v...
Path Crossing
lucky-numbers-in-a-matrix
Given a string `path`, where `path[i] = 'N'`, `'S'`, `'E'` or `'W'`, each representing moving one unit north, south, east, or west, respectively. You start at the origin `(0, 0)` on a 2D plane and walk on the path specified by `path`. Return `true` _if the path crosses itself at any point, that is, if at any time you ...
Find out and save the minimum of each row and maximum of each column in two lists. Then scan through the whole matrix to identify the elements that satisfy the criteria.
Array,Matrix
Easy
null
101
Hello, this is coding in a big way. Today, we will try to learn the lute chord. The problem we will look at today is the deep-sea trick article No. 101. problem we will look at today is the deep-sea trick article No. 101. problem we will look at today is the deep-sea trick article No. 101. So let's take a look at the p...
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
103
interviewers love grilling you on binary trees and you might be really surprised how many companies have asked this question so you are given a tree and of a level or a Troublesome they want you to Traverse this tree in a zigzag fashion what does that mean let's see what all of this is about Hello friends welcome back ...
Binary Tree Zigzag Level Order Traversal
binary-tree-zigzag-level-order-traversal
Given the `root` of a binary tree, return _the zigzag level order traversal of its nodes' values_. (i.e., from left to right, then right to left for the next level and alternate between). **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** \[\[3\],\[20,9\],\[15,7\]\] **Example 2:** **Input:** roo...
null
Tree,Breadth-First Search,Binary Tree
Medium
102
21
given two sorted linked lists how can you write a recursive program to merge these two sorted linked lists into one and return the new hat that's today's video let's get into it my name is Steve today we are going through a legal problem 21 merged two sorted lists and today we are going through the recursive solution i...
Merge Two Sorted Lists
merge-two-sorted-lists
You are given the heads of two sorted linked lists `list1` and `list2`. Merge the two lists in a one **sorted** list. The list should be made by splicing together the nodes of the first two lists. Return _the head of the merged linked list_. **Example 1:** **Input:** list1 = \[1,2,4\], list2 = \[1,3,4\] **Output:**...
null
Linked List,Recursion
Easy
23,88,148,244,1774,2071
179
hey guys welcome back to my channel the tech coders and today we are going to solve problem number 179 that is 179 of read code largest number okay let's understand what question Isa saying to us so see question states that we given a list of non- negative integer nums and a list of non- negative integer nums and a lis...
Largest Number
largest-number
Given a list of non-negative integers `nums`, arrange them such that they form the largest number and return it. Since the result may be very large, so you need to return a string instead of an integer. **Example 1:** **Input:** nums = \[10,2\] **Output:** "210 " **Example 2:** **Input:** nums = \[3,30,34,5,9\] *...
null
String,Greedy,Sorting
Medium
2284
172
so this is factorial trailing zeroes lead code one seven two and the question is given an integer and returned the number of trailing zeroes in n factorial so in an example like say we have three factorial which is three times two times one and that gives us six and in this case we have no trailing zero and we would re...
Factorial Trailing Zeroes
factorial-trailing-zeroes
Given an integer `n`, return _the number of trailing zeroes in_ `n!`. Note that `n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1`. **Example 1:** **Input:** n = 3 **Output:** 0 **Explanation:** 3! = 6, no trailing zero. **Example 2:** **Input:** n = 5 **Output:** 1 **Explanation:** 5! = 120, one trailing zero. **Exa...
null
Math
Medium
233,809,2222
392
hi everyone welcome to my channel today is a day 9 of Joomla coding challenge and the problem is subsequence so let's see the problem statement given a string as I'm a string T check if s is the subsequence of T a subsequence of a string is a new string which is formed from the original string by deleting some characte...
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,001
hi so welcome to this problem number 1001 greedy rumination it's a lead code hard problem but uh it's like i would not put this in the hard category it's medium level problem it requires a few insights but it is not as usually a harder you know such a hard problem like we do in the generally in this playlist so the que...
Grid Illumination
n-repeated-element-in-size-2n-array
There is a 2D `grid` of size `n x n` where each cell of this grid has a lamp that is initially **turned off**. You are given a 2D array of lamp positions `lamps`, where `lamps[i] = [rowi, coli]` indicates that the lamp at `grid[rowi][coli]` is **turned on**. Even if the same lamp is listed more than once, it is turned...
null
Array,Hash Table
Easy
null
59
hey everyone today we are going to solve the little questions spiral Matrix two a few months ago I solved the spiral Matrix one I put the link in the description below so you can check later actually we can apply almost the same logic to so spider Matrix 2. so you are given a positive integer n generate n by n Matrix f...
Spiral Matrix II
spiral-matrix-ii
Given a positive integer `n`, generate an `n x n` `matrix` filled with elements from `1` to `n2` in spiral order. **Example 1:** **Input:** n = 3 **Output:** \[\[1,2,3\],\[8,9,4\],\[7,6,5\]\] **Example 2:** **Input:** n = 1 **Output:** \[\[1\]\] **Constraints:** * `1 <= n <= 20`
null
Array,Matrix,Simulation
Medium
54,921
502
Hello gaze MLA Agarwal welcome ji all owner on coding channel co tricks made by you made for you so let's learn today is lead par pehla match ki problem kya bol diya 264 moving whatsapp problem na van mein discussion for 2 day problem se samaj mein a Those who want to try it themselves, see what was said here that I ha...
IPO
ipo
Suppose LeetCode will start its **IPO** soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before the **IPO**. Since it has limited resources, it can only finish at most `k` distinct projects before the **IPO**. Help LeetCode design...
null
Array,Greedy,Sorting,Heap (Priority Queue)
Hard
null
56
hello guys welcome back to techdoors and in this video we will see the merged intervals problem which is from lead code number 56 and this is a greedy type problem after discussing the intuition and the solution to the problem we will look at the most important follow-up look at the most important follow-up look at the...
Merge Intervals
merge-intervals
Given an array of `intervals` where `intervals[i] = [starti, endi]`, merge all overlapping intervals, and return _an array of the non-overlapping intervals that cover all the intervals in the input_. **Example 1:** **Input:** intervals = \[\[1,3\],\[2,6\],\[8,10\],\[15,18\]\] **Output:** \[\[1,6\],\[8,10\],\[15,18\]\...
null
Array,Sorting
Medium
57,252,253,495,616,715,761,768,1028,2297,2319
146
hello everyone in this video we're going to be going through lead code problem 146 lru cache so this problem has a 99.3% popularity is the second most 99.3% popularity is the second most 99.3% popularity is the second most popular question after tuome this says to design a data structure that follows the constraints of...
LRU Cache
lru-cache
Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**. Implement the `LRUCache` class: * `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`. * `int get(int key)` Return the valu...
null
Hash Table,Linked List,Design,Doubly-Linked List
Medium
460,588,604,1903
399
hello hi guys good morning and oh God this question is one of the best questions for intuition purposes like okay you have a question and you have to build on what data structure you can actually solve this particular problem on what on What algorithm like you want to solve this problem so basically building that part ...
Evaluate Division
evaluate-division
You are given an array of variable pairs `equations` and an array of real numbers `values`, where `equations[i] = [Ai, Bi]` and `values[i]` represent the equation `Ai / Bi = values[i]`. Each `Ai` or `Bi` is a string that represents a single variable. You are also given some `queries`, where `queries[j] = [Cj, Dj]` rep...
Do you recognize this as a graph problem?
Array,Depth-First Search,Breadth-First Search,Union Find,Graph,Shortest Path
Medium
null
319
hey everyone welcome to techwide in this video we are going to solve problem number 319 bulb switcher first you will see the explanation of the problem statement then the logic and the code now let's dive into the solution so here I have an example so here n represents number of bulbs right so initially all my bulbs wi...
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
1,857
hey everybody this is Larry this is uh this is day ninth of the liko April day challenge hit the like button hit the Subscribe button drum and Discord let me know what you think about today's Forum uh we have a contest in two and a half hours I'm excited for that we'll see how that goes so it is kind of late in later i...
Largest Color Value in a Directed Graph
largest-color-value-in-a-directed-graph
There is a **directed graph** of `n` colored nodes and `m` edges. The nodes are numbered from `0` to `n - 1`. You are given a string `colors` where `colors[i]` is a lowercase English letter representing the **color** of the `ith` node in this graph (**0-indexed**). You are also given a 2D array `edges` where `edges[j]...
null
null
Hard
null
935
Hello everyone welcome to my channel code sorry with mike so today we are going to do video number 75 of our dynamic programming playlist ok lead the number 935 but I am promising see these are many companies ok let's see the name of the question night dialer now look attention What Dena wants to say is that you will k...
Knight Dialer
orderly-queue
The chess knight has a **unique movement**, it may move two squares vertically and one square horizontally, or two squares horizontally and one square vertically (with both forming the shape of an **L**). The possible movements of chess knight are shown in this diagaram: A chess knight can move as indicated in the che...
null
Math,String,Sorting
Hard
null
904
hello friends so today in this video we're gonna discuss another problem from lead code problem name fruits into basket so this is a problem from lead code which is a uh like a google interview recommended problem so it is somewhat asking google interviews so that's not a problem from those categories so i have made a ...
Fruit Into Baskets
leaf-similar-trees
You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by an integer array `fruits` where `fruits[i]` is the **type** of fruit the `ith` tree produces. You want to collect as much fruit as possible. However, the owner has some strict rules that you must foll...
null
Tree,Depth-First Search,Binary Tree
Easy
null
835
So welcome to aspects of time but challenge and asked questions images and more share give into images and chief and I want to identify the maximum overlapping and account and between the president in all directions of dietary fats to paneer one 00054 points 151 liquid 9999 honey unique Identification Adham Maximum Boi...
Image Overlap
linked-list-components
You are given two images, `img1` and `img2`, represented as binary, square matrices of size `n x n`. A binary matrix has only `0`s and `1`s as values. We **translate** one image however we choose by sliding all the `1` bits left, right, up, and/or down any number of units. We then place it on top of the other image. W...
null
Hash Table,Linked List
Medium
2299
65
Hello hello everyone welcome to our channel code with sunny leone in this video i will be talking about the one up the good problems of displaced number index number 6 and problems of the heart problem sub delete code ok khandwa drops very small amount of likes Register and Dislike Isko Inch And Like Almas Double To Th...
Valid Number
valid-number
A **valid number** can be split up into these components (in order): 1. A **decimal number** or an **integer**. 2. (Optional) An `'e'` or `'E'`, followed by an **integer**. A **decimal number** can be split up into these components (in order): 1. (Optional) A sign character (either `'+'` or `'-'`). 2. One of the...
null
String
Hard
8
1,877
hello folks in this video we will see how to solve the problem minimize maximum pair sum in array which is a medium level lead code problem so in this question we'll be given an input array containing n elements and we need to pair the elements such that we'll be having n by 2 paired elements so here in the constraint ...
Minimize Maximum Pair Sum in Array
find-followers-count
The **pair sum** of a pair `(a,b)` is equal to `a + b`. The **maximum pair sum** is the largest **pair sum** in a list of pairs. * For example, if we have pairs `(1,5)`, `(2,3)`, and `(4,4)`, the **maximum pair sum** would be `max(1+5, 2+3, 4+4) = max(6, 5, 8) = 8`. Given an array `nums` of **even** length `n`, pai...
null
Database
Easy
null
72
so hello everyone welcome to this new video and in this video i will be explaining the problem 72 edit distance which is a hard problem but to be honest it's not that hard i will explain you the concept how to solve this problem and you will realize that this problem is pretty easy to implement once the concept is clea...
Edit Distance
edit-distance
Given two strings `word1` and `word2`, return _the minimum number of operations required to convert `word1` to `word2`_. You have the following three operations permitted on a word: * Insert a character * Delete a character * Replace a character **Example 1:** **Input:** word1 = "horse ", word2 = "ros " **O...
null
String,Dynamic Programming
Hard
161,583,712,1105,2311
423
hi guys welcome to algorithms made easy in this video we'll see the question reconstruct original digits from english given a non-empty string non-empty string non-empty string containing an out of order english representation of digits 0 to 9 output the digits in ascending order so the note attached with this question...
Reconstruct Original Digits from English
reconstruct-original-digits-from-english
Given a string `s` containing an out-of-order English representation of digits `0-9`, return _the digits in **ascending** order_. **Example 1:** **Input:** s = "owoztneoer" **Output:** "012" **Example 2:** **Input:** s = "fviefuro" **Output:** "45" **Constraints:** * `1 <= s.length <= 105` * `s[i]` is one of ...
null
Hash Table,Math,String
Medium
null
1,921
hello hi guys good morning welcome back to the new video so this video we're going to see the problem eliminate maximum number of monsters so as you can see it has been asked by gole not much frequently and last in one two years let's quickly see the problem statement itself what it says so it says that uh we are playi...
Eliminate Maximum Number of Monsters
eliminate-maximum-number-of-monsters
You are playing a video game where you are defending your city from a group of `n` monsters. You are given a **0-indexed** integer array `dist` of size `n`, where `dist[i]` is the **initial distance** in kilometers of the `ith` monster from the city. The monsters walk toward the city at a **constant** speed. The speed...
null
null
Medium
null
783
hey guys this is chaser how's everything going in this video I'm going to take a look at 783 minimum distance between PST notes we're given a binary search tree with a root which is the minimum difference between the values of any two different notes industry four two six one three in one walk like the tree like this t...
Minimum Distance Between BST Nodes
search-in-a-binary-search-tree
Given the `root` of a Binary Search Tree (BST), return _the minimum difference between the values of any two different nodes in the tree_. **Example 1:** **Input:** root = \[4,2,6,1,3\] **Output:** 1 **Example 2:** **Input:** root = \[1,0,48,null,null,12,49\] **Output:** 1 **Constraints:** * The number of nodes...
null
Tree,Binary Search Tree,Binary Tree
Easy
270,784
1,044
so everyone welcome back to another video of no mental forest today let's continue our little challenge today's question is : August articulate the question is : August articulate the question is : August articulate the Sabbath dream let's look at a question given a string is consider or duplicate a sub stream substitu...
Longest Duplicate Substring
find-common-characters
Given a string `s`, consider all _duplicated substrings_: (contiguous) substrings of s that occur 2 or more times. The occurrences may overlap. Return **any** duplicated substring that has the longest possible length. If `s` does not have a duplicated substring, the answer is `" "`. **Example 1:** **Input:** s = "ba...
null
Array,Hash Table,String
Easy
350
1,465
welcome to june's leeco challenge today's problem is maximum area of a piece of cake after horizontal and vertical cuts given a rectangle cake with height h and width w and two array of integers horizontal cuts and vertical cuts where horizontal cuts is the distance from the top of the rectangle cake to the horizontal ...
Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts
maximum-product-of-splitted-binary-tree
You are given a rectangular cake of size `h x w` and two arrays of integers `horizontalCuts` and `verticalCuts` where: * `horizontalCuts[i]` is the distance from the top of the rectangular cake to the `ith` horizontal cut and similarly, and * `verticalCuts[j]` is the distance from the left of the rectangular cake ...
If we know the sum of a subtree, the answer is max( (total_sum - subtree_sum) * subtree_sum) in each node.
Tree,Depth-First Search,Binary Tree
Medium
2175
53
what's up interview hackers sam here from bite by bite comment in this video I'm going to show you how to solve the maxims subarray problem and if you haven't already make sure you hit that subscribe button in the notification bell to get notified every time we release new videos just like this alright in this video we...
Maximum Subarray
maximum-subarray
Given an integer array `nums`, find the subarray with the largest sum, and return _its sum_. **Example 1:** **Input:** nums = \[-2,1,-3,4,-1,2,1,-5,4\] **Output:** 6 **Explanation:** The subarray \[4,-1,2,1\] has the largest sum 6. **Example 2:** **Input:** nums = \[1\] **Output:** 1 **Explanation:** The subarray \...
null
Array,Divide and Conquer,Dynamic Programming
Easy
121,152,697,1020,1849,1893
1,042
hello everyone so in this video let us talk about from the problem from lead code the problem name is flower planting with no Edison wow a nice problem name actually so okay let us go down to the problem statement so you have n Gardens labeled from 1 till n and an array of paths where pathophy is denoted by X of i y o ...
Flower Planting With No Adjacent
minimum-cost-to-merge-stones
You have `n` gardens, labeled from `1` to `n`, and an array `paths` where `paths[i] = [xi, yi]` describes a bidirectional path between garden `xi` to garden `yi`. In each garden, you want to plant one of 4 types of flowers. All gardens have **at most 3** paths coming into or leaving it. Your task is to choose a flowe...
null
Array,Dynamic Programming
Hard
312,1126
205
Hello Gas, today's question is, so here we will maintain small example maps and the second will be the hashmat of character bullion, so what will be the character bullion, what character bullion will do is that it will help us track which ones. Our elements have been done so that we can track them, how will we track th...
Isomorphic Strings
isomorphic-strings
Given two strings `s` and `t`, _determine if they are isomorphic_. Two strings `s` and `t` are isomorphic if the characters in `s` can be replaced to get `t`. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same characte...
null
Hash Table,String
Easy
290
1,784
let's solve the problem 1784 check if binary string has a at most one segment of once given a binary string S without leading zeros return true if s contains at most one contigous segment of once otherwise return false the question is that you'll be given a binary string okay a string that represents a binary number so...
Check if Binary String Has at Most One Segment of Ones
minimum-initial-energy-to-finish-tasks
Given a binary string `s` **​​​​​without leading zeros**, return `true`​​​ _if_ `s` _contains **at most one contiguous segment of ones**_. Otherwise, return `false`. **Example 1:** **Input:** s = "1001 " **Output:** false **Explanation:** The ones do not form a contiguous segment. **Example 2:** **Input:** s = "1...
We can easily figure that the f(x) : does x solve this array is monotonic so binary Search is doable Figure a sorting pattern
Array,Greedy,Sorting
Hard
null
1,947
okay hey everybody this is larry this week over q3 of the weekly contest 251 maximum compatibility score sum so for this problem uh the first thing to look um well so yeah so hit the like button hit the subscribe button join me in discord especially if you like solving this contest form come to my discord we talk about...
Maximum Compatibility Score Sum
number-of-different-subsequences-gcds
There is a survey that consists of `n` questions where each question's answer is either `0` (no) or `1` (yes). The survey was given to `m` students numbered from `0` to `m - 1` and `m` mentors numbered from `0` to `m - 1`. The answers of the students are represented by a 2D integer array `students` where `students[i]`...
Think of how to check if a number x is a gcd of a subsequence. If there is such subsequence, then all of it will be divisible by x. Moreover, if you divide each number in the subsequence by x , then the gcd of the resulting numbers will be 1. Adding a number to a subsequence cannot increase its gcd. So, if there is a v...
Array,Math,Counting,Number Theory
Hard
2106
1,457
Loot Guys Welcome and Welcome Back to my Channel Our problem today is Shiv Palace Roaming Pass in Every Such Problem Statement What have you given us, here we have been given a binary tree in which the value of the note is from your lineage to 9 Okay, what we have to do here is to fine the number of you toe paint relig...
Pseudo-Palindromic Paths in a Binary Tree
minimum-difficulty-of-a-job-schedule
Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be **pseudo-palindromic** if at least one permutation of the node values in the path is a palindrome. _Return the number of **pseudo-palindromic** paths going from the root node to leaf nodes._ **Example 1:** **Input:*...
Use DP. Try to cut the array into d non-empty sub-arrays. Try all possible cuts for the array. Use dp[i][j] where DP states are i the index of the last cut and j the number of remaining cuts. Complexity is O(n * n * d).
Array,Dynamic Programming
Hard
null
129
hey there today we'll be doing this question that is one to nine some root two Leaf numbers on lead code and the given question statement is you are given the root of a binary containing digits from 0 to 9 only each root 2 Leaf path in the tree represents a number this part is very important for example root to Leaf pa...
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
315
welcome to june's lego challenge today's problem is count of smaller numbers after self you are given an integer ring nums and you have to return a new counts array the count's array has a property where counts i is the number of smaller elements to the right of num's eye here at five we can see that there's two number...
Count of Smaller Numbers After Self
count-of-smaller-numbers-after-self
Given an integer array `nums`, return _an integer array_ `counts` _where_ `counts[i]` _is the number of smaller elements to the right of_ `nums[i]`. **Example 1:** **Input:** nums = \[5,2,6,1\] **Output:** \[2,1,1,0\] **Explanation:** To the right of 5 there are **2** smaller elements (2 and 1). To the right of 2 the...
null
Array,Binary Search,Divide and Conquer,Binary Indexed Tree,Segment Tree,Merge Sort,Ordered Set
Hard
327,406,493,1482,2280
79
all right so today we're going to be taking a look at the popular Le code problem word search and so what this problem is asking us to do is we're given an N byn grid of characters called board and a string word and so our goal is to return either true or false if word exists in the grid so as the name suggests we are ...
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,967
welcome back for another video we are going to do another decor question the question is number of strings that appear as substrings in word given a array of strings patterns and a string word return the number of strings in patterns that exist as a substring in word a substring is a contiguous sequence of characters w...
Number of Strings That Appear as Substrings in Word
longest-substring-of-all-vowels-in-order
Given an array of strings `patterns` and a string `word`, return _the **number** of strings in_ `patterns` _that exist as a **substring** in_ `word`. A **substring** is a contiguous sequence of characters within a string. **Example 1:** **Input:** patterns = \[ "a ", "abc ", "bc ", "d "\], word = "abc " **Output:**...
Start from each 'a' and find the longest beautiful substring starting at that index. Based on the current character decide if you should include the next character in the beautiful substring.
String,Sliding Window
Medium
2186