id int64 1 2k | content stringlengths 272 88.9k | title stringlengths 3 77 | title_slug stringlengths 3 79 | question_content stringlengths 230 5k | question_hints stringclasses 695
values | tag stringclasses 618
values | level stringclasses 3
values | similar_question_ids stringclasses 822
values |
|---|---|---|---|---|---|---|---|---|
1,347 | what's up guys welcome to my channel today we're going to be solving a programming question called minimum number of steps to make two strings anagram this is a medium level question and the problem description goes like this given two equal sized strings s and T in one step you can choose any character of T and replac... | Minimum Number of Steps to Make Two Strings Anagram | distance-to-a-cycle-in-undirected-graph | You are given two strings of the same length `s` and `t`. In one step you can choose **any character** of `t` and replace it with **another character**.
Return _the minimum number of steps_ to make `t` an anagram of `s`.
An **Anagram** of a string is a string that contains the same characters with a different (or the... | This problem can be broken down into two parts: finding the cycle, and finding the distance between each node and the cycle. How can we find the cycle? We can use DFS and keep track of the nodes we’ve seen, and the order that we see them in. Once we see a node we’ve already visited, we know that the cycle contains the ... | Depth-First Search,Breadth-First Search,Union Find,Graph | Hard | 2218 |
36 | hello everyone today we are going to solve the lead code question number 36 valid Sudoku the question is determine if a 9 cross 9 Sudoku board is valid only if the filled cells needs to be validated according to the following rules and the rules are every row must contain digits one to nine without repetition every col... | 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 |
371 | hey everybody so today uh today i would like to tackle uh these questions of binary bit manipulation so we just finished a section of array from last week and starting from this week i will tackle some problems regarding bit manipulation and then the first question is this saudi 371 sum of two integers so the question ... | Sum of Two Integers | sum-of-two-integers | Given two integers `a` and `b`, return _the sum of the two integers without using the operators_ `+` _and_ `-`.
**Example 1:**
**Input:** a = 1, b = 2
**Output:** 3
**Example 2:**
**Input:** a = 2, b = 3
**Output:** 5
**Constraints:**
* `-1000 <= a, b <= 1000` | null | Math,Bit Manipulation | Medium | 2 |
1,707 | More Amal Tomato Channels Rating Speed Manual Today Will Be Solving Gilas Problem Nobel Price Players And Navjeevan Problem Hee Problem Stitch Maths And Query Is Ribbon Amazon Adheen That It's Okay Thank You Also Give One Love Stories Consisting Of Name Cars Services Which Countries And Where Is Not All The Best Contai... | Maximum XOR With an Element From Array | check-if-string-is-transformable-with-substring-sort-operations | You are given an array `nums` consisting of non-negative integers. You are also given a `queries` array, where `queries[i] = [xi, mi]`.
The answer to the `ith` query is the maximum bitwise `XOR` value of `xi` and any element of `nums` that does not exceed `mi`. In other words, the answer is `max(nums[j] XOR xi)` for a... | Suppose the first digit you need is 'd'. How can you determine if it's possible to get that digit there? Consider swapping adjacent characters to maintain relative ordering. | String,Greedy,Sorting | Hard | null |
105 | hello everyone welcome to clean coder youtube channel so today we are going to solve problem number 105 construct binary tree from reorder and in order traversal so this is a very widely asked problem both in online tests and for interviews so i'll recommend you to please watch the complete video and please pay your fu... | 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,848 | foreign distance to the Target element the question is given an integer array nums zero indexed and N in two integers Target and start find an index I such that nums of I is equal to Target and absolute value of I minus start is minimized so we have to find a index which we have to find a number which is equal to Targe... | Minimum Distance to the Target Element | sum-of-unique-elements | Given an integer array `nums` **(0-indexed)** and two integers `target` and `start`, find an index `i` such that `nums[i] == target` and `abs(i - start)` is **minimized**. Note that `abs(x)` is the absolute value of `x`.
Return `abs(i - start)`.
It is **guaranteed** that `target` exists in `nums`.
**Example 1:**
**... | Use a dictionary to count the frequency of each number. | Array,Hash Table,Counting | Easy | null |
1,832 | hello guys so in this video we will be looking at the leap code problem check if the sentence is a panogram so what is the pentagram first of all so it is given in the problem statement that a panagram is a sentence where every letter of the english alphabet appears at least once so all the letters from a to z have to ... | Check if the Sentence Is Pangram | minimum-operations-to-make-a-subsequence | A **pangram** is a sentence where every letter of the English alphabet appears at least once.
Given a string `sentence` containing only lowercase English letters, return `true` _if_ `sentence` _is a **pangram**, or_ `false` _otherwise._
**Example 1:**
**Input:** sentence = "thequickbrownfoxjumpsoverthelazydog "
**O... | The problem can be reduced to computing Longest Common Subsequence between both arrays. Since one of the arrays has distinct elements, we can consider that these elements describe an arrangement of numbers, and we can replace each element in the other array with the index it appeared at in the first array. Then the pro... | Array,Hash Table,Binary Search,Greedy | Hard | null |
1,338 | Hello Friends Chote Reduces Problem List Ko Problem Name Reduce The Recite Surah Of Ajmer Simple Problem But Its Related Problems Not To Medium Can Forget It Was Sent From Segment First And Its Just Observe Chemical Mixture Like Background Related No Problem Video Also Took Place When It's Worst Back Collect Flame Medi... | Reduce Array Size to The Half | queries-quality-and-percentage | You are given an integer array `arr`. You can choose a set of integers and remove all the occurrences of these integers in the array.
Return _the minimum size of the set so that **at least** half of the integers of the array are removed_.
**Example 1:**
**Input:** arr = \[3,3,3,3,5,5,5,2,2,7\]
**Output:** 2
**Explan... | null | Database | Easy | 1773 |
1,997 | hey everybody this is larry this is me going with q3 of the weekly contest 257 first day where you have been in all the rooms uh hit the like button in the subscribe button join me on discord especially if you like this one get it i don't know uh but yeah join me on discord and we'll chat about this room and other prob... | First Day Where You Have Been in All the Rooms | next-palindrome-using-same-digits | There are `n` rooms you need to visit, labeled from `0` to `n - 1`. Each day is labeled, starting from `0`. You will go in and visit one room a day.
Initially on day `0`, you visit room `0`. The **order** you visit the rooms for the coming days is determined by the following **rules** and a given **0-indexed** array `... | Is it possible to swap one character in the first half of the palindrome to make the next one? Are there different cases for when the length is odd and even? | Two Pointers,String | Hard | 556,564 |
383 | hello and welcome to another one of my lead code videos in this one we'll do Elite code 383 Ransom note which basically says you're given a ransom note and a magazine and we want to know if the ransom note can be fully constructed using the letters from magazine each letter and magazine can only be used once right so i... | Ransom Note | ransom-note | Given two strings `ransomNote` and `magazine`, return `true` _if_ `ransomNote` _can be constructed by using the letters from_ `magazine` _and_ `false` _otherwise_.
Each letter in `magazine` can only be used once in `ransomNote`.
**Example 1:**
**Input:** ransomNote = "a", magazine = "b"
**Output:** false
**Example ... | null | Hash Table,String,Counting | Easy | 691 |
1,782 | hey what's up guys uh this is chung here so today uh lead code problem number one thousand seven hundred and eighty two count pairs of notes okay so given like undirected graph here you know represented by integer n which is the number of nodes and then you are also given like the adjacent list right so i think this is... | Count Pairs Of Nodes | smallest-string-with-a-given-numeric-value | You are given an undirected graph defined by an integer `n`, the number of nodes, and a 2D integer array `edges`, the edges in the graph, where `edges[i] = [ui, vi]` indicates that there is an **undirected** edge between `ui` and `vi`. You are also given an integer array `queries`.
Let `incident(a, b)` be defined as t... | Think greedily. If you build the string from the end to the beginning, it will always be optimal to put the highest possible character at the current index. | String,Greedy | Medium | null |
48 | That dates, today we will give the eighth question of our play list, the question is kept medium, list code number is dry ginger, the name of the question is roti image, we have to rotate this image in clockwise, okay, so many companies have asked Amazon India for Microsoft Paytm Which is fine, so now we see what is it... | Rotate Image | rotate-image | You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise).
You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati... | null | Array,Math,Matrix | Medium | 2015 |
229 | all right so let's talk about the majority element too so you're given an initial array of size of n and then you have to find the element that appears more than and over three times so this question is supposed to be like the most two elements instead of numbs array so if this is an over two this should be easy so jus... | Majority Element II | majority-element-ii | Given an integer array of size `n`, find all elements that appear more than `⌊ n/3 ⌋` times.
**Example 1:**
**Input:** nums = \[3,2,3\]
**Output:** \[3\]
**Example 2:**
**Input:** nums = \[1\]
**Output:** \[1\]
**Example 3:**
**Input:** nums = \[1,2\]
**Output:** \[1,2\]
**Constraints:**
* `1 <= nums.length <... | How many majority elements could it possibly have?
Do you have a better hint? Suggest it! | Array,Hash Table,Sorting,Counting | Medium | 169,1102 |
6 | hello guys welcome back to my channel my name is I hope you all are doing fine let's talk today's problem for lead call the problem name is zigzag conversion okay he comes under medium so it has more dislike than lag so we'll give a like so the problem saying the swing PayPal is hiring is written in zigzag pattern on a... | 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 |
103 | okay let's talk about binary tree exact level order traversal so this question is pretty similar to 102 so if you didn't watch it just go back to watch and let's talk about what's the difference between 102 so for this question you uh you need to add the list based on the constraint so if the current level is from left... | Binary Tree Zigzag Level Order Traversal | binary-tree-zigzag-level-order-traversal | Given the `root` of a binary tree, return _the zigzag level order traversal of its nodes' values_. (i.e., from left to right, then right to left for the next level and alternate between).
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[3\],\[20,9\],\[15,7\]\]
**Example 2:**
**Input:** roo... | null | Tree,Breadth-First Search,Binary Tree | Medium | 102 |
1,688 | The question is brother, count of matches in the tournament is an internal rule, how will it be seen if the current number of teams i.e. after losing, after current number of teams i.e. after losing, after current number of teams i.e. after losing, after winning some, if the current number of teams is seen, then if the... | 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 |
60 | yeah hi so in this problem we are going to solve permutation sequence problem and the tag here is hard but I'll make sure that after this video you will wonder that why the tag is hard here it should be easy or medium okay so yeah enough of the bragging let's move on to the problem statement so if you see the example t... | Permutation Sequence | permutation-sequence | The set `[1, 2, 3, ..., n]` contains a total of `n!` unique permutations.
By listing and labeling all of the permutations in order, we get the following sequence for `n = 3`:
1. `"123 "`
2. `"132 "`
3. `"213 "`
4. `"231 "`
5. `"312 "`
6. `"321 "`
Given `n` and `k`, return the `kth` permutation sequence.
**Exa... | null | Math,Recursion | Hard | 31,46 |
95 | welcome to september's lego challenge today's problem is unique binary search trees too given an integer n return all the structurally unique binary search trees which have exactly end nodes or unique values from 1 to n return the answer in any order you can give us an example here with n equals 3 we have three unique ... | Unique Binary Search Trees II | unique-binary-search-trees-ii | Given an integer `n`, return _all the structurally unique **BST'**s (binary search trees), which has exactly_ `n` _nodes of unique values from_ `1` _to_ `n`. Return the answer in **any order**.
**Example 1:**
**Input:** n = 3
**Output:** \[\[1,null,2,null,3\],\[1,null,3,2\],\[2,1,3\],\[3,1,null,null,2\],\[3,2,null,1\... | null | Dynamic Programming,Backtracking,Tree,Binary Search Tree,Binary Tree | Medium | 96,241 |
823 | welcome to march's leeco challenge today's problem is binary trees with factors given an array of unique integers where each integer is strictly greater than one we make a binary tree using these integers and each number may be used for any number of times each non-leaf node's value should be each non-leaf node's value... | Binary Trees With Factors | split-array-with-same-average | Given an array of unique integers, `arr`, where each integer `arr[i]` is strictly greater than `1`.
We make a binary tree using these integers, and each number may be used for any number of times. Each non-leaf node's value should be equal to the product of the values of its children.
Return _the number of binary tre... | null | Array,Math,Dynamic Programming,Bit Manipulation,Bitmask | Hard | 2162 |
213 | hello friends we are still not employed by a fan company so let's not stop lead coding till we get there uh today we are going to do a very important problem house robber 2 and this is actually an extension of original house robber problem i have already solved the house robber problem over here so you can check out th... | House Robber II | house-robber-ii | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are **arranged in a circle.** That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have a security system connected, and **it will automatical... | Since House[1] and House[n] are adjacent, they cannot be robbed together. Therefore, the problem becomes to rob either House[1]-House[n-1] or House[2]-House[n], depending on which choice offers more money. Now the problem has degenerated to the House Robber, which is already been solved. | Array,Dynamic Programming | Medium | 198,256,276,337,600,656 |
144 | so hello everyone welcome to my channel and hope you all are doing extremely well so in this video we are going to solve a question which is binary tree pre-order traversal in this question we pre-order traversal in this question we pre-order traversal in this question we have given a binary tree okay and we just have ... | Binary Tree Preorder Traversal | binary-tree-preorder-traversal | Given the `root` of a binary tree, return _the preorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[1,2,3\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of nodes ... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 94,255,775 |
70 | In this lesson, we are going to solve problem number 70 from the LeetCode, Climbing Stairs. Let's start with reading our task first. You're climbing a staircase. It takes n steps to reach the top. Each time, you can either climb one or two steps. In how many distinct ways can y... | 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 |
399 | Hello Hi Everyone Welcome To My Channel It's All The Problem Average Division You Are Giving Equations In Deformity Vibes Udayveer Ve subscribe The Video then subscribe to the Video then subscribe to The Amazing Hai * BYC Which Will Cancel Biwi And Will Hai * BYC Which Will Cancel Biwi And Will Hai * BYC Which Will Can... | Evaluate Division | evaluate-division | You are given an array of variable pairs `equations` and an array of real numbers `values`, where `equations[i] = [Ai, Bi]` and `values[i]` represent the equation `Ai / Bi = values[i]`. Each `Ai` or `Bi` is a string that represents a single variable.
You are also given some `queries`, where `queries[j] = [Cj, Dj]` rep... | Do you recognize this as a graph problem? | Array,Depth-First Search,Breadth-First Search,Union Find,Graph,Shortest Path | Medium | null |
35 | hello everyone welcome back here is vanamsen and today we are tackling yet another lead code problem search insert position so let's dive right into it as you can see our challenge today is about binary research in a sorted array so the problem wants us to return the index of Target value if it's found in a sorted arra... | Search Insert Position | search-insert-position | Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[1,3,5,6\], target = 5
**Output:** 2
**Exa... | null | Array,Binary Search | Easy | 278 |
122 | all right this lead code question is called best time to buy and sell stock to it says say you have an array for which the ithe element is the price of a given stock on day I design an algorithm to find the maximum profit you may complete as many transactions as you like you may not engage in multiple transactions at t... | 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,207 | hi guys welcome to lead code question number 1207 unique number of occurrences um this is another easy problem and we're going to be using python to solve it because that's the only language i know um keep in mind that i've been coding for like one month so everything i do is kind of new to me i'm going to be working t... | Unique Number of Occurrences | delete-nodes-and-return-forest | Given an array of integers `arr`, return `true` _if the number of occurrences of each value in the array is **unique** or_ `false` _otherwise_.
**Example 1:**
**Input:** arr = \[1,2,2,1,1,3\]
**Output:** true
**Explanation:** The value 1 has 3 occurrences, 2 has 2 and 3 has 1. No two values have the same number of oc... | null | Tree,Depth-First Search,Binary Tree | Medium | 2175 |
1,921 | hi everyone uh in this question we are playing a video game and defending our city from monsters we are given two arrays the first one is a monster's distance array the second one is the monster's speed array we can start eliminating monsters from minute zero and if there any monster that reaches our city before they e... | Eliminate Maximum Number of Monsters | eliminate-maximum-number-of-monsters | You are playing a video game where you are defending your city from a group of `n` monsters. You are given a **0-indexed** integer array `dist` of size `n`, where `dist[i]` is the **initial distance** in kilometers of the `ith` monster from the city.
The monsters walk toward the city at a **constant** speed. The speed... | null | null | Medium | null |
144 | hi guys welcome to day four of our journey today's the interview uh let's start a daily challenge uh question 144 binary tree per order traversal so we'll get given a root of a by Nature return the period of traversal of its nodes values uh pretty sure this is just to indicate that one doesn't have a left node but this... | Binary Tree Preorder Traversal | binary-tree-preorder-traversal | Given the `root` of a binary tree, return _the preorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[1,2,3\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of nodes ... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 94,255,775 |
448 | welcome to a new video with new problem in this video we are going to solve a problem from lead code which is called find all the numbers disappeared so this problem is of an easy category and the number for this problem i mentioned is 448 on lead code so you can find it there and you can solve it there so this questio... | Find All Numbers Disappeared in an Array | find-all-numbers-disappeared-in-an-array | Given an array `nums` of `n` integers where `nums[i]` is in the range `[1, n]`, return _an array of all the integers in the range_ `[1, n]` _that do not appear in_ `nums`.
**Example 1:**
**Input:** nums = \[4,3,2,7,8,2,3,1\]
**Output:** \[5,6\]
**Example 2:**
**Input:** nums = \[1,1\]
**Output:** \[2\]
**Constrain... | This is a really easy problem if you decide to use additional memory. For those trying to write an initial solution using additional memory, think counters! However, the trick really is to not use any additional space than what is already available to use. Sometimes, multiple passes over the input array help find the s... | Array,Hash Table | Easy | 41,442,2107,2305 |
1,941 | uh hey guys it's peng here so today i'll talk about a question called check if all characters have equal number of occurrence so let's look at the given first so given the string as return true if s is good it's a good string or false otherwise list and later on let define what's a good string so a string s is a good s... | Check if All Characters Have Equal Number of Occurrences | minimum-number-of-operations-to-make-string-sorted | Given a string `s`, return `true` _if_ `s` _is a **good** string, or_ `false` _otherwise_.
A string `s` is **good** if **all** the characters that appear in `s` have the **same** number of occurrences (i.e., the same frequency).
**Example 1:**
**Input:** s = "abacbc "
**Output:** true
**Explanation:** The character... | Note that the operations given describe getting the previous permutation of s To solve this problem you need to solve every suffix separately | Math,String,Combinatorics | Hard | null |
1,899 | Le code problem number 1,899 merge triplets to form Target 1,899 merge triplets to form Target 1,899 merge triplets to form Target triplets so this problem uh there's a lot of words but it's actually pretty straightforward so what it gives us is a array of three integers and a 2d integer called the triplet which contai... | Merge Triplets to Form Target Triplet | count-items-matching-a-rule | A **triplet** is an array of three integers. You are given a 2D integer array `triplets`, where `triplets[i] = [ai, bi, ci]` describes the `ith` **triplet**. You are also given an integer array `target = [x, y, z]` that describes the **triplet** you want to obtain.
To obtain `target`, you may apply the following opera... | Iterate on each item, and check if each one matches the rule according to the statement. | Array,String | Easy | null |
392 | okay so we have been given the two strings s1 and s2 so we have to check if s2 is a subsequence or we have to just validate whether s2 is a valid subsequence of s1 or not so this can be done quite easily we will take two pointers first pointer will be i which will be pointing at the first position of s1 and another poi... | Is Subsequence | is-subsequence | Given two strings `s` and `t`, return `true` _if_ `s` _is a **subsequence** of_ `t`_, or_ `false` _otherwise_.
A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i... | null | Two Pointers,String,Dynamic Programming | Easy | 808,1051 |
1,079 | hey quarters how's it going guys so today actually we're gonna look at this uh problem uh let's set our possibilities so we are told that we have Intel's where each tile has one letter uh printed on it to return the number of possible non-empty sequences number of possible non-empty sequences number of possible non-emp... | Letter Tile Possibilities | sum-of-root-to-leaf-binary-numbers | You have `n` `tiles`, where each tile has one letter `tiles[i]` printed on it.
Return _the number of possible non-empty sequences of letters_ you can make using the letters printed on those `tiles`.
**Example 1:**
**Input:** tiles = "AAB "
**Output:** 8
**Explanation:** The possible sequences are "A ", "B ", "AA... | Find each path, then transform that path to an integer in base 10. | Tree,Depth-First Search,Binary Tree | Easy | null |
437 | hey guys welcome back for another Elite code 75 study plan series problem so today we are still in our binary tree depth first search category and we are doing the pathsome 3 problem which is ranked as a medium uh Challenge and uh for our instructions we're given the root of a binary tree in an integer Target sum we ha... | Path Sum III | path-sum-iii | Given the `root` of a binary tree and an integer `targetSum`, return _the number of paths where the sum of the values along the path equals_ `targetSum`.
The path does not need to start or end at the root or a leaf, but it must go downwards (i.e., traveling only from parent nodes to child nodes).
**Example 1:**
**In... | null | Tree,Depth-First Search,Binary Tree | Medium | 112,113,666,687 |
538 | hello guys welcome oil hot middling question converting a tour in this question adhir veeravati subscribe and subscribe the accident on the Video then subscribe to the Page to update the value of this note 799878 subscribe me liye subscribe button in which they are living in the history After Nothing But From British R... | Convert BST to Greater Tree | convert-bst-to-greater-tree | Given the `root` of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus the sum of all keys greater than the original key in BST.
As a reminder, a _binary search tree_ is a tree that satisfies these constraints:
* The left subtree of a... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | null |
1,328 | hey everybody this is larry this is day 23 of the september lego daily challenge um i'm only 10 hours behind so i guess i'm not that bad uh for 11 almost uh hit the like button to subscribe and join me on discord today i'm a little bit late because i spent most of the day hiking and uh it was fun you could you should a... | Break a Palindrome | monthly-transactions-ii | Given a palindromic string of lowercase English letters `palindrome`, replace **exactly one** character with any lowercase English letter so that the resulting string is **not** a palindrome and that it is the **lexicographically smallest** one possible.
Return _the resulting string. If there is no way to replace a ch... | null | Database | Medium | 1317 |
502 | Peace be upon you, my dear friend. How are you doing? Oh God, you will be fine and in the best condition. God willing, today we will solve it together. If you haven’t solved it, you must first go and solve it you haven’t solved it, you must first go and solve it you haven’t solved it, you must first go and solve it bef... | IPO | ipo | Suppose LeetCode will start its **IPO** soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before the **IPO**. Since it has limited resources, it can only finish at most `k` distinct projects before the **IPO**. Help LeetCode design... | null | Array,Greedy,Sorting,Heap (Priority Queue) | Hard | null |
1,759 | Hello everyone welcome to my channel quote story with mike so today we are going to do video number 24 of our string playlist lead number 1759 I found this question very easy and actually it is very easy now we will also solve it count number Of homogeneous substrings. Okay, let's see what the question is trying to say... | Count Number of Homogenous Substrings | find-the-missing-ids | Given a string `s`, return _the number of **homogenous** substrings of_ `s`_._ Since the answer may be too large, return it **modulo** `109 + 7`.
A string is **homogenous** if all the characters of the string are the same.
A **substring** is a contiguous sequence of characters within a string.
**Example 1:**
**Inpu... | null | Database | Medium | 1357,1420,1467 |
31 | Hello friends, welcome to this video, the name of the question is next on motivation. Okay, so what is given in the input for basic, a number would have been given. For example, if we take 213, then we will have this in the entries. If you see, This is in the inter and we are next of this number okay so what will it be... | Next Permutation | next-permutation | A **permutation** of an array of integers is an arrangement of its members into a sequence or linear order.
* For example, for `arr = [1,2,3]`, the following are all the permutations of `arr`: `[1,2,3], [1,3,2], [2, 1, 3], [2, 3, 1], [3,1,2], [3,2,1]`.
The **next permutation** of an array of integers is the next le... | null | Array,Two Pointers | Medium | 46,47,60,267,1978 |
1 | hello everybody this is pj webdev and this is an update video to my original twosome lead code challenge and since i posted the original video about how to solve to some problem on lead code i had a couple of comments from philip and yusuf and they suggested a few improvements on how the code can be improved and in thi... | 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,493 | झाल ए लॉंग ए सब भारे व फोन after deleting ए लॉंग ए सब भारे व फोन after deleting ए लॉंग ए सब भारे व फोन after deleting one element due to return of the day who is the governor here delete one element moksh one element soft December-10 moksh one element soft December-10 moksh one element soft December-10 conjunctive vish... | Longest Subarray of 1's After Deleting One Element | frog-position-after-t-seconds | Given a binary array `nums`, you should delete one element from it.
Return _the size of the longest non-empty subarray containing only_ `1`_'s in the resulting array_. Return `0` if there is no such subarray.
**Example 1:**
**Input:** nums = \[1,1,0,1\]
**Output:** 3
**Explanation:** After deleting the number in pos... | Use a variation of DFS with parameters 'curent_vertex' and 'current_time'. Update the probability considering to jump to one of the children vertices. | Tree,Depth-First Search,Breadth-First Search,Graph | Hard | null |
48 | hi everyone today we'll be taking a look at question number 48 only code called rotate image so we're given a m by n matrix we want to rotate the image by 90 degrees aka clockwise so as you can see it starts out like this and ends up like this we also want to do it in place so we don't want to make another 2d matrix co... | Rotate Image | rotate-image | You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise).
You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati... | null | Array,Math,Matrix | Medium | 2015 |
293 | hey folks welcome back to another video today we're looking at Fashion 293 Flip Game the way we'll be solving this problem is by using this method uh built-in method for strings called index built-in method for strings called index built-in method for strings called index off um so it's a pretty easy part so let's get ... | Flip Game | flip-game | You are playing a Flip Game with your friend.
You are given a string `currentState` that contains only `'+'` and `'-'`. You and your friend take turns to flip **two consecutive** `"++ "` into `"-- "`. The game ends when a person can no longer make a move, and therefore the other person will be the winner.
Return all ... | null | String | Easy | 294 |
1,020 | Hello gas, today is April, where zero is written and what is written, one, means where zero is written, it is water and jawan, land is written there, and now what do I have to do, I consist of walking from one lent cell, you are inside the adjacent four directional land cell. And walking off the boundary of D great rig... | Number of Enclaves | longest-turbulent-subarray | You are given an `m x n` binary matrix `grid`, where `0` represents a sea cell and `1` represents a land cell.
A **move** consists of walking from one land cell to another adjacent (**4-directionally**) land cell or walking off the boundary of the `grid`.
Return _the number of land cells in_ `grid` _for which we cann... | null | Array,Dynamic Programming,Sliding Window | Medium | 53 |
971 | Hello Everyone Welcome To Nazar Episode Of Delete Science And Aspirations For Adultery Thrill Preorder Traversal Even Before Going To Be A Very Happy Holi Appointed By A Solid State President Of Animals And Its Node Arrangement Informative And Andar Notification Light Bill Experiment Withdrawal Dasharath Match The Amaz... | Flip Binary Tree To Match Preorder Traversal | shortest-bridge | You are given the `root` of a binary tree with `n` nodes, where each node is uniquely assigned a value from `1` to `n`. You are also given a sequence of `n` values `voyage`, which is the **desired** [**pre-order traversal**](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order) of the binary tree.
Any node in the bi... | null | Array,Depth-First Search,Breadth-First Search,Matrix | Medium | null |
1,827 | Let's move towards a next question, so this question is minimum operation to make the array increasing, what to do in this if we are given an integer array, moms and what can we do, we can choose any element of the array and It can be incremented by one, so in the example given, we chose two and incremented two by one,... | Minimum Operations to Make the Array Increasing | invalid-tweets | You are given an integer array `nums` (**0-indexed**). In one operation, you can choose an element of the array and increment it by `1`.
* For example, if `nums = [1,2,3]`, you can choose to increment `nums[1]` to make `nums = [1,**3**,3]`.
Return _the **minimum** number of operations needed to make_ `nums` _**stri... | null | Database | Easy | null |
240 | welcome back everyone we're going to be solving leeco 240 search of 2D Matrix 2. so we need to write an efficient algorithm that searches for a value Target inside of an M by n integer Matrix and this Matrix has the following properties the integers and every row are going to be sorted in ascending order from left to r... | Search a 2D Matrix II | search-a-2d-matrix-ii | Write an efficient algorithm that searches for a value `target` in an `m x n` integer matrix `matrix`. This matrix has the following properties:
* Integers in each row are sorted in ascending from left to right.
* Integers in each column are sorted in ascending from top to bottom.
**Example 1:**
**Input:** matri... | null | Array,Binary Search,Divide and Conquer,Matrix | Medium | 74 |
153 | hello welcome back to my Channel today we are going to solve another lyrical problem number 133 fat minimum in rotated salted array so the point problem is straightforward we are just giving an array Norms so this nums is rotated yeah so from the beginning it is assorted like 1 0 to 7 and then it can be rotated like th... | Find Minimum in Rotated Sorted Array | find-minimum-in-rotated-sorted-array | Suppose an array of length `n` sorted in ascending order is **rotated** between `1` and `n` times. For example, the array `nums = [0,1,2,4,5,6,7]` might become:
* `[4,5,6,7,0,1,2]` if it was rotated `4` times.
* `[0,1,2,4,5,6,7]` if it was rotated `7` times.
Notice that **rotating** an array `[a[0], a[1], a[2], .... | Array was originally in ascending order. Now that the array is rotated, there would be a point in the array where there is a small deflection from the increasing sequence. eg. The array would be something like [4, 5, 6, 7, 0, 1, 2]. You can divide the search space into two and see which direction to go.
Can you think ... | Array,Binary Search | Medium | 33,154 |
1,647 | That's guys welcome to take dola I am Nivedita and in this video we are going to solve minimum deletion to make tractor frequencies unique what is life in swiss role statement here I have given you this sting and what is trimming you have to see that in someone else If the frequency of the actor is different and the fr... | 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 |
129 | hello friends welcome to joy of life so today we are going to look at another medium 11 problem on youth code the problem number is 129. the name of the problem is sum root two leaf numbers you are given the root of a binary tree containing digits from zero to nine only each root to the path in the tree represents a nu... | Sum Root to Leaf Numbers | sum-root-to-leaf-numbers | You are given the `root` of a binary tree containing digits from `0` to `9` only.
Each root-to-leaf path in the tree represents a number.
* For example, the root-to-leaf path `1 -> 2 -> 3` represents the number `123`.
Return _the total sum of all root-to-leaf numbers_. Test cases are generated so that the answer w... | null | Tree,Depth-First Search,Binary Tree | Medium | 112,124,1030 |
424 | hey what's up guys this is sean here so today let's take a look at number 424 longest repeating character replacement i think this is a pretty interesting problem okay you're given like a string s and it consists of only uppercase english letters from a to z and you can perform at most k operations on that string so fo... | Longest Repeating Character Replacement | longest-repeating-character-replacement | You are given a string `s` and an integer `k`. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most `k` times.
Return _the length of the longest substring containing the same letter you can get after performing the above operations_.
... | null | Hash Table,String,Sliding Window | Medium | 340,1046,2119,2134,2319 |
1,577 | Hello hello welcome to my channel it's all the record problem number of where squared of number is equal to product of two numbers 100 tours to the number of the following is like subscribe and subscribe 2018 100 numbers 90 not possible similar four medium to time Subscribe Like This Apne Wrist Times Vikram Sixteen Sud... | Number of Ways Where Square of Number Is Equal to Product of Two Numbers | probability-of-a-two-boxes-having-the-same-number-of-distinct-balls | Given two arrays of integers `nums1` and `nums2`, return the number of triplets formed (type 1 and type 2) under the following rules:
* Type 1: Triplet (i, j, k) if `nums1[i]2 == nums2[j] * nums2[k]` where `0 <= i < nums1.length` and `0 <= j < k < nums2.length`.
* Type 2: Triplet (i, j, k) if `nums2[i]2 == nums1[j... | Check how many ways you can distribute the balls between the boxes. Consider that one way you will use (x1, x2, x3, ..., xk) where xi is the number of balls from colour i. The probability of achieving this way randomly is ( (ball1 C x1) * (ball2 C x2) * (ball3 C x3) * ... * (ballk C xk)) / (2n C n). The probability of ... | Math,Dynamic Programming,Backtracking,Combinatorics,Probability and Statistics | Hard | null |
864 | Hello gas I am Lalita Agarwal welcome you on your on coding channel to friends I you I on this so late have Saturday this lead code problem aaj ke lead code problem kya bol diya achha before money towards de problem na one me discussion par to us I have understood the problem of the day and I have been trying everythin... | Shortest Path to Get All Keys | image-overlap | You are given an `m x n` grid `grid` where:
* `'.'` is an empty cell.
* `'#'` is a wall.
* `'@'` is the starting point.
* Lowercase letters represent keys.
* Uppercase letters represent locks.
You start at the starting point and one move consists of walking one space in one of the four cardinal directions. ... | null | Array,Matrix | Medium | null |
520 | another day another problem so let's Solve IT hello guys I hope you are all doing well so today in this video we're gonna quickly solve this easy problem detect Capital so let's get started by reading the problem we Define the usage of capitals and a word to be right when one of the following case hauls all the letter ... | Detect Capital | detect-capital | We define the usage of capitals in a word to be right when one of the following cases holds:
* All letters in this word are capitals, like `"USA "`.
* All letters in this word are not capitals, like `"leetcode "`.
* Only the first letter in this word is capital, like `"Google "`.
Given a string `word`, return `... | null | String | Easy | 2235 |
213 | house rubber 2 is a slight extension of house rubber one remember from the previous question we have houses on a street with some money in each house and a robber can rob any house except the houses that are next to each other in this question the houses are located in a circle so that the first house become connected ... | House Robber II | house-robber-ii | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are **arranged in a circle.** That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have a security system connected, and **it will automatical... | Since House[1] and House[n] are adjacent, they cannot be robbed together. Therefore, the problem becomes to rob either House[1]-House[n-1] or House[2]-House[n], depending on which choice offers more money. Now the problem has degenerated to the House Robber, which is already been solved. | Array,Dynamic Programming | Medium | 198,256,276,337,600,656 |
1,441 | all right this question is build an array with stack operations so let's look at an example of what they want so with uh with n equals three that means we're going to get an input like one two three so we see one first and then we see two and then we see three and then we have a stack and then we have operations that w... | Build an Array With Stack Operations | minimum-flips-to-make-a-or-b-equal-to-c | You are given an integer array `target` and an integer `n`.
You have an empty stack with the two following operations:
* **`"Push "`**: pushes an integer to the top of the stack.
* **`"Pop "`**: removes the integer on the top of the stack.
You also have a stream of the integers in the range `[1, n]`.
Use the tw... | Check the bits one by one whether they need to be flipped. | Bit Manipulation | Medium | 2323 |
84 | hello everyone in this video we will be solving a heart problem number 84 largest rectangle in an histogram the problem statement is we are given an area of integers heights representing an histograms bar height where width of each of the bar is one we need to return the maximum area or the largest rectangle that we ca... | Largest Rectangle in Histogram | largest-rectangle-in-histogram | Given an array of integers `heights` representing the histogram's bar height where the width of each bar is `1`, return _the area of the largest rectangle in the histogram_.
**Example 1:**
**Input:** heights = \[2,1,5,6,2,3\]
**Output:** 10
**Explanation:** The above is a histogram where width of each bar is 1.
The l... | null | Array,Stack,Monotonic Stack | Hard | 85,1918 |
1,100 | hi hello today we'll be talking our first sliding window question find k land substrings with no repeated characters let's see what this question is all about alright so let's see what will be our flow first we will understand question then we will take an example we will discuss about this then we will find and we wil... | Find K-Length Substrings With No Repeated Characters | connecting-cities-with-minimum-cost | Given a string `s` and an integer `k`, return _the number of substrings in_ `s` _of length_ `k` _with no repeated characters_.
**Example 1:**
**Input:** s = "havefunonleetcode ", k = 5
**Output:** 6
**Explanation:** There are 6 substrings they are: 'havef','avefu','vefun','efuno','etcod','tcode'.
**Example 2:**
**... | What if we model the cities as a graph? Build a graph of cities and find the minimum spanning tree. You can use a variation of the Kruskal's algorithm for that. Sort the edges by their cost and use a union-find data structure. How to check all cities are connected? At the beginning we have n connected components, each ... | Union Find,Graph,Heap (Priority Queue),Minimum Spanning Tree | Medium | 2230 |
1,399 | yeahyeah Hello everyone, I'm a programmer. Today I will introduce to you the problem of calculating the largest group of problems and the detailed requirements are as follows, giving us an integer n from In this n we will have a series of numbers from 1 to n and these series of numbers will gradually increase by one un... | Count Largest Group | page-recommendations | You are given an integer `n`.
Each number from `1` to `n` is grouped according to the sum of its digits.
Return _the number of groups that have the largest size_.
**Example 1:**
**Input:** n = 13
**Output:** 4
**Explanation:** There are 9 groups in total, they are grouped according sum of its digits of numbers from... | null | Database | Medium | 2046,2097 |
1,032 | Hello Welcome Difficult Him Loud Challenge Updates Planets Free Mode Character Shift In You Can Understand That South Design Dynasty Wheel Chair And Software Will Decide Figure Visit To Build Addiction And Possible And Wave Goldberg And Width Character 1954 Subject So Let's Check The Example One Okay To Doctori video t... | Stream of Characters | satisfiability-of-equality-equations | Design an algorithm that accepts a stream of characters and checks if a suffix of these characters is a string of a given array of strings `words`.
For example, if `words = [ "abc ", "xyz "]` and the stream added the four characters (one by one) `'a'`, `'x'`, `'y'`, and `'z'`, your algorithm should detect that the suf... | null | Array,String,Union Find,Graph | Medium | null |
934 | video of Ajay's YouTube channel, Ashok Sandhu, who solves the questions named Test Match, completes 'Kaisa Hai Kya Ashok Sandhu, who solves the questions named Test Match, completes 'Kaisa Hai Kya Ashok Sandhu, who solves the questions named Test Match, completes 'Kaisa Hai Kya Karta' with 'Puri Next Kar' in which 0700... | 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 |
47 | this is the 47th Lego Challenge and it is called permutations 2. given a collection of numbers nums that might contain duplicates return all possible unique permutations in any order so if you have one two it will return one two one and then one two three it will return the six possible combinations for that okay let's... | Permutations II | permutations-ii | Given a collection of numbers, `nums`, that might contain duplicates, return _all possible unique permutations **in any order**._
**Example 1:**
**Input:** nums = \[1,1,2\]
**Output:**
\[\[1,1,2\],
\[1,2,1\],
\[2,1,1\]\]
**Example 2:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,... | null | Array,Backtracking | Medium | 31,46,267,1038 |
1,091 | foreign welcome back to the channel so today in this video lecture we're going to be solving this problem shortest path in binary Matrix so this problem is also included in the destroy algorithm problems list although this can be solved using a simple graph traversal algorithm like breadth first search but we'll solve ... | Shortest Path in Binary Matrix | maximum-average-subtree | Given an `n x n` binary matrix `grid`, return _the length of the shortest **clear path** in the matrix_. If there is no clear path, return `-1`.
A **clear path** in a binary matrix is a path from the **top-left** cell (i.e., `(0, 0)`) to the **bottom-right** cell (i.e., `(n - 1, n - 1)`) such that:
* All the visite... | Can you find the sum of values and the number of nodes for every sub-tree ? Can you find the sum of values and the number of nodes for a sub-tree given the sum of values and the number of nodes of it's left and right sub-trees ? Use depth first search to recursively find the solution for the children of a node then use... | Tree,Depth-First Search,Binary Tree | Medium | 2126 |
931 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem minimum falling path sum we're given an N byn Matrix of integers and they can be positive or negative actually so keep that in mind and a falling path within this Matrix basically is a path starting from the first row f... | Minimum Falling Path Sum | maximum-frequency-stack | Given an `n x n` array of integers `matrix`, return _the **minimum sum** of any **falling path** through_ `matrix`.
A **falling path** starts at any element in the first row and chooses the element in the next row that is either directly below or diagonally left/right. Specifically, the next element from position `(ro... | null | Hash Table,Stack,Design,Ordered Set | Hard | null |
706 | hey YouTube Welcome Back to we have this problem called design hashmap uh we should design a hashmap without using any built-in hashtable libraries like we any built-in hashtable libraries like we any built-in hashtable libraries like we can't build the like element equals a new set or new map things like that we can't... | Design HashMap | design-hashmap | Design a HashMap without using any built-in hash table libraries.
Implement the `MyHashMap` class:
* `MyHashMap()` initializes the object with an empty map.
* `void put(int key, int value)` inserts a `(key, value)` pair into the HashMap. If the `key` already exists in the map, update the corresponding `value`.
* ... | null | null | Easy | null |
1,189 | hi my name is david today we're going to do number 1189 maximum number of balloons this is an easy level problem on lead code and we're going to solve it in javascript in this question we take we have a function that takes some text is a string and inside of this we want to return how many times we can return balloon o... | Maximum Number of Balloons | encode-number | Given a string `text`, you want to use the characters of `text` to form as many instances of the word **"balloon "** as possible.
You can use each character in `text` **at most once**. Return the maximum number of instances that can be formed.
**Example 1:**
**Input:** text = "nlaebolko "
**Output:** 1
**Example 2... | Try to find the number of binary digits returned by the function. The pattern is to start counting from zero after determining the number of binary digits. | Math,String,Bit Manipulation | Medium | 1070 |
1,394 | hey guys welcome back to my channel and i'm back again with another really interesting coding interview question video this time guys we are going to solve question number 1394 find lucky integer in an array question before i start with the video guys if you have not yet subscribed to my channel then please do subscrib... | Find Lucky Integer in an Array | find-lucky-integer-in-an-array | Given an array of integers `arr`, a **lucky integer** is an integer that has a frequency in the array equal to its value.
Return _the largest **lucky integer** in the array_. If there is no **lucky integer** return `-1`.
**Example 1:**
**Input:** arr = \[2,2,3,4\]
**Output:** 2
**Explanation:** The only lucky number... | null | null | Easy | null |
1,936 | okay welcome back today we're looking at leak code number 1 1936 called add minimum number of rungs it's a medium question and so we are given a strictly increasing integer array called rungs that represents the height of rungs on a ladder we're also currently on the floor at height zero and we want to reach the last R... | Add Minimum Number of Rungs | maximize-number-of-nice-divisors | You are given a **strictly increasing** integer array `rungs` that represents the **height** of rungs on a ladder. You are currently on the **floor** at height `0`, and you want to reach the last rung.
You are also given an integer `dist`. You can only climb to the next highest rung if the distance between where you a... | The number of nice divisors is equal to the product of the count of each prime factor. Then the problem is reduced to: given n, find a sequence of numbers whose sum equals n and whose product is maximized. This sequence can have no numbers that are larger than 4. Proof: if it contains a number x that is larger than 4, ... | Math,Recursion | Hard | 343 |
781 | Hello Hi Guys in this video Question Rai Bachchan and Forest will be playing a very interesting question, this is the question, is there a forest and everything is within the limit and you can do it by color, if any boy from any house is okay, then our given second. Like all the missions in Hindi Chanakya is no less an... | Rabbits in Forest | basic-calculator-iv | There is a forest with an unknown number of rabbits. We asked n rabbits **"How many rabbits have the same color as you? "** and collected the answers in an integer array `answers` where `answers[i]` is the answer of the `ith` rabbit.
Given the array `answers`, return _the minimum number of rabbits that could be in the... | One way is with a Polynomial class. For example,
* `Poly:add(this, that)` returns the result of `this + that`.
* `Poly:sub(this, that)` returns the result of `this - that`.
* `Poly:mul(this, that)` returns the result of `this * that`.
* `Poly:evaluate(this, evalmap)` returns the polynomial after replacing all fr... | Hash Table,Math,String,Stack,Recursion | Hard | 736,785 |
260 | welcome to july's lego challenge today's problem is single number three given an array of numbers nums in which exactly two elements appear once and all other elements appear twice find the two elements that appear only once immediately when i saw this problem i've seen single number two so i know this is a bit wise ma... | Single Number III | single-number-iii | Given an integer array `nums`, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in **any order**.
You must write an algorithm that runs in linear runtime complexity and uses only constant extra space.
... | null | Array,Bit Manipulation | Medium | 136,137 |
1,293 | Everyone, so today we will do our first question number 25. Okay, the name of the question is Shortest Path in a Great with Optical Elimination. Okay, so let's see once who asked. Google asked this question. Okay, now let's come to the input and output. So that you can understand what is the question, then you will be ... | Shortest Path in a Grid with Obstacles Elimination | three-consecutive-odds | You are given an `m x n` integer matrix `grid` where each cell is either `0` (empty) or `1` (obstacle). You can move up, down, left, or right from and to an empty cell in **one step**.
Return _the minimum number of **steps** to walk from the upper left corner_ `(0, 0)` _to the lower right corner_ `(m - 1, n - 1)` _giv... | Check every three consecutive numbers in the array for parity. | Array | Easy | null |
1,219 | Previous Welcome to my channel Gyan Rupi Will Discuss Problem 21219 Part with Maximum Gold Silver Problems 2751 Grade Early Morning Grade Zero to Zen Servi Ki and Eggs in Every Number Represent Number and Amount of Gold Zero Means That is Gold Six Inch Six Amount for Different Vacancy Electric 6 Gram Gold 18k Gold And ... | Path with Maximum Gold | longest-well-performing-interval | In a gold mine `grid` of size `m x n`, each cell in this mine has an integer representing the amount of gold in that cell, `0` if it is empty.
Return the maximum amount of gold you can collect under the conditions:
* Every time you are located in a cell you will collect all the gold in that cell.
* From your posi... | Make a new array A of +1/-1s corresponding to if hours[i] is > 8 or not. The goal is to find the longest subarray with positive sum. Using prefix sums (PrefixSum[i+1] = A[0] + A[1] + ... + A[i]), you need to find for each j, the smallest i < j with PrefixSum[i] + 1 == PrefixSum[j]. | Array,Hash Table,Stack,Monotonic Stack,Prefix Sum | Medium | null |
237 | Hello Everyone, today's question is delete food let torch light a function to delete and acceptable in obscene clipping only a student note so we are deleting a particular but the twist here is that we do not have the written address we have If we want to delete only that note exam, that means there is a normal record ... | Delete Node in a Linked List | delete-node-in-a-linked-list | There is a singly-linked list `head` and we want to delete a node `node` in it.
You are given the node to be deleted `node`. You will **not be given access** to the first node of `head`.
All the values of the linked list are **unique**, and it is guaranteed that the given node `node` is not the last node in the linke... | null | Linked List | Easy | 203 |
141 | Ah, this is a favorite one. You're given a linked list that may have a cycle. What does that mean? It means that one of the internal nodes in the linked list points to one of the nodes in the linked list itself. So when you try to traverse this list, you will do a node.next, .next, .next, and then one of the nodes will... | 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 |
188 | welcome to my channel so before we start the video for today if you can help subscribe to this channel i would really appreciate it because it can help me grow so let's get started with uh the problem for today so best time to buy and sell stock for so in this video i'm going to cover the solution to solve this problem... | Best Time to Buy and Sell Stock IV | best-time-to-buy-and-sell-stock-iv | You are given an integer array `prices` where `prices[i]` is the price of a given stock on the `ith` day, and an integer `k`.
Find the maximum profit you can achieve. You may complete at most `k` transactions: i.e. you may buy at most `k` times and sell at most `k` times.
**Note:** You may not engage in multiple tran... | null | Array,Dynamic Programming | Hard | 121,122,123 |
2,000 | hello guys my name is welcome back to my channel and today we are going to solve a new report portion with the help of JavaScript that is a reverse prefix of word the question says given 0 index string word and character C is available the segment of word that start at index 0 and adds at an index at the index of the f... | Reverse Prefix of Word | minimum-speed-to-arrive-on-time | Given a **0-indexed** string `word` and a character `ch`, **reverse** the segment of `word` that starts at index `0` and ends at the index of the **first occurrence** of `ch` (**inclusive**). If the character `ch` does not exist in `word`, do nothing.
* For example, if `word = "abcdefd "` and `ch = "d "`, then you s... | Given the speed the trains are traveling at, can you find the total time it takes for you to arrive? Is there a cutoff where any speeds larger will always allow you to arrive on time? | Array,Binary Search | Medium | 1335,2013,2294 |
188 | hey there everyone welcome back to lead coding in this video we will be solving the part 4 of best time to buy and sell stock the problem statement is you are given an integer area prices where price i is the price of a given stock on the ift design an algorithm to find the maximum profit you can complete at most key t... | Best Time to Buy and Sell Stock IV | best-time-to-buy-and-sell-stock-iv | You are given an integer array `prices` where `prices[i]` is the price of a given stock on the `ith` day, and an integer `k`.
Find the maximum profit you can achieve. You may complete at most `k` transactions: i.e. you may buy at most `k` times and sell at most `k` times.
**Note:** You may not engage in multiple tran... | null | Array,Dynamic Programming | Hard | 121,122,123 |
322 | working on lead code 322 it's a question that call is called coin change this is a notorious coding interview question you can see here that it's asked by goldman sachs 20 times in the last six months amazon bloomberg it's definitely one you want to know and you want to know it well it's a dynamic problem a dynamic pro... | 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,483 | hello guys today i am going to explain you how can we solve this problem kth ancestor of a tree node so basically this problem is from lead codes weekly challenge and it is tagged as a heart problem the problem statement says that you are given a tree with n nodes numbered from 0 to n minus 1 in the form of a parent ar... | Kth Ancestor of a Tree Node | rank-teams-by-votes | You are given a tree with `n` nodes numbered from `0` to `n - 1` in the form of a parent array `parent` where `parent[i]` is the parent of `ith` node. The root of the tree is node `0`. Find the `kth` ancestor of a given node.
The `kth` ancestor of a tree node is the `kth` node in the path from that node to the root no... | Build array rank where rank[i][j] is the number of votes for team i to be the j-th rank. Sort the trams by rank array. if rank array is the same for two or more teams, sort them by the ID in ascending order. | Array,Hash Table,String,Sorting,Counting | Medium | 947 |
371 | code problem number 371 sum of two integers pretty straightforward problem gives us two integers A and B and the goal is to return the sum of the two integers without using the operators plus and minus right so here in our code you can see nowhere that you can see you can't find plus and minus in the code and what we a... | Sum of Two Integers | sum-of-two-integers | Given two integers `a` and `b`, return _the sum of the two integers without using the operators_ `+` _and_ `-`.
**Example 1:**
**Input:** a = 1, b = 2
**Output:** 3
**Example 2:**
**Input:** a = 2, b = 3
**Output:** 5
**Constraints:**
* `-1000 <= a, b <= 1000` | null | Math,Bit Manipulation | Medium | 2 |
234 | in this video we're going to take a look at a legal problem called palindrome linked list so given a singly linked clause determine if it is a palindrome so here you can see we have a linked list right so one and two and return is false because palindrome is a version or is a list of nodes where if we reverse it's goin... | Palindrome Linked List | palindrome-linked-list | Given the `head` of a singly linked list, return `true` _if it is a_ _palindrome_ _or_ `false` _otherwise_.
**Example 1:**
**Input:** head = \[1,2,2,1\]
**Output:** true
**Example 2:**
**Input:** head = \[1,2\]
**Output:** false
**Constraints:**
* The number of nodes in the list is in the range `[1, 105]`.
* ... | null | Linked List,Two Pointers,Stack,Recursion | Easy | 9,125,206,2236 |
122 | hello guys thank you for joining today we're going to be talking about the leak code question 122 best time to buy and sell stock 2. so this is really interesting problem deals with arrays let's go straight into the input or problem statement so you are given an array prices where prices at the index i is the price of ... | 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 |
448 | Loot Hello Everyone Welcome To Day Routine Samay Malik Ko Channel Subscribe Number subscribe to the Video then subscribe to the Page if you liked The Video then subscribe to subscribe our let's start and unlimited pain final number register pimple fluid side subscribe button a platerau in The Argument 3432 78238 to do ... | Find All Numbers Disappeared in an Array | find-all-numbers-disappeared-in-an-array | Given an array `nums` of `n` integers where `nums[i]` is in the range `[1, n]`, return _an array of all the integers in the range_ `[1, n]` _that do not appear in_ `nums`.
**Example 1:**
**Input:** nums = \[4,3,2,7,8,2,3,1\]
**Output:** \[5,6\]
**Example 2:**
**Input:** nums = \[1,1\]
**Output:** \[2\]
**Constrain... | This is a really easy problem if you decide to use additional memory. For those trying to write an initial solution using additional memory, think counters! However, the trick really is to not use any additional space than what is already available to use. Sometimes, multiple passes over the input array help find the s... | Array,Hash Table | Easy | 41,442,2107,2305 |
773 | cool one last one and I go sleep hopefully 773 sliding puzzle on a 2x3 board there are five times when President Biden in the trip one to five and an empty square because it ended by zero move consists of choosing zero and four directionally adjacent numbers and swapping it I said that a weird tone okay a state of bodi... | Sliding Puzzle | logical-or-of-two-binary-grids-represented-as-quad-trees | On an `2 x 3` board, there are five tiles labeled from `1` to `5`, and an empty square represented by `0`. A **move** consists of choosing `0` and a 4-directionally adjacent number and swapping it.
The state of the board is solved if and only if the board is `[[1,2,3],[4,5,0]]`.
Given the puzzle board `board`, return... | null | Divide and Conquer,Tree | Medium | null |
958 | Ajay Ko Hello friends welcome to the second this problem is a completeness of mind VPN problem treatment c date of birth defect in a complete binary tree every level except the possibility the lost his complaint field and all notes in the last level RS for laptop possible In the middle of Sydney this company Difficult ... | Check Completeness of a Binary Tree | sort-array-by-parity-ii | Given the `root` of a binary tree, determine if it is a _complete binary tree_.
In a **[complete binary tree](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between ... | null | Array,Two Pointers,Sorting | Easy | 2271,2283,2327 |
239 | hey everybody this is larry this is day 28 of the leeco dairy challenge hit the like button hit the subscribe button join me on discord let me know what you think hope you had a great weekend uh you know sliding window maximus today's prom uh okay you're going to do the sliding window okay numbers in the window get the... | Sliding Window Maximum | sliding-window-maximum | You are given an array of integers `nums`, there is a sliding window of size `k` which is moving from the very left of the array to the very right. You can only see the `k` numbers in the window. Each time the sliding window moves right by one position.
Return _the max sliding window_.
**Example 1:**
**Input:** nums... | How about using a data structure such as deque (double-ended queue)? The queue size need not be the same as the window’s size. Remove redundant elements and the queue should store only elements that need to be considered. | Array,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue | Hard | 76,155,159,265,1814 |
235 | Hello friends, welcome to your channel, so today is our day 94 of the challenge, so let's go straight to the screen and understand today's question. So the name of today's question is 235. Question number is sorry 25. The name of is Lowest Common Assessor of Binary Search Tree which we have to find the lowest common an... | Lowest Common Ancestor of a Binary Search Tree | lowest-common-ancestor-of-a-binary-search-tree | Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST.
According to the [definition of LCA on Wikipedia](https://en.wikipedia.org/wiki/Lowest_common_ancestor): "The lowest common ancestor is defined between two nodes `p` and `q` as the lowest node in `T` that has bo... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | 236,1190,1780,1790,1816 |
37 | so today we will be solving lead code question number 37 and that is Sudoku solver what the question says is that we are given with a Sudoku okay right here we are given with the Sudoku and we need to solve this Sudoku okay by putting in integers from one up till nine what are the rules for Sudoku I think you all know ... | Sudoku Solver | sudoku-solver | Write a program to solve a Sudoku puzzle by filling the empty cells.
A sudoku solution must satisfy **all of the following rules**:
1. Each of the digits `1-9` must occur exactly once in each row.
2. Each of the digits `1-9` must occur exactly once in each column.
3. Each of the digits `1-9` must occur exactly onc... | null | Array,Backtracking,Matrix | Hard | 36,1022 |
1,807 | hey everybody this is Ben back with another Elite code tutorial So today we're going to be looking at problem 1807 titled evaluate the bracket pairs of a string so we'll go ahead and talk through the prompt we'll talk about some pseudo code and then we'll actually type out an implementation for this problem so you're g... | Evaluate the Bracket Pairs of a String | partitioning-into-minimum-number-of-deci-binary-numbers | You are given a string `s` that contains some bracket pairs, with each pair containing a **non-empty** key.
* For example, in the string `"(name)is(age)yearsold "`, there are **two** bracket pairs that contain the keys `"name "` and `"age "`.
You know the values of a wide range of keys. This is represented by a 2D ... | Think about if the input was only one digit. Then you need to add up as many ones as the value of this digit. If the input has multiple digits, then you can solve for each digit independently, and merge the answers to form numbers that add up to that input. Thus the answer is equal to the max digit. | String,Greedy | Medium | null |
787 | hey guys it's iran and in today's video we're going to solve cheapest flights within k stops it's labeled as a medium difficulty but in my opinion it's more on the hard side either way it's definitely doable so we're going to solve it with dijkstra if you're not familiar with dijkstra i recommend you watch my dijkstra ... | Cheapest Flights Within K Stops | sliding-puzzle | There are `n` cities connected by some number of flights. You are given an array `flights` where `flights[i] = [fromi, toi, pricei]` indicates that there is a flight from city `fromi` to city `toi` with cost `pricei`.
You are also given three integers `src`, `dst`, and `k`, return _**the cheapest price** from_ `src` _... | Perform a breadth-first-search, where the nodes are the puzzle boards and edges are if two puzzle boards can be transformed into one another with one move. | Array,Breadth-First Search,Matrix | Hard | null |
355 | Le code problem number 355 design Twitter so this problem is pretty easy to be honest what it wants us to do is just to design a simplified version of Twitter right where the users can post Tweet follow unfollow and it's able to see the 10 most recent tweet in the users news feed right so here are some functions we nee... | Design Twitter | design-twitter | Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the `10` most recent tweets in the user's news feed.
Implement the `Twitter` class:
* `Twitter()` Initializes your twitter object.
* `void postTweet(int userId, int tweetId)` Composes a new tweet w... | null | Hash Table,Linked List,Design,Heap (Priority Queue) | Medium | 1640 |
71 | Loot Hello Everyone Welcome and Welcome Back to My Channel Today Will Be Shaheen's Simply Five Questions So Let's Get Started in This Question Were Given String Talk Between This Lineage Loot OK Industries Settings Zombies to File or Directory in Unix Systems Converted into the Simplified Nickel Pat ok sleep with this ... | Simplify Path | simplify-path | Given a string `path`, which is an **absolute path** (starting with a slash `'/'`) to a file or directory in a Unix-style file system, convert it to the simplified **canonical path**.
In a Unix-style file system, a period `'.'` refers to the current directory, a double period `'..'` refers to the directory up a level,... | null | String,Stack | Medium | null |
160 | hey everyone mark here welcome to a elite code question today we're gonna cover 160 which is titled intersection of two linked lists if you haven't seen the question I'd encourage you to pause the video go to the link below and give it a shot additionally if you're having trouble with the visualization which I would re... | Intersection of Two Linked Lists | intersection-of-two-linked-lists | Given the heads of two singly linked-lists `headA` and `headB`, return _the node at which the two lists intersect_. If the two linked lists have no intersection at all, return `null`.
For example, the following two linked lists begin to intersect at node `c1`:
The test cases are generated such that there are no cycle... | null | Hash Table,Linked List,Two Pointers | Easy | 599 |
44 | Do it, Hello ji, how all the special benefits increase the mark, we are going to solve the deep neck and hard question here again, the name of which is Wildcard Pattern Matching. The name of the question is Wildcard Pattern Matching, what is it, Singh and you will get out of two. One net pattern from the other here we ... | Wildcard Matching | wildcard-matching | Given an input string (`s`) and a pattern (`p`), implement wildcard pattern matching with support for `'?'` and `'*'` where:
* `'?'` Matches any single character.
* `'*'` Matches any sequence of characters (including the empty sequence).
The matching should cover the **entire** input string (not partial).
**Exam... | null | String,Dynamic Programming,Greedy,Recursion | Hard | 10 |
71 | hi guys welcome to algorithms made easy in this video we will see the question simplify path given a string path which is an absolute path starting with a slash to a file or a directory in a unique style file system we need to convert it into a simplified canonical path in a unix style file system a period refers to cu... | Simplify Path | simplify-path | Given a string `path`, which is an **absolute path** (starting with a slash `'/'`) to a file or directory in a Unix-style file system, convert it to the simplified **canonical path**.
In a Unix-style file system, a period `'.'` refers to the current directory, a double period `'..'` refers to the directory up a level,... | null | String,Stack | Medium | null |
901 | hey guys persistent programmer here and today we're gonna do another legal question online stock spam okay so first let's go ahead and understand what this question is asking so we are going to be given these stock numbers at each date so on day one we are given a hundred right so this is day one and then on day two we... | Online Stock Span | advantage-shuffle | Design an algorithm that collects daily price quotes for some stock and returns **the span** of that stock's price for the current day.
The **span** of the stock's price in one day is the maximum number of consecutive days (starting from that day and going backward) for which the stock price was less than or equal to ... | null | Array,Greedy,Sorting | Medium | null |
85 | This is very Hello everyone, go and decide compounding, so today we are going to solve this question of maximum rectangle, what to do at 31, so basically in this you will get an egg, this is supposed to be a quantity, it will be given to private dealers and inside it there will be only youth, meaning. Binary Matrix Now... | Maximal Rectangle | maximal-rectangle | Given a `rows x cols` binary `matrix` filled with `0`'s and `1`'s, find the largest rectangle 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 "\]\]
**Ou... | null | Array,Dynamic Programming,Stack,Matrix,Monotonic Stack | Hard | 84,221 |
55 | Hello hello friends in this section they want to discuss another list to problem jump game divya common interview questions of winning company you will gain and share your will be initially position at rs first and research and development in the red tube maximum jump long position return true S You Can Read Blast Inde... | Jump Game | jump-game | You are given an integer array `nums`. You are initially positioned at the array's **first index**, and each element in the array represents your maximum jump length at that position.
Return `true` _if you can reach the last index, or_ `false` _otherwise_.
**Example 1:**
**Input:** nums = \[2,3,1,1,4\]
**Output:** t... | null | Array,Dynamic Programming,Greedy | Medium | 45,1428,2001 |
865 | hey everybody this is larry this is day 12 of the league code daily challenge for december hit the like button hit the subscribe button join me in this call let me know what you think about today's prom smallest subtree with all the deepest note so i am solving this live including the explanation so if it goes a little... | Smallest Subtree with all the Deepest Nodes | robot-room-cleaner | Given the `root` of a binary tree, the depth of each node is **the shortest distance to the root**.
Return _the smallest subtree_ such that it contains **all the deepest nodes** in the original tree.
A node is called **the deepest** if it has the largest depth possible among any node in the entire tree.
The **subtre... | null | Backtracking,Interactive | Hard | 286,1931,1959,2203 |
1,318 | hey everyone welcome back today we are going to solve problem number one three one eight minimum Phillips to make a or b equal to C first we will see the explanation of the problem statement then the logic and the code now let's dive into the solution so in this problem we are given three inputs a b and c and we need t... | Minimum Flips to Make a OR b Equal to c | tournament-winners | Given 3 positives numbers `a`, `b` and `c`. Return the minimum flips required in some bits of `a` and `b` to make ( `a` OR `b` == `c` ). (bitwise OR operation).
Flip operation consists of change **any** single bit 1 to 0 or change the bit 0 to 1 in their binary representation.
**Example 1:**
**Input:** a = 2, b = 6... | null | Database | Hard | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.