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 |
|---|---|---|---|---|---|---|---|---|
20 | Loot Gayi A Hello Everyone Welcome Back To My YouTube Channel Short For Today Khayal Going To Solve This Question Parents Is Check Flex Discuss Words For Women About This Problem What You Give Strength Which Is Three Different Brackets Kali Basis Directions Like Rage And Need To Tell Weather This express in this spring... | Valid Parentheses | valid-parentheses | Given a string `s` containing just the characters `'('`, `')'`, `'{'`, `'}'`, `'['` and `']'`, determine if the input string is valid.
An input string is valid if:
1. Open brackets must be closed by the same type of brackets.
2. Open brackets must be closed in the correct order.
3. Every close bracket has a corres... | An interesting property about a valid parenthesis expression is that a sub-expression of a valid expression should also be a valid expression. (Not every sub-expression) e.g.
{ { } [ ] [ [ [ ] ] ] } is VALID expression
[ [ [ ] ] ] is VALID sub-expression
{ } [ ] is VALID sub-express... | String,Stack | Easy | 22,32,301,1045,2221 |
264 | welcome back for another video we are going to do another decode question the question is 264 ugly number two a ugly number is a positive integer whose prime factors are limited to 2 3 and 5. given a integer n return the m ugly number example one and equal to ten the output is 12 explanation 1 2 3 4 5 6 8 9 10 12 is th... | Ugly Number II | ugly-number-ii | An **ugly number** is a positive integer whose prime factors are limited to `2`, `3`, and `5`.
Given an integer `n`, return _the_ `nth` _**ugly number**_.
**Example 1:**
**Input:** n = 10
**Output:** 12
**Explanation:** \[1, 2, 3, 4, 5, 6, 8, 9, 10, 12\] is the sequence of the first 10 ugly numbers.
**Example 2:**
... | The naive approach is to call isUgly for every number until you reach the nth one. Most numbers are not ugly. Try to focus your effort on generating only the ugly ones. An ugly number must be multiplied by either 2, 3, or 5 from a smaller ugly number. The key is how to maintain the order of the ugly numbers. Try a simi... | Hash Table,Math,Dynamic Programming,Heap (Priority Queue) | Medium | 23,204,263,279,313,1307 |
15 | hey guys welcome to code world and today we'll be going over Le code number 15 three sum so this problem is pretty similar to two other problems I've solved on my channel uh which are two some one and two some 2 and we'll be combining concepts of both of those problems in order to reach the most optimal solution for th... | 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,721 | Hello Guys Welcome To Disrespect Video Adversities According And Dav High The Daily 4 Inch Problem Of Today Only Code Shifting Notes Know Best Endowed Only Business Language Problem Lol That Printed Channel 's Most Wanted To Give One Example To You To The 's Most Wanted To Give One Example To You To The 's Most Wanted ... | 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 |
735 | in this video we're going to solve the lead code problem asteroid collisions in this problem asteroid collations we are given an array of integers in this array of integers we see that we have positive value and we have negative value the absolute value represent the size of asteroid here we have five the size of aster... | Asteroid Collision | asteroid-collision | We are given an array `asteroids` of integers representing asteroids in a row.
For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed.
Find out the state of the asteroids after all collisio... | Say a row of asteroids is stable. What happens when a new asteroid is added on the right? | Array,Stack | Medium | 605,2245,2317 |
1,992 | hey everybody this is larry just me going with q2 of dubai weekly contest 60 find all groups of farmland so this one um yeah hit the like button hit the subscribe button join me on discord especially if you like talking about contest problems and stuff like that a lot of good people there and me but yeah so for this on... | Find All Groups of Farmland | sort-linked-list-already-sorted-using-absolute-values | You are given a **0-indexed** `m x n` binary matrix `land` where a `0` represents a hectare of forested land and a `1` represents a hectare of farmland.
To keep the land organized, there are designated rectangular areas of hectares that consist **entirely** of farmland. These rectangular areas are called **groups**. N... | The nodes with positive values are already in the correct order. Nodes with negative values need to be moved to the front. Nodes with negative values are in reversed order. | Linked List,Two Pointers,Sorting | Medium | 148 |
29 | Hi guys I am Nishant Chahar welcome back to the channel all group this question which will be discussed in today's video its name is divide to integers so what is given in it yaar given to integers dividend and divisor divide to integers without using multiplication division and Mod Operator The Integer Division Should... | Divide Two Integers | divide-two-integers | Given two integers `dividend` and `divisor`, divide two integers **without** using multiplication, division, and mod operator.
The integer division should truncate toward zero, which means losing its fractional part. For example, `8.345` would be truncated to `8`, and `-2.7335` would be truncated to `-2`.
Return _the... | null | Math,Bit Manipulation | Medium | null |
46 | hey guys welcome to algorithms made easy today we will be seeing the question permutations from lead code here given a collection of distinct integers we need to written all the possible permutations given the input 1 2 3 we know that we can have these six permutations for the number so how do we solve this the basic i... | 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 |
367 | hello everyone today i will we will see one more problem from leeco which is like a valid perfect square so this problem is like we want to define whether the number is a valid perfect square or not so let's look at the question given a positive integer number write a function which returns a true if number is a perfec... | Valid Perfect Square | valid-perfect-square | Given a positive integer num, return `true` _if_ `num` _is a perfect square or_ `false` _otherwise_.
A **perfect square** is an integer that is the square of an integer. In other words, it is the product of some integer with itself.
You must not use any built-in library function, such as `sqrt`.
**Example 1:**
**In... | null | Math,Binary Search | Easy | 69,633 |
1,512 | Hello everyone, welcome to my channel, there will be many good purchases, right from the beautiful to the best approach to the question is quite simple, I have given you an integer number, count the number and tell me how many are good by the first few words. What does it mean? Okay, so how many more forests are there ... | Number of Good Pairs | design-underground-system | Given an array of integers `nums`, return _the number of **good pairs**_.
A pair `(i, j)` is called _good_ if `nums[i] == nums[j]` and `i` < `j`.
**Example 1:**
**Input:** nums = \[1,2,3,1,1,3\]
**Output:** 4
**Explanation:** There are 4 good pairs (0,3), (0,4), (3,4), (2,5) 0-indexed.
**Example 2:**
**Input:** nu... | Use two hash tables. The first to save the check-in time for a customer and the second to update the total time between two stations. | Hash Table,String,Design | Medium | 2285 |
70 | all right so we have about 220 videos to go we've done about 30 videos if you have not checked out the github check out the github I have not been that good with code samples my first videos don't have code samples but I think it's very necessary for learning to have clear code samples well named well commented for tea... | Climbing Stairs | climbing-stairs | You are climbing a staircase. It takes `n` steps to reach the top.
Each time you can either climb `1` or `2` steps. In how many distinct ways can you climb to the top?
**Example 1:**
**Input:** n = 2
**Output:** 2
**Explanation:** There are two ways to climb to the top.
1. 1 step + 1 step
2. 2 steps
**Example 2:**
... | To reach nth step, what could have been your previous steps? (Think about the step sizes) | Math,Dynamic Programming,Memoization | Easy | 747,1013,1236 |
141 | hello everyone welcome to my channel coding together my name is vikas soja today we will see another lead code problem that is linked list cycle so we are given with a linked list and we have to find the cycle in it so what is a cycle if the same node is repeated the sum node in the list can be reached Again by continu... | 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 |
1,650 | hello everyone let's take a look at lowest common ancestor of a banner tree three okay for this problem let's take a look at the problem description since it's a log question so given two nodes of a panel tree p and q went to return their lowest common ancestor let's take a look at definition of this node it does not o... | Lowest Common Ancestor of a Binary Tree III | find-root-of-n-ary-tree | Given two nodes of a binary tree `p` and `q`, return _their lowest common ancestor (LCA)_.
Each node will have a reference to its parent node. The definition for `Node` is below:
class Node {
public int val;
public Node left;
public Node right;
public Node parent;
}
According to the **[definition of ... | Node with indegree 0 is the root | Hash Table,Bit Manipulation,Tree,Depth-First Search | Medium | 1655 |
1,646 | hello everyone today we are going to do another lead good problem and its name is get maximum in the generated array so let's be clear we are given a generated array so uh we have given a pattern by the question Setter and it is like the value at the 08 index 0 index is 0 at the first index it is 1 and other the patter... | Get Maximum in Generated Array | kth-missing-positive-number | You are given an integer `n`. A **0-indexed** integer array `nums` of length `n + 1` is generated in the following way:
* `nums[0] = 0`
* `nums[1] = 1`
* `nums[2 * i] = nums[i]` when `2 <= 2 * i <= n`
* `nums[2 * i + 1] = nums[i] + nums[i + 1]` when `2 <= 2 * i + 1 <= n`
Return _the **maximum** integer in the... | Keep track of how many positive numbers are missing as you scan the array. | Array,Binary Search | Easy | 2305 |
1,094 | foreign hey guys this is Jasmine from Tech Buck interview and welcome to another tutorial today we're going to talk about the car pulling problem which is another interesting problem related to intervals in this problem you're given an integer called capacity and then an array of trips and basically each trip has three... | 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 |
1,568 | hey guys we're back with another leak code video today we're going to be doing problem number 1568 minimum number of days to disconnect island so we're given a 2d grid consisting of ones which is land and zeros which is water an island is a maximal four directionally horizontal or vertical so not the corners right four... | Minimum Number of Days to Disconnect Island | pseudo-palindromic-paths-in-a-binary-tree | You are given an `m x n` binary grid `grid` where `1` represents land and `0` represents water. An **island** is a maximal **4-directionally** (horizontal or vertical) connected group of `1`'s.
The grid is said to be **connected** if we have **exactly one island**, otherwise is said **disconnected**.
In one day, we a... | Note that the node values of a path form a palindrome if at most one digit has an odd frequency (parity). Use a Depth First Search (DFS) keeping the frequency (parity) of the digits. Once you are in a leaf node check if at most one digit has an odd frequency (parity). | Bit Manipulation,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
735 | hey guys what's up uh in this video i want to go through this little 735 asteroid collusion uh we are giving an array of asteroids of integer representing the asteroids in the row for each asteroid the absolute value represents size and the sign represents its direction so positive means going right and negative means ... | Asteroid Collision | asteroid-collision | We are given an array `asteroids` of integers representing asteroids in a row.
For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed.
Find out the state of the asteroids after all collisio... | Say a row of asteroids is stable. What happens when a new asteroid is added on the right? | Array,Stack | Medium | 605,2245,2317 |
1,647 | hey guys welcome back in today's video we'll be talking about lead code problem 1647 it's called minimum deletions to make character frequencies unique and the reason why i picked this question is because it's currently being asked by microsoft for their online assessments so let's look at the question a string s is ca... | Minimum Deletions to Make Character Frequencies Unique | can-convert-string-in-k-moves | A string `s` is called **good** if there are no two different characters in `s` that have the same **frequency**.
Given a string `s`, return _the **minimum** number of characters you need to delete to make_ `s` _**good**._
The **frequency** of a character in a string is the number of times it appears in the string. F... | Observe that shifting a letter x times has the same effect of shifting the letter x + 26 times. You need to check whether k is large enough to cover all shifts with the same remainder after modulo 26. | Hash Table,String | Medium | null |
314 | can you solve this leeco premium question I'll give you 15 minutes to come up with a solution and then once you're ready you can go ahead and resume the video what's up guys it's epsyphus here with another lead code question and today we're solving binary tree vertical order traversal and pretty much for this question ... | Binary Tree Vertical Order Traversal | binary-tree-vertical-order-traversal | Given the `root` of a binary tree, return _**the vertical order traversal** of its nodes' values_. (i.e., from top to bottom, column by column).
If two nodes are in the same row and column, the order should be from **left to right**.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[9\],\[3,... | null | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 102 |
86 | Hello guys welcome to vikram media manager david c the question related to subscribe my channel subscribe loot the differently and before the thing of putting all the value scheduler target subscribe The Video then subscribe to the Page if you liked The Video then subscribe to The Amazing Subscribe Must Subscribe Shri ... | Partition List | partition-list | Given the `head` of a linked list and a value `x`, partition it such that all nodes **less than** `x` come before nodes **greater than or equal** to `x`.
You should **preserve** the original relative order of the nodes in each of the two partitions.
**Example 1:**
**Input:** head = \[1,4,3,2,5,2\], x = 3
**Output:**... | null | Linked List,Two Pointers | Medium | 2265 |
168 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem Excel sheet column title while this is an easy problem it actually took me longer than I would have expected and I'll kind of go into why that is we're given an integer called column number and we want to return what th... | Excel Sheet Column Title | excel-sheet-column-title | Given an integer `columnNumber`, return _its corresponding column title as it appears in an Excel sheet_.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
**Example 1:**
**Input:** columnNumber = 1
**Output:** "A "
**Example 2:**
**Input:** columnNumber = 28
**Output:** "AB "
**Example 3:**... | null | Math,String | Easy | 171,2304 |
114 | So hello everyone my name is Akshay welcome you a gf gp beauty week of de 78 so before starting today's question there was some dispute in the last question which I explained everything was correct but I missed a line and For the same reason, our code was submitting even after missing that line, so its tips how it was ... | 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 |
1,816 | hey guys spain here today we're going to talk about question 1816 called truncated sentence so let's see what the question is asking so given the string an integer k and all the string is separated by spaces and we want to truncate the sentence up to how many number how many words in case of for example if the string i... | Truncate Sentence | lowest-common-ancestor-of-a-binary-tree-iv | A **sentence** is a list of words that are separated by a single space with no leading or trailing spaces. Each of the words consists of **only** uppercase and lowercase English letters (no punctuation).
* For example, `"Hello World "`, `"HELLO "`, and `"hello world hello world "` are all sentences.
You are given a... | Starting from the root, traverse the left and the right subtrees, checking if one of the nodes exist there. If one of the subtrees doesn't contain any given node, the LCA can be the node returned from the other subtree If both subtrees contain nodes, the LCA node is the current node. | Tree,Depth-First Search,Binary Tree | Medium | 235,236,1218,1780,1790,1816 |
161 | okay so let's talk about our one added distance so you're giving a string s and key so you have to return true if both of the 180 system apart and other spots will return false so you can use either inserting deleting and replace right so we can only uh insert one character they do one character or replace one characte... | One Edit Distance | one-edit-distance | Given two strings `s` and `t`, return `true` if they are both one edit distance apart, otherwise return `false`.
A string `s` is said to be one distance apart from a string `t` if you can:
* Insert **exactly one** character into `s` to get `t`.
* Delete **exactly one** character from `s` to get `t`.
* Replace *... | null | Two Pointers,String | Medium | 72 |
516 | hey so welcome back this is another daily code problem so today it was called longest powderomic subsequence and it's a medium level question and so this is like a different one where I'm actually just going to already have the code written out and I also have some printing statements it's just for me because this one ... | Longest Palindromic Subsequence | longest-palindromic-subsequence | Given a string `s`, find _the longest palindromic **subsequence**'s length in_ `s`.
A **subsequence** is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.
**Example 1:**
**Input:** s = "bbbab "
**Output:** 4
**Explanation:** On... | null | String,Dynamic Programming | Medium | 5,647,730,1250,1822,1897,2130 |
1,980 | hello guys and welcome back to lead Logics this is the find unique binary string it is a lead code medium and the number for this is 1980 so in this question we are given with an array of strings nums and which is a string of binary numbers you can say like binary strings it consists of only zeros and ones and we have ... | Find Unique Binary String | faulty-sensor | Given an array of strings `nums` containing `n` **unique** binary strings each of length `n`, return _a binary string of length_ `n` _that **does not appear** in_ `nums`_. If there are multiple answers, you may return **any** of them_.
**Example 1:**
**Input:** nums = \[ "01 ", "10 "\]
**Output:** "11 "
**Explanatio... | Check for a common prefix of the two arrays. After this common prefix, there should be one array similar to the other but shifted by one. If both arrays can be shifted, return -1. | Array,Two Pointers | Easy | null |
1,457 | hello hi guys good morning welcome back to a new video in this we're going to see the problem and yeah I hope that you guys are doing good in this we going to see the problem uh pseudo palic Parts in a binary it has been asked by Amazon not pretty much but yeah it's actually a very good problem if you want to go deep i... | Pseudo-Palindromic Paths in a Binary Tree | minimum-difficulty-of-a-job-schedule | Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be **pseudo-palindromic** if at least one permutation of the node values in the path is a palindrome.
_Return the number of **pseudo-palindromic** paths going from the root node to leaf nodes._
**Example 1:**
**Input:*... | Use DP. Try to cut the array into d non-empty sub-arrays. Try all possible cuts for the array. Use dp[i][j] where DP states are i the index of the last cut and j the number of remaining cuts. Complexity is O(n * n * d). | Array,Dynamic Programming | Hard | null |
134 | hello everyone and welcome back in this video we will be tackling another lit Cod problem which is called the gas station problem we are going to explore this problem from a couple of different angles so let's read the problem first there are end gas stations along a circular route where the amount of gas at the ISA st... | Gas Station | gas-station | There are `n` gas stations along a circular route, where the amount of gas at the `ith` station is `gas[i]`.
You have a car with an unlimited gas tank and it costs `cost[i]` of gas to travel from the `ith` station to its next `(i + 1)th` station. You begin the journey with an empty tank at one of the gas stations.
Gi... | null | Array,Greedy | Medium | 1346 |
179 | Hello friends in this section they want a discussion let's see problem log just remember give very common question in which interviewer you will give up and they are all and positive integers only negative numbers unit arrange all the member since they came from the largest number of Times result will be released and l... | Largest Number | largest-number | Given a list of non-negative integers `nums`, arrange them such that they form the largest number and return it.
Since the result may be very large, so you need to return a string instead of an integer.
**Example 1:**
**Input:** nums = \[10,2\]
**Output:** "210 "
**Example 2:**
**Input:** nums = \[3,30,34,5,9\]
*... | null | String,Greedy,Sorting | Medium | 2284 |
45 | hello and welcome back to another Elite code problem today we're going to be doing the continuation of Jump game one which I did earlier and so this time we still have the zero index array of integers of length n where positioned at n0 but now the difference is first of all we are guaranteed to reach the end so and we ... | Jump Game II | jump-game-ii | You are given a **0-indexed** array of integers `nums` of length `n`. You are initially positioned at `nums[0]`.
Each element `nums[i]` represents the maximum length of a forward jump from index `i`. In other words, if you are at `nums[i]`, you can jump to any `nums[i + j]` where:
* `0 <= j <= nums[i]` and
* `i +... | null | Array,Dynamic Programming,Greedy | Medium | 55,1428,2001 |
105 | construct binary search tree from preorder traversal and will solve this problem and then also maybe do some drawing to explain what happens return the root note of a binary search tree that matches the given preorder traversal if this is the tree and then preorder traversal is if we start with DFS in the root the firs... | Construct Binary Tree from Preorder and Inorder Traversal | construct-binary-tree-from-preorder-and-inorder-traversal | Given two integer arrays `preorder` and `inorder` where `preorder` is the preorder traversal of a binary tree and `inorder` is the inorder traversal of the same tree, construct and return _the binary tree_.
**Example 1:**
**Input:** preorder = \[3,9,20,15,7\], inorder = \[9,3,15,20,7\]
**Output:** \[3,9,20,null,null,... | null | Array,Hash Table,Divide and Conquer,Tree,Binary Tree | Medium | 106 |
1,048 | Hello Hello Ajay how not to forget because this question is in such a way that we will be decided the year in it all which he can now understand that there is voltage exactly press any one letter in such a way that we Wada jo market jo order change ki war due to which both of them are ABC BBC and try this, whatever cha... | 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 |
530 | hello and welcome to another Elite code problem today we're going to be doing the problem of the day for June 14th it's going to be a minimum absolute difference in a VST so given the root of a binary search tree return the minimum absolute difference between the values of two different nodes in the tree and so what yo... | Minimum Absolute Difference in BST | minimum-absolute-difference-in-bst | Given the `root` of a Binary Search Tree (BST), return _the minimum absolute difference between the values of any two different nodes in the tree_.
**Example 1:**
**Input:** root = \[4,2,6,1,3\]
**Output:** 1
**Example 2:**
**Input:** root = \[1,0,48,null,null,12,49\]
**Output:** 1
**Constraints:**
* The number... | null | Tree,Depth-First Search,Breadth-First Search,Binary Search Tree,Binary Tree | Easy | 532 |
191 | hello everyone welcome today we are looking at another lead code question which is number of bits number of one bits and this is your first question in february week 2021. now uh what the question says is uh we need to write a function that takes an unassigned integer and returns the number of ones into it so what we n... | Number of 1 Bits | number-of-1-bits | Write a function that takes the binary representation of an unsigned integer and returns the number of '1' bits it has (also known as the [Hamming weight](http://en.wikipedia.org/wiki/Hamming_weight)).
**Note:**
* Note that in some languages, such as Java, there is no unsigned integer type. In this case, the input ... | null | Bit Manipulation | Easy | 190,231,338,401,461,693,767 |
1,851 | hello everyone let's take a look at the code on 1851 minimum interval to include each query it's the last question in weekly content and it's also a hard question but there are many solutions to this question so let's take a look at very simple solution and this is a problem description i will skip this section so if y... | 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 |
337 | hey what's up guys this is Chung here and so this time let's take a look at the nether like tree interesting tree problem here number 337 is called house robber 3 okay so let's read the description here so there's a save here this just the safe has found himself a new place for his theory again and basically he found l... | 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 |
885 | we are given the number of rows and Columns of a matrix and also a random starting cell indices inside the Matrix from this particular cell we need to Traverse through the Matrix in a spiral order till we visit all the cells in The Matrix and at last we need to return an array of cell indices we have visited in the sam... | Spiral Matrix III | exam-room | You start at the cell `(rStart, cStart)` of an `rows x cols` grid facing east. The northwest corner is at the first row and column in the grid, and the southeast corner is at the last row and column.
You will walk in a clockwise spiral shape to visit every position in this grid. Whenever you move outside the grid's bo... | null | Design,Ordered Set | Medium | 879 |
1,822 | okay so this problem is 1822 sine of the product of an array so it has all this stuff here but i'm just going to explain this problem as simply as i can so if i get this test case here so say we're given this nums and it's this list here basically if we were to take the product of all the numbers in this array would it... | Sign of the Product of an Array | longest-palindromic-subsequence-ii | There is a function `signFunc(x)` that returns:
* `1` if `x` is positive.
* `-1` if `x` is negative.
* `0` if `x` is equal to `0`.
You are given an integer array `nums`. Let `product` be the product of all values in the array `nums`.
Return `signFunc(product)`.
**Example 1:**
**Input:** nums = \[-1,-2,-3,-4,... | As with any good dp problem that uses palindromes, try building the palindrome from the edges The prime point is to check that no two adjacent characters are equal, so save the past character while building the palindrome. | String,Dynamic Programming | Medium | 516 |
51 | this is the 51st liquor Challenge and it is called end Queens the end Queens puzzle is the problem of placing in Queens on an N by n chessboard such that Naruto Queens attack each other given an integer n return all distinct solutions to the end Queens puzzle you may return the answer in any Order each solution contain... | N-Queens | n-queens | The **n-queens** puzzle is the problem of placing `n` queens on an `n x n` chessboard such that no two queens attack each other.
Given an integer `n`, return _all distinct solutions to the **n-queens puzzle**_. You may return the answer in **any order**.
Each solution contains a distinct board configuration of the n-... | null | Array,Backtracking | Hard | 52,1043 |
452 | 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 minimum number of arrows to burst balloons so there are some spherical balloons tabbed onto a flat wall that represents the XY plane the balloons are represent as a 2d array called points which is given... | Minimum Number of Arrows to Burst Balloons | minimum-number-of-arrows-to-burst-balloons | There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array `points` where `points[i] = [xstart, xend]` denotes a balloon whose **horizontal diameter** stretches between `xstart` and `xend`. You do not know the exact y-coordinates of the ball... | null | Array,Greedy,Sorting | Medium | 253,435 |
278 | given a series of product versions and also an API is bad version which returns true or false you are asked to find the very first bad version and also keep in mind you should minimize the number of API calls to this operation how can you do that best today's video let's get into it hi everyone my name is Steve today w... | 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 |
438 | going on everyone today we are looking at lead code number 438 find all anagrams in a string this is another question another string question that is frequently asked at a lot of companies so i highly recommend being familiar with it will show up out in the wild and um definitely want to know definitely want to be fami... | Find All Anagrams in a String | find-all-anagrams-in-a-string | Given two strings `s` and `p`, return _an array of all the start indices of_ `p`_'s anagrams in_ `s`. You may return the answer in **any order**.
An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
**Example 1:**
*... | null | Hash Table,String,Sliding Window | Medium | 242,567 |
1,519 | hey everybody this is Larry this is day 12 of the legal daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's Forum 1519 number of notes in the sub tree with the same label hit the like button hit the Subscribe button join me on Discord and let's take a... | Number of Nodes in the Sub-Tree With the Same Label | minimum-subsequence-in-non-increasing-order | You are given a tree (i.e. a connected, undirected graph that has no cycles) consisting of `n` nodes numbered from `0` to `n - 1` and exactly `n - 1` `edges`. The **root** of the tree is the node `0`, and each node of the tree has **a label** which is a lower-case character given in the string `labels` (i.e. The node w... | Sort elements and take each element from the largest until accomplish the conditions. | Array,Greedy,Sorting | Easy | 2316 |
933 | Hello Hi Everyone Welcome To My Channel Today We Are One Of October Channel And Problems Number Of Recent Call 100 You Have A Reception Counter Class Which Country Number Of This And Requested In A Certain Time Frame Implement Vriksha Encounter Class Which Has One Constructor Festival Hours Or Se Request and Third in P... | Number of Recent Calls | increasing-order-search-tree | You have a `RecentCounter` class which counts the number of recent requests within a certain time frame.
Implement the `RecentCounter` class:
* `RecentCounter()` Initializes the counter with zero recent requests.
* `int ping(int t)` Adds a new request at time `t`, where `t` represents some time in milliseconds, a... | null | Stack,Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | null |
1,793 | Today's question is we have maximum score of good sub array problem statement what is given to us in the problem statement we are given an array of numbers and an integer we are given a score we are defined what is the score in the problem statement Meaning of Array: If we Meaning of Array: If we Meaning of Array: If w... | Maximum Score of a Good Subarray | minimum-moves-to-make-array-complementary | You are given an array of integers `nums` **(0-indexed)** and an integer `k`.
The **score** of a subarray `(i, j)` is defined as `min(nums[i], nums[i+1], ..., nums[j]) * (j - i + 1)`. A **good** subarray is a subarray where `i <= k <= j`.
Return _the maximum possible **score** of a **good** subarray._
**Example 1:**... | Given a target sum x, each pair of nums[i] and nums[n-1-i] would either need 0, 1, or 2 modifications. Can you find the optimal target sum x value such that the sum of modifications is minimized? Create a difference array to efficiently sum all the modifications. | Array,Hash Table,Prefix Sum | Medium | null |
1,631 | the problem 1631 and we are trying to find the root effort which is defined as a maximum absolute difference between any consecutive cells and we want to return the minimum effort here so for example one three five the minimum effort here will be two since uh the absolute difference maximum will be two here and if we g... | Path With Minimum Effort | number-of-sub-arrays-with-odd-sum | You are a hiker preparing for an upcoming hike. You are given `heights`, a 2D array of size `rows x columns`, where `heights[row][col]` represents the height of cell `(row, col)`. You are situated in the top-left cell, `(0, 0)`, and you hope to travel to the bottom-right cell, `(rows-1, columns-1)` (i.e., **0-indexed**... | Can we use the accumulative sum to keep track of all the odd-sum sub-arrays ? if the current accu sum is odd, we care only about previous even accu sums and vice versa. | Array,Math,Dynamic Programming,Prefix Sum | Medium | 2242 |
934 | There are six things to do, look, there are a lot of questions, there is nothing to stress you, what do you have to keep in mind here you have to keep two most important things in mind, first of all, make yourself clear here. It is given that there are exactly two islands, exactly how many islands are there in our grat... | Shortest Bridge | bitwise-ors-of-subarrays | You are given an `n x n` binary matrix `grid` where `1` represents land and `0` represents water.
An **island** is a 4-directionally connected group of `1`'s not connected to any other `1`'s. There are **exactly two islands** in `grid`.
You may change `0`'s to `1`'s to connect the two islands to form **one island**.
... | null | Array,Dynamic Programming,Bit Manipulation | Medium | null |
41 | welcome to september's leco challenge the last question of the month today's problem is first missing positive given an unsorted integer array find the smallest missing positive integer example one two zero the smallest positive integer would be three example three four minus one the smallest positive integer would be ... | 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 |
332 | hello friends today that's over reconstruct itinerary given a list of airline tickets represented by pairs of departure in the arrival airports thrown to reconstructed the itinerary in order all of the tickets belong to a man who departs from JFK thus the ident itinerary must begin with JFK and the problem also mention... | Reconstruct Itinerary | reconstruct-itinerary | You are given a list of airline `tickets` where `tickets[i] = [fromi, toi]` represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it.
All of the tickets belong to a man who departs from `"JFK "`, thus, the itinerary must begin with `"JFK "`. If there are multiple... | null | Depth-First Search,Graph,Eulerian Circuit | Hard | 2051,2201 |
67 | Hey hey what's up guys Nick white here I detect OD stuff on Twitch on YouTube haven't posted in a day or two we're gonna get back on it right now check the description for all my information I do premium leak Oh problems on patreon and join my discord this is ad binary this is easy problem got a lot of likes if you don... | Add Binary | add-binary | Given two binary strings `a` and `b`, return _their sum as a binary string_.
**Example 1:**
**Input:** a = "11", b = "1"
**Output:** "100"
**Example 2:**
**Input:** a = "1010", b = "1011"
**Output:** "10101"
**Constraints:**
* `1 <= a.length, b.length <= 104`
* `a` and `b` consist only of `'0'` or `'1'` chara... | null | Math,String,Bit Manipulation,Simulation | Easy | 2,43,66,1031 |
1,051 | hey welcome guys so that song is one zero five one high checker so school is trying to end your photo of all students right so you have a photo a student i'll ask the standard single file a line of non-decreasing order for non-decreasing non-decreasing order for non-decreasing non-decreasing order for non-decreasing ok... | 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 |
1,822 | let's solve sine of the products of an array so we have a function it's called array sign it has a parameter which is a vector of integers by reference it's called nums and we have to find the products of all the values in the array and determine the sign of the results so if the result is positive that is the products... | Sign of the Product of an Array | longest-palindromic-subsequence-ii | There is a function `signFunc(x)` that returns:
* `1` if `x` is positive.
* `-1` if `x` is negative.
* `0` if `x` is equal to `0`.
You are given an integer array `nums`. Let `product` be the product of all values in the array `nums`.
Return `signFunc(product)`.
**Example 1:**
**Input:** nums = \[-1,-2,-3,-4,... | As with any good dp problem that uses palindromes, try building the palindrome from the edges The prime point is to check that no two adjacent characters are equal, so save the past character while building the palindrome. | String,Dynamic Programming | Medium | 516 |
69 | so welcome to my channel doctor today we are going to solve a problem called square root of x so the main intention is to understand what are the intuition behind this problem so when somebody asks you sk find the square root of x or find the cube root of x or find the power of x there is a common algorithm or you can ... | Sqrt(x) | sqrtx | Given a non-negative integer `x`, return _the square root of_ `x` _rounded down to the nearest integer_. The returned integer should be **non-negative** as well.
You **must not use** any built-in exponent function or operator.
* For example, do not use `pow(x, 0.5)` in c++ or `x ** 0.5` in python.
**Example 1:**
... | Try exploring all integers. (Credits: @annujoshi) Use the sorted property of integers to reduced the search space. (Credits: @annujoshi) | Math,Binary Search | Easy | 50,367 |
148 | Loot Oil Welcome To Learn Repeat Today Bill Boxing Day Thirteen Update Change The Name Of The Problem Me Shot Latest Updates Login Problem Only Problem States Give The Head Of Liquids Return Delhi Starter Shopping Destination Digger Inform This Can Us For Telling List In Open Login Time and open memory is a subject was... | Sort List | sort-list | Given the `head` of a linked list, return _the list after sorting it in **ascending order**_.
**Example 1:**
**Input:** head = \[4,2,1,3\]
**Output:** \[1,2,3,4\]
**Example 2:**
**Input:** head = \[-1,5,3,4,0\]
**Output:** \[-1,0,3,4,5\]
**Example 3:**
**Input:** head = \[\]
**Output:** \[\]
**Constraints:**
* ... | null | Linked List,Two Pointers,Divide and Conquer,Sorting,Merge Sort | Medium | 21,75,147,1992 |
368 | hello everyone welcome to date night 15th of november challenge and today's question is largest divisible subset in this question we are given an array of positive integers and we need to identify the largest subset as an answer such that each pair entry that exist in that subset satisfies this property either a modulu... | Largest Divisible Subset | largest-divisible-subset | Given a set of **distinct** positive integers `nums`, return the largest subset `answer` such that every pair `(answer[i], answer[j])` of elements in this subset satisfies:
* `answer[i] % answer[j] == 0`, or
* `answer[j] % answer[i] == 0`
If there are multiple solutions, return any of them.
**Example 1:**
**Inp... | null | Array,Math,Dynamic Programming,Sorting | Medium | null |
388 | in this video we're going to be looking at this problem longest absolute file path so we're given a file system that stores both files and directories here's an example of that file system so you have dir then subdir1 file1.ext have dir then subdir1 file1.ext have dir then subdir1 file1.ext sub subdir1 subner2 sub subn... | Longest Absolute File Path | longest-absolute-file-path | Suppose we have a file system that stores both files and directories. An example of one system is represented in the following picture:
Here, we have `dir` as the only directory in the root. `dir` contains two subdirectories, `subdir1` and `subdir2`. `subdir1` contains a file `file1.ext` and subdirectory `subsubdir1`.... | null | String,Stack,Depth-First Search | Medium | null |
187 | Hello Hi Everyone Welcome To My Channel Today Vishal's Problem Repeated DNA Sequence Sold In Is Composed Of A Series Of Nucleotides Every Son CET For Example A CGTTCE Web Streaming DLNA Mitti Sometime Useful To Identify Repeat Sequences With Tel Function To Find All The Channel Subscribe Indian molecule for example sub... | Repeated DNA Sequences | repeated-dna-sequences | The **DNA sequence** is composed of a series of nucleotides abbreviated as `'A'`, `'C'`, `'G'`, and `'T'`.
* For example, `"ACGAATTCCG "` is a **DNA sequence**.
When studying **DNA**, it is useful to identify repeated sequences within the DNA.
Given a string `s` that represents a **DNA sequence**, return all the *... | null | Hash Table,String,Bit Manipulation,Sliding Window,Rolling Hash,Hash Function | Medium | null |
783 | uh this question is a minimum difference between PST nodes so you're given a root of a PSD and then return the minimum difference between the value of any two different nodes in the tree so basically like you can Traverse the tree and then uh get your current now and then subtract by the previous node and then this wil... | Minimum Distance Between BST Nodes | search-in-a-binary-search-tree | Given the `root` of a Binary Search Tree (BST), return _the minimum difference between the values of any two different nodes in the tree_.
**Example 1:**
**Input:** root = \[4,2,6,1,3\]
**Output:** 1
**Example 2:**
**Input:** root = \[1,0,48,null,null,12,49\]
**Output:** 1
**Constraints:**
* The number of nodes... | null | Tree,Binary Search Tree,Binary Tree | Easy | 270,784 |
162 | everyone it's Orkin welcome to my Channel today we are gonna solve a lead code 162 find Peak element problem so the problem statement is that we are given an input array and we need to find a peak element and return that Peak element in case if we have multiple Peaks we can return any pick um another important requirem... | 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 |
401 | Soon hello guys normal tell me their video line and liquid problem description And subscribe The Amazing hai kuch nahin soch raha hoon nine mostly ko Meghnad teri tarf and video arrow button like share subscribe 0nline Adhir Veerwati subscribe must subscribe channel Must listen, according to the blossom on the mango tr... | 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 |
1,752 | hey guys how's everything going this is jayster in this video i'm going to solve another problem from lead code uh it's a one seven five three two check if array is sorted and rotated given an array nums return true if the array was originally soared in a non-decreasing soared in a non-decreasing soared in a non-decrea... | Check if Array Is Sorted and Rotated | arithmetic-subarrays | Given an array `nums`, return `true` _if the array was originally sorted in non-decreasing order, then rotated **some** number of positions (including zero)_. Otherwise, return `false`.
There may be **duplicates** in the original array.
**Note:** An array `A` rotated by `x` positions results in an array `B` of the sa... | To check if a given sequence is arithmetic, just check that the difference between every two consecutive elements is the same. If and only if a set of numbers can make an arithmetic sequence, then its sorted version makes an arithmetic sequence. So to check a set of numbers, sort it, and check if that sequence is arith... | Array,Sorting | Medium | 413,1626 |
301 | and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem 301 remove invalid parentheses given a string s that contains parentheses and letters remove the minimum number of invalid parentheses to make the input string valid return all possible results you may return the ans... | Remove Invalid Parentheses | remove-invalid-parentheses | Given a string `s` that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.
Return _a list of **unique strings** that are valid with the minimum number of removals_. You may return the answer in **any order**.
**Example 1:**
**Input:** s = "()())() "
**... | Since we don't know which of the brackets can possibly be removed, we try out all the options! We can use recursion to try out all possibilities for the given expression. For each of the brackets, we have 2 options:
We keep the bracket and add it to the expression that we are building on the fly during recursion.... | String,Backtracking,Breadth-First Search | Hard | 20,2095 |
639 | welcome to july's lee code challenge this problem is called decode ways 2. a message containing letters from a to z can be encoded into numbers using the following mapping a is 1 b is 2 z is 26. to decode an encoded message all the digits must be grouped together uh or grouped then mapped back into letters using the re... | Decode Ways II | decode-ways-ii | 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 | Hard | 91,2091,2251 |
630 | hey everybody this is larry this is day 23 of the leeco day challenge hit the like button to subscribe on drum and discord let me know what you think about today's problem i have gotten comments recently about my mic being too low um i'm checking the levels and it does seem a little low i don't know what to make of it ... | Course Schedule III | course-schedule-iii | There are `n` different online courses numbered from `1` to `n`. You are given an array `courses` where `courses[i] = [durationi, lastDayi]` indicate that the `ith` course should be taken **continuously** for `durationi` days and must be finished before or on `lastDayi`.
You will start on the `1st` day and you cannot ... | During iteration, say I want to add the current course, currentTotalTime being total time of all courses taken till now, but adding the current course might exceed my deadline or it doesn’t.
1. If it doesn’t, then I have added one new course. Increment the currentTotalTime with duration of current course. 2. If it e... | Array,Greedy,Heap (Priority Queue) | Hard | 207,210,2176 |
151 | hey friends welcome to the new episode of Kult was just and today we're going to do lead code number 151 reverse words English training if the input is the sky is blue and alpha will be blue is sky and we can see the edge cases includes the leading and trailing spaces and we need to delete all the actual spaces in betw... | Reverse Words in a String | reverse-words-in-a-string | Given an input string `s`, reverse the order of the **words**.
A **word** is defined as a sequence of non-space characters. The **words** in `s` will be separated by at least one space.
Return _a string of the words in reverse order concatenated by a single space._
**Note** that `s` may contain leading or trailing s... | null | Two Pointers,String | Medium | 186 |
221 | all right let's talk about the maximum square so you're given an unbiased matrix so you have to return the largest square containing only one so you have to return the area so this question is supposed to be easy so um you are given a matrix like this so basically just create another matrix the same size is going to be... | Maximal Square | maximal-square | Given an `m x n` binary `matrix` filled with `0`'s and `1`'s, _find the largest square containing only_ `1`'s _and return its area_.
**Example 1:**
**Input:** matrix = \[\[ "1 ", "0 ", "1 ", "0 ", "0 "\],\[ "1 ", "0 ", "1 ", "1 ", "1 "\],\[ "1 ", "1 ", "1 ", "1 ", "1 "\],\[ "1 ", "0 ", "0 ", "1 ", "0 "\]\]
**Output:*... | null | Array,Dynamic Programming,Matrix | Medium | 85,769,1312,2200 |
67 | Jai hind this video clip year digit code number 6 7 4 dictionary 2012 - ring return visam also this 2012 - ring return visam also this 2012 - ring return visam also this resting in posting and sense nine marks lead character 0512 subscribe video number two main one plus one two three and find to march 2018 live 1000 ja... | Add Binary | add-binary | Given two binary strings `a` and `b`, return _their sum as a binary string_.
**Example 1:**
**Input:** a = "11", b = "1"
**Output:** "100"
**Example 2:**
**Input:** a = "1010", b = "1011"
**Output:** "10101"
**Constraints:**
* `1 <= a.length, b.length <= 104`
* `a` and `b` consist only of `'0'` or `'1'` chara... | null | Math,String,Bit Manipulation,Simulation | Easy | 2,43,66,1031 |
115 | we're going to take a look at a legal problem called distinct sub sequences so given two strings s and t return the number of distinct subsequence of s which equals t so a string subsequence is a new string formed from the original string by deleting some can be none of characters without disrupting the remaining chara... | Distinct Subsequences | distinct-subsequences | Given two strings `s` and `t`, return _the number of distinct_ **_subsequences_** _of_ `s` _which equals_ `t`.
The test cases are generated so that the answer fits on a 32-bit signed integer.
**Example 1:**
**Input:** s = "rabbbit ", t = "rabbit "
**Output:** 3
**Explanation:**
As shown below, there are 3 ways you... | null | String,Dynamic Programming | Hard | 2115 |
1,317 | elephants so today we are discuss this question on feed code 171 if you could bt 171 question number one three months if convert integer to the sum of non zero mission statement states that you are given and into the tent and you have to return two integers a and B says that the two a and B are the nonzero integers it ... | 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 |
1,663 | hello everyone welcome to quartus camp we are a 22nd day of march lead code challenge and the problem we are going to cover in this video is smallest string with a given numeric value so the input given here is to integer value n and k and we have to return a string as an output which is nothing but lexicographically s... | Smallest String With A Given Numeric Value | detect-cycles-in-2d-grid | The **numeric value** of a **lowercase character** is defined as its position `(1-indexed)` in the alphabet, so the numeric value of `a` is `1`, the numeric value of `b` is `2`, the numeric value of `c` is `3`, and so on.
The **numeric value** of a **string** consisting of lowercase characters is defined as the sum of... | Keep track of the parent (previous position) to avoid considering an invalid path. Use DFS or BFS and keep track of visited cells to see if there is a cycle. | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | null |
216 | welcome to september's lego challenge today's problem is combination sum three find out possible combinations of k numbers that add up to a number n given that only numbers one to nine can be used and each combination should be a unique set of numbers so that's actually very helpful that each combination can only be a ... | 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 |
378 | welcome to july's leeco challenge today's problem is k smallest element in a sorted matrix given an m times n matrix where each of the rows and columns are sorted in ascending order we turn the kth smallest element in the matrix now note that it is the k smallest element in the sorted order not the case distinct elemen... | Kth Smallest Element in a Sorted Matrix | kth-smallest-element-in-a-sorted-matrix | Given an `n x n` `matrix` where each of the rows and columns is sorted in ascending order, return _the_ `kth` _smallest element in the matrix_.
Note that it is the `kth` smallest element **in the sorted order**, not the `kth` **distinct** element.
You must find a solution with a memory complexity better than `O(n2)`.... | null | Array,Binary Search,Sorting,Heap (Priority Queue),Matrix | Medium | 373,668,719,802 |
478 | hello everyone welcome to day 17th of march lead code challenge and today's question is generate random points in a circle in this question you are given three parameters the first one is the radius of the circle the second one is the x coordinate of the center of the circle followed by the y coordinate of the center o... | Generate Random Point in a Circle | generate-random-point-in-a-circle | Given the radius and the position of the center of a circle, implement the function `randPoint` which generates a uniform random point inside the circle.
Implement the `Solution` class:
* `Solution(double radius, double x_center, double y_center)` initializes the object with the radius of the circle `radius` and th... | null | null | Medium | null |
147 | hi guys how are you i hope all you are doing good welcome to the learn code easily so today we will solve one more question that is medial well question and the question is insertion list it's it is a very easy question actually this is coming from the insertion sort if you know the insertion sort then you have to then... | Insertion Sort List | insertion-sort-list | Given the `head` of a singly linked list, sort the list using **insertion sort**, and return _the sorted list's head_.
The steps of the **insertion sort** algorithm:
1. Insertion sort iterates, consuming one input element each repetition and growing a sorted output list.
2. At each iteration, insertion sort removes... | null | Linked List,Sorting | Medium | 148,850 |
363 | welcome to july third sleep code challenge maximum sum max sum of rectangle no larger than k given an m by n matrix entry k return the maximum sum of the rectangle and the matrix such that its sum is no larger than k it's guaranteed that there will be a rectangle with the sum larger than k so given this matrix here uh ... | Max Sum of Rectangle No Larger Than K | max-sum-of-rectangle-no-larger-than-k | Given an `m x n` matrix `matrix` and an integer `k`, return _the max sum of a rectangle in the matrix such that its sum is no larger than_ `k`.
It is **guaranteed** that there will be a rectangle with a sum no larger than `k`.
**Example 1:**
**Input:** matrix = \[\[1,0,1\],\[0,-2,3\]\], k = 2
**Output:** 2
**Explana... | null | Array,Binary Search,Dynamic Programming,Matrix,Ordered Set | Hard | null |
1,859 | hey everybody this is larry this is me going over q1 of the bi-weekly me going over q1 of the bi-weekly me going over q1 of the bi-weekly contest 52 52nd sorting the sentence so hit the like button hit the subscribe button join me on discord let me know what you think about this prom so this one could be it could be a ... | Sorting the Sentence | change-minimum-characters-to-satisfy-one-of-three-conditions | A **sentence** is a list of words that are separated by a single space with no leading or trailing spaces. Each word consists of lowercase and uppercase English letters.
A sentence can be **shuffled** by appending the **1-indexed word position** to each word then rearranging the words in the sentence.
* For example... | Iterate on each letter in the alphabet, and check the smallest number of operations needed to make it one of the following: the largest letter in a and smaller than the smallest one in b, vice versa, or let a and b consist only of this letter. For the first 2 conditions, take care that you can only change characters to... | Hash Table,String,Counting,Prefix Sum | Medium | null |
805 | hey everybody this is Larry this is me trying to do a bonus prom that haven't done before hit the like button hit the Subscribe button join me on Discord let me know what you think about this one on February 20th 20 24 I almost forgot the year a second all right we have a hard problem today so hopefully not too hard ho... | Split Array With Same Average | escape-the-ghosts | You are given an integer array `nums`.
You should move each element of `nums` into one of the two arrays `A` and `B` such that `A` and `B` are non-empty, and `average(A) == average(B)`.
Return `true` if it is possible to achieve that and `false` otherwise.
**Note** that for an array `arr`, `average(arr)` is the sum ... | null | Array,Math | Medium | 1727 |
215 | hello everyone welcome back here is vanamsen today we are diving into a super interesting coding problem number 250 key largest element in an array so it's a daily lead code Challenge and also its classic problem very common on uh coding interview so make sure to stick around till the end okay so uh here is the test gu... | Kth Largest Element in an Array | kth-largest-element-in-an-array | Given an integer array `nums` and an integer `k`, return _the_ `kth` _largest element in the array_.
Note that it is the `kth` largest element in the sorted order, not the `kth` distinct element.
You must solve it in `O(n)` time complexity.
**Example 1:**
**Input:** nums = \[3,2,1,5,6,4\], k = 2
**Output:** 5
**Ex... | null | Array,Divide and Conquer,Sorting,Heap (Priority Queue),Quickselect | Medium | 324,347,414,789,1014,2113,2204,2250 |
621 | everyone welcome back and let's write some more neat code today so today let's solve the problem task scheduler one of you suggested this problem and i think it's a pretty good one so we're given an array of tasks it's a character array and it's going to be limited to the characters from uppercase a to uppercase z so 2... | Task Scheduler | task-scheduler | Given a characters array `tasks`, representing the tasks a CPU needs to do, where each letter represents a different task. Tasks could be done in any order. Each task is done in one unit of time. For each unit of time, the CPU could complete either one task or just be idle.
However, there is a non-negative integer `n`... | null | Array,Hash Table,Greedy,Sorting,Heap (Priority Queue),Counting | Medium | 358,778,2084 |
403 | hello everyone welcome back here is Van Amazon and today we are diving into a fascinating problem on uh lead code the frog jump problem so you will understand the logic behind the solution and how to implement it in Python and for those of you who prefer other languages don't worry I will provide implementation in the ... | 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 |
118 | all right so this leap code question is called Pascal's triangle it says given a non-negative integer num rows generate non-negative integer num rows generate non-negative integer num rows generate the first num rows of Pascal's triangle in Pascal's triangle each number is the sum of the two numbers directly above it s... | Pascal's Triangle | pascals-triangle | Given an integer `numRows`, return the first numRows of **Pascal's triangle**.
In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown:
**Example 1:**
**Input:** numRows = 5
**Output:** \[\[1\],\[1,1\],\[1,2,1\],\[1,3,3,1\],\[1,4,6,4,1\]\]
**Example 2:**
**Input:** numRows = ... | null | Array,Dynamic Programming | Easy | 119 |
682 | everyone welcome back and let's write some more neat code today so today let's solve the problem baseball game even though this has practically nothing to do with baseball maybe that's why it has so many dislikes because other than that i think it's a pretty good problem it's very logical there's no crazy tricks behind... | Baseball Game | baseball-game | You are keeping the scores for a baseball game with strange rules. At the beginning of the game, you start with an empty record.
You are given a list of strings `operations`, where `operations[i]` is the `ith` operation you must apply to the record and is one of the following:
* An integer `x`.
* Record a new... | null | Array,Stack,Simulation | Easy | 1720 |
157 | yo whatsapp vyas going students should be given all circulars question which is the read and tagged as given read most loudly okay what is this is like and he is the question like and subscribe this Video give a video liquid liner person subscribe problems - Abdominal Total and Guys So problems - Abdominal Total and Gu... | Read N Characters Given Read4 | read-n-characters-given-read4 | Given a `file` and assume that you can only read the file using a given method `read4`, implement a method to read `n` characters.
**Method read4:**
The API `read4` reads **four consecutive characters** from `file`, then writes those characters into the buffer array `buf4`.
The return value is the number of actual c... | null | String,Simulation,Interactive | Easy | 158 |
141 | in this video we'll go over Lee code question number 141 link list cycle given the head to a linked list we need to return true if there is a cycle in the linked list or return false if there isn't one so what exactly is a cycle in a linked list well a linked list consists of nodes and pointers to the next node in the ... | 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 |
336 | hey coders so today we will look at this problem number 336 balance bears which says given a list of unique words return all the pair of distinct indices i j in the given list so that the concatenation of the two words word i and word j is a bad intro right so okay so this is a palindrome sort of question so if we have... | 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 |
186 | all right so let's talk about the reverse Source in the string too so you're giving the charter radius and then reverse the order of the word so this is going to be pretty much it right so you have to reverse the original chart right so again so little sky is blue right so you blue put it in it first is put it as a sec... | Reverse Words in a String II | reverse-words-in-a-string-ii | Given a character array `s`, reverse the order of the **words**.
A **word** is defined as a sequence of non-space characters. The **words** in `s` will be separated by a single space.
Your code must solve the problem **in-place,** i.e. without allocating extra space.
**Example 1:**
**Input:** s = \["t","h","e"," ",... | null | Two Pointers,String | Medium | 151,189 |
179 | hey guys welcome back to another video and today we're going to be solving the lead code question largest number all right so in this question we're given a list of non-negative integers given a list of non-negative integers given a list of non-negative integers and we want to arrange them in such a way that they form ... | Largest Number | largest-number | Given a list of non-negative integers `nums`, arrange them such that they form the largest number and return it.
Since the result may be very large, so you need to return a string instead of an integer.
**Example 1:**
**Input:** nums = \[10,2\]
**Output:** "210 "
**Example 2:**
**Input:** nums = \[3,30,34,5,9\]
*... | null | String,Greedy,Sorting | Medium | 2284 |
1,662 | welcome to january's legal challenge today's problem is check if two string arrays are equivalent given two string arrays word one and word two return true if the two arrays represent the same string so what do we mean so we're given a list of strings you can see though that they're going to be kind of split up in diff... | Check If Two String Arrays are Equivalent | minimum-numbers-of-function-calls-to-make-target-array | Given two string arrays `word1` and `word2`, return `true` _if the two arrays **represent** the same string, and_ `false` _otherwise._
A string is **represented** by an array if the array elements concatenated **in order** forms the string.
**Example 1:**
**Input:** word1 = \[ "ab ", "c "\], word2 = \[ "a ", "bc "... | Work backwards: try to go from nums to arr. You should try to divide by 2 as much as possible, but you can only divide by 2 if everything is even. | Array,Greedy | Medium | null |
695 | So if Video Inderpreet Kaur Degree Holder Problem Max India Of Ireland Surya Giver Great And Basically Ireland Group-1 Connected For Directions Where Is Group-1 Connected For Directions Where Is Group-1 Connected For Directions Where Is The Number Of The Return Of The Volume To Maximum Subscribe Example Which You Have ... | Max Area of Island | max-area-of-island | You are given an `m x n` binary matrix `grid`. An island is a group of `1`'s (representing land) connected **4-directionally** (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.
The **area** of an island is the number of cells with a value `1` in the island.
Return _the maxim... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | 200,463,1845,2206 |
304 | Ajay Ko Hello Hi Everyone Welcome To My Channel It's All The List Problem 304 Ransomware Redeem Your Troubles For This Problem Is Very Famous Interview Problem Anycut Aaj In Amazon Google Microsoft Interview subscribe to the Page if you liked The Video then subscribe to the Page Indian Ginger Green can we like this red... | Range Sum Query 2D - Immutable | range-sum-query-2d-immutable | Given a 2D matrix `matrix`, handle multiple queries of the following type:
* Calculate the **sum** of the elements of `matrix` inside the rectangle defined by its **upper left corner** `(row1, col1)` and **lower right corner** `(row2, col2)`.
Implement the `NumMatrix` class:
* `NumMatrix(int[][] matrix)` Initial... | null | Array,Design,Matrix,Prefix Sum | Medium | 303,308 |
1,646 | hi guys welcome to algorithms made easy in this video we will see the question get maximum in generated array you are given an integer n and an array numbers of length n plus 1 is generated in the following way numbers of 0 becomes 0 nums of 1 becomes 1 and for any nums 2 into i it becomes nums of i and for any nums 2 ... | Get Maximum in Generated Array | kth-missing-positive-number | You are given an integer `n`. A **0-indexed** integer array `nums` of length `n + 1` is generated in the following way:
* `nums[0] = 0`
* `nums[1] = 1`
* `nums[2 * i] = nums[i]` when `2 <= 2 * i <= n`
* `nums[2 * i + 1] = nums[i] + nums[i + 1]` when `2 <= 2 * i + 1 <= n`
Return _the **maximum** integer in the... | Keep track of how many positive numbers are missing as you scan the array. | Array,Binary Search | Easy | 2305 |
1,996 | hello welcome to my channel today let's talk about lead coder 1096 the number of weak characters in the game so um it will give you a 2d array called properties and then each element of the properties is a two are two uh length of two integer array uh the first one is called attack the second one is called defense so o... | The Number of Weak Characters in the Game | number-of-ways-to-rearrange-sticks-with-k-sticks-visible | You are playing a game that contains multiple characters, and each of the characters has **two** main properties: **attack** and **defense**. You are given a 2D integer array `properties` where `properties[i] = [attacki, defensei]` represents the properties of the `ith` character in the game.
A character is said to be... | Is there a way to build the solution from a base case? How many ways are there if we fix the position of one stick? | Math,Dynamic Programming,Combinatorics | Hard | null |
253 | hey everyone in this video let's go to question 253 meeting rooms 2 on leak code this is part of a blind 75 list of questions so let's begin so this question is actually a premium question and that's why we're doing it on this lint code website that's why the number here is different but otherwise the question and the ... | 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 |
1,346 | Going to question check double exists a simple exists whose double is also in the same array as in this example punch is a number whose double i.e. 10 number whose double i.e. 10 number whose double i.e. 10 remaxists from this what does it mean I will return true second example What is 317? There is no number whose dou... | Check If N and Its Double Exist | maximize-the-topmost-element-after-k-moves | Given an array `arr` of integers, check if there exist two indices `i` and `j` such that :
* `i != j`
* `0 <= i, j < arr.length`
* `arr[i] == 2 * arr[j]`
**Example 1:**
**Input:** arr = \[10,2,5,3\]
**Output:** true
**Explanation:** For i = 0 and j = 2, arr\[i\] == 10 == 2 \* 5 == 2 \* arr\[j\]
**Example 2:**... | For each index i, how can we check if nums[i] can be present at the top of the pile or not after k moves? For which conditions will we end up with an empty pile? | Array,Greedy | Medium | 134 |
51 | hi guys this is khushboo and welcome to algorithms made easy in this video we'll see the question n queens the n queen puzzle is a problem of placing n number of queens on an n cross n chessboard such that no two queens attack each other given an integer n return all the distinct solutions to the end queen puzzle each ... | N-Queens | n-queens | The **n-queens** puzzle is the problem of placing `n` queens on an `n x n` chessboard such that no two queens attack each other.
Given an integer `n`, return _all distinct solutions to the **n-queens puzzle**_. You may return the answer in **any order**.
Each solution contains a distinct board configuration of the n-... | null | Array,Backtracking | Hard | 52,1043 |
912 | hi everyone welcome back to the channel and today we're going to solve with code daily challenge problem number 912 sort and array so it's a really simple and a straightforward problem in which uh they want us to solve or they want us to sort an array in an ascending order and just want to return that okay and this is ... | Sort an Array | random-pick-with-weight | Given an array of integers `nums`, sort the array in ascending order and return it.
You must solve the problem **without using any built-in** functions in `O(nlog(n))` time complexity and with the smallest space complexity possible.
**Example 1:**
**Input:** nums = \[5,2,3,1\]
**Output:** \[1,2,3,5\]
**Explanation:*... | null | Math,Binary Search,Prefix Sum,Randomized | Medium | 398,894,914 |
859 | Hello hello welcome to Delhi report is required till 1658 we are in this news district so I will give into strips 60 units start to-do list like example with 2GB RAM by Saurabh Singh b positive thinking simple to b subscribe and subscirbe subscribe now Now To Receive New Updates Hai Ki Saugandh 300 Ko Zara Because They... | Buddy Strings | design-circular-deque | Given two strings `s` and `goal`, return `true` _if you can swap two letters in_ `s` _so the result is equal to_ `goal`_, otherwise, return_ `false`_._
Swapping letters is defined as taking two indices `i` and `j` (0-indexed) such that `i != j` and swapping the characters at `s[i]` and `s[j]`.
* For example, swappi... | null | Array,Linked List,Design,Queue | Medium | 860,1767 |
17 | hey everyone welcome back and let's write some more neat code today so today let's solve letter combinations of a phone number so we're given a string of digits that contain only two through nine so the digits are only going to contain the numbers 2 through 9 and we want to return all possible letter combinations that ... | Letter Combinations of a Phone Number | letter-combinations-of-a-phone-number | Given a string containing digits from `2-9` inclusive, return all possible letter combinations that the number could represent. Return the answer in **any order**.
A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.
**Example 1:**
**Input:** di... | null | Hash Table,String,Backtracking | Medium | 22,39,401 |
295 | hi guys in this video i'm going to walk through this elite call number 2.95 find through this elite call number 2.95 find through this elite call number 2.95 find medium from data stream uh so this question was asked by uh amazon microsoft facebook apple big dance and not other big names and obviously amazon loves this... | Find Median from Data Stream | find-median-from-data-stream | The **median** is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two middle values.
* For example, for `arr = [2,3,4]`, the median is `3`.
* For example, for `arr = [2,3]`, the median is `(2 + 3) / 2 = 2.5`.
Implement the M... | null | Two Pointers,Design,Sorting,Heap (Priority Queue),Data Stream | Hard | 480,1953,2207 |
81 | hello everyone so how are you all so I am Aditya and I'm again with a new question on lead code today we will be solving the search in rotated sorted array so now let's read out the problem first so this is the question and we are given there is an integer array nums okay we have been given an integer array okay its na... | Search in Rotated Sorted Array II | search-in-rotated-sorted-array-ii | There is an integer array `nums` sorted in non-decreasing order (not necessarily with **distinct** values).
Before being passed to your function, `nums` is **rotated** at an unknown pivot index `k` (`0 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nu... | null | Array,Binary Search | Medium | 33 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.