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 |
|---|---|---|---|---|---|---|---|---|
149 | so today we're going to be going over our max points while I initially I thought this problem was kind of easy but we can start with the definition given endpoints on a 2d plane find the maximum number of points that lie on the same straight line like I said initially I thought this problem was sort of easy and the the... | 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 |
289 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem game of life so as you can see this problem is quite an essay so i'm going to try to break it down simple just using this below example drawing so we're given an n by m grid and each position of the grid is either gonna... | Game of Life | game-of-life | According to [Wikipedia's article](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life): "The **Game of Life**, also known simply as **Life**, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. "
The board is made up of an `m x n` grid of cells, where each cell has an initial st... | null | Array,Matrix,Simulation | Medium | 73 |
1,094 | Main college absolutely channel ko d sunny and today am going clear the like problem telescope change bnd do it is the problem ne pragya ok shop yes quality solve this problem 333 likes 75 wrong and software police mistake is the prevention quality connect birth details like Is now when the routine the time of this 150... | Car Pooling | matrix-cells-in-distance-order | There is a car with `capacity` empty seats. The vehicle only drives east (i.e., it cannot turn around and drive west).
You are given the integer `capacity` and an array `trips` where `trips[i] = [numPassengersi, fromi, toi]` indicates that the `ith` trip has `numPassengersi` passengers and the locations to pick them u... | null | Array,Math,Geometry,Sorting,Matrix | Easy | 2304 |
2,000 | To Ajay that if this was made then I have a question reverse fix of world to question come give that index trim world and academicians f-16 is given academicians f-16 is given academicians f-16 is given end character in word is given reverse the secret of world day get started 10 and set IT INDEX OF THE FOREST OFFICER ... | Reverse Prefix of Word | minimum-speed-to-arrive-on-time | Given a **0-indexed** string `word` and a character `ch`, **reverse** the segment of `word` that starts at index `0` and ends at the index of the **first occurrence** of `ch` (**inclusive**). If the character `ch` does not exist in `word`, do nothing.
* For example, if `word = "abcdefd "` and `ch = "d "`, then you s... | Given the speed the trains are traveling at, can you find the total time it takes for you to arrive? Is there a cutoff where any speeds larger will always allow you to arrive on time? | Array,Binary Search | Medium | 1335,2013,2294 |
254 | all right so are we back hopefully so let me see here welcome hello so here we are um let's go ahead and keep solving some problems um this time around factor combinations let's see if we can solve this one a little faster the last problem i spent about an hour on let's even go faster let's see how fast we do how quick... | Factor Combinations | factor-combinations | Numbers can be regarded as the product of their factors.
* For example, `8 = 2 x 2 x 2 = 2 x 4`.
Given an integer `n`, return _all possible combinations of its factors_. You may return the answer in **any order**.
**Note** that the factors should be in the range `[2, n - 1]`.
**Example 1:**
**Input:** n = 1
**Ou... | null | Array,Backtracking | Medium | 39 |
545 | guys welcome back right this is horus right here and we just cracked one of the questions that i failed numerous times lead code 545 boundary of binary tree right i've seen this question for the first time it was definitely a couple of months ago it was i think it was even earlier than that was back in you know i think... | Boundary of Binary Tree | boundary-of-binary-tree | The **boundary** of a binary tree is the concatenation of the **root**, the **left boundary**, the **leaves** ordered from left-to-right, and the **reverse order** of the **right boundary**.
The **left boundary** is the set of nodes defined by the following:
* The root node's left child is in the left boundary. If ... | null | Tree,Depth-First Search,Binary Tree | Medium | 199 |
752 | That a Hello Everyone Welcome to Taste Voter List Challenge and Asked Questions Open the Lock in These Questions Were Giving Unlock the Train List from Wishes Staff and Jewels in Both Directions from November 1999 That All Should They Give in Few States of the Will You Can't Movie On Date Of The Free Riders Tube School... | Open the Lock | ip-to-cidr | You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: `'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'`. The wheels can rotate freely and wrap around: for example we can turn `'9'` to be `'0'`, or `'0'` to be `'9'`. Each move consists of turning one wheel one slot.
The lock initially starts... | Convert the ip addresses to and from (long) integers. You want to know what is the most addresses you can put in this block starting from the "start" ip, up to n. It is the smallest between the lowest bit of start and the highest bit of n. Then, repeat this process with a new start and n. | String,Bit Manipulation | Medium | 93,468 |
766 | hey what's up guys John here again so today let's take a look at another lead called the problem number 766 top please matrix and a matrix is top please if every diagonal from top left to bottom right has the same element all right so for example this one 1 right 1 2 3 5 and yeah this is select pretty straight okay I'm... | Toeplitz Matrix | flatten-a-multilevel-doubly-linked-list | Given an `m x n` `matrix`, return _`true` if the matrix is Toeplitz. Otherwise, return `false`._
A matrix is **Toeplitz** if every diagonal from top-left to bottom-right has the same elements.
**Example 1:**
**Input:** matrix = \[\[1,2,3,4\],\[5,1,2,3\],\[9,5,1,2\]\]
**Output:** true
**Explanation:**
In the above gr... | null | Linked List,Depth-First Search,Doubly-Linked List | Medium | 114,1796 |
95 | hi everyone in today's challenge we are going to solve this problem the problem in unique binary search tree part 2 and the problem number is nine five all right guys so first of all what we are going to do we are going to clearly understand the problem statement after understanding the problem statement then we will m... | Unique Binary Search Trees II | unique-binary-search-trees-ii | Given an integer `n`, return _all the structurally unique **BST'**s (binary search trees), which has exactly_ `n` _nodes of unique values from_ `1` _to_ `n`. Return the answer in **any order**.
**Example 1:**
**Input:** n = 3
**Output:** \[\[1,null,2,null,3\],\[1,null,3,2\],\[2,1,3\],\[3,1,null,null,2\],\[3,2,null,1\... | null | Dynamic Programming,Backtracking,Tree,Binary Search Tree,Binary Tree | Medium | 96,241 |
162 | hi let's talk about find peak element so find peak elements question is pretty straightforward so uh the pick element is the greatest in array and you are going to use the login method so when you see the login right you are not going to traverse every single element in the array so you need a middle value um like bina... | Find Peak Element | find-peak-element | A peak element is an element that is strictly greater than its neighbors.
Given a **0-indexed** integer array `nums`, find a peak element, and return its index. If the array contains multiple peaks, return the index to **any of the peaks**.
You may imagine that `nums[-1] = nums[n] = -∞`. In other words, an element is... | null | Array,Binary Search | Medium | 882,2047,2273,2316 |
1,685 | So hello everyone, so today we are going to solve today's PTD whose name is Sum of Absolute Difference in Sorted Array. Okay, so let's first understand what the question is. Without understanding the question, we will not be able to solve it further. Better first understand what it is saying, we have given the name 'In... | Sum of Absolute Differences in a Sorted Array | stone-game-v | You are given an integer array `nums` sorted in **non-decreasing** order.
Build and return _an integer array_ `result` _with the same length as_ `nums` _such that_ `result[i]` _is equal to the **summation of absolute differences** between_ `nums[i]` _and all the other elements in the array._
In other words, `result[i... | We need to try all possible divisions for the current row to get the max score. As calculating all possible divisions will lead us to calculate some sub-problems more than once, we need to think of dynamic programming. | Array,Math,Dynamic Programming,Game Theory | Hard | 909,1240,1522,1617,1788,1808,2002,2156 |
1,764 | hello everyone let's solve this problem today so it's uh something like a string match since it's the second problem in context and the test cases are not that long so we don't need to use some complicated algorithm like mp we can just use brute force like pattern match algorithm so this is problem we want to match eac... | Form Array by Concatenating Subarrays of Another Array | maximum-repeating-substring | You are given a 2D integer array `groups` of length `n`. You are also given an integer array `nums`.
You are asked if you can choose `n` **disjoint** subarrays from the array `nums` such that the `ith` subarray is equal to `groups[i]` (**0-indexed**), and if `i > 0`, the `(i-1)th` subarray appears **before** the `ith`... | The constraints are low enough for a brute force approach. Try every k value from 0 upwards until word is no longer k-repeating. | String,String Matching | Easy | 1689 |
27 | hey what's up guys Nick white here I detect the coding stuff on Twitch in YouTube first problem of the day so we're warming up with an easy one I check the description for all my information I do patreon I do premium Lee code on patreon and I have a discord remove element is what we're doing today and it is very easy a... | Remove Element | remove-element | Given an integer array `nums` and an integer `val`, remove all occurrences of `val` in `nums` [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm). The order of the elements may be changed. Then return _the number of elements in_ `nums` _which are not equal to_ `val`.
Consider the number of elements in `nu... | The problem statement clearly asks us to modify the array in-place and it also says that the element beyond the new length of the array can be anything. Given an element, we need to remove all the occurrences of it from the array. We don't technically need to remove that element per-say, right? We can move all the occu... | Array,Two Pointers | Easy | 26,203,283 |
1,004 | hello so today we are doing this problem called max consecutive ones three it's a medium problem and the problem says that we have an array of zeros and ones and we can change up to K values from 0 to 1 and we want to return the length of the longest consecutive sub array that contains only ones here and so if we look ... | Max Consecutive Ones III | least-operators-to-express-number | Given a binary array `nums` and an integer `k`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most_ `k` `0`'s.
**Example 1:**
**Input:** nums = \[1,1,1,0,0,0,1,1,1,1,0\], k = 2
**Output:** 6
**Explanation:** \[1,1,1,0,0,**1**,1,1,1,1,**1**\]
Bolded numbers were flipped from 0 to 1.... | null | Math,Dynamic Programming | Hard | null |
423 | hello everyone this is the lead code problem reconstruct original digits from english given a non-empty string containing an given a non-empty string containing an given a non-empty string containing an out of order english representation of digits from 0 to 9 output the digits in ascending order input contains only lo... | 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 |
27 | hi guys welcome back to another video in this video we will be looking at another lead code problem named as remove element the problem statement is as follows given an array nums and a value val remove all instances of that value in place and return the new length do not allocate extra space for another array you must... | Remove Element | remove-element | Given an integer array `nums` and an integer `val`, remove all occurrences of `val` in `nums` [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm). The order of the elements may be changed. Then return _the number of elements in_ `nums` _which are not equal to_ `val`.
Consider the number of elements in `nu... | The problem statement clearly asks us to modify the array in-place and it also says that the element beyond the new length of the array can be anything. Given an element, we need to remove all the occurrences of it from the array. We don't technically need to remove that element per-say, right? We can move all the occu... | Array,Two Pointers | Easy | 26,203,283 |
1,319 | hey guys welcome back to the channel this is today's video we are going to continue our graph placement bootcamp playlist right uh so as promised i am providing you videos every day this month so do don't forget to subscribe to my channel that will help you to put more and more of such videos right so in today's video ... | Number of Operations to Make Network Connected | unique-number-of-occurrences | There are `n` computers numbered from `0` to `n - 1` connected by ethernet cables `connections` forming a network where `connections[i] = [ai, bi]` represents a connection between computers `ai` and `bi`. Any computer can reach any other computer directly or indirectly through the network.
You are given an initial com... | Find the number of occurrences of each element in the array using a hash map. Iterate through the hash map and check if there is a repeated value. | Array,Hash Table | Easy | null |
518 | in today's video well this isn't really today's video because I actually recorded this whole video I got deleted off my hard drive accidentally and now I'm actually in a huge pain because I have to reteach this but we are going to do the total unique ways to make change problem so what is this question asking us it is ... | Coin Change II | coin-change-2 | You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money.
Return _the number of combinations that make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `0`.
You may assume that yo... | null | Array,Dynamic Programming | Medium | 1393 |
1,473 | hey guys this is jason how's everything going in today's video i'm going to take a look at the 1473 painthouse 3. actually i did this in today's live contest but i didn't make it i tried to backtrack backtracking solution and it cost too much time and of course i met tle and it actually worked but it's very complicated... | Paint House III | find-the-longest-substring-containing-vowels-in-even-counts | There is a row of `m` houses in a small city, each house must be painted with one of the `n` colors (labeled from `1` to `n`), some houses that have been painted last summer should not be painted again.
A neighborhood is a maximal group of continuous houses that are painted with the same color.
* For example: `hous... | Represent the counts (odd or even) of vowels with a bitmask. Precompute the prefix xor for the bitmask of vowels and then get the longest valid substring. | Hash Table,String,Bit Manipulation,Prefix Sum | Medium | null |
142 | hey everyone welcome to Tech wide in this video we are going to solve problem number 142 linked list cycle 2. first we will see the explanational problem statement then the logic and the code now let's dive into the solution so here I've taken the first example from the liquid website so we need to find the node that i... | Linked List Cycle II | linked-list-cycle-ii | Given the `head` of a linked list, return _the node where the cycle begins. If there is no cycle, return_ `null`.
There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that ta... | null | Hash Table,Linked List,Two Pointers | Medium | 141,287 |
77 | Hello hi guys welcome will roll question combination not to do is that you have box and item identical okay so you know how you can take that before you have that identical item how many ways are there NCR ways. Okay, earlier you had seen from these items inbox from this and from the nomadic item like this, click on hi... | Combinations | combinations | Given two integers `n` and `k`, return _all possible combinations of_ `k` _numbers chosen from the range_ `[1, n]`.
You may return the answer in **any order**.
**Example 1:**
**Input:** n = 4, k = 2
**Output:** \[\[1,2\],\[1,3\],\[1,4\],\[2,3\],\[2,4\],\[3,4\]\]
**Explanation:** There are 4 choose 2 = 6 total combin... | null | Backtracking | Medium | 39,46 |
401 | so today we would be solving lead code question number 401 that is binary watch and what the question says is that uh we are given with uh timings that is turned on time and this is a binary watch so the hours in it is in the power of two to the power 0 to the power 1 to the power 2 to the power 3 similarly uh these wo... | Binary Watch | binary-watch | A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent the minutes (0-59). Each LED represents a zero or one, with the least significant bit on the right.
* For example, the below binary watch reads `"4:51 "`.
Given an integer `turnedOn` which represents the number... | Simplify by seeking for solutions that involve comparing bit counts. Consider calculating all possible times for comparison purposes. | Backtracking,Bit Manipulation | Easy | 17,191 |
775 | welcome to april's lego challenge today's problem is global and local inversions we have some permutation a of zero one through n minus one where n is the length of a so basically we have a permutation of numbers between zero to n minus one it's going to be reordered in some way but each one of these numbers are going ... | Global and Local Inversions | n-ary-tree-preorder-traversal | You are given an integer array `nums` of length `n` which represents a permutation of all the integers in the range `[0, n - 1]`.
The number of **global inversions** is the number of the different pairs `(i, j)` where:
* `0 <= i < j < n`
* `nums[i] > nums[j]`
The number of **local inversions** is the number of i... | null | Stack,Tree,Depth-First Search | Easy | 144,764,776 |
347 | hey everyone welcome back and let's write some more neat code today so today let's solve top k frequent elements i really like this problem because it's pretty clever and once you figure it out the code is really easy to write so we're given an input array nums and an integer k and we want to return the k most frequent... | Top K Frequent Elements | top-k-frequent-elements | Given an integer array `nums` and an integer `k`, return _the_ `k` _most frequent elements_. You may return the answer in **any order**.
**Example 1:**
**Input:** nums = \[1,1,1,2,2,3\], k = 2
**Output:** \[1,2\]
**Example 2:**
**Input:** nums = \[1\], k = 1
**Output:** \[1\]
**Constraints:**
* `1 <= nums.lengt... | null | Array,Hash Table,Divide and Conquer,Sorting,Heap (Priority Queue),Bucket Sort,Counting,Quickselect | Medium | 192,215,451,659,692,1014,1919 |
73 | in the spirit of learning continuously sometimes you will encounter problems that do not test your coding skills primarily it does not matter how well do you know data structures or how good of a code you can write sometimes it is just about the logic you are taking and how are you solving a problem that means we are t... | Set Matrix Zeroes | set-matrix-zeroes | Given an `m x n` integer matrix `matrix`, if an element is `0`, set its entire row and column to `0`'s.
You must do it [in place](https://en.wikipedia.org/wiki/In-place_algorithm).
**Example 1:**
**Input:** matrix = \[\[1,1,1\],\[1,0,1\],\[1,1,1\]\]
**Output:** \[\[1,0,1\],\[0,0,0\],\[1,0,1\]\]
**Example 2:**
**In... | If any cell of the matrix has a zero we can record its row and column number using additional memory.
But if you don't want to use extra memory then you can manipulate the array instead. i.e. simulating exactly what the question says. Setting cell values to zero on the fly while iterating might lead to discrepancies. ... | Array,Hash Table,Matrix | Medium | 289,2244,2259,2314 |
422 | hey everybody this is Larry this is me doing uh the first weekly premium challenge of the uh after March weekly code there I don't know whatever we're doing this Farm uh let me know what you think uh oh man I don't even know what I'm saying anymore hit the like button hit the Subscribe button join me on this card let m... | Valid Word Square | valid-word-square | Given an array of strings `words`, return `true` _if it forms a valid **word square**_.
A sequence of strings forms a valid **word square** if the `kth` row and column read the same string, where `0 <= k < max(numRows, numColumns)`.
**Example 1:**
**Input:** words = \[ "abcd ", "bnrt ", "crmy ", "dtye "\]
**Output:*... | null | Array,Matrix | Easy | 425,777 |
1,224 | hello friends today i'm going to talk about leader code 1224 maximum equal frequency the problem is that given an array numbers of positive integers return the longest possible index of an array prefix of nums the condition is that you are allowed to remove exactly one element from the prefix array so that every elemen... | Maximum Equal Frequency | minimum-falling-path-sum-ii | Given an array `nums` of positive integers, return the longest possible length of an array prefix of `nums`, such that it is possible to remove **exactly one** element from this prefix so that every number that has appeared in it will have the same number of occurrences.
If after removing one element there are no rema... | Use dynamic programming. Let dp[i][j] be the answer for the first i rows such that column j is chosen from row i. Use the concept of cumulative array to optimize the complexity of the solution. | Array,Dynamic Programming,Matrix | Hard | 967 |
1,048 | welcome to mazelico challenge today's problem is longest string chain given a list of words each word consists of english lowercase letters now let's say word one is a predecessor of word two if and only if we can add exactly one letter anywhere in word one to make equal to word two so for example abc is a predecessor ... | 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 |
341 | hello everyone welcome to our channel code with sunny and today i am going to discuss the problem flatten nested list iterator index number is 341 and the problem is of medium type of late code okay so let's discuss the problem now we have been given a nested list of integers nested list as its name each element is eit... | Flatten Nested List Iterator | flatten-nested-list-iterator | You are given a nested list of integers `nestedList`. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an iterator to flatten it.
Implement the `NestedIterator` class:
* `NestedIterator(List nestedList)` Initializes the iterator with the nested list `nestedLi... | null | Stack,Tree,Depth-First Search,Design,Queue,Iterator | Medium | 251,281,385,565 |
515 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem find largest value in each tree row so just like the problem says given a binary tree here for every single row we want to find the maximum element in that row and as you can see in the first row we just have a single v... | Find Largest Value in Each Tree Row | find-largest-value-in-each-tree-row | Given the `root` of a binary tree, return _an array of the largest value in each row_ of the tree **(0-indexed)**.
**Example 1:**
**Input:** root = \[1,3,2,5,3,null,9\]
**Output:** \[1,3,9\]
**Example 2:**
**Input:** root = \[1,2,3\]
**Output:** \[1,3\]
**Constraints:**
* The number of nodes in the tree will be... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
485 | Hello Everyone Welcome To That Point Sub Electronic Subscribe And Subscribe The Amazing Must Subscribe Play List Ronit Roy Example Jo Hair Din Ko Different Awal Maximum subscribe and subscribe this Video Subscribe Padh Subscribe Now Subscribe To I Want Their Embarrassing Squashed Interview Will Be Treated S Subscribe T... | Max Consecutive Ones | max-consecutive-ones | Given a binary array `nums`, return _the maximum number of consecutive_ `1`_'s in the array_.
**Example 1:**
**Input:** nums = \[1,1,0,1,1,1\]
**Output:** 3
**Explanation:** The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s is 3.
**Example 2:**
**Input:** nums = ... | You need to think about two things as far as any window is concerned. One is the starting point for the window. How do you detect that a new window of 1s has started? The next part is detecting the ending point for this window.
How do you detect the ending point for an existing window? If you figure these two things... | Array | Easy | 487,1046,1542,1999 |
131 | hey everyone welcome to Tech quiet in this video we are going to see lead code problem number 131 palindrome partitioning we are going to solve this problem using backtracking I am going to use the first example to solve this so now let's dive into the solution and logic so guys please like And subscribe and this will ... | Palindrome Partitioning | palindrome-partitioning | Given a string `s`, partition `s` such that every substring of the partition is a **palindrome**. Return _all possible palindrome partitioning of_ `s`.
**Example 1:**
**Input:** s = "aab"
**Output:** \[\["a","a","b"\],\["aa","b"\]\]
**Example 2:**
**Input:** s = "a"
**Output:** \[\["a"\]\]
**Constraints:**
* `1... | null | String,Dynamic Programming,Backtracking | Medium | 132,1871 |
1,027 | hello everyone welcome back here's van damson and today we are going uh to tackle very interesting problem from lead code longest arithmetic subsequence so it's a medium difficulty problem uh and it might be quite trickier to understand and solve it efficiently uh but uh we will dive to the solution right away so let's... | Longest Arithmetic Subsequence | sum-of-even-numbers-after-queries | Given an array `nums` of integers, return _the length of the longest arithmetic subsequence in_ `nums`.
**Note** that:
* A **subsequence** is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.
* A sequence `seq` is arithmetic if `s... | null | Array,Simulation | Medium | null |
1,933 | dream is decomposable into value equal substrings yeah let me first try to explain it so we are giving us a dream so for the consecutive characters so for example 0 it is the three and 1 one it is the three but when need to meet one condition that is yeah we need to have ADD yeah we need to have exact exactly one subst... | Check if String Is Decomposable Into Value-Equal Substrings | number-of-different-integers-in-a-string | A **value-equal** string is a string where **all** characters are the same.
* For example, `"1111 "` and `"33 "` are value-equal strings.
* In contrast, `"123 "` is not a value-equal string.
Given a digit string `s`, decompose the string into some number of **consecutive value-equal** substrings where **exactly o... | Try to split the string so that each integer is in a different string. Try to remove each integer's leading zeroes and compare the strings to find how many of them are unique. | Hash Table,String | Easy | null |
1,192 | so let's talk about it code 1192 critical connections in the network so first let's draw a example network we have node one connects to node two connects to node and node 1 connects to node 3. and we have another node 0 that is only connected to node 3. so in this network the critical path is the edge that's connecting... | 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 |
546 | move out this okay given several bouts of different colors represented by different positive numbers you may experience several rounds to remove thousands of no boxes there if she was time you care and choose some container box in the same color combos with Kaiba right okay go then we moved him and got K times kick oka... | Remove Boxes | remove-boxes | You are given several `boxes` with different colors represented by different positive numbers.
You may experience several rounds to remove boxes until there is no box left. Each time you can choose some continuous boxes with the same color (i.e., composed of `k` boxes, `k >= 1`), remove them and get `k * k` points.
R... | null | Array,Dynamic Programming,Memoization | Hard | 664,2247 |
828 | today let's talk about question a28 count unique characters of all substrates of a given string let's define let's look at the function first let's define a function count unique characters that returns number of unique characters on s for example calling count unique charts if s is lead code then lt cod are the unique... | Count Unique Characters of All Substrings of a Given String | chalkboard-xor-game | Let's define a function `countUniqueChars(s)` that returns the number of unique characters on `s`.
* For example, calling `countUniqueChars(s)` if `s = "LEETCODE "` then `"L "`, `"T "`, `"C "`, `"O "`, `"D "` are the unique characters since they appear only once in `s`, therefore `countUniqueChars(s) = 5`.
Given a ... | null | Array,Math,Bit Manipulation,Brainteaser,Game Theory | Hard | null |
787 | Hello friends, how are you all? Hope you all will be fine. So today we have a question of cheapest flight with stop in Hindi. This is a medium level question of lead code and it is a very good question. In this question, we all have written as much as we can in our graph. There is an algorithm, we can do all the algori... | 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 |
946 | hi guys welcome to algorithms made easy in this video we will see the question validate stack sequences given two sequences pushed and popped with distinct values return true if and only if this could have been the result of a sequence of pusher pop operations on the initially empty stack so in the example one we are g... | Validate Stack Sequences | smallest-range-ii | Given two integer arrays `pushed` and `popped` each with distinct values, return `true` _if this could have been the result of a sequence of push and pop operations on an initially empty stack, or_ `false` _otherwise._
**Example 1:**
**Input:** pushed = \[1,2,3,4,5\], popped = \[4,5,3,2,1\]
**Output:** true
**Explana... | null | Array,Math,Greedy,Sorting | Medium | null |
1,727 | hello hi guys sub I hope that you guys are doing in problem largest submatrix with rearrangement and we going to see three follow-ups as in we going to see three follow-ups as in we going to see three follow-ups as in two more follow-ups with the actual two more follow-ups with the actual two more follow-ups with the a... | 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 |
92 | hey everyone welcome back and we'll be doing another lead code problem 92 reverse link list 2 we have already done reverse link list one this is the medium one given the add of the singly link list and two integers left and right so rever the left two right nodes and where left should be less than right so we are given... | 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,049 | all right let's talk about last one weight two so you're given the array of integer of sums so if the two stones are equal they are going to be destroyed if they are not equal uh you want to generate a new stone which is going to be y minus x weight for the stone right and you have to return the smallest possible weigh... | Last Stone Weight II | minimum-domino-rotations-for-equal-row | 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 any two stones and smash them together. Suppose the stones have weights `x` and `y` with `x <= y`. The result of this smash is:
* If `x == y`, both stones ar... | null | Array,Greedy | Medium | null |
390 | now is coding tech today we are doing legal question 390 elimination game in this question we are given a list of elements 1 2 3 all the way until n we first eliminate every other element from left to right and then we eliminate every other element from right to left i will keep repeating this left to right and then ri... | Elimination Game | elimination-game | You have a list `arr` of all integers in the range `[1, n]` sorted in a strictly increasing order. Apply the following algorithm on `arr`:
* Starting from left to right, remove the first number and every other number afterward until you reach the end of the list.
* Repeat the previous step again, but this time fro... | null | Math | Medium | null |
1,203 | Hello friends welcome to code Sutra in this video we'll be solving lead code problem number one two zero three sort items by groups respecting dependencies and one of the prerequisites of this problem is that we know topological sort and in this video I have explained topological sort in depth and at the end of the vid... | Sort Items by Groups Respecting Dependencies | print-in-order | There are `n` items each belonging to zero or one of `m` groups where `group[i]` is the group that the `i`\-th item belongs to and it's equal to `-1` if the `i`\-th item belongs to no group. The items and the groups are zero indexed. A group can have no item belonging to it.
Return a sorted list of the items such that... | null | Concurrency | Easy | 1187 |
897 | um hello so today we are doing this sleek code challenge part of uh late good april lady challenge um so the problem says that we get a binary search tree we get the root of it and we want to rearrange it in order where the leftmost node becomes the root of the tree and every node should have no loved child and only on... | 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 |
143 | Hello everyone welcome to this technique in this video we are covering a problem statement reorder list in this question we have given a single linked list and what we have to return look like our linked list is like this, we have explained in such a way that our linked list That's the first note in L zero L1 is my sec... | Reorder List | reorder-list | You are given the head of a singly linked-list. The list can be represented as:
L0 -> L1 -> ... -> Ln - 1 -> Ln
_Reorder the list to be on the following form:_
L0 -> Ln -> L1 -> Ln - 1 -> L2 -> Ln - 2 -> ...
You may not modify the values in the list's nodes. Only nodes themselves may be changed.
**Example 1:**
**... | null | Linked List,Two Pointers,Stack,Recursion | Medium | 2216 |
1,716 | hey everybody this is larry this is q1 of the recent weekly bi-weekly contest recent weekly bi-weekly contest recent weekly bi-weekly contest uh calculate money in the lead code bank so this is a simulation problem you just follow department uh and pretty much that's it so we're gonna go over the code real quick becaus... | Calculate Money in Leetcode Bank | maximum-non-negative-product-in-a-matrix | Hercy wants to save money for his first car. He puts money in the Leetcode bank **every day**.
He starts by putting in `$1` on Monday, the first day. Every day from Tuesday to Sunday, he will put in `$1` more than the day before. On every subsequent Monday, he will put in `$1` more than the **previous Monday**.
Given... | Use Dynamic programming. Keep the highest value and lowest value you can achieve up to a point. | Array,Dynamic Programming,Matrix | Medium | null |
91 | hey guys how higher is everything going I hope you are doing well I'm safe please stay at home stay healthy let's take a look at number 91 decode ways a message containing letters from A to Z is being coded to numbers using the index a is 1 B is 2 that is 26 and we're given a non empty string containing only digits det... | Decode Ways | decode-ways | A message containing letters from `A-Z` can be **encoded** into numbers using the following mapping:
'A' -> "1 "
'B' -> "2 "
...
'Z' -> "26 "
To **decode** an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For examp... | null | String,Dynamic Programming | Medium | 639,2091 |
3 | so today i'm going to show you the best way to solve this problem in lead code this is longest substring without repeating characters so basically we have a soft string like this i count a b c i find a here it means that we have a repeating character and then it means that the longest so far is this and then we can now... | 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 |
443 | 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 string compression so in this question we given a character array called Cs and we need to compress it using the following algorithm so we have to begin with the empty string s for each group of consecu... | 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 |
854 | in 1854 of Egypt site macri similar links passion is what this problem is about is that they are going to give us two strings and for example these two and we have to see how much is the minimum amount of suárez that we have to give to get to one string to the other because it is here we only have to invest see and sea... | K-Similar Strings | making-a-large-island | Strings `s1` and `s2` are `k`**\-similar** (for some non-negative integer `k`) if we can swap the positions of two letters in `s1` exactly `k` times so that the resulting string equals `s2`.
Given two anagrams `s1` and `s2`, return the smallest `k` for which `s1` and `s2` are `k`**\-similar**.
**Example 1:**
**Input... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Hard | null |
303 | what's up everyone today we're gonna be going over leaked code 303 some range query and this is pretty much a kind of a design problem but they'll give you a integer or no index is I and J between this area and they want to know what the sum is between that of course it's super simple if you do kind of like a brute-for... | Range Sum Query - Immutable | range-sum-query-immutable | Given an integer array `nums`, handle multiple queries of the following type:
1. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`.
Implement the `NumArray` class:
* `NumArray(int[] nums)` Initializes the object with the integer array `nums`.
* ... | null | Array,Design,Prefix Sum | Easy | 304,307,325 |
43 | hi guys let's do the multiple strings problem lead code 43 and it's kind of a i would say slightly more complicated version of lead code 415 i guess which was add strings and the idea is that you're doing all this addition or multiplication and all that without converting these strings into numbers or integers by calli... | Multiply Strings | multiply-strings | Given two non-negative integers `num1` and `num2` represented as strings, return the product of `num1` and `num2`, also represented as a string.
**Note:** You must not use any built-in BigInteger library or convert the inputs to integer directly.
**Example 1:**
**Input:** num1 = "2", num2 = "3"
**Output:** "6"
**Ex... | null | Math,String,Simulation | Medium | 2,66,67,415 |
623 | welcome to march's lego challenge today's problem is add one row to tree given the root of a binary tree then value v and depth d you need to add a row of nodes with value v at the given depth d the root node is at depth one now the adding rule is given a positive integer depth d for each not null tree nodes in depth d... | Add One Row to Tree | add-one-row-to-tree | Given the `root` of a binary tree and two integers `val` and `depth`, add a row of nodes with value `val` at the given depth `depth`.
Note that the `root` node is at depth `1`.
The adding rule is:
* Given the integer `depth`, for each not null tree node `cur` at the depth `depth - 1`, create two tree nodes with va... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
142 | hi everyone today we are going to solve the leaderboard question link to this circle too so a few months ago I actually I solved the linked list Circle one so I put the link in the description below so today so you are given a head of a link to this return the node where the circle begins if there's no Circle or return... | Linked List Cycle II | linked-list-cycle-ii | Given the `head` of a linked list, return _the node where the cycle begins. If there is no cycle, return_ `null`.
There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that ta... | null | Hash Table,Linked List,Two Pointers | Medium | 141,287 |
1,010 | Hello Scientific Forces Subscribe My Channel Subscribe subscribe and subscribe the Channel Please subscribe and Subscribe Provident Fund Civil Lines Repair Will Be Created with Live More than 150 Shares Subscribe and Must Subscribe Now to Subscribe fluid This page is directly looted Subscribe The Channel Please subscri... | Pairs of Songs With Total Durations Divisible by 60 | powerful-integers | You are given a list of songs where the `ith` song has a duration of `time[i]` seconds.
Return _the number of pairs of songs for which their total duration in seconds is divisible by_ `60`. Formally, we want the number of indices `i`, `j` such that `i < j` with `(time[i] + time[j]) % 60 == 0`.
**Example 1:**
**Input... | null | Hash Table,Math | Medium | null |
931 | Hi gas welcome and welcome back to my channel today we are going to discuss date d problem is minimum falling parts we so in this problem will be given a matrix and see we have to return d minimum sum of other falling path through matrix what is the Following path Falling path starts other element in d first row so it ... | Minimum Falling Path Sum | maximum-frequency-stack | Given an `n x n` array of integers `matrix`, return _the **minimum sum** of any **falling path** through_ `matrix`.
A **falling path** starts at any element in the first row and chooses the element in the next row that is either directly below or diagonally left/right. Specifically, the next element from position `(ro... | null | Hash Table,Stack,Design,Ordered Set | Hard | null |
231 | hey welcome to this video we're going to be doing Leko prom 231 power of two so give it an integer write a function to determine if a if it is a power of two so one is a power of two because two to the power of zero is equal to one so it's 16 right because you do 2 to the power of 4 you get 16 back but there's no way y... | Power of Two | power-of-two | Given an integer `n`, return _`true` if it is a power of two. Otherwise, return `false`_.
An integer `n` is a power of two, if there exists an integer `x` such that `n == 2x`.
**Example 1:**
**Input:** n = 1
**Output:** true
**Explanation:** 20 = 1
**Example 2:**
**Input:** n = 16
**Output:** true
**Explanation:**... | null | Math,Bit Manipulation,Recursion | Easy | 191,326,342 |
384 | hey everybody this is larry this is me going with day 20 of the july lego day challenge hit the like button to subscribe and join me on discord let me know what you think about today's prom i am in l.a right now so things are a i am in l.a right now so things are a i am in l.a right now so things are a little bit messy... | Shuffle an Array | shuffle-an-array | Given an integer array `nums`, design an algorithm to randomly shuffle the array. All permutations of the array should be **equally likely** as a result of the shuffling.
Implement the `Solution` class:
* `Solution(int[] nums)` Initializes the object with the integer array `nums`.
* `int[] reset()` Resets the arr... | The solution expects that we always use the original array to shuffle() else some of the test cases fail. (Credits; @snehasingh31) | Array,Math,Randomized | Medium | null |
155 | hi friends welcome back today we are going to solve one amazon facebook coding interview question it's only code 155 mean stack so as you can see from live dislike ratio this is very likable problem and quite important problem also if you are preparing for any coding rounds of interviews so make sure you watch this vid... | 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 |
920 | Every Number of Music Playlist Name of the Problem What's in it We have been given a music player and different songs and what we have to do is we are getting bored so during a trick what is our goal that we have to Have to listen to songs If we see what is given to us in the first question that N is your free, G is al... | Number of Music Playlists | uncommon-words-from-two-sentences | Your music player contains `n` different songs. You want to listen to `goal` songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that:
* Every song is played **at least once**.
* A song can only be played again only if `k` other songs have been played.
Given `n`, `g... | null | Hash Table,String | Easy | 2190 |
230 | hello everyone in this video we are going to solve a lead code problem number 230 which is about 0.03 so the number 230 which is about 0.03 so the number 230 which is about 0.03 so the problem is we are giving the row the root of a binary search tree and an integer K we should return the kth smallest value of all the v... | Kth Smallest Element in a BST | kth-smallest-element-in-a-bst | Given the `root` of a binary search tree, and an integer `k`, return _the_ `kth` _smallest value (**1-indexed**) of all the values of the nodes in the tree_.
**Example 1:**
**Input:** root = \[3,1,4,null,2\], k = 1
**Output:** 1
**Example 2:**
**Input:** root = \[5,3,6,2,4,null,null,1\], k = 3
**Output:** 3
**Cons... | Try to utilize the property of a BST. Try in-order traversal. (Credits to @chan13) What if you could modify the BST node's structure? The optimal runtime complexity is O(height of BST). | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | 94,671 |
458 | hey guys welcome back to another video and today we're going to be solving the leak good questions poor pics all right so i think this question is really interesting so let's just kind of see how we can solve it and before that let's see what the question actually is all right so we're given a thousand buckets and out ... | Poor Pigs | poor-pigs | There are `buckets` buckets of liquid, where **exactly one** of the buckets is poisonous. To figure out which one is poisonous, you feed some number of (poor) pigs the liquid to see whether they will die or not. Unfortunately, you only have `minutesToTest` minutes to determine which bucket is poisonous.
You can feed t... | What if you only have one shot? Eg. 4 buckets, 15 mins to die, and 15 mins to test. How many states can we generate with x pigs and T tests? Find minimum x such that (T+1)^x >= N | Math,Dynamic Programming,Combinatorics | Hard | null |
1,038 | hey how are you doing guys it's ilya bella here i recording stuff on youtube chat description for all my information i do all lit gold problems make sure you um subscribe to the channel give me a big thumbs up to support it and this is called binary search three to creator sum tree um given the root of binary search tr... | Binary Search Tree to Greater Sum Tree | number-of-squareful-arrays | Given the `root` of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus the sum of all keys greater than the original key in BST.
As a reminder, a _binary search tree_ is a tree that satisfies these constraints:
* The left subtree of a... | null | Array,Math,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask | Hard | 47 |
336 | Hello hello si need tu return word i + word a parent like every si need word i + word a parent like every si need word i + word a parent like every si need tu return so si need tu return such a condition can also happen then we will reduce one which If anyone checks, can give only one thing, then we will also take an i... | Palindrome Pairs | palindrome-pairs | You are given a **0-indexed** array of **unique** strings `words`.
A **palindrome pair** is a pair of integers `(i, j)` such that:
* `0 <= i, j < words.length`,
* `i != j`, and
* `words[i] + words[j]` (the concatenation of the two strings) is a palindrome.
Return _an array of all the **palindrome pairs** of_ `... | null | Array,Hash Table,String,Trie | Hard | 5,214,2237 |
278 | And here we are going to attempt question number 278 which is the first bed version, it is an easy level difficult question, India has a lot of downloads also, what is given in the question, it is given in the question that there is a product manager. You are running a company and you are leading a team which is develo... | First Bad Version | first-bad-version | You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.
Suppose you have `n` versions `[1, 2, ..., n]` an... | null | Binary Search,Interactive | Easy | 34,35,374 |
112 | So the name of the question is Path Sam, you will get this question number 112, I will add this question in the description in the link, you can go and solve it, so how has the path been defined in this question, which will start from the root and go to the leaf. It will end, okay, so this is our route which I am marki... | Path Sum | path-sum | Given the `root` of a binary tree and an integer `targetSum`, return `true` if the tree has a **root-to-leaf** path such that adding up all the values along the path equals `targetSum`.
A **leaf** is a node with no children.
**Example 1:**
**Input:** root = \[5,4,8,11,null,13,4,7,2,null,null,null,1\], targetSum = 22... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 113,124,129,437,666 |
409 | okay for nine longest palindrome give me a string which consists of lowercase up or uppercase letters find the length of the longest param that can be filled with it with these with those letters this is case sensitive for Cemil uppercase L okay days that concern param here assume the length of the given string will no... | Longest Palindrome | longest-palindrome | Given a string `s` which consists of lowercase or uppercase letters, return _the length of the **longest palindrome**_ that can be built with those letters.
Letters are **case sensitive**, for example, `"Aa "` is not considered a palindrome here.
**Example 1:**
**Input:** s = "abccccdd "
**Output:** 7
**Explanation... | null | Hash Table,String,Greedy | Easy | 266,2237 |
4 | Hello everyone I am Siddhesh Final Air CSC student Nagpur so in today's date we are going to talk about the next question which is Median of Tu Sorted are the official size so before this we have discussed all the problems mentioned above, you bill get. D link of d playlist in d description of d video you can and check... | Median of Two Sorted Arrays | median-of-two-sorted-arrays | Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays.
The overall run time complexity should be `O(log (m+n))`.
**Example 1:**
**Input:** nums1 = \[1,3\], nums2 = \[2\]
**Output:** 2.00000
**Explanation:** merged array = \[1,2,3\] and median is ... | null | Array,Binary Search,Divide and Conquer | Hard | null |
1,920 | the code 1920 build array from permutation in JavaScript this is a tricky question but it's not that hard once you understand it given a zero-based permutation nums given a zero-based permutation nums given a zero-based permutation nums right there it's already bad given an array nums build an array ands of the same le... | Build Array from Permutation | determine-color-of-a-chessboard-square | Given a **zero-based permutation** `nums` (**0-indexed**), build an array `ans` of the **same length** where `ans[i] = nums[nums[i]]` for each `0 <= i < nums.length` and return it.
A **zero-based permutation** `nums` is an array of **distinct** integers from `0` to `nums.length - 1` (**inclusive**).
**Example 1:**
*... | Convert the coordinates to (x, y) - that is, "a1" is (1, 1), "d7" is (4, 7). Try add the numbers together and look for a pattern. | Math,String | Easy | null |
328 | Sooner Length Mark I Plane More Children Dance *With Devgan Not Children Dance *With Devgan Not Children Dance *With Devgan Not Interesting Network Problem Special And De Villiers Software Going To Invest And What Is Subscribe Vidron It's Okay No Problem Yes-Yes Video Link Not Understand What You Can See Hidden Somethi... | 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 |
389 | hi all welcome to learn code repeat so today we will be looking at the day 24 of the september lead code challenge the name of the problem is find the difference let's look into the problem so the problem says given to string s and t which consists of any lower case shrink t is generated by randomly shuffling string s ... | Find the Difference | find-the-difference | You are given two strings `s` and `t`.
String `t` is generated by random shuffling string `s` and then add one more letter at a random position.
Return the letter that was added to `t`.
**Example 1:**
**Input:** s = "abcd ", t = "abcde "
**Output:** "e "
**Explanation:** 'e' is the letter that was added.
**Exam... | null | Hash Table,String,Bit Manipulation,Sorting | Easy | 136 |
10 | in this video I'm going to talk about a coding interview ocean in regular expression massing here is the problem statement given an input string edge and pattern P implement a regular expression massing with support dot and asterisk here dot means message any single character asterisk means massive zero or more of the ... | Regular Expression Matching | regular-expression-matching | Given an input string `s` and a pattern `p`, implement regular expression matching with support for `'.'` and `'*'` where:
* `'.'` Matches any single character.
* `'*'` Matches zero or more of the preceding element.
The matching should cover the **entire** input string (not partial).
**Example 1:**
**Input:... | null | String,Dynamic Programming,Recursion | Hard | 44 |
72 | you guys let's do this every second problem at least or add existing giving to work toward one and what to find the maximum minimum number that is why some words one to work to you'll have the Pollux we operate informative on a world in search of collectibility collector and replace a collector so you have to understan... | 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 |
1,814 | so hello everyone welcome to this new video and in this video i will be explaining the problem count nice pairs in an area so this problem is a little bit easier than medium um because the only difficult tricky part in this is to observe what is actually happening and then if once you get to know that what is happening... | Count Nice Pairs in an Array | jump-game-vi | You are given an array `nums` that consists of non-negative integers. Let us define `rev(x)` as the reverse of the non-negative integer `x`. For example, `rev(123) = 321`, and `rev(120) = 21`. A pair of indices `(i, j)` is **nice** if it satisfies all of the following conditions:
* `0 <= i < j < nums.length`
* `nu... | Let dp[i] be "the maximum score to reach the end starting at index i". The answer for dp[i] is nums[i] + max{dp[i+j]} for 1 <= j <= k. That gives an O(n*k) solution. Instead of checking every j for every i, keep track of the largest dp[i] values in a heap and calculate dp[i] from right to left. When the largest value i... | Array,Dynamic Programming,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue | Medium | 239,2001 |
1,947 | uh this question is maximum capability score sum so you can rest through it so whatever you got you know your student array um array should be the sest uh your Mentor or almost the same to get a higher score because you want to return maximum score right so I'm going to useing the example one and you should be St for e... | 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,851 | hey everyone welcome to my channel so in this video i'm going to try to solve this problem do some left coding work at the same time i'm going to try to follow the general interview steps while trying to solve this problem so let's get started so first of all we are going to try to go through this question and get a go... | Minimum Interval to Include Each Query | maximum-number-of-events-that-can-be-attended-ii | You are given a 2D integer array `intervals`, where `intervals[i] = [lefti, righti]` describes the `ith` interval starting at `lefti` and ending at `righti` **(inclusive)**. The **size** of an interval is defined as the number of integers it contains, or more formally `righti - lefti + 1`.
You are also given an intege... | Sort the events by its startTime. For every event, you can either choose it and consider the next event available, or you can ignore it. You can efficiently find the next event that is available using binary search. | Array,Binary Search,Dynamic Programming | Hard | 1478,2118,2164 |
7 | hello everyone welcome to code for placement in today's question we will see reverse integer so basically reverse integer is one of the easiest topic or the easiest question which we have but it is very straightforward not the easy one it is very straightforward uh the question is saying that uh from question itself we... | Reverse Integer | reverse-integer | Given a signed 32-bit integer `x`, return `x` _with its digits reversed_. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-231, 231 - 1]`, then return `0`.
**Assume the environment does not allow you to store 64-bit integers (signed or unsigned).**
**Example 1:**
**Input:** x = 123
... | null | Math | Medium | 8,190,2238 |
709 | Yes, do you need something like a bag from Kate? What is English and the Half of Turtles and reduce the world of work which reflects the winner is her Pretty Happy with Butter better about Everything and illustrates Rita food the wondrous rate of your way to the installed and lightweight please Channel to have in the m... | To Lower Case | to-lower-case | Given a string `s`, return _the string after replacing every uppercase letter with the same lowercase letter_.
**Example 1:**
**Input:** s = "Hello "
**Output:** "hello "
**Example 2:**
**Input:** s = "here "
**Output:** "here "
**Example 3:**
**Input:** s = "LOVELY "
**Output:** "lovely "
**Constraints:**... | null | null | Easy | null |
593 | hey guys welcome back to another video and today we're going to be solving the link of question ballot square all right so in this question we're given the coordinates of four points in a two dimensional space return whether the four points could construct a square all right so the coordinate x comma y of a point is re... | Valid Square | valid-square | Given the coordinates of four points in 2D space `p1`, `p2`, `p3` and `p4`, return `true` _if the four points construct a square_.
The coordinate of a point `pi` is represented as `[xi, yi]`. The input is **not** given in any order.
A **valid square** has four equal sides with positive length and four equal angles (9... | null | Math,Geometry | Medium | null |
436 | Hello hello everyone welcome to my channel it's all the net problem find right in trouble for giving us a topper interview for each of the interval i check is tej us jor start point is bigger than or equal to the point in the interval i which can we Call The Day Is The Right Interval Of High For Interview Neetu Story M... | Find Right Interval | find-right-interval | You are given an array of `intervals`, where `intervals[i] = [starti, endi]` and each `starti` is **unique**.
The **right interval** for an interval `i` is an interval `j` such that `startj >= endi` and `startj` is **minimized**. Note that `i` may equal `j`.
Return _an array of **right interval** indices for each int... | null | Array,Binary Search,Sorting | Medium | 352 |
373 | hey everybody this is Larry still in this pin so hit the like button hit the Subscribe button drop me on Discord let me know what you think about today's problem find Kate Paris with the smallest sums and it seems like I haven't done this before so that's kind of fun it's always nice to see a new problem all right so y... | Find K Pairs with Smallest Sums | find-k-pairs-with-smallest-sums | You are given two integer arrays `nums1` and `nums2` sorted in **ascending order** and an integer `k`.
Define a pair `(u, v)` which consists of one element from the first array and one element from the second array.
Return _the_ `k` _pairs_ `(u1, v1), (u2, v2), ..., (uk, vk)` _with the smallest sums_.
**Example 1:**... | null | Array,Heap (Priority Queue) | Medium | 378,719,2150 |
763 | foreign coding together my name is vikas hoja today we will see another lead code problem that is partition labels so it's a medium level question and it's a very popular question as you can see from the likes so let's read the problem statement you are given a string s we want to partition the string into as many part... | Partition Labels | special-binary-string | You are given a string `s`. We want to partition the string into as many parts as possible so that each letter appears in at most one part.
Note that the partition is done so that after concatenating all the parts in order, the resultant string should be `s`.
Return _a list of integers representing the size of these ... | Draw a line from (x, y) to (x+1, y+1) if we see a "1", else to (x+1, y-1).
A special substring is just a line that starts and ends at the same y-coordinate, and that is the lowest y-coordinate reached.
Call a mountain a special substring with no special prefixes - ie. only at the beginning and end is the lowest y-coo... | String,Recursion | Hard | 678 |
389 | hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you have not liked the video please like it subscribe to my channels and hit the bell icon so that you get notified when i post a new video so without any further ado let's get started so pr... | Find the Difference | find-the-difference | You are given two strings `s` and `t`.
String `t` is generated by random shuffling string `s` and then add one more letter at a random position.
Return the letter that was added to `t`.
**Example 1:**
**Input:** s = "abcd ", t = "abcde "
**Output:** "e "
**Explanation:** 'e' is the letter that was added.
**Exam... | null | Hash Table,String,Bit Manipulation,Sorting | Easy | 136 |
415 | all right guys welcome to our channel code with sunny and in this video i will be talking about the easy problem you can see over here the problem is basically we have to add two strings as the name suggests its index is four one five as i've already said it's an easy type problem okay so we'll be given two non-negativ... | Add Strings | add-strings | Given two non-negative integers, `num1` and `num2` represented as string, return _the sum of_ `num1` _and_ `num2` _as a string_.
You must solve the problem without using any built-in library for handling large integers (such as `BigInteger`). You must also not convert the inputs to integers directly.
**Example 1:**
... | null | Math,String,Simulation | Easy | 2,43,1031 |
719 | hey everybody this is Larry this is me doing extra bonus question on October 8 2022 I haven't done as many bonus questions as whatever I've been just uh not sleeping well to be honest I have some I don't know uh I'm working on it we'll see what happens but yeah that's the short story so yeah let's kind of do one proble... | Find K-th Smallest Pair Distance | find-k-th-smallest-pair-distance | The **distance of a pair** of integers `a` and `b` is defined as the absolute difference between `a` and `b`.
Given an integer array `nums` and an integer `k`, return _the_ `kth` _smallest **distance among all the pairs**_ `nums[i]` _and_ `nums[j]` _where_ `0 <= i < j < nums.length`.
**Example 1:**
**Input:** nums =... | Binary search for the answer. How can you check how many pairs have distance <= X? | Array,Two Pointers,Binary Search,Sorting | Hard | 373,378,658,668,802 |
856 | Ajay Ko Hello Hi Everyone Democratic Setup Coding This Video Pyaar James Ko Parents are going to solve this question let's see what is spraying barfi that the previous one pin is mixed add space only opening and closing date will be there and this trick is some This scoring has been completed according to Russia. You h... | Score of Parentheses | consecutive-numbers-sum | Given a balanced parentheses string `s`, return _the **score** of the string_.
The **score** of a balanced parentheses string is based on the following rule:
* `"() "` has score `1`.
* `AB` has score `A + B`, where `A` and `B` are balanced parentheses strings.
* `(A)` has score `2 * A`, where `A` is a balanced ... | null | Math,Enumeration | Hard | null |
1 | foreign hello everyone and welcome back to another video So today we're going to be solving the lead code question to some all right so in this question we're going to be given an array of integers called nums and an integer called Target the goal here is to return the indices of the two numbers such that they add up t... | Two Sum | two-sum | Given an array of integers `nums` and an integer `target`, return _indices of the two numbers such that they add up to `target`_.
You may assume that each input would have **_exactly_ one solution**, and you may not use the _same_ element twice.
You can return the answer in any order.
**Example 1:**
**Input:** nums... | A really brute force way would be to search for all possible pairs of numbers but that would be too slow. Again, it's best to try out brute force solutions for just for completeness. It is from these brute force solutions that you can come up with optimizations. So, if we fix one of the numbers, say x, we have to scan ... | Array,Hash Table | Easy | 15,18,167,170,560,653,1083,1798,1830,2116,2133,2320 |
509 | welcome back everyone we're gonna be solving leak out 509 Fibonacci number so the Fibonacci numbers commonly denoted F of n form a sequence called the Fibonacci sequence such that each number in the sum of the two preceding is the sum of the two preceding ones starting from zero to one so if we take a look at example o... | Fibonacci Number | inorder-successor-in-bst-ii | The **Fibonacci numbers**, commonly denoted `F(n)` form a sequence, called the **Fibonacci sequence**, such that each number is the sum of the two preceding ones, starting from `0` and `1`. That is,
F(0) = 0, F(1) = 1
F(n) = F(n - 1) + F(n - 2), for n > 1.
Given `n`, calculate `F(n)`.
**Example 1:**
**Input:** n = ... | null | Tree,Binary Search Tree,Binary Tree | Medium | 285 |
84 | the problem of finding the largest rectangle in histogram is a very interesting one given a list of integers denoting height of unit width bars in a histogram our objective is to find the area of largest rectangle formed in the histogram there are various solutions to this problem and while most of them have a quadrati... | Largest Rectangle in Histogram | largest-rectangle-in-histogram | Given an array of integers `heights` representing the histogram's bar height where the width of each bar is `1`, return _the area of the largest rectangle in the histogram_.
**Example 1:**
**Input:** heights = \[2,1,5,6,2,3\]
**Output:** 10
**Explanation:** The above is a histogram where width of each bar is 1.
The l... | null | Array,Stack,Monotonic Stack | Hard | 85,1918 |
2 | hello guys welcome to another video in the series of coding today we are going to do the problem which is called add two numbers so you are given two non-empty linked lists representing two non-empty linked lists representing two non-empty linked lists representing two negative integers the digits are stored in reverse... | Add Two Numbers | add-two-numbers | You are given two **non-empty** linked lists representing two non-negative integers. The digits are stored in **reverse order**, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 ... | null | Linked List,Math,Recursion | Medium | 43,67,371,415,445,1031,1774 |
692 | k frequency is given, then what do we have to return? We have to return the highest frequency of k. Okay, so in this particular case, the top two strings which have the highest frequency are to be returned. Okay, so if I If I look at this question, if I look at aa, what is the frequency of aa? If I look at this, how ma... | Top K Frequent Words | top-k-frequent-words | Given an array of strings `words` and an integer `k`, return _the_ `k` _most frequent strings_.
Return the answer **sorted** by **the frequency** from highest to lowest. Sort the words with the same frequency by their **lexicographical order**.
**Example 1:**
**Input:** words = \[ "i ", "love ", "leetcode ", "i ", "... | null | Hash Table,String,Trie,Sorting,Heap (Priority Queue),Bucket Sort,Counting | Medium | 347,1014,1919 |
901 | everyone welcome back and let's write some more neat code today so today let's solve the problem online stock span we're given a list of daily stock prices and we want to return the span of each of these stock prices now the span of a stock price is defined as being the maximum number of consecutive days starting from ... | Online Stock Span | advantage-shuffle | Design an algorithm that collects daily price quotes for some stock and returns **the span** of that stock's price for the current day.
The **span** of the stock's price in one day is the maximum number of consecutive days (starting from that day and going backward) for which the stock price was less than or equal to ... | null | Array,Greedy,Sorting | Medium | null |
73 | all right doing this problem called set Matrix zeros given an AM cross and integer Matrix if an element is 0 set its entire row and column to zeros you must do it in place that means you have to do it in O of 1 you can't take extra space and if any of the uh if any of the so for example here this is 0 that means the en... | Set Matrix Zeroes | set-matrix-zeroes | Given an `m x n` integer matrix `matrix`, if an element is `0`, set its entire row and column to `0`'s.
You must do it [in place](https://en.wikipedia.org/wiki/In-place_algorithm).
**Example 1:**
**Input:** matrix = \[\[1,1,1\],\[1,0,1\],\[1,1,1\]\]
**Output:** \[\[1,0,1\],\[0,0,0\],\[1,0,1\]\]
**Example 2:**
**In... | If any cell of the matrix has a zero we can record its row and column number using additional memory.
But if you don't want to use extra memory then you can manipulate the array instead. i.e. simulating exactly what the question says. Setting cell values to zero on the fly while iterating might lead to discrepancies. ... | Array,Hash Table,Matrix | Medium | 289,2244,2259,2314 |
1,334 | foreign welcome back to the channel so today in this video lecture we're going to be solving this problem find the city with the smallest number of Neighbors at a threshold distance which is a yet another problem which can be solved using test algorithm so basically in this problem we are given and cities numbered from... | Find the City With the Smallest Number of Neighbors at a Threshold Distance | find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance | There are `n` cities numbered from `0` to `n-1`. Given the array `edges` where `edges[i] = [fromi, toi, weighti]` represents a bidirectional and weighted edge between cities `fromi` and `toi`, and given the integer `distanceThreshold`.
Return the city with the smallest number of cities that are reachable through some ... | null | null | Medium | null |
895 | this is larry this is day 28 of the february leco daily challenge uh hit the like button hit the subscribe button join me on discord or twitch or whatever you like and let's go over today's prom uh maximum frequency stack uh and usually i solve these live so if it's a little bit slow fast forward or skip ahead whatever... | Maximum Frequency Stack | shortest-path-to-get-all-keys | Design a stack-like data structure to push elements to the stack and pop the most frequent element from the stack.
Implement the `FreqStack` class:
* `FreqStack()` constructs an empty frequency stack.
* `void push(int val)` pushes an integer `val` onto the top of the stack.
* `int pop()` removes and returns the... | null | Bit Manipulation,Breadth-First Search | Hard | null |
1,721 | Hello everyone welcome to my channel with mike so today you have given the code on your on ok so the name of the question is swapping notes in n link list ok so by giving input and output let us understand what is the question is very simple it is given in this That brother, I have given you a linked list, okay, I have... | Swapping Nodes in a Linked List | maximum-profit-of-operating-a-centennial-wheel | You are given the `head` of a linked list, and an integer `k`.
Return _the head of the linked list after **swapping** the values of the_ `kth` _node from the beginning and the_ `kth` _node from the end (the list is **1-indexed**)._
**Example 1:**
**Input:** head = \[1,2,3,4,5\], k = 2
**Output:** \[1,4,3,2,5\]
**Ex... | Think simulation Note that the number of turns will never be more than 50 / 4 * n | Array,Simulation | Medium | null |
1,260 | um hello so today we are going to do um the problem uh from latecode april challenge um april um 11. so the problem says we'll get a grid and of size m by n and then integer k and we need to shift the grid k times and here what they mean by shift operation is that uh grid i j moves to the next column so it moves to gri... | Shift 2D Grid | day-of-the-year | Given a 2D `grid` of size `m x n` and an integer `k`. You need to shift the `grid` `k` times.
In one shift operation:
* Element at `grid[i][j]` moves to `grid[i][j + 1]`.
* Element at `grid[i][n - 1]` moves to `grid[i + 1][0]`.
* Element at `grid[m - 1][n - 1]` moves to `grid[0][0]`.
Return the _2D grid_ after... | Have a integer array of how many days there are per month. February gets one extra day if its a leap year. Then, we can manually count the ordinal as day + (number of days in months before this one). | Math,String | Easy | null |
341 | hello guys let's all flatten nested let's titrator today so in this question we are given a nested list of integers called nested list where each element can either be an integer or a list itself and again the list can contain elements which are again integers or less and so on so in this question we basically need to ... | Flatten Nested List Iterator | flatten-nested-list-iterator | You are given a nested list of integers `nestedList`. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an iterator to flatten it.
Implement the `NestedIterator` class:
* `NestedIterator(List nestedList)` Initializes the iterator with the nested list `nestedLi... | null | Stack,Tree,Depth-First Search,Design,Queue,Iterator | Medium | 251,281,385,565 |
3 | foreign problem and the problem's name is longer substring without repeating characters in this question we are given a string s and we need to find the length of the longest substring without repeating characters so by definition a substring is a contiguous non-empty sequence of is a contiguous non-empty sequence of i... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.