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 |
|---|---|---|---|---|---|---|---|---|
867 | hello friends so today we are discuss this question from leet code problem number 867 transpose matrix in this question you are given a matrix as an input you have to find the transpose of matrix is actually the matrix which is clipped over its main diagonals or you can say is switching the rows and columns of the indi... | Transpose Matrix | new-21-game | Given a 2D integer array `matrix`, return _the **transpose** of_ `matrix`.
The **transpose** of a matrix is the matrix flipped over its main diagonal, switching the matrix's row and column indices.
**Example 1:**
**Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[\[1,4,7\],\[2,5,8\],\[3,6,9\]\]
**E... | null | Math,Dynamic Programming,Sliding Window,Probability and Statistics | Medium | null |
15 | hey everyone welcome to Tech wired in this video we are going to solve the problem number 15 threesome athlete code so in this problem we are going to uh find three triplets that sum to zero and those triplets should not be duplicate values okay so we will see the solution using the first example so this is the first e... | 3Sum | 3sum | Given an integer array nums, return all the triplets `[nums[i], nums[j], nums[k]]` such that `i != j`, `i != k`, and `j != k`, and `nums[i] + nums[j] + nums[k] == 0`.
Notice that the solution set must not contain duplicate triplets.
**Example 1:**
**Input:** nums = \[-1,0,1,2,-1,-4\]
**Output:** \[\[-1,-1,2\],\[-1,0... | So, we essentially need to find three numbers x, y, and z such that they add up to the given value. If we fix one of the numbers say x, we are left with the two-sum problem at hand! For the two-sum problem, if we fix one of the numbers, say x, we have to scan the entire array to find the next numbery which is value - x... | Array,Two Pointers,Sorting | Medium | 1,16,18,259 |
1,262 | hello everyone i hope you're having a great day uh today we're gonna go over the lead code problem greatest sum divisible by three including white boarding approaches and solutions greatest sum divisible by three is a dynamic programming problem with the little number theory sprinkled on top so hopefully you've attempt... | Greatest Sum Divisible by Three | online-majority-element-in-subarray | Given an integer array `nums`, return _the **maximum possible sum** of elements of the array such that it is divisible by three_.
**Example 1:**
**Input:** nums = \[3,6,5,1,8\]
**Output:** 18
**Explanation:** Pick numbers 3, 6, 1 and 8 their sum is 18 (maximum sum divisible by 3).
**Example 2:**
**Input:** nums = \... | What's special about a majority element ? A majority element appears more than half the length of the array number of times. If we tried a random index of the array, what's the probability that this index has a majority element ? It's more than 50% if that array has a majority element. Try a random index for a proper n... | Array,Binary Search,Design,Binary Indexed Tree,Segment Tree | Hard | null |
74 | Hello friends today I'm going to solve liquid problem number 74 search a 2d Matrix in this problem we are given an M by an integer Matrix and two properties each row is sorted in non-decreasing each row is sorted in non-decreasing each row is sorted in non-decreasing order and the first integer of each row is greater t... | Search a 2D Matrix | search-a-2d-matrix | You are given an `m x n` integer matrix `matrix` with the following two properties:
* Each row is sorted in non-decreasing order.
* The first integer of each row is greater than the last integer of the previous row.
Given an integer `target`, return `true` _if_ `target` _is in_ `matrix` _or_ `false` _otherwise_.
... | null | Array,Binary Search,Matrix | Medium | 240 |
3 | That's a hello hi guys welcome back to my video english video will get another date problem yes-yes long statement with fitting characters which yes-yes long statement with fitting characters which yes-yes long statement with fitting characters which states the given string find the length of the longest substring with... | 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 |
329 | welcome to my channel so in this video i'm going to cover the solution to this question and do some live coding at the same time i'm going to go through the general process in the real quick interview so before we start the real content for today i would really appreciate that if you can help subscribe this channel so ... | Longest Increasing Path in a Matrix | longest-increasing-path-in-a-matrix | Given an `m x n` integers `matrix`, return _the length of the longest increasing path in_ `matrix`.
From each cell, you can either move in four directions: left, right, up, or down. You **may not** move **diagonally** or move **outside the boundary** (i.e., wrap-around is not allowed).
**Example 1:**
**Input:** matr... | null | Dynamic Programming,Depth-First Search,Breadth-First Search,Graph,Topological Sort,Memoization | Hard | null |
7 | hi there to solve this challenge we're going to be using the ternary operator the module operator a while loop and the javascript global function parsing if any of these are unfamiliar to you please watch the cars that appear above during the video so if this sounds interesting to you let's do it all right you are stil... | 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 |
1,046 | foreign problem and the problem's name is last stone weight in this question we are given an integer array called Stones where each element in the array represents the weight of the stone so we perform a operation where we select the two heaviest stones in the available array and smash them together suppose if this two... | Last Stone Weight | max-consecutive-ones-iii | You are given an array of integers `stones` where `stones[i]` is the weight of the `ith` stone.
We are playing a game with the stones. On each turn, we choose the **heaviest two stones** and smash them together. Suppose the heaviest two stones have weights `x` and `y` with `x <= y`. The result of this smash is:
* I... | One thing's for sure, we will only flip a zero if it extends an existing window of 1s. Otherwise, there's no point in doing it, right? Think Sliding Window! Since we know this problem can be solved using the sliding window construct, we might as well focus in that direction for hints. Basically, in a given window, we c... | Array,Binary Search,Sliding Window,Prefix Sum | Medium | 340,424,485,487,2134 |
345 | hello everyone welcome back here is Vanessa today we are going to dive into a fun and interesting cutting challenge uh reverse vowels of a string so this is a fantastic problem for those of you uh who are trying to improve your string manipulation and pointer skill so let's get started our task is to reverse only the v... | Reverse Vowels of a String | reverse-vowels-of-a-string | Given a string `s`, reverse only all the vowels in the string and return it.
The vowels are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`, and they can appear in both lower and upper cases, more than once.
**Example 1:**
**Input:** s = "hello"
**Output:** "holle"
**Example 2:**
**Input:** s = "leetcode"
**Output:** "leotc... | null | Two Pointers,String | Easy | 344,1089 |
83 | hello everybody welcome to another video on problem solving so in this video we're going to take up another problem from lead code which is to remove duplicates from a sorted list so let's quickly go through the description once so it says we've been given the head of a sorted linked list and we need to delete all dupl... | Remove Duplicates from Sorted List | remove-duplicates-from-sorted-list | Given the `head` of a sorted linked list, _delete all duplicates such that each element appears only once_. Return _the linked list **sorted** as well_.
**Example 1:**
**Input:** head = \[1,1,2\]
**Output:** \[1,2\]
**Example 2:**
**Input:** head = \[1,1,2,3,3\]
**Output:** \[1,2,3\]
**Constraints:**
* The numb... | null | Linked List | Easy | 82,1982 |
1,403 | hey yo what's up my little coders what's up today delete hold question 1403 minimum subsequence in non-increasing minimum subsequence in non-increasing minimum subsequence in non-increasing order here's an example if there's the input array we need to return this subsequence of elements which in sum will make a sum whi... | Minimum Subsequence in Non-Increasing Order | palindrome-partitioning-iii | Given the array `nums`, obtain a subsequence of the array whose sum of elements is **strictly greater** than the sum of the non included elements in such subsequence.
If there are multiple solutions, return the subsequence with **minimum size** and if there still exist multiple solutions, return the subsequence with t... | For each substring calculate the minimum number of steps to make it palindrome and store it in a table. Create a dp(pos, cnt) which means the minimum number of characters changed for the suffix of s starting on pos splitting the suffix on cnt chunks. | String,Dynamic Programming | Hard | 1871 |
1,700 | hey everybody this is larry this is me going over the biweekly contest 42 q1 the number of students unable to eat lunch um so this one i thought about doing it in a clever way during the contest um so hit the like button hit the subscribe and join me on discord all that stuff um but yeah but during the contest i defini... | Number of Students Unable to Eat Lunch | minimum-time-to-make-rope-colorful | The school cafeteria offers circular and square sandwiches at lunch break, referred to by numbers `0` and `1` respectively. All students stand in a queue. Each student either prefers square or circular sandwiches.
The number of sandwiches in the cafeteria is equal to the number of students. The sandwiches are placed i... | Maintain the running sum and max value for repeated letters. | Array,String,Dynamic Programming,Greedy | Medium | null |
1,704 | Hi gas welcome and welcome back to my channel so in this problem statement what have you given me here Na give us a string okay with the name S and whatever it is and the length of it okay so here all the number of these you It can be of length four, it can be of six length, it can be of length 8, that is, it can be of... | Determine if String Halves Are Alike | special-positions-in-a-binary-matrix | You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half.
Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppe... | Keep track of 1s in each row and in each column. Then while iterating over matrix, if the current position is 1 and current row as well as current column contains exactly one occurrence of 1. | Array,Matrix | Easy | null |
1,900 | hey everybody this is larry this is me going over q4 of the weekly contest 245. the earliest and latest roundware players compete so well before my rant hit the like button to subscribe and join me on discord where we talk about this and every other contest forum right after the contest uh and just hang out and just yo... | The Earliest and Latest Rounds Where Players Compete | closest-dessert-cost | There is a tournament where `n` players are participating. The players are standing in a single row and are numbered from `1` to `n` based on their **initial** standing position (player `1` is the first player in the row, player `2` is the second player in the row, etc.).
The tournament consists of multiple rounds (st... | As the constraints are not large, you can brute force and enumerate all the possibilities. | Array,Dynamic Programming,Backtracking | Medium | null |
43 | so let's finally code problem number 43 multiply strings so we are getting two non-negrative so we are getting two non-negrative so we are getting two non-negrative integers and numbers one and num2 for example here and we are going to return the multiplication of these two numbers and convert it to string but we canno... | Multiply Strings | multiply-strings | Given two non-negative integers `num1` and `num2` represented as strings, return the product of `num1` and `num2`, also represented as a string.
**Note:** You must not use any built-in BigInteger library or convert the inputs to integer directly.
**Example 1:**
**Input:** num1 = "2", num2 = "3"
**Output:** "6"
**Ex... | null | Math,String,Simulation | Medium | 2,66,67,415 |
1,443 | Hey everyone, I hope people will be well, have fun, be healthy. Today we will solve the questions in minimum time. You collect all appleside. Look, this type of questions is nothing new for us, there are just some mod modifications if you like BFS well. If you understand, then you will definitely be able to solve the q... | Minimum Time to Collect All Apples in a Tree | minimum-distance-to-type-a-word-using-two-fingers | Given an undirected tree consisting of `n` vertices numbered from `0` to `n-1`, which has some apples in their vertices. You spend 1 second to walk over one edge of the tree. _Return the minimum time in seconds you have to spend to collect all apples in the tree, starting at **vertex 0** and coming back to this vertex.... | Use dynamic programming. dp[i][j][k]: smallest movements when you have one finger on i-th char and the other one on j-th char already having written k first characters from word. | String,Dynamic Programming | Hard | 2088 |
274 | hello everyone today we are going to solve the problem 274 H index given an array of integers citations we will citation of I is the number of citation a research is received a for their eighth paper return the research is H index the syntax is Define X to maximum value of H such that the given researcher has published... | H-Index | h-index | Given an array of integers `citations` where `citations[i]` is the number of citations a researcher received for their `ith` paper, return _the researcher's h-index_.
According to the [definition of h-index on Wikipedia](https://en.wikipedia.org/wiki/H-index): The h-index is defined as the maximum value of `h` such th... | An easy approach is to sort the array first. What are the possible values of h-index? A faster approach is to use extra space. | Array,Sorting,Counting Sort | Medium | 275 |
441 | hey everyone welcome back and today we'll be doing another leave code 441 arranging coins an easy one you have n coins and you want to build a staircase with these coins the staircase consists of K rows where I throw has exactly I coins the last row of the staircase may be incomplete so if we have coins given five we c... | Arranging Coins | arranging-coins | You have `n` coins and you want to build a staircase with these coins. The staircase consists of `k` rows where the `ith` row has exactly `i` coins. The last row of the staircase **may be** incomplete.
Given the integer `n`, return _the number of **complete rows** of the staircase you will build_.
**Example 1:**
**I... | null | Math,Binary Search | Easy | null |
256 | hey so welcome back in this another daily Guild problem so today it's called Paint house and it's a medium level dynamic programming problem so basically what you're given here is just a two-dimensional array called just a two-dimensional array called just a two-dimensional array called costs now the number of columns ... | Paint House | paint-house | There is a row of `n` houses, where each house can be painted one of three colors: red, blue, or green. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color.
The cost of painting each house with a certain color is repre... | null | Array,Dynamic Programming | Medium | 198,213,265,276 |
403 | hey everyone in this video let's take a look at question 403 frog jump only code this is part of our blind 75 playlist only code where we go through the blind 75 questions let us begin in this question a frog is crossing a river and the river is divided into some number of units at each unit there may or may not exist ... | Frog Jump | frog-jump | A frog is crossing a river. The river is divided into some number of units, and at each unit, there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.
Given a list of `stones`' positions (in units) in sorted **ascending order**, determine if the frog can cross the river by... | null | Array,Dynamic Programming | Hard | 1952,2262 |
113 | question 113 of the code path sum 2 given the root of a binary tree and an integer target sum return all route to leaf paths where the sum of the node values in the path equals target sum each path should be returned as a list of the node values not node references a root to leaf path is a path starting from the root a... | Path Sum II | path-sum-ii | Given the `root` of a binary tree and an integer `targetSum`, return _all **root-to-leaf** paths where the sum of the node values in the path equals_ `targetSum`_. Each path should be returned as a list of the node **values**, not node references_.
A **root-to-leaf** path is a path starting from the root and ending at... | null | Backtracking,Tree,Depth-First Search,Binary Tree | Medium | 112,257,437,666,2217 |
216 | hello everyone welcome back here is vamson with another live coding challenge so today uh daily challenge was easy so I decided to do one more so today we will be unraveling the magic behind lead code problem uh combination Su free so it's one of top 70 uh five uh lead code challenges so let's Dive Right In so what thi... | Combination Sum III | combination-sum-iii | Find all valid combinations of `k` numbers that sum up to `n` such that the following conditions are true:
* Only numbers `1` through `9` are used.
* Each number is used **at most once**.
Return _a list of all possible valid combinations_. The list must not contain the same combination twice, and the combinations... | null | Array,Backtracking | Medium | 39 |
867 | Ajay soon one my name is Raees and today we are going to call another new questions of garage symbol named transform matrix with determination and crops and right so this question is very easy a bird flu is important because sequence Questions related to this will come forward. It has been placed in Level-2, Questions ... | Transpose Matrix | new-21-game | Given a 2D integer array `matrix`, return _the **transpose** of_ `matrix`.
The **transpose** of a matrix is the matrix flipped over its main diagonal, switching the matrix's row and column indices.
**Example 1:**
**Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[\[1,4,7\],\[2,5,8\],\[3,6,9\]\]
**E... | null | Math,Dynamic Programming,Sliding Window,Probability and Statistics | Medium | null |
1,903 | hey and welcome today we will solve largest odd number in a string interview question this one is simple and quick so let's get into it here's the first example we have a number in a string form in this case 52 and this is an even number but the only odd thing about this number is five here so we might return it again ... | 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 |
141 | hello and welcome everyone let's continue solving the issuan prazad patterns by tackling the list link cycle problem we are giving the head of a linked list and we want to determine if the linked list has a cycle in it and basically we know that um a linked list is supposed to we know that we've gotten to the end of a ... | Linked List Cycle | linked-list-cycle | Given `head`, the head of a linked list, determine if the linked list has a cycle in it.
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 tail's `next` pointer is co... | null | Hash Table,Linked List,Two Pointers | Easy | 142,202 |
41 | either and number 41 first we missing positive so give me also generate integer and the smallest missing positive indeed it's a hard question how hard is the question we find them into the fryin integer we can easily sort very first and skinnier time after I found no problem you said you're always a short of running on... | First Missing Positive | first-missing-positive | Given an unsorted integer array `nums`, return the smallest missing positive integer.
You must implement an algorithm that runs in `O(n)` time and uses constant extra space.
**Example 1:**
**Input:** nums = \[1,2,0\]
**Output:** 3
**Explanation:** The numbers in the range \[1,2\] are all in the array.
**Example 2:*... | Think about how you would solve the problem in non-constant space. Can you apply that logic to the existing space? We don't care about duplicates or non-positive integers Remember that O(2n) = O(n) | Array,Hash Table | Hard | 268,287,448,770 |
1,727 | hey what's up guys this is chong so to today uh 1727 largest sub matrix with rearrangements and so you're given like a binary matrix which means that there's only the only zero or ones and you're allowed to rearrange the columns of the matrix in any other but you have to rearrange the entire column and you need to retu... | 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 |
122 | is persistent programmer here and welcome to my channel so in this channel we solve a lot of algos and go through a lot of legal questions so if you haven't subscribed already go ahead and hit that subscribe button under this video and let's go ahead and get started today with our question best time to buy and sell sto... | Best Time to Buy and Sell Stock II | best-time-to-buy-and-sell-stock-ii | You are given an integer array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
On each day, you may decide to buy and/or sell the stock. You can only hold **at most one** share of the stock at any time. However, you can buy it then immediately sell it on the **same day**.
Find and return _t... | null | Array,Dynamic Programming,Greedy | Medium | 121,123,188,309,714 |
1,481 | TT Daily Challenge Least Number of Unique Injurers After K Removal and Prob Statement Given A of Injurer and Ijor K F The Least Number of Unique Injurors After Mavi K Element So Statement Prost Forward So What in the Question Asked Us Ek Injur A and We have been given one number and we have to remove all the digits and... | Least Number of Unique Integers after K Removals | students-with-invalid-departments | Given an array of integers `arr` and an integer `k`. Find the _least number of unique integers_ after removing **exactly** `k` elements**.**
**Example 1:**
**Input:** arr = \[5,5,4\], k = 1
**Output:** 1
**Explanation**: Remove the single 4, only 5 is left.
**Example 2:**
**Input:** arr = \[4,3,1,1,3,3,2\], k = 3
*... | null | Database | Easy | null |
36 | Hai Hello Guys Welcome Chala Do Mein Folding Suggestion Problem Solve Problem Different Program By Subscribe Now To Receive New Updates 2012 Idi Do To Ab Kab Due To Be Tu Roads Par At Water Droplets Bluetooth Try to be lit Field Mother Took Place When One End Subscribe 12345 wizard101 Already A Me Pain Cost Effective W... | Valid Sudoku | valid-sudoku | Determine if a `9 x 9` Sudoku board is valid. Only the filled cells need to be validated **according to the following rules**:
1. Each row must contain the digits `1-9` without repetition.
2. Each column must contain the digits `1-9` without repetition.
3. Each of the nine `3 x 3` sub-boxes of the grid must contain... | null | Array,Hash Table,Matrix | Medium | 37,2254 |
209 | Hello guys welcome back to tech division in this video you will see minimum sir important problem world record number 2098 from this topic PNB tried to solve ujjain two points and sliding window technique before looking at the problem statement you like to according to courses Which Upcoming And In February Day And Use... | Minimum Size Subarray Sum | minimum-size-subarray-sum | Given an array of positive integers `nums` and a positive integer `target`, return _the **minimal length** of a_ _subarray_ _whose sum is greater than or equal to_ `target`. If there is no such subarray, return `0` instead.
**Example 1:**
**Input:** target = 7, nums = \[2,3,1,2,4,3\]
**Output:** 2
**Explanation:** Th... | null | Array,Binary Search,Sliding Window,Prefix Sum | Medium | 76,325,718,1776,2211,2329 |
140 | hey guys how's it going in this video i'm going to go through this the code number 140 word break number two so uh this question was asked by um facebook amazon google bloomberg and other and also microsoft uber and adobe so uh this problem we are giving a string of s and the dictionary of strings word dick and as basi... | Word Break II | word-break-ii | Given a string `s` and a dictionary of strings `wordDict`, add spaces in `s` to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in **any order**.
**Note** that the same word in the dictionary may be reused multiple times in the segmentation.
**Example 1:**
**Input:... | null | Hash Table,String,Dynamic Programming,Backtracking,Trie,Memoization | Hard | 139,472 |
1,958 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem check mo check if move is legal and this is a problem from this morning's leak code contest so let's get into it and if you would like to see a solution from this knights sleep code contest subscribe and stay tuned for ... | Check if Move is Legal | ad-free-sessions | You are given a **0-indexed** `8 x 8` grid `board`, where `board[r][c]` represents the cell `(r, c)` on a game board. On the board, free cells are represented by `'.'`, white cells are represented by `'W'`, and black cells are represented by `'B'`.
Each move in this game consists of choosing a free cell and changing i... | null | Database | Easy | null |
130 | hello everyone welcome to day first of november eco challenge and it's the new month a new beginning and i hope as for the last six months we are able to continue the consistency for the next six months as well we are able to get the november lead code monthly challenge badge as well without much to do let's look at th... | Surrounded Regions | surrounded-regions | Given an `m x n` matrix `board` containing `'X'` and `'O'`, _capture all regions that are 4-directionally surrounded by_ `'X'`.
A region is **captured** by flipping all `'O'`s into `'X'`s in that surrounded region.
**Example 1:**
**Input:** board = \[\[ "X ", "X ", "X ", "X "\],\[ "X ", "O ", "O ", "X "\],\[ "X ", "... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | 200,286 |
1,317 | hello so doing this lift code contest 171 that was yesterday so the first problem was of the contest with this problem 1317 converged integer to the sum of two nonzero integers so the problem says given an integer n we have something called non zero no zero integer which is just a positive number that doesn't contain a... | Convert Integer to the Sum of Two No-Zero Integers | monthly-transactions-i | **No-Zero integer** is a positive integer that **does not contain any `0`** in its decimal representation.
Given an integer `n`, return _a list of two integers_ `[a, b]` _where_:
* `a` and `b` are **No-Zero integers**.
* `a + b = n`
The test cases are generated so that there is at least one valid solution. If th... | null | Database | Medium | 1328 |
310 | hey everybody this is larry this is day four of the november daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's farm or just in general uh and today's problem is minimum height trees okay so what is this a tree is a okay i know what a tree is okay th... | Minimum Height Trees | minimum-height-trees | A tree is an undirected graph in which any two vertices are connected by _exactly_ one path. In other words, any connected graph without simple cycles is a tree.
Given a tree of `n` nodes labelled from `0` to `n - 1`, and an array of `n - 1` `edges` where `edges[i] = [ai, bi]` indicates that there is an undirected edg... | How many MHTs can a graph have at most? | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 207,210 |
102 | hey yo what's up my little coders let me show you in this tutorial how to solve the little question number one hiring a two binary tree level order traversal basically we are given the root of a binary tree and we want to return the level order traversal of its node's values the return type should be the list of lists ... | Binary Tree Level Order Traversal | binary-tree-level-order-traversal | Given the `root` of a binary tree, return _the level order traversal of its nodes' values_. (i.e., from left to right, level by level).
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[3\],\[9,20\],\[15,7\]\]
**Example 2:**
**Input:** root = \[1\]
**Output:** \[\[1\]\]
**Example 3:**
**I... | null | Tree,Breadth-First Search,Binary Tree | Medium | 103,107,111,314,637,764,1035 |
1,011 | hello welcome back today I will solve Leal 1011 capacity to ship packages within D days we given an array of weights and this represent the weight of different packages we also given the number of days to ship all the package to a different port our job is to determine the minimum capacity of the ship that can ship all... | Capacity To Ship Packages Within D Days | flip-binary-tree-to-match-preorder-traversal | A conveyor belt has packages that must be shipped from one port to another within `days` days.
The `ith` package on the conveyor belt has a weight of `weights[i]`. Each day, we load the ship with packages on the conveyor belt (in the order given by `weights`). We may not load more weight than the maximum weight capaci... | null | Tree,Depth-First Search,Binary Tree | Medium | null |
867 | all right hey what's up guys Nick white here at detected coding someone's watching YouTube I have all the leaked code and a current solutions and playlist on my channel if you want to check those out also everything else in the description this problem is called transpose matrix given a matrix a return the transpose of... | Transpose Matrix | new-21-game | Given a 2D integer array `matrix`, return _the **transpose** of_ `matrix`.
The **transpose** of a matrix is the matrix flipped over its main diagonal, switching the matrix's row and column indices.
**Example 1:**
**Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[\[1,4,7\],\[2,5,8\],\[3,6,9\]\]
**E... | null | Math,Dynamic Programming,Sliding Window,Probability and Statistics | Medium | null |
987 | so hey there everyone welcome back i hope you all are doing extremely well so this was our today's problem of the day vertical order traversal of a binary tree so let's see what the problem is so we are given the root of a binary tree we have to calculate the vertical order traversal of the binary tree so for each node... | 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 |
46 | hey there everyone welcome back to lead coding i'm your host faraz so recently i uploaded a lecture on recursion and backtracking so it was an introductory lecture in that lecture i had three questions so two are the basic questions and one was a bit advanced so if you didn't get everything into that lecture i am going... | Permutations | permutations | Given an array `nums` of distinct integers, return _all the possible permutations_. You can return the answer in **any order**.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,1\],\[3,1,2\],\[3,2,1\]\]
**Example 2:**
**Input:** nums = \[0,1\]
**Output:** \[\[0,1\],\[1,0\... | null | Array,Backtracking | Medium | 31,47,60,77 |
1,539 | hi everyone my name is steve today we're going to go through lead code problem 1539 case missing positive number let's take a look at the problem description first given that array of positive integers sorted in strictly increasing order and an integer k find the k positive integer that is missing from the array all ri... | Kth Missing Positive Number | diagonal-traverse-ii | Given an array `arr` of positive integers sorted in a **strictly increasing order**, and an integer `k`.
Return _the_ `kth` _**positive** integer that is **missing** from this array._
**Example 1:**
**Input:** arr = \[2,3,4,7,11\], k = 5
**Output:** 9
**Explanation:** The missing positive integers are \[1,5,6,8,9,10... | Notice that numbers with equal sums of row and column indexes belong to the same diagonal. Store them in tuples (sum, row, val), sort them, and then regroup the answer. | Array,Sorting,Heap (Priority Queue) | Medium | null |
1,021 | foreign see how like this for this opening we have groups but this one single limits overpoint cannot be evaluated so this is empty so yeah so that means you could see here this opens okay then again this opens here it closes so these two are canceled this closes so that will be equal to this X same thing A Plus here o... | Remove Outermost Parentheses | distribute-coins-in-binary-tree | A valid parentheses string is either empty `" "`, `"( " + A + ") "`, or `A + B`, where `A` and `B` are valid parentheses strings, and `+` represents string concatenation.
* For example, `" "`, `"() "`, `"(())() "`, and `"(()(())) "` are all valid parentheses strings.
A valid parentheses string `s` is primitive if i... | null | Tree,Depth-First Search,Binary Tree | Medium | 863,1008 |
53 | welcome back to the cracking fan YouTube channel today we're going to be solving lead code problem number 53 maximum subarray before we do I just want to ask if you guys could leave a like and a comment on the video because it helps me a lot with the YouTube algorithm and a subscription to the channel really helps me g... | Maximum Subarray | maximum-subarray | Given an integer array `nums`, find the subarray with the largest sum, and return _its sum_.
**Example 1:**
**Input:** nums = \[-2,1,-3,4,-1,2,1,-5,4\]
**Output:** 6
**Explanation:** The subarray \[4,-1,2,1\] has the largest sum 6.
**Example 2:**
**Input:** nums = \[1\]
**Output:** 1
**Explanation:** The subarray \... | null | Array,Divide and Conquer,Dynamic Programming | Easy | 121,152,697,1020,1849,1893 |
108 | hello everyone and welcome back to another video so today we're going to be throwing the leak good question convert sorted area to a binary search tree okay so let's start off with what exactly a binary search tree is so it's a tree based data structure and the way it works is that given a certain root it's left subtre... | Convert Sorted Array to Binary Search Tree | convert-sorted-array-to-binary-search-tree | Given an integer array `nums` where the elements are sorted in **ascending order**, convert _it to a_ **_height-balanced_** _binary search tree_.
**Example 1:**
**Input:** nums = \[-10,-3,0,5,9\]
**Output:** \[0,-3,9,-10,null,5\]
**Explanation:** \[0,-10,5,null,-3,null,9\] is also accepted:
**Example 2:**
**Input... | null | Array,Divide and Conquer,Tree,Binary Search Tree,Binary Tree | Easy | 109 |
1,727 | So in today's video, we are going to solve LID code question number 1727 Largest Sub Matrix with Rearrangements. In this, we have been given a binary matrix whose size will be m cross n and we are allowed to rearrange its columns. We can rearrange the matrix in any order. We have to return the area of the largest ret... | 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 |
93 | hello guys welcome to deep codes and in today's video we will discuss record question 93 that says restore IP address so here we are given one uh IP address in the form of string and we need to restore it by putting some Dots here so let's see the question uh this is the definition of valid IP address that says the fou... | 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 |
36 | A house today will see ali problem on electric loco shed qualities eclipse business determine weather all these people and lucky number today these celebs will see number repeat problem and boxes for kids in the giver number is a date of big movies carefully replace 538 Minute and always Chandrasen columns of his CD pu... | Valid Sudoku | valid-sudoku | Determine if a `9 x 9` Sudoku board is valid. Only the filled cells need to be validated **according to the following rules**:
1. Each row must contain the digits `1-9` without repetition.
2. Each column must contain the digits `1-9` without repetition.
3. Each of the nine `3 x 3` sub-boxes of the grid must contain... | null | Array,Hash Table,Matrix | Medium | 37,2254 |
336 | today we're gonna work and today we're gonna working on it quote question number 336 palindrome pairs and given a list of unique words written all the pairs of the distinct indices i j in the given list so that the concatenation of the two words of i and vertex j is appalling room so over here the answer is 0 1 0 3 2 4... | 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 |
1,923 | hey everybody this is larry this is me going with q4 of the weekly contest 248 on lead code longest common sub path so hit the like button hit the subscribe button join me on discord about this farm other contest farms let me know um we actually usually go over you know in chat and discord right after the contest so if... | Longest Common Subpath | sentence-similarity-iii | There is a country of `n` cities numbered from `0` to `n - 1`. In this country, there is a road connecting **every pair** of cities.
There are `m` friends numbered from `0` to `m - 1` who are traveling through the country. Each one of them will take a path consisting of some cities. Each path is represented by an inte... | One way to look at it is to find one sentence as a concatenation of a prefix and suffix from the other sentence. Get the longest common prefix between them and the longest common suffix. | Array,Two Pointers,String | Medium | null |
211 | okay welcome back to algae.js today's okay welcome back to algae.js today's okay welcome back to algae.js today's question is leak code 211 design add and search words data structure so we need to design a data structure that supports adding new words and finding if a string matches any previously added string so we ne... | Design Add and Search Words Data Structure | design-add-and-search-words-data-structure | Design a data structure that supports adding new words and finding if a string matches any previously added string.
Implement the `WordDictionary` class:
* `WordDictionary()` Initializes the object.
* `void addWord(word)` Adds `word` to the data structure, it can be matched later.
* `bool search(word)` Returns ... | You should be familiar with how a Trie works. If not, please work on this problem: Implement Trie (Prefix Tree) first. | String,Depth-First Search,Design,Trie | Medium | 208,746 |
1,630 | hello subasi I hope that you guys are doing good in this video we're going to see the problem arithmatic sub arrays we will see both the approaches from the very scratch and again we have seen the exact replication of a question in a live stream also so if you have been watching us regular please try it by yourself fir... | Arithmetic Subarrays | count-odd-numbers-in-an-interval-range | A sequence of numbers is called **arithmetic** if it consists of at least two elements, and the difference between every two consecutive elements is the same. More formally, a sequence `s` is arithmetic if and only if `s[i+1] - s[i] == s[1] - s[0]` for all valid `i`.
For example, these are **arithmetic** sequences:
1... | If the range (high - low + 1) is even, the number of even and odd numbers in this range will be the same. If the range (high - low + 1) is odd, the solution will depend on the parity of high and low. | Math | Easy | null |
114 | hello friends welcome to joy of life so today we are going to look at another medium level problem from lead code the problem number is 114 the name of the problem is flatten binary tree to link list so given the root of a binary tree flatten the tree into a linked list so it says the linked list should use the same th... | Flatten Binary Tree to Linked List | flatten-binary-tree-to-linked-list | Given the `root` of a binary tree, flatten the tree into a "linked list ":
* The "linked list " should use the same `TreeNode` class where the `right` child pointer points to the next node in the list and the `left` child pointer is always `null`.
* The "linked list " should be in the same order as a [**pre-order*... | If you notice carefully in the flattened tree, each node's right child points to the next node of a pre-order traversal. | Linked List,Stack,Tree,Depth-First Search,Binary Tree | Medium | 766,1796 |
896 | Hello everyone welcome to my channel codestorywithMIK so today we are going to do video number 62 of our playlist the question is of easy level lead code number is 896 the name of the question is monotonic are it has been asked by multiple times I think three times asked Its frequency is three. Okay, so let's see, the ... | Monotonic Array | smallest-subtree-with-all-the-deepest-nodes | An array is **monotonic** if it is either monotone increasing or monotone decreasing.
An array `nums` is monotone increasing if for all `i <= j`, `nums[i] <= nums[j]`. An array `nums` is monotone decreasing if for all `i <= j`, `nums[i] >= nums[j]`.
Given an integer array `nums`, return `true` _if the given array is ... | null | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
1,180 | so my system is having hard time to figure things out uh probably it is because i'm uploading bunch of high resolution video um with a 34 inch display and it's not keeping up well so what you're looking at right now on my screen is basically some gibberish word which is an input causing my code to fail so this is code ... | Count Substrings with Only One Distinct Letter | game-play-analysis-ii | Given a string `s`, return _the number of substrings that have only **one distinct** letter_.
**Example 1:**
**Input:** s = "aaaba "
**Output:** 8
**Explanation:** The substrings with one distinct letter are "aaa ", "aa ", "a ", "b ".
"aaa " occurs 1 time.
"aa " occurs 2 times.
"a " occurs 4 times.
"b " occu... | null | Database | Easy | 1179,1181 |
460 | in this video we're going to take a look at a legal problem called lfu cache so the goal for this question is we want to design and implement a data structure for at least frequently used cache so implement the least frequently used cache so this class should have three uh supports these uh two methods right this one's... | LFU Cache | lfu-cache | Design and implement a data structure for a [Least Frequently Used (LFU)](https://en.wikipedia.org/wiki/Least_frequently_used) cache.
Implement the `LFUCache` class:
* `LFUCache(int capacity)` Initializes the object with the `capacity` of the data structure.
* `int get(int key)` Gets the value of the `key` if the... | null | Hash Table,Linked List,Design,Doubly-Linked List | Hard | 146,588 |
677 | six seventy sevens mapped some pairs implement maps some class of inserts some methods for MF and insert you're given a pair of string integer the string represents a key and the integer represents two by the key already exist and the original key pair will be over into the new one but if it's some you're given represe... | Map Sum Pairs | map-sum-pairs | Design a map that allows you to do the following:
* Maps a string key to a given value.
* Returns the sum of the values that have a key with a prefix equal to a given string.
Implement the `MapSum` class:
* `MapSum()` Initializes the `MapSum` object.
* `void insert(String key, int val)` Inserts the `key-val`... | null | Hash Table,String,Design,Trie | Medium | 1333 |
1,022 | hey guys welcome back to another video and today we're going to be solving the leakout question sum of root to leave binary numbers all right so in this question we're given a binary tree each node has a value of either zero or one each route to leaf path represents a binary number starting with the most significant bi... | Sum of Root To Leaf Binary Numbers | unique-paths-iii | You are given the `root` of a binary tree where each node has a value `0` or `1`. Each root-to-leaf path represents a binary number starting with the most significant bit.
* For example, if the path is `0 -> 1 -> 1 -> 0 -> 1`, then this could represent `01101` in binary, which is `13`.
For all leaves in the tree, c... | null | Array,Backtracking,Bit Manipulation,Matrix | Hard | 37,63,212 |
1,402 | Hua Hai Is Style Hello Viewers Welcome Back To My Channel Ko Pyaar Doing Great Rihai Manch subscribe To My Channel Year Please Do Subscribe Every Week Test One Playlist Cover Various Categories of Problems Subscribe Research Dynamic Programming And Don't Forget To Subscribe To You Can Link Description Box Office Collec... | Reducing Dishes | count-square-submatrices-with-all-ones | A chef has collected data on the `satisfaction` level of his `n` dishes. Chef can cook any dish in 1 unit of time.
**Like-time coefficient** of a dish is defined as the time taken to cook that dish including previous dishes multiplied by its satisfaction level i.e. `time[i] * satisfaction[i]`.
Return _the maximum sum... | Create an additive table that counts the sum of elements of submatrix with the superior corner at (0,0). Loop over all subsquares in O(n^3) and check if the sum make the whole array to be ones, if it checks then add 1 to the answer. | Array,Dynamic Programming,Matrix | Medium | 2192,2193 |
517 | oh cool 5:17 super washing machines Jeff oh cool 5:17 super washing machines Jeff oh cool 5:17 super washing machines Jeff and super washing machines on online initially each washing machine has some choices or is empty for each move you can choose any M where m is between 1 and N 1 to n washing machines and press pass... | Super Washing Machines | super-washing-machines | You have `n` super washing machines on a line. Initially, each washing machine has some dresses or is empty.
For each move, you could choose any `m` (`1 <= m <= n`) washing machines, and pass one dress of each washing machine to one of its adjacent washing machines at the same time.
Given an integer array `machines` ... | null | Array,Greedy | Hard | null |
1,877 | hey everybody this is Larry this is day 17 of the Lego day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's problem uh my SD card got corrupted uh while I was in uh KOB so no um no intro today or like this is the intro so hope you understand but right no... | Minimize Maximum Pair Sum in Array | find-followers-count | The **pair sum** of a pair `(a,b)` is equal to `a + b`. The **maximum pair sum** is the largest **pair sum** in a list of pairs.
* For example, if we have pairs `(1,5)`, `(2,3)`, and `(4,4)`, the **maximum pair sum** would be `max(1+5, 2+3, 4+4) = max(6, 5, 8) = 8`.
Given an array `nums` of **even** length `n`, pai... | null | Database | Easy | null |
1,837 | what is going on everybody it's your boy average leader here with another video and today we are tackling number 1837 sum of digits in base k this question is pretty new and hasn't been asked by any companies just yet but i can see this one being asked by a few in the future if you guys can go ahead and hit that like a... | Sum of Digits in Base K | daily-leads-and-partners | Given an integer `n` (in base `10`) and a base `k`, return _the **sum** of the digits of_ `n` _**after** converting_ `n` _from base_ `10` _to base_ `k`.
After converting, each digit should be interpreted as a base `10` number, and the sum should be returned in base `10`.
**Example 1:**
**Input:** n = 34, k = 6
**Out... | null | Database | Easy | null |
303 | welcome guys welcome to my lego solving section so this is called range sum query so basically somewhere to give you an integer array and you need to find a sum of the element between index i and j i know the basically is inclusive so summary zero two means that you sum this index from zero to two the number is one and... | 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 |
110 | complete code problem 110 balanced binary tree so this problem gives us the root of a binary tree and our job is to determine if its height balanced right so the high balance would mean that the binary tree is a binary in which deduct of the two sub trees of every note never differs by 101 so what this means is that fo... | Balanced Binary Tree | balanced-binary-tree | Given a binary tree, determine if it is **height-balanced**.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** true
**Example 2:**
**Input:** root = \[1,2,2,3,3,null,null,4,4\]
**Output:** false
**Example 3:**
**Input:** root = \[\]
**Output:** true
**Constraints:**
* The number of nodes ... | null | Tree,Depth-First Search,Binary Tree | Easy | 104 |
455 | Hello Everyone and Welcome Back to my Channel Algorithm Hk Today I am going to write the code and also explain to you all the algorithm to solve this assign cookies problem hk is there in lead code it is an easy level problem and can be solved using A Greedy Algorithm But Before Moving On To The Solution I Would Like T... | Assign Cookies | assign-cookies | Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.
Each child `i` has a greed factor `g[i]`, which is the minimum size of a cookie that the child will be content with; and each cookie `j` has a size `s[j]`. If `s[j] >= g[i]`, we can assign ... | null | Array,Greedy,Sorting | Easy | null |
1,897 | hey what's up guys so let's solve this uh legal story in section uh one eight nine seven redistributed characters to make all three equals so you're given a string a word and then basically you need you can swap any two indices basically you can swap any two uh indices and uh make another words right so for example you... | Redistribute Characters to Make All Strings Equal | maximize-palindrome-length-from-subsequences | You are given an array of strings `words` (**0-indexed**).
In one operation, pick two **distinct** indices `i` and `j`, where `words[i]` is a non-empty string, and move **any** character from `words[i]` to **any** position in `words[j]`.
Return `true` _if you can make **every** string in_ `words` _**equal** using **a... | Let's ignore the non-empty subsequence constraint. We can concatenate the two strings and find the largest palindromic subsequence with dynamic programming. Iterate through every pair of characters word1[i] and word2[j], and see if some palindrome begins with word1[i] and ends with word2[j]. This ensures that the subse... | String,Dynamic Programming | Hard | 516 |
124 | hello and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem 124 binary tree maximum path sum even though this question is marked as hard it's actually not that bad i would personally rate this question more of a medium the question the solution isn't really that complic... | Binary Tree Maximum Path Sum | binary-tree-maximum-path-sum | A **path** in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence **at most once**. Note that the path does not need to pass through the root.
The **path sum** of a path is the sum of the node's values in the path.
... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Hard | 112,129,666,687,1492 |
198 | hey guys welcome back to another video and today we're going to be solving the leakout question house robber all right so in this question uh we're a professional robber planning to rob houses along a certain street each house has a certain amount of money stashed the only constraint stopping you from robbing all of th... | House Robber | house-robber | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and **it will automatically contact the police if two adjacent houses were broken into... | null | Array,Dynamic Programming | Medium | 152,213,256,276,337,600,656,740,2262 |
41 | you guys mess you the party for this problem at equaled first missing positive given a nice order integer array find the force missing positive will be the third and why do 0 return 3 4 - 1 return to their wagon shell 3 4 - 1 return to their wagon shell 3 4 - 1 return to their wagon shell traitor should run in both end... | First Missing Positive | first-missing-positive | Given an unsorted integer array `nums`, return the smallest missing positive integer.
You must implement an algorithm that runs in `O(n)` time and uses constant extra space.
**Example 1:**
**Input:** nums = \[1,2,0\]
**Output:** 3
**Explanation:** The numbers in the range \[1,2\] are all in the array.
**Example 2:*... | Think about how you would solve the problem in non-constant space. Can you apply that logic to the existing space? We don't care about duplicates or non-positive integers Remember that O(2n) = O(n) | Array,Hash Table | Hard | 268,287,448,770 |
1 | how to do it's a very well-known how to do it's a very well-known how to do it's a very well-known problem they said that they will create five new problems but I guess it's not one of them submit speedrun give me the second problem where can I find the problem I don't know if you ask yourself this question a lot of ti... | 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 |
1,689 | hi guys welcome to tech geek so today we are back with another lead quote question that's the daily need for problem basically i try to discuss each and every link problem with you all and give the best of approach that's helpful as well as easy to understand even for the beginners uh before beginning i'd like to reque... | Partitioning Into Minimum Number Of Deci-Binary Numbers | detect-pattern-of-length-m-repeated-k-or-more-times | A decimal number is called **deci-binary** if each of its digits is either `0` or `1` without any leading zeros. For example, `101` and `1100` are **deci-binary**, while `112` and `3001` are not.
Given a string `n` that represents a positive decimal integer, return _the **minimum** number of positive **deci-binary** n... | Use a three-layer loop to check all possible patterns by iterating through all possible starting positions, all indexes less than m, and if the character at the index is repeated k times. | Array,Enumeration | Easy | 1764 |
1,051 | foreign students are asked to stand in a single file line in non-decreasing order by file line in non-decreasing order by file line in non-decreasing order by height so let this ordering be represented by an integer are expected where each element is expected height of ith student tree line so you are given an array He... | Height Checker | shortest-way-to-form-string | A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in **non-decreasing order** by height. Let this ordering be represented by the integer array `expected` where `expected[i]` is the expected height of the `ith` student in line.
You are given an integer... | Which conditions have to been met in order to be impossible to form the target string? If there exists a character in the target string which doesn't exist in the source string then it will be impossible to form the target string. Assuming we are in the case which is possible to form the target string, how can we assur... | String,Dynamic Programming,Greedy | Medium | 392,808 |
897 | hey everybody this is larry this is day three of the december league day challenge hit the like button hit the subscribe button join me in discord let me know what you think about tracepalm uh if you're new to the channel um usually i explain my thought process from beginning to end uh and i record everything live so i... | 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 |
12 | in this video we'll be going over Elite code problem 12. integer to Roman here's the problem description Roman numerals are represented by seven different symbols i b x l c d and M here's a table with the respective symbols and their values for example 2 is written as I in Roman numeral just two ones added together 12 ... | Integer to Roman | integer-to-roman | Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`.
**Symbol** **Value**
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, `2` is written as `II` in Roman numeral, just two one's adde... | null | Hash Table,Math,String | Medium | 13,273 |
338 | hello guys welcome to another video in the series of coding today um let's do the problem it's called counting bits you are given an integer n you have to return an array answer of length n plus 1 such that for each i answer of i is the number of ones in the binary representation of i okay so what do you have to do in ... | 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 |
142 | what is up YouTube today I'm going to be going over linked lifecycle - it's a going over linked lifecycle - it's a going over linked lifecycle - it's a continuation of the first link list cycle problem it's a medium problem link code I started a slack channel I have to invite link below where I post daily leak Co probl... | 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 |
139 | hi everyone today we are going to solve the little question World break so you are given a string s and the dictionary of strings while dict return true if s can be segmented into a space separated sequence of one more dictionary words note that's the same word in the dictionary may be used multiple times in the segmen... | Word Break | word-break | Given a string `s` and a dictionary of strings `wordDict`, return `true` if `s` can be segmented into a space-separated sequence of one or more dictionary words.
**Note** that the same word in the dictionary may be reused multiple times in the segmentation.
**Example 1:**
**Input:** s = "leetcode ", wordDict = \[ "... | null | Hash Table,String,Dynamic Programming,Trie,Memoization | Medium | 140 |
253 | equal question 5 253 here meeting room 2 and it's a median legal question basically they give you a meeting array intervals where you have two number first one is the star and the second one is the end of the meeting return the minimal number of cons conference room that is needed looking at here zero i have a meeting ... | Meeting Rooms II | meeting-rooms-ii | Given an array of meeting time intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of conference rooms required_.
**Example 1:**
**Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\]
**Output:** 2
**Example 2:**
**Input:** intervals = \[\[7,10\],\[2,4\]\]
**Output:** 1
**Constr... | Think about how we would approach this problem in a very simplistic way. We will allocate rooms to meetings that occur earlier in the day v/s the ones that occur later on, right? If you've figured out that we have to sort the meetings by their start time, the next thing to think about is how do we do the allocation? Th... | Array,Two Pointers,Greedy,Sorting,Heap (Priority Queue) | Medium | 56,252,452,1184 |
322 | hello everyone my name is Horus and in this video we're going to be going through leak code number 322 coin change for this problem we're given an integer array called coins and this integer array represents coins of different denominations and an integer amount which represents the total amount of money we want to ret... | Coin Change | coin-change | You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money.
Return _the fewest number of coins that you need to make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `-1`.
You may a... | null | Array,Dynamic Programming,Breadth-First Search | Medium | 1025,1393,2345 |
1,774 | hello so today we are going to solve this problem called closest dessert cost and the problem says we would like to make a dessert and we are preparing to buy the ingredient and we have an ice cream base flavors and m types of toppings to choose from and you must follow these rules um when so basically we have a couple... | Closest Dessert Cost | add-two-polynomials-represented-as-linked-lists | You would like to make dessert and are preparing to buy the ingredients. You have `n` ice cream base flavors and `m` types of toppings to choose from. You must follow these rules when making your dessert:
* There must be **exactly one** ice cream base.
* You can add **one or more** types of topping or have no topp... | Process both linked lists at the same time If the current power of the two heads is equal, add this power with the sum of the coefficients to the answer list. If one head has a larger power, add this power to the answer list and move only this head. | Linked List,Math,Two Pointers | Medium | 2,21,445 |
146 | um hello so today we are going to do this problem which is part of Fleet code daily challenge so today's problem is lru cash so we want to implement a data structure um called lru cache where the lru cache has a capacity and do initialize with that capacity um which is a positive size right and we have two functions th... | LRU Cache | lru-cache | Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**.
Implement the `LRUCache` class:
* `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`.
* `int get(int key)` Return the valu... | null | Hash Table,Linked List,Design,Doubly-Linked List | Medium | 460,588,604,1903 |
309 | hello everyone welcome to my YouTube Channel programming with DP Wala today we are discussing the very interesting and the famous interview problem that is already asked in many interviews the name of this problem is best time to buy and sell stock with cooldown so in this problem we are given an array prices where pri... | Best Time to Buy and Sell Stock with Cooldown | best-time-to-buy-and-sell-stock-with-cooldown | You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the following restrictions:
* After you sell your stock, yo... | null | Array,Dynamic Programming | Medium | 121,122 |
1,688 | hey everybody this is larry just me going over q1 of the weekly contest 219 count of matches in tournament so this is a little bit tricky but actually you know just to make sure that it gets correctly especially if you're trying to do it quickly but you're given the rules it is a little bit strange but it is also very ... | Count of Matches in Tournament | the-most-recent-orders-for-each-product | You are given an integer `n`, the number of teams in a tournament that has strange rules:
* If the current number of teams is **even**, each team gets paired with another team. A total of `n / 2` matches are played, and `n / 2` teams advance to the next round.
* If the current number of teams is **odd**, one team ... | null | Database | Medium | 1671,1735 |
494 | so today we would be solving lead code question number 494 that is Target sum so what our question really means is that we are given with an array of numbers and we need two positions plus and minus in such a way that we are available with our Target sum 3 like for example and we need to print how many plus and minus i... | Target Sum | target-sum | You are given an integer array `nums` and an integer `target`.
You want to build an **expression** out of nums by adding one of the symbols `'+'` and `'-'` before each integer in nums and then concatenate all the integers.
* For example, if `nums = [2, 1]`, you can add a `'+'` before `2` and a `'-'` before `1` and ... | null | Array,Dynamic Programming,Backtracking | Medium | 282 |
898 | hey guys welcome back to my channel and i'm back again with another really interesting coding into a question video this time guys we are going to solve question number 898 bitwise awards of sub array question before i start with the problem statement guys if you have not yet subscribed to my channel then please do sub... | Bitwise ORs of Subarrays | transpose-matrix | Given an integer array `arr`, return _the number of distinct bitwise ORs of all the non-empty subarrays of_ `arr`.
The bitwise OR of a subarray is the bitwise OR of each integer in the subarray. The bitwise OR of a subarray of one integer is that integer.
A **subarray** is a contiguous non-empty sequence of elements ... | We don't need any special algorithms to do this. You just need to know what the transpose of a matrix looks like. Rows become columns and vice versa! | Array,Matrix,Simulation | Easy | null |
1,964 | hey what's up guys this is sean here so elite code number 1964 find the longest valid obstacle course at each position right so the description of this one is pretty long but you know so basically uh we're trying to build some obstacle courses you know so we're given like obstacles of length n where the uh the obstacle... | Find the Longest Valid Obstacle Course at Each Position | find-interview-candidates | You want to build some obstacle courses. You are given a **0-indexed** integer array `obstacles` of length `n`, where `obstacles[i]` describes the height of the `ith` obstacle.
For every index `i` between `0` and `n - 1` (**inclusive**), find the length of the **longest obstacle course** in `obstacles` such that:
* ... | null | Database | Medium | null |
232 | hey what's going on guys today i'll be going over how to implement a queue using two stacks the first thing you want to note here is the distinguishing features of a queue and a stack so in the case of a queue we have this concept of first element and first element out and for stacks we have this concept of last in fir... | Implement Queue using Stacks | implement-queue-using-stacks | Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (`push`, `peek`, `pop`, and `empty`).
Implement the `MyQueue` class:
* `void push(int x)` Pushes element x to the back of the queue.
* `int pop()` Removes the element from th... | null | Stack,Design,Queue | Easy | 225 |
1,438 | hello everyone this is your daily dose of late code assuming you have an array of integers and a integer limit can you find the longest continuous sub array such that the max range of the array does not exceed our limit no can you if the limit is equal to 5 in our case the longest continuous sub array we can find as 2 ... | Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | find-the-team-size | Given an array of integers `nums` and an integer `limit`, return the size of the longest **non-empty** subarray such that the absolute difference between any two elements of this subarray is less than or equal to `limit`_._
**Example 1:**
**Input:** nums = \[8,2,4,7\], limit = 4
**Output:** 2
**Explanation:** All su... | null | Database | Easy | null |
203 | this little challenge is called removing list elements we're going to receive a linked list and we need to remove all the elements from that list of integers that have the value val so let's say this here is our list we need to remove the nodes that have the value six so these linked lists will become this here what yo... | Remove Linked List Elements | remove-linked-list-elements | Given the `head` of a linked list and an integer `val`, remove all the nodes of the linked list that has `Node.val == val`, and return _the new head_.
**Example 1:**
**Input:** head = \[1,2,6,3,4,5,6\], val = 6
**Output:** \[1,2,3,4,5\]
**Example 2:**
**Input:** head = \[\], val = 1
**Output:** \[\]
**Example 3:**... | null | Linked List,Recursion | Easy | 27,237,2216 |
941 | foreign it's a very simple question but as usual let's start with the reading the question trying to understand it with an example and developing algorithm later obviously let's get really good and code that as a garden so let's get started by reading the question so given an array of integers ARR return true if and on... | Valid Mountain Array | sort-array-by-parity | Given an array of integers `arr`, return _`true` if and only if it is a valid mountain array_.
Recall that arr is a mountain array if and only if:
* `arr.length >= 3`
* There exists some `i` with `0 < i < arr.length - 1` such that:
* `arr[0] < arr[1] < ... < arr[i - 1] < arr[i]`
* `arr[i] > arr[i + 1]... | null | Array,Two Pointers,Sorting | Easy | 2283,2327 |
322 | hi fellow golfers today we're going to have a look at the coin change problem let's have a look at the description so you are given an integer array coins representing coins of different denomination and an integer amount representing a total amount of money return the fewest number of coins that you need to make up th... | Coin Change | coin-change | You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money.
Return _the fewest number of coins that you need to make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `-1`.
You may a... | null | Array,Dynamic Programming,Breadth-First Search | Medium | 1025,1393,2345 |
380 | Hello hello guys welcome back to back design this video will see problem where required design and data structure which will be doing should delete and at random in one everest time solar system digit code 12:00 challenge so let's no problem no 12:00 challenge so let's no problem no 12:00 challenge so let's no problem ... | Insert Delete GetRandom O(1) | insert-delete-getrandom-o1 | Implement the `RandomizedSet` class:
* `RandomizedSet()` Initializes the `RandomizedSet` object.
* `bool insert(int val)` Inserts an item `val` into the set if not present. Returns `true` if the item was not present, `false` otherwise.
* `bool remove(int val)` Removes an item `val` from the set if present. Retur... | null | Array,Hash Table,Math,Design,Randomized | Medium | 381 |
6 | Do it Hello friends welcome to another episode of I am from Indian company Vestige Paper Should give this question on a Saiyan Fagua II level problem Entries Question No. 60 451 A friend singh like this place is having four wheel and beside such a want To give a number of what you want to divided into several different... | 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 |
384 | ok let's do this together yeah 1 384 shuffling away chipping away number of numbers of about duplicates and then there's just some usage ok so I mean this is kind of silly now I'll explain what I would do later so let's just say or what you know and then this like a random Dutch shuffle I think I put it in the wrong pl... | 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 |
1,685 | hey everyone let's all the today's ladco challenge which is sum of absolute differences in a sorted array so here in this problem we are given a list of number arrang in order and for each number in the list we want to find the sum of the absolute differences between that number and the every other number in the list s... | 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,260 | hey everyone it is aside hope you are doing good so let's start with the question so the question is shift 2d grade okay so you're given a 2d grid of size m cross n and integer k you need to shift grid k times okay so in one shift operation uh if the element is at grid i j you have to move to grid i j plus one basicall... | 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 |
374 | hello everyone welcome back here is vanamsen uh if you're new here we discuss and solve all things uh code if you haven't already don't forget to smash the Subscribe button and ring the notification Bell so you never miss any coding fans so today we are attacking a very interesting problem guest number higher or lower ... | Guess Number Higher or Lower | guess-number-higher-or-lower | We are playing the Guess Game. The game is as follows:
I pick a number from `1` to `n`. You have to guess which number I picked.
Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess.
You call a pre-defined API `int guess(int num)`, which returns three possible re... | null | Binary Search,Interactive | Easy | 278,375,658 |
337 | all right let's talk about the house rubber three and then you're given a route and which is a binary tree and then basically you don't want to uh take the value when there are connected so basically that directly in this house which is directly linked with no you cannot uh you cannot rob right so basically you need to... | House Robber III | house-robber-iii | The thief has found himself a new place for his thievery again. There is only one entrance to this area, called `root`.
Besides the `root`, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will automatically contact the police if ... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Medium | 198,213 |
108 | hey what's up guys white here I'm detecting coding stuff on twitch and YouTube and I'm back on leak code it's been a while but here I am and we're gonna get back into it now we're gonna start with an easy problem here this is a tree problem I've done most of them but I guess I missed this one it is the last easy one I ... | Convert Sorted Array to Binary Search Tree | convert-sorted-array-to-binary-search-tree | Given an integer array `nums` where the elements are sorted in **ascending order**, convert _it to a_ **_height-balanced_** _binary search tree_.
**Example 1:**
**Input:** nums = \[-10,-3,0,5,9\]
**Output:** \[0,-3,9,-10,null,5\]
**Explanation:** \[0,-10,5,null,-3,null,9\] is also accepted:
**Example 2:**
**Input... | null | Array,Divide and Conquer,Tree,Binary Search Tree,Binary Tree | Easy | 109 |
337 | today we're doing recursion specifically recursion with some memorization or cash we're going to do that with the example of House robber 3. the thief has found himself a new place for his theory again there is only one entrance to this area called root besides the route each house has a one and only one parent house a... | House Robber III | house-robber-iii | The thief has found himself a new place for his thievery again. There is only one entrance to this area, called `root`.
Besides the `root`, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will automatically contact the police if ... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Medium | 198,213 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.