id
int64
1
2k
content
stringlengths
272
88.9k
title
stringlengths
3
77
title_slug
stringlengths
3
79
question_content
stringlengths
230
5k
question_hints
stringclasses
695 values
tag
stringclasses
618 values
level
stringclasses
3 values
similar_question_ids
stringclasses
822 values
1,765
hello everyone let's solve the code 1765 map of highest peak so it's a very typical bfs problem let's take a look at this problem so we are given an integer matrix this order of size and multiply n and if value is zero that is the length series that is one then it's vertical so the um blue color cell is a word there an...
Map of Highest Peak
merge-in-between-linked-lists
You are given an integer matrix `isWater` of size `m x n` that represents a map of **land** and **water** cells. * If `isWater[i][j] == 0`, cell `(i, j)` is a **land** cell. * If `isWater[i][j] == 1`, cell `(i, j)` is a **water** cell. You must assign each cell a height in a way that follows these rules: * The...
Check which edges need to be changed. Let the next node of the (a-1)th node of list1 be the 0-th node in list 2. Let the next node of the last node of list2 be the (b+1)-th node in list 1.
Linked List
Medium
null
1,187
Hello everyone, welcome to me, the concept of the channel and the playlist of questions has also been started, so you can start there too, where the dynamic is explained from the scrap, there are more videos coming soon. Okay, so this is 1187 hard in liquid. But it is very similar and if you understand it well then it ...
Make Array Strictly Increasing
print-foobar-alternately
Given two integer arrays `arr1` and `arr2`, return the minimum number of operations (possibly zero) needed to make `arr1` strictly increasing. In one operation, you can choose two indices `0 <= i < arr1.length` and `0 <= j < arr2.length` and do the assignment `arr1[i] = arr2[j]`. If there is no way to make `arr1` str...
null
Concurrency
Medium
1203,1216
199
hey guys welcome to a new video in today's video we're going to look at a lead code problem and the problem's name is binary tree right side view so in this question we're given the root of a binary tree and you have to imagine yourself standing on the right side of it and our task is to return the values of the nodes ...
Binary Tree Right Side View
binary-tree-right-side-view
Given the `root` of a binary tree, imagine yourself standing on the **right side** of it, return _the values of the nodes you can see ordered from top to bottom_. **Example 1:** **Input:** root = \[1,2,3,null,5,null,4\] **Output:** \[1,3,4\] **Example 2:** **Input:** root = \[1,null,3\] **Output:** \[1,3\] **Examp...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
116,545
92
hello Shak speaking uh as part the commitment uh yesterday I said that we are going to solve this problem and it's medium problem uh up to today up to date we have solved easy problems but now it's time to solve some medium problems and it's reversing Ling list so my plan is to divide this solution into two part in the...
Reverse Linked List II
reverse-linked-list-ii
Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_. **Example 1:** **Input:** head = \[1,2,3,4,5\], left = 2, right = 4 **Output:** \[1,4,3,2,5\] **Example 2:** **I...
null
Linked List
Medium
206
1,631
Hello hi everyone welcome to my channel it's all the problem pass with minimum fat so you are doing preparation for the upcoming like you are given its tours of sizes in favor of vs in the top 10 most to travel to bottom right corner bin tere ab them face to face Boss subscribe to the Page if you liked The Video from t...
Path With Minimum Effort
number-of-sub-arrays-with-odd-sum
You are a hiker preparing for an upcoming hike. You are given `heights`, a 2D array of size `rows x columns`, where `heights[row][col]` represents the height of cell `(row, col)`. You are situated in the top-left cell, `(0, 0)`, and you hope to travel to the bottom-right cell, `(rows-1, columns-1)` (i.e., **0-indexed**...
Can we use the accumulative sum to keep track of all the odd-sum sub-arrays ? if the current accu sum is odd, we care only about previous even accu sums and vice versa.
Array,Math,Dynamic Programming,Prefix Sum
Medium
2242
388
so let's talk about the longest absolute file pack so this question is pretty long and might be misunderstanding for some point but i'm just going to dive into example and then you will be able to see what happened so here is it so you have a string so this is your string and then this string is actually represent this...
Longest Absolute File Path
longest-absolute-file-path
Suppose we have a file system that stores both files and directories. An example of one system is represented in the following picture: Here, we have `dir` as the only directory in the root. `dir` contains two subdirectories, `subdir1` and `subdir2`. `subdir1` contains a file `file1.ext` and subdirectory `subsubdir1`....
null
String,Stack,Depth-First Search
Medium
null
662
today we are solving maximum width of a binary tree given the root of a binary tree we need to return the maximum width of the given tree among all the levels where the width of one level is defined as the length between the end nodes where these end nodes have to be non-null nodes to find out what exactly non-null nod...
Maximum Width of Binary Tree
maximum-width-of-binary-tree
Given the `root` of a binary tree, return _the **maximum width** of the given tree_. The **maximum width** of a tree is the maximum **width** among all levels. The **width** of one level is defined as the length between the end-nodes (the leftmost and rightmost non-null nodes), where the null nodes between the end-no...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
1,510
hey what's up guys this is sean here again so let's take a look at today's daily challenge problem which is number 1510 stone game number four okay so this is the fourth problem in the stone game theory so again alice and bob are playing a game and with alice starting first so now this time they're not the peak they're...
Stone Game IV
find-lucky-integer-in-an-array
Alice and Bob take turns playing a game, with Alice starting first. Initially, there are `n` stones in a pile. On each player's turn, that player makes a _move_ consisting of removing **any** non-zero **square number** of stones in the pile. Also, if a player cannot make a move, he/she loses the game. Given a positi...
Count the frequency of each integer in the array. Get all lucky numbers and return the largest of them.
Array,Hash Table,Counting
Easy
null
897
hello let's start with another interesting problem so they have told us that given the root of a binary Source tree rearrange the tree in order so that the leftmost node in the tree is now the root of the tree and every node as no left child and only one right child so let's understand this using example so basically t...
Increasing Order Search Tree
prime-palindrome
Given the `root` of a binary search tree, rearrange the tree in **in-order** so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only one right child. **Example 1:** **Input:** root = \[5,3,6,2,4,null,8,1,null,null,null,7,9\] **Output:** \[1,null,2,null,3,null,4,nul...
null
Math
Medium
2202
1,019
hi guys how are you I hope all you are doing good welcome to the learn code easily so today we will solve next create a node in linked list and this is our next question in our stack Series so I hope you have already accessed my stack series because we are I'm solving the numbers of question we have done the easy level...
Next Greater Node In Linked List
squares-of-a-sorted-array
You are given the `head` of a linked list with `n` nodes. For each node in the list, find the value of the **next greater node**. That is, for each node, find the value of the first node that is next to it and has a **strictly larger** value than it. Return an integer array `answer` where `answer[i]` is the value of ...
null
Array,Two Pointers,Sorting
Easy
88,360
1,669
all right let's talk about the merging between linked lists so you are given two linked lists this one and these two and there are sets of m and m so you have to remove this one no from eight from a note to b note and then put these two in their place so basically like um you are giving a and b in this one and then you...
Merge In Between Linked Lists
minimum-cost-to-cut-a-stick
You are given two linked lists: `list1` and `list2` of sizes `n` and `m` respectively. Remove `list1`'s nodes from the `ath` node to the `bth` node, and put `list2` in their place. The blue edges and nodes in the following figure indicate the result: _Build the result list and return its head._ **Example 1:** **In...
Build a dp array where dp[i][j] is the minimum cost to achieve all the cuts between i and j. When you try to get the minimum cost between i and j, try all possible cuts k between them, dp[i][j] = min(dp[i][k] + dp[k][j]) + (j - i) for all possible cuts k between them.
Array,Dynamic Programming
Hard
2251
382
Hello friends today I am going to solve liquid problem number 382 linked list random note I have also created another video solving the same problem using o of n time complexity but o of one space complexity now in this video I am going to solve this problem using of 1 time complexity and um using off and space complex...
Linked List Random Node
linked-list-random-node
Given a singly linked list, return a random node's value from the linked list. Each node must have the **same probability** of being chosen. Implement the `Solution` class: * `Solution(ListNode head)` Initializes the object with the head of the singly-linked list `head`. * `int getRandom()` Chooses a node randoml...
null
Linked List,Math,Reservoir Sampling,Randomized
Medium
398
252
so today we are going to talk about this question meeting rooms so uh let's see the description for this uh question so given an array of meeting time uh meeting uh time intervals can uh consistent for starting at the ending time so uh let's see this example um so uh the first value is the starting time of the meeting ...
Meeting Rooms
meeting-rooms
Given an array of meeting time `intervals` where `intervals[i] = [starti, endi]`, determine if a person could attend all meetings. **Example 1:** **Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\] **Output:** false **Example 2:** **Input:** intervals = \[\[7,10\],\[2,4\]\] **Output:** true **Constraints:** * ...
null
Array,Sorting
Easy
56,253
1,026
Hello hello guys welcome on donkey week singh krishna singh difference between noida and system subscribe must subscribe veer channel subscribe must subscribe like and subscribe subscription thanks a drama b r country and give another problem the number of verses result subscribe And subscribe The Amazing subscribe Vid...
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
48
Ae House Today Will Really Good Problem remove those voltage delhi-110002 matrix juice. voltage delhi-110002 matrix juice. voltage delhi-110002 matrix juice. Match Inkrice the Givar 12345 600 Subscribe button Click 052 Ashes Subscribe Electronic 12345 600 Tips 8085 600 Tips23 Solve Thinks 12345 60 First River System 04...
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,027
Hello friends welcome back to me channel once again so here we are going to talk about today's daily problems question of lead code which is lead code medium level question and its name is Longest Arthritis Progression Men's Right so here you Whatever the name of the question is suggesting to you, the same thing is bei...
Longest Arithmetic Subsequence
sum-of-even-numbers-after-queries
Given an array `nums` of integers, return _the length of the longest arithmetic subsequence in_ `nums`. **Note** that: * A **subsequence** is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements. * A sequence `seq` is arithmetic if `s...
null
Array,Simulation
Medium
null
849
hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you've not liked the video please like it subscribe to my channel so that you get notified whenever post a new video without any further due let's get started so the problem is maximize dist...
Maximize Distance to Closest Person
maximize-distance-to-closest-person
You are given an array representing a row of `seats` where `seats[i] = 1` represents a person sitting in the `ith` seat, and `seats[i] = 0` represents that the `ith` seat is empty **(0-indexed)**. There is at least one empty seat, and at least one person sitting. Alex wants to sit in the seat such that the distance b...
null
null
Medium
null
746
hey everybody this is larry this is day seven of the june eco daily challenge hit the like button to subscribe and join me on discord that means that we're coming up on one week congratulate yourselves a little bit uh one fourth and a little bit less of the way there uh anyway today's problem is min cars climbing stair...
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
937
this is little to question number 937 the other day tiny log file this is a gesture let's get into it I don't think this is a good eating question I think this is to check syntax ability so I think that is reason why there is a lot of some down anyway let's get it all right you have inaudible logs each log is a space d...
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
1,687
hi everyone myself Bish and today we will see about the with delivering boxes from stor reports number uh L question and it is comes under the hard category and we'll have to properly understand so the question is arriving like you have the task of delivering some boxes from Storage to the airports and only one ship ho...
Delivering Boxes from Storage to Ports
the-most-similar-path-in-a-graph
You have the task of delivering some boxes from storage to their ports using only one ship. However, this ship has a **limit** on the **number of boxes** and the **total weight** that it can carry. You are given an array `boxes`, where `boxes[i] = [ports​​i​, weighti]`, and three integers `portsCount`, `maxBoxes`, and...
Create an array dp where dp[i][j] is the min edit distance for the path starting at node i and compared to index j of the targetPath. Traverse the dp array to obtain a valid answer.
Dynamic Programming,Graph
Hard
null
1,903
welcome back guys so today i would be discussing the problems of weekly contest 246 and i would be doing so in english only so yeah do watch it and also those who don't give lead code or don't like lead code so what they can do is they can click on the problem link in the description and they can try to submit few prob...
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
328
in this video we're going to look at a legal problem called all even linked lists so we're given the head of linked list uh we want to group all the odd indexes together and then followed by the even indexes notes so in this case the first note is always going to be odd right so the first node and the second node is go...
Odd Even Linked List
odd-even-linked-list
Given the `head` of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return _the reordered list_. The **first** node is considered **odd**, and the **second** node is **even**, and so on. Note that the relative order inside both the even and odd groups s...
null
Linked List
Medium
725
1,561
hey guys welcome back today we're going to go through legal problem 1561 maximum number of coins you can get let's take a look at the problem first there are three n piles of coins of varying size you and your friends will take piles of coins as follows so in each step you will first choose any three piles of coins not...
Maximum Number of Coins You Can Get
rearrange-words-in-a-sentence
There are `3n` piles of coins of varying size, you and your friends will take piles of coins as follows: * In each step, you will choose **any** `3` piles of coins (not necessarily consecutive). * Of your choice, Alice will pick the pile with the maximum number of coins. * You will pick the next pile with the ma...
Store each word and their relative position. Then, sort them by length of words in case of tie by their original order.
String,Sorting
Medium
null
1,297
hello everyone so today we are going to see maximum number of occurrences of a substring so we are given an input of a string s and three integer values max letters min size and max size so we have to return the number of substrings we can form from the string yes but the substring can be formed with following rules th...
Maximum Number of Occurrences of a Substring
maximum-number-of-balloons
Given a string `s`, return the maximum number of ocurrences of **any** substring under the following rules: * The number of unique characters in the substring must be less than or equal to `maxLetters`. * The substring size must be between `minSize` and `maxSize` inclusive. **Example 1:** **Input:** s = "aababc...
Count the frequency of letters in the given string. Find the letter than can make the minimum number of instances of the word "balloon".
Hash Table,String,Counting
Easy
null
149
Good evening friends, today we have brought the next lecture of computer series in which we are going to solve the questions of Max Point Channel Line which is the problem of heart category and today our de tu hai date is this 8th of January 9. Ordinance is given in Let's Start which There will be one point, we will re...
Max Points on a Line
max-points-on-a-line
Given an array of `points` where `points[i] = [xi, yi]` represents a point on the **X-Y** plane, return _the maximum number of points that lie on the same straight line_. **Example 1:** **Input:** points = \[\[1,1\],\[2,2\],\[3,3\]\] **Output:** 3 **Example 2:** **Input:** points = \[\[1,1\],\[3,2\],\[5,3\],\[4,1\]...
null
Array,Hash Table,Math,Geometry
Hard
356,2287
923
hey what's up guys uh this is chung here so let's take a look at today's daily challenge problem uh number 923 threesome is multiplicity right so this is a very interesting like three-sum problem three-sum problem three-sum problem this is like a little bit of variation of that so given like an integer array right and ...
3Sum With Multiplicity
super-egg-drop
Given an integer array `arr`, and an integer `target`, return the number of tuples `i, j, k` such that `i < j < k` and `arr[i] + arr[j] + arr[k] == target`. As the answer can be very large, return it **modulo** `109 + 7`. **Example 1:** **Input:** arr = \[1,1,2,2,3,3,4,4,5,5\], target = 8 **Output:** 20 **Explanatio...
null
Math,Binary Search,Dynamic Programming
Hard
2031
71
okay question 71 leak code simplifying path so given a string path which is an absolute path starting with a forward slash to a file or directory in a unix style file system convert it to the simplified canonical path a unix style file system period refers to the current directory a double period refers to the director...
Simplify Path
simplify-path
Given a string `path`, which is an **absolute path** (starting with a slash `'/'`) to a file or directory in a Unix-style file system, convert it to the simplified **canonical path**. In a Unix-style file system, a period `'.'` refers to the current directory, a double period `'..'` refers to the directory up a level,...
null
String,Stack
Medium
null
1,647
uh let's talk about a minimum direction to make character frequency unique so a good string s if there are no two different characters in s they have the same frequency so basically you don't want a character that have the same frequency in the string so uh in this idea we can actually use a container array to just mak...
Minimum Deletions to Make Character Frequencies Unique
can-convert-string-in-k-moves
A string `s` is called **good** if there are no two different characters in `s` that have the same **frequency**. Given a string `s`, return _the **minimum** number of characters you need to delete to make_ `s` _**good**._ The **frequency** of a character in a string is the number of times it appears in the string. F...
Observe that shifting a letter x times has the same effect of shifting the letter x + 26 times. You need to check whether k is large enough to cover all shifts with the same remainder after modulo 26.
Hash Table,String
Medium
null
1,066
all right i am so excited to bring you guys this video today we're going to try something new i just bought an ipad so i'm going to use it as a virtual whiteboard and hopefully this will improve my production quality you know you guys can be able to see things on a bigger screen be able to um get some better visuals so...
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,576
let's solve lead code problem 1576 replace all question marks to avoid consecutive repeating characters the question goes like this so you'll be given any string right and some of the characters on that string will be question marks right so all you have to do is replace this question mark with some character some alph...
Replace All ?'s to Avoid Consecutive Repeating Characters
reorder-routes-to-make-all-paths-lead-to-the-city-zero
Given a string `s` containing only lowercase English letters and the `'?'` character, convert **all** the `'?'` characters into lowercase letters such that the final string does not contain any **consecutive repeating** characters. You **cannot** modify the non `'?'` characters. It is **guaranteed** that there are no ...
Treat the graph as undirected. Start a dfs from the root, if you come across an edge in the forward direction, you need to reverse the edge.
Depth-First Search,Breadth-First Search,Graph
Medium
null
1,640
Hello hello one sir let's see the question January changes is its first question and check the reformation proximity of contention solved Here first an area is given which is all its element district and a piece of the same area is given it has been given some strength and grinded it. And it should be 150 real distant....
Check Array Formation Through Concatenation
design-a-file-sharing-system
You are given an array of **distinct** integers `arr` and an array of integer arrays `pieces`, where the integers in `pieces` are **distinct**. Your goal is to form `arr` by concatenating the arrays in `pieces` **in any order**. However, you are **not** allowed to reorder the integers in each array `pieces[i]`. Return...
Try to solve it by keeping for each file chunk, the users who have this chunk. Try to solve it by keeping all the users in the system with their owned chunks, and when you request a chunk, check all users for it.
Hash Table,Design,Heap (Priority Queue),Data Stream
Medium
355
1,480
hi guys this is khushboo and welcome to algorithms made easy in this video we will see the question running sum of 1d array given an error nums we define the running sum of an array as running sum of i is equal to sum of num 0 to the num till ayath position and we need to return the running sum of the nums array there ...
Running Sum of 1d Array
movie-rating
Given an array `nums`. We define a running sum of an array as `runningSum[i] = sum(nums[0]...nums[i])`. Return the running sum of `nums`. **Example 1:** **Input:** nums = \[1,2,3,4\] **Output:** \[1,3,6,10\] **Explanation:** Running sum is obtained as follows: \[1, 1+2, 1+2+3, 1+2+3+4\]. **Example 2:** **Input:** ...
null
Database
Medium
null
973
hey everyone welcome back and let's write some more neat code today so today let's solve the problem k closest points to the origin so let's take a look at this example and you can't really see it well but they have a couple points so there's one point over here and there's one point over here so we have a list of poin...
K Closest Points to Origin
stamping-the-sequence
Given an array of `points` where `points[i] = [xi, yi]` represents a point on the **X-Y** plane and an integer `k`, return the `k` closest points to the origin `(0, 0)`. The distance between two points on the **X-Y** plane is the Euclidean distance (i.e., `√(x1 - x2)2 + (y1 - y2)2`). You may return the answer in **an...
null
String,Stack,Greedy,Queue
Hard
null
1,608
hello so this question is special array with X element greater than or equal to X so this question is pretty challenge uh the wording is kind of tricky so if the nums is considered special if there exists a number X so this is going to be the dynamic value that you want to find out what is the number X such that there ...
Special Array With X Elements Greater Than or Equal X
calculate-salaries
You are given an array `nums` of non-negative integers. `nums` is considered **special** if there exists a number `x` such that there are **exactly** `x` numbers in `nums` that are **greater than or equal to** `x`. Notice that `x` **does not** have to be an element in `nums`. Return `x` _if the array is **special**, ...
null
Database
Medium
null
1,385
hi my name is david today we're going to do number one three eight five find a distance value between two arrays this is an easy level problem and we're going to solve it in javascript so basically the prompts a little bit confusing given the amount of dislikes it got but what we have here is an array of them the first...
Find the Distance Value Between Two Arrays
number-of-ways-to-build-house-of-cards
Given two integer arrays `arr1` and `arr2`, and the integer `d`, _return the distance value between the two arrays_. The distance value is defined as the number of elements `arr1[i]` such that there is not any element `arr2[j]` where `|arr1[i]-arr2[j]| <= d`. **Example 1:** **Input:** arr1 = \[4,5,8\], arr2 = \[10,9...
If a row has k triangles, how many cards does it take to build that row? It takes 3 * k - 1 cards. If you still have i cards left, and on the previous row there were k triangles, what are the possible ways to build the current row? You can start at 1 triangle and continue adding more until you run out of cards or reach...
Math,Dynamic Programming
Medium
815
435
hello hi everyone welcome back to the channel so this is your randip Singh I'm back with yet another lead code problem so in the previous days I was a little ill that's why I couldn't upload video but from now I will be uploading videos continuously so in this video lecture we'll be solving this problem nonoverlapping ...
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
1,394
hi welcome to data structure and algorithm series by coding ally i'm your host sue in this video i would like to go through this problem find lucky integer in an array this is the agenda first i will go through the problem statement and thought process behind and for this problem in this video i will use hashmap to sol...
Find Lucky Integer in an Array
find-lucky-integer-in-an-array
Given an array of integers `arr`, a **lucky integer** is an integer that has a frequency in the array equal to its value. Return _the largest **lucky integer** in the array_. If there is no **lucky integer** return `-1`. **Example 1:** **Input:** arr = \[2,2,3,4\] **Output:** 2 **Explanation:** The only lucky number...
null
null
Easy
null
1,189
hello everybody and welcome back to the DCCC channel where in this series we saw for technical interview questions let's pick a question and I was looking at it I think maximum number of balloons sounds interesting kind of like goofy let's see 1189 maximum number of balloons given a string which would be text you want ...
Maximum Number of Balloons
encode-number
Given a string `text`, you want to use the characters of `text` to form as many instances of the word **"balloon "** as possible. You can use each character in `text` **at most once**. Return the maximum number of instances that can be formed. **Example 1:** **Input:** text = "nlaebolko " **Output:** 1 **Example 2...
Try to find the number of binary digits returned by the function. The pattern is to start counting from zero after determining the number of binary digits.
Math,String,Bit Manipulation
Medium
1070
59
uh hello friends uh welcome to my channel so let's have a look at problem 59 together the sphero matrix two so we saw that there are four such problems in this code so we are going to share the solutions for all these four problems using the rotation matrix method um here let's look at the this problem sphero matrix tw...
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
393
hey everybody this is larry this is me doing a bonus question so let's find one that we haven't done yet and also hopefully isn't premium because i'm too cheap but yeah hit the like button and subscribe and join me on discord let me know uh yeah uh and definitely especially let me know for this part because i would app...
UTF-8 Validation
utf-8-validation
Given an integer array `data` representing the data, return whether it is a valid **UTF-8** encoding (i.e. it translates to a sequence of valid UTF-8 encoded characters). A character in **UTF8** can be from **1 to 4 bytes** long, subjected to the following rules: 1. For a **1-byte** character, the first bit is a `0`...
All you have to do is follow the rules. For a given integer, obtain its binary representation in the string form and work with the rules given in the problem. An integer can either represent the start of a UTF-8 character, or a part of an existing UTF-8 character. There are two separate rules for these two scenarios in...
Array,Bit Manipulation
Medium
null
5
everyone in this video we are going to discuss a very famous problem known as longest palindromic subsequence so they're given a string and we have to identify a subsequence of the string so we have to pick the characters out of the string and the order of characters should remain same and this is known as a subsequenc...
Longest Palindromic Substring
longest-palindromic-substring
Given a string `s`, return _the longest_ _palindromic_ _substring_ in `s`. **Example 1:** **Input:** s = "babad " **Output:** "bab " **Explanation:** "aba " is also a valid answer. **Example 2:** **Input:** s = "cbbd " **Output:** "bb " **Constraints:** * `1 <= s.length <= 1000` * `s` consist of only dig...
How can we reuse a previously computed palindrome to compute a larger palindrome? If “aba” is a palindrome, is “xabax” a palindrome? Similarly is “xabay” a palindrome? Complexity based hint: If we use brute-force and check whether for every start and end position a substring is a palindrome we have O(n^2) start - end ...
String,Dynamic Programming
Medium
214,266,336,516,647
20
What have we put in the current character? We have put its icon in the current character. Okay, so is the current character equal to this and then I said, is my current character equal to the square bracket? Opening square bracket. Okay, if any of these. If it happens, what did I say? In this type, push me. Current cha...
Valid Parentheses
valid-parentheses
Given a string `s` containing just the characters `'('`, `')'`, `'{'`, `'}'`, `'['` and `']'`, determine if the input string is valid. An input string is valid if: 1. Open brackets must be closed by the same type of brackets. 2. Open brackets must be closed in the correct order. 3. Every close bracket has a corres...
An interesting property about a valid parenthesis expression is that a sub-expression of a valid expression should also be a valid expression. (Not every sub-expression) e.g. { { } [ ] [ [ [ ] ] ] } is VALID expression [ [ [ ] ] ] is VALID sub-expression { } [ ] is VALID sub-express...
String,Stack
Easy
22,32,301,1045,2221
93
Hello hello friends welcome to jaipur flight today once again went look absolutely medium glutes core problem 193 restore ip address for the problems is given stringer scanning only it has written all possible valid ip address that can be obtained from this app you can determine your order 24 Comprehensive event with s...
Restore IP Addresses
restore-ip-addresses
A **valid IP address** consists of exactly four integers separated by single dots. Each integer is between `0` and `255` (**inclusive**) and cannot have leading zeros. * For example, `"0.1.2.201 "` and `"192.168.1.1 "` are **valid** IP addresses, but `"0.011.255.245 "`, `"192.168.1.312 "` and `"192.168@1.1 "` are **...
null
String,Backtracking
Medium
752
539
hello and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem 539 minimum time difference given a list of 24 hour clock time points in our hour minute format return the minimum minutes difference between two any two time points in the list so if we were given the time you...
Minimum Time Difference
minimum-time-difference
Given a list of 24-hour clock time points in **"HH:MM "** format, return _the minimum **minutes** difference between any two time-points in the list_. **Example 1:** **Input:** timePoints = \["23:59","00:00"\] **Output:** 1 **Example 2:** **Input:** timePoints = \["00:00","23:59","00:00"\] **Output:** 0 **Constrai...
null
Array,Math,String,Sorting
Medium
2266
823
Hello everyone welcome to my channel quote sir with me so today we are going to consume the video number of the playlist of our hash map hashset ok so the lead code number is 823 medium is marked but it will be a very easy question it will be very intuitive it will be built very easily The question is okay but from thi...
Binary Trees With Factors
split-array-with-same-average
Given an array of unique integers, `arr`, where each integer `arr[i]` is strictly greater than `1`. We make a binary tree using these integers, and each number may be used for any number of times. Each non-leaf node's value should be equal to the product of the values of its children. Return _the number of binary tre...
null
Array,Math,Dynamic Programming,Bit Manipulation,Bitmask
Hard
2162
1,396
hi guys good morning welcome back to the next video so basically firstly many people have made video on this but for sure if you're watching this my Prime purpose is how to make you think that how to start solving these problems everyone will tell you that okay it's a hash map use this map make this map but how to actu...
Design Underground System
count-servers-that-communicate
An underground railway system is keeping track of customer travel times between different stations. They are using this data to calculate the average time it takes to travel from one station to another. Implement the `UndergroundSystem` class: * `void checkIn(int id, string stationName, int t)` * A customer w...
Store number of computer in each row and column. Count all servers that are not isolated.
Array,Depth-First Search,Breadth-First Search,Union Find,Matrix,Counting
Medium
null
1,191
Hain Saunf Bandh Today Baikunthpur Discuss Important To Medium Problem Number One Question Maximum Set Only Delicious Question Has Been Previously Today Note Of Companies And Make Sure Important Diagnostic Is Gold Medal Tomorrow Morning Starting With Problem Ayush Bhawan Recommend You To That Way Forward Porn Dance of ...
K-Concatenation Maximum Sum
synonymous-sentences
Given an integer array `arr` and an integer `k`, modify the array by repeating it `k` times. For example, if `arr = [1, 2]` and `k = 3` then the modified array will be `[1, 2, 1, 2, 1, 2]`. Return the maximum sub-array sum in the modified array. Note that the length of the sub-array can be `0` and its sum in that cas...
Find all synonymous groups of words. Use union-find data structure. By backtracking, generate all possible statements.
Array,Hash Table,String,Backtracking,Union Find
Medium
null
6
hello and welcome to python programming practice in this episode we are going to be covering elite code number six called zigzag conversion this is classified as a medium problem so it might take some doing to get through it so i'll start by reading the problem description here the string pay pal is hiring is written i...
Zigzag Conversion
zigzag-conversion
The string `"PAYPALISHIRING "` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: `"PAHNAPLSIIGYIR "` Write the code that will take a string and make this co...
null
String
Medium
null
40
hey everyone today we are going to talk with a little question in combination sum two so you are given a collection of candidate numbers candidates and a target number Target and find all unique combinations in candidates where the candidate numbers sum to Target so each number in candidates may only be used once in th...
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
949
in this problem we are given uh four digits uh single digits from zero to nine so like this let's say three two one five so we will be always given four digits and we have to form time and time should be in this format h m so you see four digits are being used and you can use these four digits in any of these four posi...
Largest Time for Given Digits
cat-and-mouse
Given an array `arr` of 4 digits, find the latest 24-hour time that can be made using each digit **exactly once**. 24-hour times are formatted as `"HH:MM "`, where `HH` is between `00` and `23`, and `MM` is between `00` and `59`. The earliest 24-hour time is `00:00`, and the latest is `23:59`. Return _the latest 24-h...
null
Math,Dynamic Programming,Breadth-First Search,Graph,Memoization,Game Theory
Hard
1727
987
hey everybody this is Larry this is me doing cube four of day four of the legal day challenge hit the like button hit the Subscribe button join my Discord let me know what you think about this poem this day before hope you liked the intro uh it took me a long hike to kind of get there but uh but yeah it was fun uh and ...
Vertical Order Traversal of a Binary Tree
reveal-cards-in-increasing-order
Given the `root` of a binary tree, calculate the **vertical order traversal** of the binary tree. For each node at position `(row, col)`, its left and right children will be at positions `(row + 1, col - 1)` and `(row + 1, col + 1)` respectively. The root of the tree is at `(0, 0)`. The **vertical order traversal** o...
null
Array,Queue,Sorting,Simulation
Medium
null
459
hey everybody this is Larry this is me doing day 21st 21 of the code daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's part and we got a easy one so yay uh good because I'm a little bit tired I uh played a lot of softball today and went as much as I...
Repeated Substring Pattern
repeated-substring-pattern
Given a string `s`, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. **Example 1:** **Input:** s = "abab " **Output:** true **Explanation:** It is the substring "ab " twice. **Example 2:** **Input:** s = "aba " **Output:** false **Example 3:** ...
null
String,String Matching
Easy
28,686
872
hey yo what's up my little coders let me show you in this tutorial how to solve the lead called question 872. leave some more trees basically we are given two binary trees and the only thing about which we hear is the binary trees leaves so we need to return true if the leaf values of these two binary trees are the sam...
Leaf-Similar Trees
split-array-into-fibonacci-sequence
Consider all the leaves of a binary tree, from left to right order, the values of those leaves form a **leaf value sequence**_._ For example, in the given tree above, the leaf value sequence is `(6, 7, 4, 9, 8)`. Two binary trees are considered _leaf-similar_ if their leaf value sequence is the same. Return `true` i...
null
String,Backtracking
Medium
306,1013
894
hey what's up guys this is Chung here and so today let's talk about another like a tree and recursion problem here it's called our possible for binary number 894 it's a classic medium problem I like this problem I'm gonna give it my own like here so what does this problem say alright let's say you're given a number so ...
All Possible Full Binary Trees
random-pick-with-blacklist
Given an integer `n`, return _a list of all possible **full binary trees** with_ `n` _nodes_. Each node of each tree in the answer must have `Node.val == 0`. Each element of the answer is the root node of one possible tree. You may return the final list of trees in **any order**. A **full binary tree** is a binary tr...
null
Hash Table,Math,Binary Search,Sorting,Randomized
Hard
398,912,2107
904
this is a classic problem to solve and certainly it is asked by a lot of tech companies what they generally do is they will try to play around with the words a lot try to make a whole story behind it but the underlying concept Remains the Same one such perfect example is fruit into baskets on lead code so let's see wha...
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
1,727
um hello so today we are going to do this daily challenge largest submatrix with rearrangement so the idea here is we have a submatrix of one and zeros and we want to get the largest submatrix where every element is one and what we are allowed to do here is reorder The Columns optimally um so we can change the order um...
Largest Submatrix With Rearrangements
cat-and-mouse-ii
You are given a binary matrix `matrix` of size `m x n`, and you are allowed to rearrange the **columns** of the `matrix` in any order. Return _the area of the largest submatrix within_ `matrix` _where **every** element of the submatrix is_ `1` _after reordering the columns optimally._ **Example 1:** **Input:** matri...
Try working backward: consider all trivial states you know to be winning or losing, and work backward to determine which other states can be labeled as winning or losing.
Math,Dynamic Programming,Breadth-First Search,Graph,Memoization,Game Theory
Hard
805,949
76
Hello hello everyone welcome defect in the flashlight to challenge and fast forward to wish you very happy independence day thursday morning mist subscribe different the independence day came bullet stories from agra in paris about journey of partition and difficult to grow and subscribe Video Subscribe To That Electro...
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
63
hello everyone in today's video we'll be tackling a legal problem called unique path 2. this is a classic problem that can be solved using dynamic programming and you may encounter the problem or its variations in interviews every now and then so you should fully understand the technique to solve this problem and be ab...
Unique Paths II
unique-paths-ii
You are given an `m x n` integer array `grid`. There is a robot initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time. An obstacle and space are marked as ...
The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be if obstacleGrid[i][j] is not an obstacle ...
Array,Dynamic Programming,Matrix
Medium
62,1022
816
welcome to mazelico challenge today's problem is ambiguous coordinates we had some two dimensional coordinates like one comma three or two comma 0.5 comma three or two comma 0.5 comma three or two comma 0.5 then we removed all commas decimal points and spaces and ended up with a string s return a list of strings repres...
Ambiguous Coordinates
design-hashset
We had some 2-dimensional coordinates, like `"(1, 3) "` or `"(2, 0.5) "`. Then, we removed all commas, decimal points, and spaces and ended up with the string s. * For example, `"(1, 3) "` becomes `s = "(13) "` and `"(2, 0.5) "` becomes `s = "(205) "`. Return _a list of strings representing all possibilities for wh...
null
Array,Hash Table,Linked List,Design,Hash Function
Easy
817,1337
97
hey everyone welcome back and let's write some more neat code today so today let's solve interleaving string so in this problem we're given a list of three strings well not really a list but we're given three strings s1 s2 and s3 and we just want to know a simple question can we form the string s3 by interleaving the s...
Interleaving String
interleaving-string
Given strings `s1`, `s2`, and `s3`, find whether `s3` is formed by an **interleaving** of `s1` and `s2`. An **interleaving** of two strings `s` and `t` is a configuration where `s` and `t` are divided into `n` and `m` substrings respectively, such that: * `s = s1 + s2 + ... + sn` * `t = t1 + t2 + ... + tm` * `|...
null
String,Dynamic Programming
Medium
null
1,848
all right so this question is minimum distance to Target element so giv integer array and Target value and the star value so what you need to do is you want to find the index I such that nums I equal to Target and absolute I minus star is minimized and return absolute I minus of star so um yeah so this question is actu...
Minimum Distance to the Target Element
sum-of-unique-elements
Given an integer array `nums` **(0-indexed)** and two integers `target` and `start`, find an index `i` such that `nums[i] == target` and `abs(i - start)` is **minimized**. Note that `abs(x)` is the absolute value of `x`. Return `abs(i - start)`. It is **guaranteed** that `target` exists in `nums`. **Example 1:** **...
Use a dictionary to count the frequency of each number.
Array,Hash Table,Counting
Easy
null
953
hello everyone welcome to the channel today's question is verifying an alien dictionary if you are new to this channel please consider subscribing we sold a lot of intrusion on this channel and that can definitely help you with your interview the question says we Argan with words and order and we need to return true if...
Verifying an Alien Dictionary
reverse-only-letters
In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different `order`. The `order` of the alphabet is some permutation of lowercase letters. Given a sequence of `words` written in the alien language, and the `order` of the alphabet, return `true` if and only if the given `wor...
This problem is exactly like reversing a normal string except that there are certain characters that we have to simply skip. That should be easy enough to do if you know how to reverse a string using the two-pointer approach.
Two Pointers,String
Easy
null
1,817
hello everyone welcome to another video now in this video we are going to look at another arrays medium level question now this question it is about arrays it is in the arrays tag but it is more of a hashmap hash site kind of question okay now without wasting any time let's jump into the question what it says and then ...
Finding the Users Active Minutes
calculate-money-in-leetcode-bank
You are given the logs for users' actions on LeetCode, and an integer `k`. The logs are represented by a 2D integer array `logs` where each `logs[i] = [IDi, timei]` indicates that the user with `IDi` performed an action at the minute `timei`. **Multiple users** can perform actions simultaneously, and a single user can...
Simulate the process by keeping track of how much money John is putting in and which day of the week it is, and use this information to deduce how much money John will put in the next day.
Math
Easy
null
138
hey everyone this is this site hope you're doing well so let's start with the question so the question is copy list with random pointer okay so again a linked list question so you're given a linked list of length n is given such that each node contains an additional random pointer okay so there is an additional random ...
Copy List with Random Pointer
copy-list-with-random-pointer
A linked list of length `n` is given such that each node contains an additional random pointer, which could point to any node in the list, or `null`. Construct a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) of the list. The deep copy should consist of exactly `n` **brand new** nodes, where e...
Just iterate the linked list and create copies of the nodes on the go. Since a node can be referenced from multiple nodes due to the random pointers, make sure you are not making multiple copies of the same node. You may want to use extra space to keep old node ---> new node mapping to prevent creating multiples copies...
Hash Table,Linked List
Medium
133,1624,1634
69
hey everyone today we'll be doing another League core 69 square root X in this problem we will be just finding the square root of a given number but we cannot use any built-in number but we cannot use any built-in number but we cannot use any built-in functions uh that's it straightforward problem but if you encounter ...
Sqrt(x)
sqrtx
Given a non-negative integer `x`, return _the square root of_ `x` _rounded down to the nearest integer_. The returned integer should be **non-negative** as well. You **must not use** any built-in exponent function or operator. * For example, do not use `pow(x, 0.5)` in c++ or `x ** 0.5` in python. **Example 1:** ...
Try exploring all integers. (Credits: @annujoshi) Use the sorted property of integers to reduced the search space. (Credits: @annujoshi)
Math,Binary Search
Easy
50,367
516
hey there and welcome to another B code video So today we're going to be doing uh problem number 516 longest palindromic subsequence and we are saying find the longest pound dromic substance subsequence in the word we have and the difference between this and a substring so let me show you real quick here let's just do ...
Longest Palindromic Subsequence
longest-palindromic-subsequence
Given a string `s`, find _the longest palindromic **subsequence**'s length in_ `s`. A **subsequence** is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. **Example 1:** **Input:** s = "bbbab " **Output:** 4 **Explanation:** On...
null
String,Dynamic Programming
Medium
5,647,730,1250,1822,1897,2130
67
hey guys let's take a look at this easy 167 ad battery we're given two binary strings like 1 we need to return the Sun also binary string the string both non empty and contains only captures 1 was 0 so this well this just a similar as the previous question we did it's 66 please take a look at there which means we only ...
Add Binary
add-binary
Given two binary strings `a` and `b`, return _their sum as a binary string_. **Example 1:** **Input:** a = "11", b = "1" **Output:** "100" **Example 2:** **Input:** a = "1010", b = "1011" **Output:** "10101" **Constraints:** * `1 <= a.length, b.length <= 104` * `a` and `b` consist only of `'0'` or `'1'` chara...
null
Math,String,Bit Manipulation,Simulation
Easy
2,43,66,1031
1,781
so lead care 1781 sum of beauty of all sub strings so the beauty of a string is the difference between the most frequent character and the least frequent characters counts so for example the beauty of this is three because you have three a's minus one because you only have one b which is the least frequent character an...
Sum of Beauty of All Substrings
check-if-two-string-arrays-are-equivalent
The **beauty** of a string is the difference in frequencies between the most frequent and least frequent characters. * For example, the beauty of `"abaacc "` is `3 - 1 = 2`. Given a string `s`, return _the sum of **beauty** of all of its substrings._ **Example 1:** **Input:** s = "aabcb " **Output:** 5 **Explana...
Concatenate all strings in the first array into a single string in the given order, the same for the second array. Both arrays represent the same string if and only if the generated strings are the same.
Array,String
Easy
2184
42
hello everyone welcome back to algorithms simplified today we are going over leak code number 42 trapping rainwater first let's go over the question itself so in the description of leak code this is what it says given n non-negative integers representing an non-negative integers representing an non-negative integers re...
Trapping Rain Water
trapping-rain-water
Given `n` non-negative integers representing an elevation map where the width of each bar is `1`, compute how much water it can trap after raining. **Example 1:** **Input:** height = \[0,1,0,2,1,0,1,3,2,1,2,1\] **Output:** 6 **Explanation:** The above elevation map (black section) is represented by array \[0,1,0,2,1,...
null
Array,Two Pointers,Dynamic Programming,Stack,Monotonic Stack
Hard
11,238,407,756
338
foreign and we've returned an array of ants of length n plus one such that for each eye from 0 to n and of I is the number of ones in the binary representation of n so we're given this example with the input as n equals two so basically we have to find the number of ones for every number starting from zero all the way ...
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
417
hey everyone today we are going to solve the question Pacific Atlantic water flow so this is a very long description so let me summarize it so we get a 2d metrix so we can think this metrix as a island and there is a Pacific Ocean and Atlantic Ocean and the island receives a lot of rain so you can think each number is ...
Pacific Atlantic Water Flow
pacific-atlantic-water-flow
There is an `m x n` rectangular island that borders both the **Pacific Ocean** and **Atlantic Ocean**. The **Pacific Ocean** touches the island's left and top edges, and the **Atlantic Ocean** touches the island's right and bottom edges. The island is partitioned into a grid of square cells. You are given an `m x n` i...
null
Array,Depth-First Search,Breadth-First Search,Matrix
Medium
null
24
lead call Fortune 24 swap notes in pairs give a linked list swap every two adjacent nodes and return its head you must solve the problem without modifying the values in the list node that is only nodes themselves may be changed in this first example there are two pairs the first pair and the second pair so in this case...
Swap Nodes in Pairs
swap-nodes-in-pairs
Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.) **Example 1:** **Input:** head = \[1,2,3,4\] **Output:** \[2,1,4,3\] **Example 2:** **Input:** head = \[\] **Output:** \[\...
null
Linked List,Recursion
Medium
25,528
213
hey everyone today we're going to be doing another Elite code problem 213 house dropper 2. so let's read this problem your professional router planning throughout houses along the street each house has a certain amount of money stashed all houses displays a range in a circle let's pull open okay and that means the firs...
House Robber II
house-robber-ii
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are **arranged in a circle.** That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have a security system connected, and **it will automatical...
Since House[1] and House[n] are adjacent, they cannot be robbed together. Therefore, the problem becomes to rob either House[1]-House[n-1] or House[2]-House[n], depending on which choice offers more money. Now the problem has degenerated to the House Robber, which is already been solved.
Array,Dynamic Programming
Medium
198,256,276,337,600,656
1,206
and this one we're gonna be looking at the link uh skip list which is probably number one two zero six it's specified as a hard one i would tend to agree it's kind of hard especially if you have not seen any data structure like that so read the problem it's essentially saying of log n for searching with inside the link...
Design Skiplist
corporate-flight-bookings
Design a **Skiplist** without using any built-in libraries. A **skiplist** is a data structure that takes `O(log(n))` time to add, erase and search. Comparing with treap and red-black tree which has the same function and performance, the code length of Skiplist can be comparatively short and the idea behind Skiplists ...
null
Array,Prefix Sum
Medium
null
637
hey everybody this is larry this is me in a new city as you can tell maybe all these new hotels so technically it doesn't have to be new city but uh yeah uh i'm in the city of entire in turkey so yeah i think i have a drone video but it's just been very tiring so i don't know we'll see uh hit the like button hit the su...
Average of Levels in Binary Tree
average-of-levels-in-binary-tree
Given the `root` of a binary tree, return _the average value of the nodes on each level in the form of an array_. Answers within `10-5` of the actual answer will be accepted. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** \[3.00000,14.50000,11.00000\] Explanation: The average value of nodes on...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
102,107
732
cool 7:32 my candid we implement a my cool 7:32 my candid we implement a my cool 7:32 my candid we implement a my calendar 3 class to story events a new event can always be asked I always be added your class with one method book starring an end for my discipline set represents a booking on the half open interval start ...
My Calendar III
my-calendar-iii
A `k`\-booking happens when `k` events have some non-empty intersection (i.e., there is some time that is common to all `k` events.) You are given some events `[startTime, endTime)`, after each given event, return an integer `k` representing the maximum `k`\-booking between all the previous events. Implement the `MyC...
Treat each interval [start, end) as two events "start" and "end", and process them in sorted order.
Design,Segment Tree,Ordered Set
Hard
729,731
86
hello everyone welcome back here is bananas and today we are diving into Political daily challenge number 86 partition list and we are doing it in go or go link so linked list might sound uh hard but trust me once you get the hang of it they are super fun and immersed and Powerful especially in go where everything just...
Partition List
partition-list
Given the `head` of a linked list and a value `x`, partition it such that all nodes **less than** `x` come before nodes **greater than or equal** to `x`. You should **preserve** the original relative order of the nodes in each of the two partitions. **Example 1:** **Input:** head = \[1,4,3,2,5,2\], x = 3 **Output:**...
null
Linked List,Two Pointers
Medium
2265
1,071
Oops, let's start another exercise here for the 1071, right, in this exercise here, two Strings will be passed to us and we will have to return a shelf that divides the two splines, right, it's explained here, right, it has to be divisible, right, in this case, there the ST will be able to divide S if s was equal to t ...
Greatest Common Divisor of Strings
binary-prefix-divisible-by-5
For two strings `s` and `t`, we say "`t` divides `s` " if and only if `s = t + ... + t` (i.e., `t` is concatenated with itself one or more times). Given two strings `str1` and `str2`, return _the largest string_ `x` _such that_ `x` _divides both_ `str1` _and_ `str2`. **Example 1:** **Input:** str1 = "ABCABC ", str2...
If X is the first i digits of the array as a binary number, then 2X + A[i] is the first i+1 digits.
Array
Easy
null
6
I come hello everyone start students problem call teacher planning limit problem in this and half 100 twists and turns blushing egg white from the slow pace of this video a little teacher relief subscribe for quality thank you want to from bottom cross subscribe now to receive New Updates Reviews and Does One Basically...
Zigzag Conversion
zigzag-conversion
The string `"PAYPALISHIRING "` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: `"PAHNAPLSIIGYIR "` Write the code that will take a string and make this co...
null
String
Medium
null
1,780
hi everyone welcome back to lead coding i'm your host faraz so in this video we'll be looking at the second question of lead code by weekly contest 42 now in this question we are given a number and we have to tell whether this number can be represented as a submission of unique powers of three now first of all i though...
Check if Number is a Sum of Powers of Three
lowest-common-ancestor-of-a-binary-tree-ii
Given an integer `n`, return `true` _if it is possible to represent_ `n` _as the sum of distinct powers of three._ Otherwise, return `false`. An integer `y` is a power of three if there exists an integer `x` such that `y == 3x`. **Example 1:** **Input:** n = 12 **Output:** true **Explanation:** 12 = 31 + 32 **Examp...
Traverse the graph visiting root, left, root, right, root to make an Euler Path Return the node (LCA) that is at the lowest depth between p and q in the Euler Path
Tree,Depth-First Search,Binary Tree
Medium
235,236,1790,1816
118
Hello friends, welcome to the new video, question number 118 is in the robbery, the name is Paas Kar Triangle, it is a question of level, it is a race question, let's see once, what is Paas Kar Triangle, what is called Paas Kar Triangle, there are number of roses in Paas Kar Triangle and You will see that the first ele...
Pascal's Triangle
pascals-triangle
Given an integer `numRows`, return the first numRows of **Pascal's triangle**. In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown: **Example 1:** **Input:** numRows = 5 **Output:** \[\[1\],\[1,1\],\[1,2,1\],\[1,3,3,1\],\[1,4,6,4,1\]\] **Example 2:** **Input:** numRows = ...
null
Array,Dynamic Programming
Easy
119
147
Hello hello guys welcome koi gautam miding obscene subscribe Thursday subscribe Video subscribe the instructions for telling jhatak praise subscribe to ko uttar pal phase loop fluid subscribe nayyaan kids pe loot subscribe point to point loot your birthday old Person Floor 800th Urs To Do Subscribe My Channel Are Appoi...
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
910
hey guys welcome back to another video and today we're going to be solving the leak code question smallest range 2. all right so in this question we're given an area of integers a okay so for each integer a i we need to choose either x equals negative k or x equals k and add that x value to a i and we're only going to ...
Smallest Range II
nth-magical-number
You are given an integer array `nums` and an integer `k`. For each index `i` where `0 <= i < nums.length`, change `nums[i]` to be either `nums[i] + k` or `nums[i] - k`. The **score** of `nums` is the difference between the maximum and minimum elements in `nums`. Return _the minimum **score** of_ `nums` _after changi...
null
Math,Binary Search
Hard
null
326
Hello Everyone Laddu Solve Question No. 326 Power of Trade Today To Give Shape In This Question Were Given And Interior For Example Shesh 9n Vs To Determine Weather Its Power Of Tree Not To Not Considered To Power 2012 Similarly Saffron Represents Power Will Return Force Okay So Let's see circular solution for this pro...
Power of Three
power-of-three
Given an integer `n`, return _`true` if it is a power of three. Otherwise, return `false`_. An integer `n` is a power of three, if there exists an integer `x` such that `n == 3x`. **Example 1:** **Input:** n = 27 **Output:** true **Explanation:** 27 = 33 **Example 2:** **Input:** n = 0 **Output:** false **Explanat...
null
Math,Recursion
Easy
231,342,1889
642
hey guys we are going to discuss a hard problem and this problem is basically an application of tries so the problem is known as design search autocomplete system the description of this problem is quite long i'm not going to go through all of this but i will explain you the main problem we can read the first few parag...
Design Search Autocomplete System
design-search-autocomplete-system
Design a search autocomplete system for a search engine. Users may input a sentence (at least one word and end with a special character `'#'`). You are given a string array `sentences` and an integer array `times` both of length `n` where `sentences[i]` is a previously typed sentence and `times[i]` is the correspondin...
null
String,Design,Trie,Data Stream
Hard
208
1,698
very special to make that Jan and also not with the thing I screen the web both on the day before the leak chill the trip first be the tree sees the folding bike graphing yes malic acid and the number of the stinks and confused Marcus is vinkt substrings in clothing and piece of spring is your blubber the program sing ...
Number of Distinct Substrings in a String
replace-all-s-to-avoid-consecutive-repeating-characters
Given a string `s`, return _the number of **distinct** substrings of_ `s`. A **substring** of a string is obtained by deleting any number of characters (possibly zero) from the front of the string and any number (possibly zero) from the back of the string. **Example 1:** **Input:** s = "aabbaba " **Output:** 21 **E...
Processing string from left to right, whenever you get a ‘?’, check left character and right character, and select a character not equal to either of them Do take care to compare with replaced occurrence of ‘?’ when checking the left character.
String
Easy
null
80
hello today we'll be solving the problem number 80 of Lee code remove duplicates from sorted array to give it an integer array nums sorted in increasing order remove some duplicates in place such that each unique element appears at most twice the relative order of the elements should be kept the same since it is imposs...
Remove Duplicates from Sorted Array II
remove-duplicates-from-sorted-array-ii
Given an integer array `nums` sorted in **non-decreasing order**, remove some duplicates [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm) such that each unique element appears **at most twice**. The **relative order** of the elements should be kept the **same**. Since it is impossible to change the len...
null
Array,Two Pointers
Medium
26
69
in this video we'll be going over square root of x given a non-negative integer x root of x given a non-negative integer x root of x given a non-negative integer x compute and return the square root of x since the return type is integer the decimal digits are truncated and only the integer part of the result is returne...
Sqrt(x)
sqrtx
Given a non-negative integer `x`, return _the square root of_ `x` _rounded down to the nearest integer_. The returned integer should be **non-negative** as well. You **must not use** any built-in exponent function or operator. * For example, do not use `pow(x, 0.5)` in c++ or `x ** 0.5` in python. **Example 1:** ...
Try exploring all integers. (Credits: @annujoshi) Use the sorted property of integers to reduced the search space. (Credits: @annujoshi)
Math,Binary Search
Easy
50,367
237
hello there so today's legal challenge question is called a delete node in a linked list so we have a singly linked list and we have access to a node that we want to do a deletion we need to you know write a function to perform this operation so as an example we have a linked list for five one nine we've been given a p...
Delete Node in a Linked List
delete-node-in-a-linked-list
There is a singly-linked list `head` and we want to delete a node `node` in it. You are given the node to be deleted `node`. You will **not be given access** to the first node of `head`. All the values of the linked list are **unique**, and it is guaranteed that the given node `node` is not the last node in the linke...
null
Linked List
Easy
203
39
everyone in this video we will be solving a lead called medium level problem number 39 combination sum the problem statement is we are given an area of distinct integer candidates and a target integer target we need to return all the unique combinations of the candidates where the total of all of the numbers is equal t...
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
221
hello friends now that solves a maximum square problem as I expand this problem as a comparison and the maximum rectangle problem and you see before given to the binary matrix filled with zeros and ones find the largest square containing only ones and returnees area so what's the difference between the maximum Square a...
Maximal Square
maximal-square
Given an `m x n` binary `matrix` filled with `0`'s and `1`'s, _find the largest square 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 "\]\] **Output:*...
null
Array,Dynamic Programming,Matrix
Medium
85,769,1312,2200
674
all right so this is 674 and it's called longest continuous increasing subsequence so it's an easy level question i would say it's a very easy question and here we're given a nums array along with an output that we need to return which is an integer and what we want to do is we want to iterate through this array and ju...
Longest Continuous Increasing Subsequence
longest-continuous-increasing-subsequence
Given an unsorted array of integers `nums`, return _the length of the longest **continuous increasing subsequence** (i.e. subarray)_. The subsequence must be **strictly** increasing. A **continuous increasing subsequence** is defined by two indices `l` and `r` (`l < r`) such that it is `[nums[l], nums[l + 1], ..., num...
null
Array
Easy
673,727
443
hey everybody this is Larry I hit the like button hit the subscribe button let me know how you're doing this farm I'm gonna stop alive right about now 4:43 gonna stop alive right about now 4:43 gonna stop alive right about now 4:43 strain compression given in a way of strings compress it in place that's always a little...
String Compression
string-compression
Given an array of characters `chars`, compress it using the following algorithm: Begin with an empty string `s`. For each group of **consecutive repeating characters** in `chars`: * If the group's length is `1`, append the character to `s`. * Otherwise, append the character followed by the group's length. The co...
How do you know if you are at the end of a consecutive group of characters?
Two Pointers,String
Medium
38,271,604,1241
1,048
hi guys welcome to algorithms made easy my name is khushpu and in this video we'll see the question longest string chain given a list of words each word consists of english lowercase letter let's say word1 is a predecessor of word two if and only if we can add exactly one letter anywhere in word one to make it equal to...
Longest String Chain
clumsy-factorial
You are given an array of `words` where each word consists of lowercase English letters. `wordA` is a **predecessor** of `wordB` if and only if we can insert **exactly one** letter anywhere in `wordA` **without changing the order of the other characters** to make it equal to `wordB`. * For example, `"abc "` is a **...
null
Math,Stack,Simulation
Medium
null
480
in this video we're going to take a look at a legal problem called sliding window median so median is basically the middle value in an order integer list so the size of the list is even then there's no uh middle value so we gotta have to find the average of the two middle value so here you can see we have an example of...
Sliding Window Median
sliding-window-median
The **median** is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle values. * For examples, if `arr = [2,3,4]`, the median is `3`. * For examples, if `arr = [1,2,3,4]`, the median is `(2 + 3) / 2 = 2.5`. You are give...
The simplest of solutions comes from the basic idea of finding the median given a set of numbers. We know that by definition, a median is the center element (or an average of the two center elements). Given an unsorted list of numbers, how do we find the median element? If you know the answer to this question, can we e...
Array,Hash Table,Sliding Window,Heap (Priority Queue)
Hard
295
520
hey guys welcome back to another video and today we're going to be solving the lead code question detect capital uh so i just want to mention two things before i get started so first i don't have a premium membership so i won't be able to solve these questions and second uh if there are any specific lead code questions...
Detect Capital
detect-capital
We define the usage of capitals in a word to be right when one of the following cases holds: * All letters in this word are capitals, like `"USA "`. * All letters in this word are not capitals, like `"leetcode "`. * Only the first letter in this word is capital, like `"Google "`. Given a string `word`, return `...
null
String
Easy
2235
1,304
hello so today we are doing problems for this contest weekly contest 169 the first problem is find and unique integers that sum up to 0 and so the problem says if we have an integer N and we want to return any array containing and unique integers such that they are such that these integers add up to 0 and so for exampl...
Find N Unique Integers Sum up to Zero
longest-happy-string
Given an integer `n`, return **any** array containing `n` **unique** integers such that they add up to `0`. **Example 1:** **Input:** n = 5 **Output:** \[-7,-1,1,3,4\] **Explanation:** These arrays also are accepted \[-5,-1,1,2,3\] , \[-3,-1,2,-2,4\]. **Example 2:** **Input:** n = 3 **Output:** \[-1,0,1\] **Exampl...
Use a greedy approach. Use the letter with the maximum current limit that can be added without breaking the condition.
String,Greedy,Heap (Priority Queue)
Medium
778
674
yes it is or how to be going this video I'm going to take a look at six seven for an easy one longest continuous increasing subsequent given an unsorted array I also did array of integers find the length of longest continuous increasing subsequence sub array so 1 3 5 4 7 the longest would be 1 3 4 or 1 3 5 so get 3 wel...
Longest Continuous Increasing Subsequence
longest-continuous-increasing-subsequence
Given an unsorted array of integers `nums`, return _the length of the longest **continuous increasing subsequence** (i.e. subarray)_. The subsequence must be **strictly** increasing. A **continuous increasing subsequence** is defined by two indices `l` and `r` (`l < r`) such that it is `[nums[l], nums[l + 1], ..., num...
null
Array
Easy
673,727
935
hello hi guys welcome back I hope that you guys are doing good and problem night dialers and again in this video we're going to see all three approaches to solve this problem and we'll code also simultaneously we'll modify the existing codes itself please make sure that you look onto all the approaches and how we progr...
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
463
hello everyone so today's question is from july lead coding challenge day 7 and it's called island perimeter we have a 2d matrix or a grid of zeros and ones zero represents water and one represents land grid cells are connected horizontally and vertically not diagonally so from any given cell you can only go up down ri...
Island Perimeter
island-perimeter
You are given `row x col` `grid` representing a map where `grid[i][j] = 1` represents land and `grid[i][j] = 0` represents water. Grid cells are connected **horizontally/vertically** (not diagonally). The `grid` is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells)...
null
Array,Depth-First Search,Breadth-First Search,Matrix
Easy
695,733,1104