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,814 | everyone and good afternoon to all of you today we have problem which name is Count nice PS in an array lead c844 problem so before going forward in this video please make sure that you have liked and subscribed to this Channel and also it's my advice to all of you that please read the problem and try to build up the i... | Count Nice Pairs in an Array | jump-game-vi | You are given an array `nums` that consists of non-negative integers. Let us define `rev(x)` as the reverse of the non-negative integer `x`. For example, `rev(123) = 321`, and `rev(120) = 21`. A pair of indices `(i, j)` is **nice** if it satisfies all of the following conditions:
* `0 <= i < j < nums.length`
* `nu... | Let dp[i] be "the maximum score to reach the end starting at index i". The answer for dp[i] is nums[i] + max{dp[i+j]} for 1 <= j <= k. That gives an O(n*k) solution. Instead of checking every j for every i, keep track of the largest dp[i] values in a heap and calculate dp[i] from right to left. When the largest value i... | Array,Dynamic Programming,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue | Medium | 239,2001 |
430 | Hello Everyone Welcome to Delhi Flight Channel And subscribe The Amazing Subscribe To A Plot To Multiply Avoid During This Liquid 432 In This Question Thursday Subscribe Video subscribe and subscribe the Channel Please subscribe and subscribe the Channel Loot Superintendent Engineer and Eight This particular Doob Schoo... | Flatten a Multilevel Doubly Linked List | flatten-a-multilevel-doubly-linked-list | You are given a doubly linked list, which contains nodes that have a next pointer, a previous pointer, and an additional **child pointer**. This child pointer may or may not point to a separate doubly linked list, also containing these special nodes. These child lists may have one or more children of their own, and so ... | null | null | Medium | null |
516 | hello everyone welcome to netset os today in this video we will see how to find out longest palindromic subsequence if you have any problem in understanding subsequence i have made a special video on it the video link will be in the description below so let's start how to find out longest palindromic subsequence let's ... | 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 |
48 | okay leak code question 48 rotate image you're given an n by n 2d matrix represented in an image rotate the image by 90 degrees clockwise you have to rotate the image in place which means you have to modify the input 2d matrix directly do not allocate another 2d matrix and do the rotation so in this example we have jus... | 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 |
443 | hello guys today I watch other self dust during compression profit give array of characters a compress it in place a lens after compression must always be smaller than a leakage energy no array every element of the relation of your character not in tollens one after you are to be modifying the input array in place retu... | String Compression | string-compression | Given an array of characters `chars`, compress it using the following algorithm:
Begin with an empty string `s`. For each group of **consecutive repeating characters** in `chars`:
* If the group's length is `1`, append the character to `s`.
* Otherwise, append the character followed by the group's length.
The co... | How do you know if you are at the end of a consecutive group of characters? | Two Pointers,String | Medium | 38,271,604,1241 |
125 | hi everyone in this video we will solve the problem valid palindrome on lead code so the problem says given a string s return true if s is a palindrome and Falls otherwise so for example if we have the word race car we reverse the word and we still get race car so if it's the same as the original then we know that it i... | Valid Palindrome | valid-palindrome | A phrase is a **palindrome** if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.
Given a string `s`, return `true` _if it is a **palindrome**, or_ `false` _otherwise_... | null | Two Pointers,String | Easy | 234,680,2130,2231 |
1,857 | hey everybody this is larry this is me going with q4 of the weekly contest 240 largest color by unit directed graph uh hit the like button hit the subscribe button join me on discord let me know what you think about this problem so this problem has a lot of different components i urge you to kind of practice it um the ... | Largest Color Value in a Directed Graph | largest-color-value-in-a-directed-graph | There is a **directed graph** of `n` colored nodes and `m` edges. The nodes are numbered from `0` to `n - 1`.
You are given a string `colors` where `colors[i]` is a lowercase English letter representing the **color** of the `ith` node in this graph (**0-indexed**). You are also given a 2D array `edges` where `edges[j]... | null | null | Hard | null |
1,745 | hey everybody this is larry this is me going with q4 of the weekly contest 226 of lead code palindrome petitioning 4. uh hit the like button hit the subscribe button join me on discord let me know what you think about this problem so this one is a little bit tricky for me just because in python um this is a very hard p... | Palindrome Partitioning IV | find-nearest-right-node-in-binary-tree | Given a string `s`, return `true` _if it is possible to split the string_ `s` _into three **non-empty** palindromic substrings. Otherwise, return_ `false`.
A string is said to be palindrome if it the same string when reversed.
**Example 1:**
**Input:** s = "abcbdd "
**Output:** true
**Explanation: ** "abcbdd "... | Use BFS, traverse the tree level by level and always push the left node first When you reach the target node, mark a boolean variable true If you meet another node in the same level after marking the boolean true, return this node. If you did not meet new nodes in the same level and started traversing a new level, ret... | Tree,Breadth-First Search,Binary Tree | Medium | null |
344 | hey guys persistent programmer here and welcome to my channel so if you're new here we solve a lot of problems on this channel and today we're gonna be looking at the reverse string problem so this is a really interesting problem when you use the two pointer solution to solve it and that's exactly what we will be doing... | Reverse String | reverse-string | Write a function that reverses a string. The input string is given as an array of characters `s`.
You must do this by modifying the input array [in-place](https://en.wikipedia.org/wiki/In-place_algorithm) with `O(1)` extra memory.
**Example 1:**
**Input:** s = \["h","e","l","l","o"\]
**Output:** \["o","l","l","e","h... | The entire logic for reversing a string is based on using the opposite directional two-pointer approach! | Two Pointers,String,Recursion | Easy | 345,541 |
871 | Bullet Guys Welcome To Our Channel What's Onion In This Video You Will Be Talking About Minimum Number Of Curing Stops Problem Udhar Lead Code Indexes 80 Problems Categorized As Heart Problem Delete Ok Sorry For Movie Phanda Just Want To Ask Weather You Have Done This Problem and possible third list to be destroyed bec... | Minimum Number of Refueling Stops | keys-and-rooms | A car travels from a starting position to a destination which is `target` miles east of the starting position.
There are gas stations along the way. The gas stations are represented as an array `stations` where `stations[i] = [positioni, fueli]` indicates that the `ith` gas station is `positioni` miles east of the sta... | null | Depth-First Search,Breadth-First Search,Graph | Medium | 261 |
387 | hello everyone welcome back uh here is van damson with another live coding session and today we got a super interesting problem on our hands first unique character in asterisk so sounds simple right but there is so much more to it so stick around and let's dive deep together so here is the task given a string we need t... | First Unique Character in a String | first-unique-character-in-a-string | Given a string `s`, _find the first non-repeating character in it and return its index_. If it does not exist, return `-1`.
**Example 1:**
**Input:** s = "leetcode"
**Output:** 0
**Example 2:**
**Input:** s = "loveleetcode"
**Output:** 2
**Example 3:**
**Input:** s = "aabb"
**Output:** -1
**Constraints:**
* `... | null | Hash Table,String,Queue,Counting | Easy | 451 |
623 | hello everyone so today i want to solve this question add one row to into the tree okay so let us read the description so given the root of a binary tree okay the value v uh end of the d okay so there are two values they are given you need to add a row of node with the value v at the given depth d the root node is a de... | Add One Row to Tree | add-one-row-to-tree | Given the `root` of a binary tree and two integers `val` and `depth`, add a row of nodes with value `val` at the given depth `depth`.
Note that the `root` node is at depth `1`.
The adding rule is:
* Given the integer `depth`, for each not null tree node `cur` at the depth `depth - 1`, create two tree nodes with va... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
1,936 | hello everyone welcome to quartus camp in this video we are going to cover the problem at minimum number of ranks which has been asked in one of the lead code weekly contest so the input given here is an integer array runs and an integer variable distance and we have to return the minimum number of trunks that we must ... | 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 |
1,464 | hey everybody this is Larry I'm doing this problem as part of a contest so you're gonna watch me live as I go through my darts I'm coding they've been explanation near the end and for more context there'll be a link below on this actual screencast of the contest how did you do let me know you do hit the like button eit... | Maximum Product of Two Elements in an Array | reduce-array-size-to-the-half | Given the array of integers `nums`, you will choose two different indices `i` and `j` of that array. _Return the maximum value of_ `(nums[i]-1)*(nums[j]-1)`.
**Example 1:**
**Input:** nums = \[3,4,5,2\]
**Output:** 12
**Explanation:** If you choose the indices i=1 and j=2 (indexed from 0), you will get the maximum v... | Count the frequency of each integer in the array. Start with an empty set, add to the set the integer with the maximum frequency. Keep Adding the integer with the max frequency until you remove at least half of the integers. | Array,Hash Table,Greedy,Sorting,Heap (Priority Queue) | Medium | null |
129 | hi everyone this is a question about tree so this question is sums root 2 leaf number you are given a root of a binary tree containing digits from 0 to 9 only issue to leave path in the tree represent a number so for example the root to leave path is one two three now represent a number one two three and return to retu... | 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 |
1,679 | Hi Ga Namaskar, welcome to the channel, this is lead code 1679, max number of even pairs for 90 days, this is how it is going on, question number 12, lead code is 75, see what is the question, you have been given an array like tooth 4, it can also be sorted. It can also be non-sorted. It can also be non-sorted. It can ... | Max Number of K-Sum Pairs | shortest-subarray-to-be-removed-to-make-array-sorted | You are given an integer array `nums` and an integer `k`.
In one operation, you can pick two numbers from the array whose sum equals `k` and remove them from the array.
Return _the maximum number of operations you can perform on the array_.
**Example 1:**
**Input:** nums = \[1,2,3,4\], k = 5
**Output:** 2
**Explana... | The key is to find the longest non-decreasing subarray starting with the first element or ending with the last element, respectively. After removing some subarray, the result is the concatenation of a sorted prefix and a sorted suffix, where the last element of the prefix is smaller than the first element of the suffix... | Array,Two Pointers,Binary Search,Stack,Monotonic Stack | Medium | null |
1,632 | hey everybody this is larry this is me going over q4 of the reason contest ranked transformer matrix uh sadly to be honest i didn't solve this during the contest um i solved this about like 10 minutes afterwards uh with some motivation you could watch me solve this live during the contest and also afterwards uh after t... | Rank Transform of a Matrix | number-of-good-ways-to-split-a-string | Given an `m x n` `matrix`, return _a new matrix_ `answer` _where_ `answer[row][col]` _is the_ _**rank** of_ `matrix[row][col]`.
The **rank** is an **integer** that represents how large an element is compared to other elements. It is calculated using the following rules:
* The rank is an integer starting from `1`.
*... | Use two HashMap to store the counts of distinct letters in the left and right substring divided by the current index. | String,Dynamic Programming,Bit Manipulation | Medium | null |
509 | Hello guys welcome to the hunt Delhi challenge problem and some viewers problem Medical teams number Sotheby's number commonly believed in the form of sequence of difficult surgeries number 10 2010 2011 2012 plus one number to the number one plus one number After OnePlus 3T Rudra Number After 10 Female Actress 500 You ... | Fibonacci Number | inorder-successor-in-bst-ii | The **Fibonacci numbers**, commonly denoted `F(n)` form a sequence, called the **Fibonacci sequence**, such that each number is the sum of the two preceding ones, starting from `0` and `1`. That is,
F(0) = 0, F(1) = 1
F(n) = F(n - 1) + F(n - 2), for n > 1.
Given `n`, calculate `F(n)`.
**Example 1:**
**Input:** n = ... | null | Tree,Binary Search Tree,Binary Tree | Medium | 285 |
1,390 | number 1300 high the ico said part of the contest 181 was frankly I couldn't solve it at that moment it is more of a mathematical problem but it has some interesting things what this problem asks of us is that they are going to give us an arrangement with several numbers and we must of taking the divisors of each of it... | Four Divisors | average-selling-price | Given an integer array `nums`, return _the sum of divisors of the integers in that array that have exactly four divisors_. If there is no such integer in the array, return `0`.
**Example 1:**
**Input:** nums = \[21,4,7\]
**Output:** 32
**Explanation:**
21 has 4 divisors: 1, 3, 7, 21
4 has 3 divisors: 1, 2, 4
7 has 2... | null | Database | Easy | null |
1,276 | hi today i'm talking about leak code problem 1276 number of burgers with no waste ingredients what this problem asks you to do is write a function that will take a number of tomato slices and a number of cheese slices and it will output a list with two elements where the first element in the list is the number of jumbo... | Number of Burgers with No Waste of Ingredients | closest-divisors | Given two integers `tomatoSlices` and `cheeseSlices`. The ingredients of different burgers are as follows:
* **Jumbo Burger:** `4` tomato slices and `1` cheese slice.
* **Small Burger:** `2` Tomato slices and `1` cheese slice.
Return `[total_jumbo, total_small]` so that the number of remaining `tomatoSlices` equa... | Find the divisors of n+1 and n+2. To find the divisors of a number, you only need to iterate to the square root of that number. | Math | Medium | null |
1,644 | hey everybody this is Larry this is me doing the weekly premium problem uh 1644 lowest common ancestor of a binary tree too hit the like button in the Subscribe button drop me on this card let me know what you think about this farm this is uh yeah let's take a look I haven't done this one yet but it sounds okay let's s... | Lowest Common Ancestor of a Binary Tree II | maximum-number-of-non-overlapping-substrings | Given the `root` of a binary tree, return _the lowest common ancestor (LCA) of two given nodes,_ `p` _and_ `q`. If either node `p` or `q` **does not exist** in the tree, return `null`. All values of the nodes in the tree are **unique**.
According to the **[definition of LCA on Wikipedia](https://en.wikipedia.org/wiki/... | Notice that it's impossible for any two valid substrings to overlap unless one is inside another. We can start by finding the starting and ending index for each character. From these indices, we can form the substrings by expanding each character's range if necessary (if another character exists in the range with small... | String,Greedy | Hard | null |
1,929 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem concatenation of array we're given an integer array nums of length n so maybe something like this where the length is obviously three values we want to return a concatenation of this array meaning we take this array and... | Concatenation of Array | maximum-value-at-a-given-index-in-a-bounded-array | Given an integer array `nums` of length `n`, you want to create an array `ans` of length `2n` where `ans[i] == nums[i]` and `ans[i + n] == nums[i]` for `0 <= i < n` (**0-indexed**).
Specifically, `ans` is the **concatenation** of two `nums` arrays.
Return _the array_ `ans`.
**Example 1:**
**Input:** nums = \[1,2,1\... | What if the problem was instead determining if you could generate a valid array with nums[index] == target? To generate the array, set nums[index] to target, nums[index-i] to target-i, and nums[index+i] to target-i. Then, this will give the minimum possible sum, so check if the sum is less than or equal to maxSum. n is... | Binary Search,Greedy | Medium | null |
85 | hi guys hope you're doing great today's question is maximal rectangle so the patients say is given a 2d binary matrix filled with zeros and ones find the largest rectangle containing only ones and return its area so for example here in this matrix as we can see this is the highlighted rectangle with ones okay so the re... | 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 |
290 | video World python Securities as well as the same pattern so here follow me so full matches that there is a bijection between letter and pattern and a non-multivatory test pattern and a non-multivatory test pattern and a non-multivatory test so the building problem is given a patent or EA next to ADB I will string dot ... | Word Pattern | word-pattern | Given a `pattern` and a string `s`, find if `s` follows the same pattern.
Here **follow** means a full match, such that there is a bijection between a letter in `pattern` and a **non-empty** word in `s`.
**Example 1:**
**Input:** pattern = "abba ", s = "dog cat cat dog "
**Output:** true
**Example 2:**
**Input:*... | null | Hash Table,String | Easy | 205,291 |
139 | So hello everyone, today is 4th August and today we are going to solve the poo problem of let's code. Break, so here it is said that there is a string named S and we have a dictionary of string which will contain what it means, you can say what we can do. Can also be found in the dictionary, multiple times in D segment... | Word Break | word-break | Given a string `s` and a dictionary of strings `wordDict`, return `true` if `s` can be segmented into a space-separated sequence of one or more dictionary words.
**Note** that the same word in the dictionary may be reused multiple times in the segmentation.
**Example 1:**
**Input:** s = "leetcode ", wordDict = \[ "... | null | Hash Table,String,Dynamic Programming,Trie,Memoization | Medium | 140 |
347 | leite code 347 top K frequent elements given an integer array nums and an integer K return the K most frequent elements you can return the answer in any order okay um this is a uh the this is a two-part problem so the first part is a two-part problem so the first part is a two-part problem so the first part of it is a ... | Top K Frequent Elements | top-k-frequent-elements | Given an integer array `nums` and an integer `k`, return _the_ `k` _most frequent elements_. You may return the answer in **any order**.
**Example 1:**
**Input:** nums = \[1,1,1,2,2,3\], k = 2
**Output:** \[1,2\]
**Example 2:**
**Input:** nums = \[1\], k = 1
**Output:** \[1\]
**Constraints:**
* `1 <= nums.lengt... | null | Array,Hash Table,Divide and Conquer,Sorting,Heap (Priority Queue),Bucket Sort,Counting,Quickselect | Medium | 192,215,451,659,692,1014,1919 |
162 | hello everyone today, one of the tasks on the Finder lead code, we still have to throw those tasks to ask about this work in our hit from find the highest Why are you our Picnic because our appearance is like three and so I’ll because our appearance is like three and so I’ll because our appearance is like three and so ... | Find Peak Element | find-peak-element | A peak element is an element that is strictly greater than its neighbors.
Given a **0-indexed** integer array `nums`, find a peak element, and return its index. If the array contains multiple peaks, return the index to **any of the peaks**.
You may imagine that `nums[-1] = nums[n] = -∞`. In other words, an element is... | null | Array,Binary Search | Medium | 882,2047,2273,2316 |
1,838 | Hello and welcome to my channel this is Shaurya Vasti and today we will solve the medium level problem of lead code which is to tell the frequency of the most frequency and after that we can increment it by one and as many operations. We are given as many numbers as we can do this number of times, like this is an opera... | Frequency of the Most Frequent Element | number-of-distinct-substrings-in-a-string | The **frequency** of an element is the number of times it occurs in an array.
You are given an integer array `nums` and an integer `k`. In one operation, you can choose an index of `nums` and increment the element at that index by `1`.
Return _the **maximum possible frequency** of an element after performing **at mos... | Calculate the prefix hashing array for s. Use the prefix hashing array to calculate the hashing value of each substring. Compare the hashing values to determine the unique substrings. There could be collisions if you use hashing, what about double hashing. | String,Trie,Rolling Hash,Suffix Array,Hash Function | Medium | null |
746 | hello guys welcome back to another video today we'll be talking about number four hundred 746 and the Lee code problem set min cost climbing stairs this problem is an easy problem and one of the few problems that have that has so many likes on lee code alright let's get into the problem so on a staircase the I this ste... | Min Cost Climbing Stairs | prefix-and-suffix-search | You are given an integer array `cost` where `cost[i]` is the cost of `ith` step on a staircase. Once you pay the cost, you can either climb one or two steps.
You can either start from the step with index `0`, or the step with index `1`.
Return _the minimum cost to reach the top of the floor_.
**Example 1:**
**Input... | For a word like "test", consider "#test", "t#test", "st#test", "est#test", "test#test". Then if we have a query like prefix = "te", suffix = "t", we can find it by searching for something we've inserted starting with "t#te". | String,Design,Trie | Hard | 211 |
1,029 | Sonu Nigam Two Point Question Today's Attacks Late Co's Question is 2016 Scheduling 1380 People A Company Is Planning To Interview Till Cost Of Drawing The Question To City Eggs Course If Opposite Element And Cost Of Minds Of Those To Cities Screwdriver 800 To 1000 Minimum Cost for every person to cities was exact le i... | Two City Scheduling | vertical-order-traversal-of-a-binary-tree | A company is planning to interview `2n` people. Given the array `costs` where `costs[i] = [aCosti, bCosti]`, the cost of flying the `ith` person to city `a` is `aCosti`, and the cost of flying the `ith` person to city `b` is `bCosti`.
Return _the minimum cost to fly every person to a city_ such that exactly `n` people... | null | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Hard | null |
945 | hello Iraq today we talk about each color problem 945 minimum increment to make armory unique the problem is about given an array of integers a or mu consists of cruising any AI and increment it by 1 return this number of modes to make every value being a unique let's say an example 1 the input array is a one who true ... | Minimum Increment to Make Array Unique | snakes-and-ladders | You are given an integer array `nums`. In one move, you can pick an index `i` where `0 <= i < nums.length` and increment `nums[i]` by `1`.
Return _the minimum number of moves to make every value in_ `nums` _**unique**_.
The test cases are generated so that the answer fits in a 32-bit integer.
**Example 1:**
**Input... | null | Array,Breadth-First Search,Matrix | Medium | null |
1,419 | hello uh let's do a question minute number of frogs croaking so you're given a string of frogs which represent a combination of string croak from different frogs each multiple frogs can crook at the same time so multiple croak are mixed and turn the minimum number of different frogs to finish all the croaks in a given ... | Minimum Number of Frogs Croaking | minimum-number-of-frogs-croaking | You are given the string `croakOfFrogs`, which represents a combination of the string `"croak "` from different frogs, that is, multiple frogs can croak at the same time, so multiple `"croak "` are mixed.
_Return the minimum number of_ different _frogs to finish all the croaks in the given string._
A valid `"croak "`... | null | null | Medium | null |
1,723 | Hello friends today let's find the minimum time to finish all jobs let's see some examples in this example the drops would be 323 it means in total we have three jobs and each job would take three uh maybe hours or days and two days or three days and now we have three a person who will work on these jobs so we would li... | Find Minimum Time to Finish All Jobs | maximum-number-of-achievable-transfer-requests | You are given an integer array `jobs`, where `jobs[i]` is the amount of time it takes to complete the `ith` job.
There are `k` workers that you can assign jobs to. Each job should be assigned to **exactly** one worker. The **working time** of a worker is the sum of the time it takes to complete all jobs assigned to th... | Think brute force When is a subset of requests okay? | Array,Backtracking,Bit Manipulation,Enumeration | Hard | null |
1,834 | hey what's up guys uh this is juan here again so this time 1834 single thread and cpu okay so this one um so the description is a little bit long you know so you're given like n tasks labeled from n to n zero from zero to m minus one and each task has two property so the first one is the in q time second one is the pro... | Single-Threaded CPU | minimum-number-of-people-to-teach | You are given `n` tasks labeled from `0` to `n - 1` represented by a 2D integer array `tasks`, where `tasks[i] = [enqueueTimei, processingTimei]` means that the `ith` task will be available to process at `enqueueTimei` and will take `processingTimei` to finish processing.
You have a single-threaded CPU... | You can just use brute force and find out for each language the number of users you need to teach Note that a user can appear in multiple friendships but you need to teach that user only once | Array,Greedy | Medium | null |
1,531 | hey everybody this is lry this is day 27 28 of the Leo day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's PR today's challenge everything in between uh today's PR is going to be 1531 strain compression so ring one length encoding R rle is a string comp... | String Compression II | number-of-ways-to-wear-different-hats-to-each-other | [Run-length encoding](http://en.wikipedia.org/wiki/Run-length_encoding) is a string compression method that works by replacing consecutive identical characters (repeated 2 or more times) with the concatenation of the character and the number marking the count of the characters (length of the run). For example, to compr... | Dynamic programming + bitmask. dp(peopleMask, idHat) number of ways to wear different hats given a bitmask (people visited) and used hats from 1 to idHat-1. | Array,Dynamic Programming,Bit Manipulation,Bitmask | Hard | 2105 |
1,528 | Hello friends, I am Ishwar Maps, welcome to my channel Take Target, friends, today we will see 5000 successful spin problems list, first of all you read the statement, in its statement this Ghee add in tears are in distress of England that today Tejaswini is AIDS patient character. Position is smooth to in India this i... | Shuffle String | kids-with-the-greatest-number-of-candies | You are given a string `s` and an integer array `indices` of the **same length**. The string `s` will be shuffled such that the character at the `ith` position moves to `indices[i]` in the shuffled string.
Return _the shuffled string_.
**Example 1:**
**Input:** s = "codeleet ", `indices` = \[4,5,6,7,0,2,1,3\]
**Out... | Use greedy approach. For each kid check if candies[i] + extraCandies ≥ maximum in Candies[i]. | Array | Easy | null |
1,585 | uh hey everybody this is larry this is me going over q4 of the recent weekly contest 206 uh check if string is transformable with substring sort operation so this so my implementation is like 20 lines of code but i took about a long time because i actually spent like 10 to 15 minutes just like looking or well not 15 mi... | Check If String Is Transformable With Substring Sort Operations | the-kth-factor-of-n | Given two strings `s` and `t`, transform string `s` into string `t` using the following operation any number of times:
* Choose a **non-empty** substring in `s` and sort it in place so the characters are in **ascending order**.
* For example, applying the operation on the underlined substring in `"14234 "` res... | The factors of n will be always in the range [1, n]. Keep a list of all factors sorted. Loop i from 1 to n and add i if n % i == 0. Return the kth factor if it exist in this list. | Math | Medium | null |
389 | all right this lead code question is called find the difference it says given two strings s and T which consists of only lowercase letters string T is generated by randomly shuffling string s and then adding one more letter at a random position find the letter that was added in T so the example they give us the first s... | Find the Difference | find-the-difference | You are given two strings `s` and `t`.
String `t` is generated by random shuffling string `s` and then add one more letter at a random position.
Return the letter that was added to `t`.
**Example 1:**
**Input:** s = "abcd ", t = "abcde "
**Output:** "e "
**Explanation:** 'e' is the letter that was added.
**Exam... | null | Hash Table,String,Bit Manipulation,Sorting | Easy | 136 |
321 | hello that's to this question create maximum number caused me much pain but there was a prerequisite question that i recommend you would do before this and that's the previous video that i made so what is this question you're given two arrays num1 num2 with links m and n respectively and also integer k and you want to ... | Create Maximum Number | create-maximum-number | You are given two integer arrays `nums1` and `nums2` of lengths `m` and `n` respectively. `nums1` and `nums2` represent the digits of two numbers. You are also given an integer `k`.
Create the maximum number of length `k <= m + n` from digits of the two numbers. The relative order of the digits from the same array mus... | null | Stack,Greedy,Monotonic Stack | Hard | 402,670 |
1,345 | Hello everyone, welcome to my channel, I think it is not difficult, it will become very easy, ok, quite easy, it will be solved, I am just letting you understand, when I will explain the question, then at that very moment you will understand more than half of the 1345 questions in liquid. The name is Jump Game, initial... | Jump Game IV | perform-string-shifts | Given an array of integers `arr`, you are initially positioned at the first index of the array.
In one step you can jump from index `i` to index:
* `i + 1` where: `i + 1 < arr.length`.
* `i - 1` where: `i - 1 >= 0`.
* `j` where: `arr[i] == arr[j]` and `i != j`.
Return _the minimum number of steps_ to reach the... | Intuitively performing all shift operations is acceptable due to the constraints. You may notice that left shift cancels the right shift, so count the total left shift times (may be negative if the final result is right shift), and perform it once. | Array,Math,String | Easy | null |
1,759 | and welcome back today we have 1759 count number of homogeneous substrings we were given a string and we are to count the total number of substrings which are contiguous and every character in that substring are the same so we're given three examples and I thought we could go in reverse order where let's say we have a ... | 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 |
165 | Loot Hello Viewers Welcome Back To My Channel Suggestion Or Green Day Ka Shraddha Problem But Before Going Forward From Not Like Video Please Like And Subscribe My Channel Health Bell Icon In The Morning You Get Notified When My Post New Video Song Without Any Positive Let's Get Started Problem This computer version nu... | Compare Version Numbers | compare-version-numbers | Given two version numbers, `version1` and `version2`, compare them.
Version numbers consist of **one or more revisions** joined by a dot `'.'`. Each revision consists of **digits** and may contain leading **zeros**. Every revision contains **at least one character**. Revisions are **0-indexed from left to right**, wit... | null | Two Pointers,String | Medium | null |
430 | hello everyone welcome back so today's question is flatten or multi-level question is flatten or multi-level question is flatten or multi-level doubly-linked list you are given a doubly-linked list you are given a doubly-linked list you are given a doubly-linked list which in addition to doubly-linked list which in add... | Flatten a Multilevel Doubly Linked List | flatten-a-multilevel-doubly-linked-list | You are given a doubly linked list, which contains nodes that have a next pointer, a previous pointer, and an additional **child pointer**. This child pointer may or may not point to a separate doubly linked list, also containing these special nodes. These child lists may have one or more children of their own, and so ... | null | null | Medium | null |
299 | hello so let's talk about the bows and calls so this is one of the game you definitely play so uh you're just given the secret number secret and the guessing number so you want to return the hint for your friend the a represents the accurate number P represent the number is correct but the position is not correct so a ... | Bulls and Cows | bulls-and-cows | You are playing the **[Bulls and Cows](https://en.wikipedia.org/wiki/Bulls_and_Cows)** game with your friend.
You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint with the following info:
* The number of "bulls ", which are digits in the ... | null | Hash Table,String,Counting | Medium | null |
1,816 | Hello hello welcome to station and say z problem and turn on the light sentences for morning hair sentence's 1st day collection whatsapp request english play list 150 gram paneer waiting for me and content five whatsapp images english speech and give it difficult for engineers and you Need to return gift to give water ... | 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 |
330 | welcome to august eco challenge this problem is called patching array given assorted integer array nums and an integer n add slash patch elements to the array such that any number in the range 1 to n inclusive can be formed by the sum of some elements in the array return the minimum number of patches required okay so i... | Patching Array | patching-array | Given a sorted integer array `nums` and an integer `n`, add/patch elements to the array such that any number in the range `[1, n]` inclusive can be formed by the sum of some elements in the array.
Return _the minimum number of patches required_.
**Example 1:**
**Input:** nums = \[1,3\], n = 6
**Output:** 1
Explanati... | null | Array,Greedy | Hard | 1930 |
848 | hey everybody this is larry this is september 8th so you know the first day of the second week of the lego daily challenge hit the like button hit the subscribe button drum and discord let me know what you're thinking um yeah so i'm going to be doing this for another week um i'm doing a little bit of traveling but i'll... | Shifting Letters | shifting-letters | You are given a string `s` of lowercase English letters and an integer array `shifts` of the same length.
Call the `shift()` of a letter, the next letter in the alphabet, (wrapping around so that `'z'` becomes `'a'`).
* For example, `shift('a') = 'b'`, `shift('t') = 'u'`, and `shift('z') = 'a'`.
Now for each `shif... | null | null | Medium | null |
98 | hi everyone today we are going to solve the read called question validate binary subtree this is actually a very good question to learn basic binary search three so you are given a root the root of binary tree determining if it is a valid binary subtree the definition of valid binary star 3 is as follows the left subtr... | Validate Binary Search Tree | validate-binary-search-tree | Given the `root` of a binary tree, _determine if it is a valid binary search tree (BST)_.
A **valid BST** is defined as follows:
* The left subtree of a node contains only nodes with keys **less than** the node's key.
* The right subtree of a node contains only nodes with keys **greater than** the node's key.
* ... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | 94,501 |
1,192 | hey everybody today we are going to solve another daily lit code challenge so today we got a hard one and the problem is number 1192 critical connections in the network so the problem is we are given a non-directed graph like the one that you non-directed graph like the one that you non-directed graph like the one that... | Critical Connections in a Network | divide-chocolate | There are `n` servers numbered from `0` to `n - 1` connected by undirected server-to-server `connections` forming a network where `connections[i] = [ai, bi]` represents a connection between servers `ai` and `bi`. Any server can reach other servers directly or indirectly through the network.
A _critical connection_ is ... | After dividing the array into K+1 sub-arrays, you will pick the sub-array with the minimum sum. Divide the sub-array into K+1 sub-arrays such that the minimum sub-array sum is as maximum as possible. Use binary search with greedy check. | Array,Binary Search | Hard | 410,1056 |
1,816 | everyone tonight I am working on lead code Challenge number 1816 this one is called truncate sentence and in this challenge you're giving an input sentence which is the parameter s right here and then an integer parameter K and they want you to truncate us such that it contains only the first K number of words so essen... | 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 |
34 | High absolutely questions series and here we are going to atom question number 34 which is find first and last question of element in unsorted is a medium level difficulty of question with super question very good question is very interesting okay and here There are no downloads from some minimum here. What is given to... | Find First and Last Position of Element in Sorted Array | find-first-and-last-position-of-element-in-sorted-array | Given an array of integers `nums` sorted in non-decreasing order, find the starting and ending position of a given `target` value.
If `target` is not found in the array, return `[-1, -1]`.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[5,7,7,8,8,10\], target = 8
*... | null | Array,Binary Search | Medium | 278,2165,2210 |
1,022 | welcome to september's leeco challenge today's problem is sum of route to leaf binary numbers given a binary tree each node has value 0 or 1. each route to leaf path represents a binary number starting with the most significant bit for example if the path is 0 1 then this is going to be represented by 0 1 in binary whi... | Sum of Root To Leaf Binary Numbers | unique-paths-iii | You are given the `root` of a binary tree where each node has a value `0` or `1`. Each root-to-leaf path represents a binary number starting with the most significant bit.
* For example, if the path is `0 -> 1 -> 1 -> 0 -> 1`, then this could represent `01101` in binary, which is `13`.
For all leaves in the tree, c... | null | Array,Backtracking,Bit Manipulation,Matrix | Hard | 37,63,212 |
146 | hello friends today less of the LRU cache design and the employment a data structure for leads to recently used her cache it issued a suppose has a following operations dirty and put get a key can as a value will always be positive of the key if the key exists in the cache otherwise return negative one put a key value ... | LRU Cache | lru-cache | Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**.
Implement the `LRUCache` class:
* `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`.
* `int get(int key)` Return the valu... | null | Hash Table,Linked List,Design,Doubly-Linked List | Medium | 460,588,604,1903 |
153 | hey guys welcome back to the channel today we're going to be solving the code 153 find minimum in rotated sorted array keywords are rotated and sorted it also asks us to do it in log in time and i'm going to show you guys three different ways of doing it the first one is kind of like a cheat method and it's just simply... | 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 |
820 | Hello Guys Welcome to Your Consideration Questions for Trading Video then subscribe to the Page if you liked The Video then subscribe to The Amazing That Aditya And In The mid day meal will start from do and boys celebrate valentine wedding valency subscribe liquid subscribe ameer vote mange more likely to video subscr... | Short Encoding of Words | find-eventual-safe-states | A **valid encoding** of an array of `words` is any reference string `s` and array of indices `indices` such that:
* `words.length == indices.length`
* The reference string `s` ends with the `'#'` character.
* For each index `indices[i]`, the **substring** of `s` starting from `indices[i]` and up to (but not incl... | null | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | null |
1,189 | section 1189 so this is the maximum number of balloons so given a string text and you are find the characters or texts will form as many as a word balloon as possible but each text can only use once okay so for example at least you can from the balloon and this you can from the two balloons okay i think this problem is... | 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 |
609 | Hello Hi Everyone Welcome To My Channel Night Fall Bilk Problem Says Problem Court Appeared In Amazon Microbes Interview Solve This Problem Statement Of Account In First Directly And Indirectly Or Directly From Multiple Files From The Tak Considered Upon Its Mode On * All Considered Upon Its Mode On * All Considered Up... | Find Duplicate File in System | find-duplicate-file-in-system | Given a list `paths` of directory info, including the directory path, and all the files with contents in this directory, return _all the duplicate files in the file system in terms of their paths_. You may return the answer in **any order**.
A group of duplicate files consists of at least two files that have the same ... | null | Array,Hash Table,String | Medium | 2079 |
1,566 | Hello hello everybody welcome to my channel its all digit code problem detect pattern offline tempted and mota is in this problem has given address of no individual are and how to find the length of david k and subscribe button and bell multiple times and the subscribe to r Feed subscribe to this is true for so special... | Detect Pattern of Length M Repeated K or More Times | check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence | Given an array of positive integers `arr`, find a pattern of length `m` that is repeated `k` or more times.
A **pattern** is a subarray (consecutive sub-sequence) that consists of one or more values, repeated multiple times **consecutively** without overlapping. A pattern is defined by its length and the number of rep... | First extract the words of the sentence. Check for each word if searchWord occurs at index 0, if so return the index of this word (1-indexed) If searchWord doesn't exist as a prefix of any word return the default value (-1). | String,String Matching | Easy | 2292 |
1,020 | hello guys today we are going to see the lead code question 1020 that is number of En Clips here we are given M cross n binary Matrix where zero represents a C cell and one represents a land cell that means these all are C or water and one all one or land a move consist of working from one land cell to another adjacent... | 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 |
205 | hello guys myself Amrita welcome back to our Channel techno Siege so in today's video we are going to discuss lead code problem number 205 that is isomorphic strings so let's get started let's first understand the problem given two strings s and t determine if they are isomorphic two strings sntr isomorphic if characte... | Isomorphic Strings | isomorphic-strings | Given two strings `s` and `t`, _determine if they are isomorphic_.
Two strings `s` and `t` are isomorphic if the characters in `s` can be replaced to get `t`.
All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same characte... | null | Hash Table,String | Easy | 290 |
700 | hey hello there today's liquid in challenge question it's called the search in a binary search tree we have a root node to the binary search tree and the target value we need to find if there is a node inside this binary search tree that has the value equal to the target value if there is such a node we return the poin... | Search in a Binary Search Tree | search-in-a-binary-search-tree | You are given the `root` of a binary search tree (BST) and an integer `val`.
Find the node in the BST that the node's value equals `val` and return the subtree rooted with that node. If such a node does not exist, return `null`.
**Example 1:**
**Input:** root = \[4,2,7,1,3\], val = 2
**Output:** \[2,1,3\]
**Example... | null | null | Easy | null |
373 | hi everyone in today challenge we are going to solve this problem the problem name is find K pairs with the smallest sum and the problem number is 373. as usual first of all because problem statement after that we are going to move to the logic part we are going to see how we can solve this problem what is the logic to... | Find K Pairs with Smallest Sums | find-k-pairs-with-smallest-sums | You are given two integer arrays `nums1` and `nums2` sorted in **ascending order** and an integer `k`.
Define a pair `(u, v)` which consists of one element from the first array and one element from the second array.
Return _the_ `k` _pairs_ `(u1, v1), (u2, v2), ..., (uk, vk)` _with the smallest sums_.
**Example 1:**... | null | Array,Heap (Priority Queue) | Medium | 378,719,2150 |
1,237 | basically uh solving the code one two three seven and uh i don't know whether this question is interesting but it i mean it looks like there is no other ways to solve it because uh if you know basically some mathematics then you know that the there's no uh any algorithms basically you can find any pos you can find posi... | Find Positive Integer Solution for a Given Equation | reported-posts-ii | Given a callable function `f(x, y)` **with a hidden formula** and a value `z`, reverse engineer the formula and return _all positive integer pairs_ `x` _and_ `y` _where_ `f(x,y) == z`. You may return the pairs in any order.
While the exact formula is hidden, the function is monotonically increasing, i.e.:
* `f(x, y... | null | Database | Medium | null |
202 | hello in this video we're going to be doing lead code problem 202 which is Happy number this is an easy problem and it states write an algorithm to determine if a number n is Happy what does that mean a happy number is a number defined by the following process starting with any positive integer replace the number by th... | Happy Number | happy-number | Write an algorithm to determine if a number `n` is happy.
A **happy number** is a number defined by the following process:
* Starting with any positive integer, replace the number by the sum of the squares of its digits.
* Repeat the process until the number equals 1 (where it will stay), or it **loops endlessly ... | null | Hash Table,Math,Two Pointers | Easy | 141,258,263,2076 |
452 | I hope that do in this video minimum number of arrows to burst balloon it has been asked by Amazon Apple Microsoft and Uber again um I highly recommend please go and watch the parent video for any kind of interval problem so that you have an intuition of what kind of things you need to think of while you even encounter... | 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 |
237 | Jhal Hello Hi Guys Welcome to Code West Today's question is not in the list in this question verma2 Right function to delete unwanted nursing killing at least you will not give any access to the head of the list in hat you will give the access to the Not be dated 20th day denoted is not attained not ok morning this riv... | 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 |
269 | hello friends welcome back today we'll be going over another lead code problem called alien diction T this is another frequently asked question by Facebook and if this question has also been asked quite a few times by Amazon Google Microsoft Apple and quite a few other companies let's go through the problem description... | Alien Dictionary | alien-dictionary | There is a new alien language that uses the English alphabet. However, the order among the letters is unknown to you.
You are given a list of strings `words` from the alien language's dictionary, where the strings in `words` are **sorted lexicographically** by the rules of this new language.
Return _a string of the u... | null | Array,String,Depth-First Search,Breadth-First Search,Graph,Topological Sort | Hard | 210 |
983 | Hello friends today I'm going to solve liquid problem number 983 minimum cost for tickets in this problem we are given two areas days and costs um in today's area um those are the num the days in a year uh when we will be traveling so the value would be ranging from 1 to 365 and the cost is uh um is of length 3 which h... | Minimum Cost For Tickets | validate-stack-sequences | You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array `days`. Each day is an integer from `1` to `365`.
Train tickets are sold in **three different ways**:
* a **1-day** pass is sold for `costs[0]` dollars,
* a **7-day** pass is sold... | null | Array,Stack,Simulation | Medium | null |
299 | On Karo Ki A Hello Everyone Welcome Back to the Channel Programming Bodh This Platform Court On this channel we are going to discuss very topic temple programs important questions like Google like metric like Doobie and terrorism like Amazon, if you love any company or not, here are the types which are going to discuss... | Bulls and Cows | bulls-and-cows | You are playing the **[Bulls and Cows](https://en.wikipedia.org/wiki/Bulls_and_Cows)** game with your friend.
You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint with the following info:
* The number of "bulls ", which are digits in the ... | null | Hash Table,String,Counting | Medium | null |
94 | everyone welcome back and let's write some more neat code today so today let's solve binary tree in order traversal and this is actually a pretty trivial problem if you've you know done anything with trees before especially if we do the recursive solution which we will but we're going to take that recursive solution an... | Binary Tree Inorder Traversal | binary-tree-inorder-traversal | Given the `root` of a binary tree, return _the inorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[1,3,2\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of nodes i... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 98,144,145,173,230,272,285,758,799 |
1,416 | hello guys welcome to deep codes and in today's video we will discuss net good question 1416 that says restore the item so guys as you can see in the past few days we are getting very more and more questions on the string and deeper related in the lead code daily challenge so today's question is also very much similar ... | Restore The Array | check-if-an-array-is-consecutive | A program was supposed to print an array of integers. The program forgot to print whitespaces and the array is printed as a string of digits `s` and all we know is that all integers in the array were in the range `[1, k]` and there are no leading zeros in the array.
Given the string `s` and the integer `k`, return _th... | Try sorting nums. If nums is consecutive and sorted in ascending order, then nums[i] + 1 = nums[i + 1] for every i in the range 0 ≤ i < nums.length - 1. | Array | Easy | 298,549,1542 |
935 | everyone and good afternoon to all of you today we have problem which name is night derer D code 935 problem so before going forward in this video please make sure that you have liked and subscribed to this Channel and also it's my advice to all of you that please read the problem and try to build up the inducer in you... | Knight Dialer | orderly-queue | The chess knight has a **unique movement**, it may move two squares vertically and one square horizontally, or two squares horizontally and one square vertically (with both forming the shape of an **L**). The possible movements of chess knight are shown in this diagaram:
A chess knight can move as indicated in the che... | null | Math,String,Sorting | Hard | null |
452 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem minimum number of arrows to burst balloons don't worry it's not as hard as the original burst balloons problem and they give us a pretty long story here so I'll try to condense it for you so the idea is we're given a bu... | 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 |
354 | hello guys welcome to algorithms made easy today we will be discussing the question russian doll envelopes in this question we are given a 2d array of integers envelopes where envelope i represent the width and the height of an envelope one envelope can fit into another if and only if both the width and the height of o... | Russian Doll Envelopes | russian-doll-envelopes | You are given a 2D array of integers `envelopes` where `envelopes[i] = [wi, hi]` represents the width and the height of an envelope.
One envelope can fit into another if and only if both the width and height of one envelope are greater than the other envelope's width and height.
Return _the maximum number of envelope... | null | Array,Binary Search,Dynamic Programming,Sorting | Hard | 300,2123 |
108 | hey there so today we'll solve one of the problem on lead code uh the problem which says convert sorted array to binary search tree uh to solve that um we will be given input in the array in the binary tree we know that anything which is less than node a root node will go to the left anything which is higher than the r... | Convert Sorted Array to Binary Search Tree | convert-sorted-array-to-binary-search-tree | Given an integer array `nums` where the elements are sorted in **ascending order**, convert _it to a_ **_height-balanced_** _binary search tree_.
**Example 1:**
**Input:** nums = \[-10,-3,0,5,9\]
**Output:** \[0,-3,9,-10,null,5\]
**Explanation:** \[0,-10,5,null,-3,null,9\] is also accepted:
**Example 2:**
**Input... | null | Array,Divide and Conquer,Tree,Binary Search Tree,Binary Tree | Easy | 109 |
100 | question 100 delete code same tree so given the root of two binary trees p and q write a function to check if they are the same or not two binary trees are considered the same if they are structurally identical and the nodes have the same values so with this question it's going to be a recursive solution so what we nee... | Same Tree | same-tree | Given the roots of two binary trees `p` and `q`, write a function to check if they are the same or not.
Two binary trees are considered the same if they are structurally identical, and the nodes have the same value.
**Example 1:**
**Input:** p = \[1,2,3\], q = \[1,2,3\]
**Output:** true
**Example 2:**
**Input:** p... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
3 | hi it's Tom today we are going to solve another very popular problem which is being used during the coding interview it's called longest Sam string without repeating characters so it's pretty easy to understand what's the problem but let's read the dead description given a string find the length of the longest substrin... | Longest Substring Without Repeating Characters | longest-substring-without-repeating-characters | Given a string `s`, find the length of the **longest** **substring** without repeating characters.
**Example 1:**
**Input:** s = "abcabcbb "
**Output:** 3
**Explanation:** The answer is "abc ", with the length of 3.
**Example 2:**
**Input:** s = "bbbbb "
**Output:** 1
**Explanation:** The answer is "b ", with t... | null | Hash Table,String,Sliding Window | Medium | 159,340,1034,1813,2209 |
885 | i Bakir read called questioner 885 square matrix 3 this is the mid intestine ok that's guaranteed on the two-dimensional grid two-dimensional grid two-dimensional grid did Allah and seek help and we started where i'll 0 and C 0 okay now we walk in the clockwise with the special shapes period shape is like this okay whe... | 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 |
374 | so hello everyone i am straight i am a software development engineer so we are starting with this lead code premium top interview problem series we will be discussing each and every problem which are mentioned on the lead code top interviews and also this will help you to crack your next coding interview in the top not... | Guess Number Higher or Lower | guess-number-higher-or-lower | We are playing the Guess Game. The game is as follows:
I pick a number from `1` to `n`. You have to guess which number I picked.
Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess.
You call a pre-defined API `int guess(int num)`, which returns three possible re... | null | Binary Search,Interactive | Easy | 278,375,658 |
1,800 | all right let's do the code um okay easy okay have i done this no given an array of positive numbers it turned the maximum possible sum of an ascending sub array in nums summary is to find looking to use this on numbers in an array is sending of an ascending so it's not necessarily ascending size one is ascending okay ... | Maximum Ascending Subarray Sum | concatenation-of-consecutive-binary-numbers | Given an array of positive integers `nums`, return the _maximum possible sum of an **ascending** subarray in_ `nums`.
A subarray is defined as a contiguous sequence of numbers in an array.
A subarray `[numsl, numsl+1, ..., numsr-1, numsr]` is **ascending** if for all `i` where `l <= i < r`, `numsi < numsi+1`. Note th... | Express the nth number value in a recursion formula and think about how we can do a fast evaluation. | Math,Bit Manipulation,Simulation | Medium | null |
611 | Thank you hi everyone welcome to my channel it's all the problem first triangle number sudhir 1000 from are subscribe me to for triangle properties basically subscribe and share and subscribe video please language video internet subscribe a solution vic and dros bengaluru power free for life sexual more 2513 This hole ... | Valid Triangle Number | valid-triangle-number | Given an integer array `nums`, return _the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle_.
**Example 1:**
**Input:** nums = \[2,2,3,4\]
**Output:** 3
**Explanation:** Valid combinations are:
2,3,4 (using the first 2)
2,3,4 (using the second 2)
2,2,3
*... | null | Array,Two Pointers,Binary Search,Greedy,Sorting | Medium | 259 |
1,335 | hello guys welcome to my channel and today i'm gonna share um legal question number one three five the minimum difficulty of a job schedule and the description is we have to schedule lists of jobs in d-days schedule lists of jobs in d-days schedule lists of jobs in d-days and the jobs are dependent which means you have... | Minimum Difficulty of a Job Schedule | maximum-candies-allocated-to-k-children | You want to schedule a list of jobs in `d` days. Jobs are dependent (i.e To work on the `ith` job, you have to finish all the jobs `j` where `0 <= j < i`).
You have to finish **at least** one task every day. The difficulty of a job schedule is the sum of difficulties of each day of the `d` days. The difficulty of a da... | For a fixed number of candies c, how can you check if each child can get c candies? Use binary search to find the maximum c as the answer. | Array,Binary Search | Medium | 907,1886,2000,2027,2188,2294 |
18 | welcome to good haircut is co-teacher welcome to good haircut is co-teacher welcome to good haircut is co-teacher here we're going to solve for some coding problem so given rate noms of integers and integer target are their enemies ABC and Dean are alums such that a plus B plus C plus D you go to target find all unique... | 4Sum | 4sum | Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that:
* `0 <= a, b, c, d < n`
* `a`, `b`, `c`, and `d` are **distinct**.
* `nums[a] + nums[b] + nums[c] + nums[d] == target`
You may return the answer in **any order**.
**Examp... | null | Array,Two Pointers,Sorting | Medium | 1,15,454,2122 |
1,649 | so lead code 1649 create sorted array through instructions so in this problem you're giving an integer array of instructions which are just numbers and you need to insert them into a nums container and you need to keep this nums container sorted and at every step you have a cost which is the minimum between the number ... | Create Sorted Array through Instructions | maximum-number-of-non-overlapping-subarrays-with-sum-equals-target | Given an integer array `instructions`, you are asked to create a sorted array from the elements in `instructions`. You start with an empty container `nums`. For each element from **left to right** in `instructions`, insert it into `nums`. The **cost** of each insertion is the **minimum** of the following:
* The numb... | Keep track of prefix sums to quickly look up what subarray that sums "target" can be formed at each step of scanning the input array. It can be proved that greedily forming valid subarrays as soon as one is found is optimal. | Array,Hash Table,Greedy,Prefix Sum | Medium | null |
1,417 | Ajay Ko Hello Viewers Welcome Back To My Channel I Hope You Enjoying All Videos The Time Uploading Rihai Manch subscribe To My Channel Airtel Is Gold And Subscribe And Also Share With Your Friends Through This Problem Reformer Distic Give One Alpha Numeric Jayenge Iss Channel Ko Subscribe Station superintendent subscri... | Reformat The String | reformat-the-string | You are given an alphanumeric string `s`. (**Alphanumeric string** is a string consisting of lowercase English letters and digits).
You have to find a permutation of the string where no letter is followed by another letter and no digit is followed by another digit. That is, no two adjacent characters have the same typ... | null | null | Easy | null |
116 | hey yo what's up guys babybear4812 coming at you one more time this time today we're doing problem number 116 populating next right pointers in each node uh old problem been around for a while but past six months amazon facebook bloomberg microsoft and google have all asked it so that means it's relevant if it's releva... | Populating Next Right Pointers in Each Node | populating-next-right-pointers-in-each-node | You are given a **perfect binary tree** where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:
struct Node {
int val;
Node \*left;
Node \*right;
Node \*next;
}
Populate each next pointer to point to its next right node. If there is no next righ... | null | Linked List,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 117,199 |
1,913 | he everyone today we are going to solve theal equation maximum product difference between two pairs okay so constraint said so all numbers are positive so simply um maximum product difference should be first biggest multiply second biggest minus first smallest multiply second smallest so if we use Sal and then take the... | Maximum Product Difference Between Two Pairs | make-the-xor-of-all-segments-equal-to-zero | The **product difference** between two pairs `(a, b)` and `(c, d)` is defined as `(a * b) - (c * d)`.
* For example, the product difference between `(5, 6)` and `(2, 7)` is `(5 * 6) - (2 * 7) = 16`.
Given an integer array `nums`, choose four **distinct** indices `w`, `x`, `y`, and `z` such that the **product differ... | Let's note that for the XOR of all segments with size K to be equal to zeros, nums[i] has to be equal to nums[i+k] Basically, we need to make the first K elements have XOR = 0 and then modify them. | Array,Dynamic Programming,Bit Manipulation | Hard | null |
914 | hey folks welcome back to another video today we're looking at question 914 x of a kind in a deck of cards the way we'll be approaching this problem is by getting the occurrences of all of the like the numbers in the deck and then we will be using those occurrences to get uh the greatest common um divisor if the uh gre... | X of a Kind in a Deck of Cards | random-point-in-non-overlapping-rectangles | You are given an integer array `deck` where `deck[i]` represents the number written on the `ith` card.
Partition the cards into **one or more groups** such that:
* Each group has **exactly** `x` cards where `x > 1`, and
* All the cards in one group have the same integer written on them.
Return `true` _if such pa... | null | Math,Binary Search,Reservoir Sampling,Prefix Sum,Ordered Set,Randomized | Medium | 912,915 |
29 | welcome to february's leeco challenge today's problem is divide two integers given two integers dividend and divisor or divisor divide two integers without using multiplication division and mod operators return the quotient after dividing dividend by divisor the integer division blah basically the quotient is going to ... | 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 |
189 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem rotate array we are given an array and we want to rotate the array by k steps where k is always going to be a non-negative integer so going to be a non-negative integer so going to be a non-negative integer so what exac... | Rotate Array | rotate-array | Given an integer array `nums`, rotate the array to the right by `k` steps, where `k` is non-negative.
**Example 1:**
**Input:** nums = \[1,2,3,4,5,6,7\], k = 3
**Output:** \[5,6,7,1,2,3,4\]
**Explanation:**
rotate 1 steps to the right: \[7,1,2,3,4,5,6\]
rotate 2 steps to the right: \[6,7,1,2,3,4,5\]
rotate 3 steps to... | The easiest solution would use additional memory and that is perfectly fine. The actual trick comes when trying to solve this problem without using any additional memory. This means you need to use the original array somehow to move the elements around. Now, we can place each element in its original location and shift ... | Array,Math,Two Pointers | Medium | 61,186 |
1,796 | uh okay welcome guys welcome to my league also in section one seven nine eight oh sorry i'm sorry one seven nine six subscribe to my channel before i start so second largest theory in the stream right someone give your alphabet string and return second largest and numerical digits that appear in s if minus one that doe... | Second Largest Digit in a String | correct-a-binary-tree | Given an alphanumeric string `s`, return _the **second largest** numerical digit that appears in_ `s`_, or_ `-1` _if it does not exist_.
An **alphanumeric** string is a string consisting of lowercase English letters and digits.
**Example 1:**
**Input:** s = "dfa12321afd "
**Output:** 2
**Explanation:** The digits t... | If you traverse the tree from right to left, the invalid node will point to a node that has already been visited. | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 114,766 |
433 | welcome to lead to JavaScript Channel where we solve every single little question using JavaScript today we have 433 minimum genetic mutation this is a medium question so a gene string can be represented by an a character long string with choices are a c g and T we suppose we need to investigate a mutation for Gen stri... | Minimum Genetic Mutation | minimum-genetic-mutation | A gene string can be represented by an 8-character long string, with choices from `'A'`, `'C'`, `'G'`, and `'T'`.
Suppose we need to investigate a mutation from a gene string `startGene` to a gene string `endGene` where one mutation is defined as one single character changed in the gene string.
* For example, `"AAC... | null | Hash Table,String,Breadth-First Search | Medium | 127 |
1,051 | Hello friends, today we are going to do problem number 1051 of lead code, its name is Height Checker, it is going to be an easy category problem, let us understand this problem first what does this problem want, in this we have been given an array of heights, we want that Let us create an expected array which should be... | 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 |
712 | hey everybody this is Larry this is day 31st of July the last day of the July legal date and so if you've been here with me uh congratulations and thank you I suppose uh we'll be doing August as well I mean you know me now uh we have a 12 16 and then that's a 1216 Day Street going so I don't know it'll fight and at som... | Minimum ASCII Delete Sum for Two Strings | minimum-ascii-delete-sum-for-two-strings | Given two strings `s1` and `s2`, return _the lowest **ASCII** sum of deleted characters to make two strings equal_.
**Example 1:**
**Input:** s1 = "sea ", s2 = "eat "
**Output:** 231
**Explanation:** Deleting "s " from "sea " adds the ASCII value of "s " (115) to the sum.
Deleting "t " from "eat " adds 116 to ... | Let dp(i, j) be the answer for inputs s1[i:] and s2[j:]. | String,Dynamic Programming | Medium | 72,300,583 |
487 | See, in this video we are going to ask the question ' See, in this video we are going to ask the question ' See, in this video we are going to ask the question ' Maximum Consecutive Once Tu Premium Hai Bhai'. If this is not a lover then this Hai Bhai'. If this is not a lover then this Hai Bhai'. If this is not a lover ... | Max Consecutive Ones II | max-consecutive-ones-ii | Given a binary array `nums`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most one_ `0`.
**Example 1:**
**Input:** nums = \[1,0,1,1,0\]
**Output:** 4
**Explanation:**
- If we flip the first zero, nums becomes \[1,1,1,1,0\] and we have 4 consecutive ones.
- If we flip the second z... | null | Array,Dynamic Programming,Sliding Window | Medium | 485,1046,2261 |
367 | welcome to Mays LICO challenge today's problem is valid perfect square I actually made a video for this a couple days ago but unfortunately forgot to plug in my microphone so be doing again so here's the problem given a positive integer num write a function which returns true if num is a perfect square and all that mea... | 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 |
257 | okay so now we are going to solve a problem which has been very frequently Asked in interviews okay so uh we will be given uh binary tree okay before we move ahead let me ask you a very quick McQ kind of question so we have a binary tree okay we have a binary tree with n nodes what can be the maximum value of its heigh... | Binary Tree Paths | binary-tree-paths | Given the `root` of a binary tree, return _all root-to-leaf paths in **any order**_.
A **leaf** is a node with no children.
**Example 1:**
**Input:** root = \[1,2,3,null,5\]
**Output:** \[ "1->2->5 ", "1->3 "\]
**Example 2:**
**Input:** root = \[1\]
**Output:** \[ "1 "\]
**Constraints:**
* The number of nodes ... | null | String,Backtracking,Tree,Depth-First Search,Binary Tree | Easy | 113,1030,2217 |
1,060 | hey everybody this is Larry this is us doing week five of the weekly premium problem 1060. missing element inserted away hit the like button hit the Subscribe button join me on Discord let me know what you think about today's Forum or these problems or well I don't know we this week's for this week's Farm all right so ... | Missing Element in Sorted Array | longest-repeating-substring | Given an integer array `nums` which is sorted in **ascending order** and all of its elements are **unique** and given also an integer `k`, return the `kth` missing number starting from the leftmost number of the array.
**Example 1:**
**Input:** nums = \[4,7,9,10\], k = 1
**Output:** 5
**Explanation:** The first missi... | Generate all substrings in O(N^2) time with hashing. Choose those hashing of strings with the largest length. | String,Binary Search,Dynamic Programming,Rolling Hash,Suffix Array,Hash Function | Medium | null |
334 | hey guys in today's video we'll cover the question increasing triplet subsequence this is a commonly asked question in interviews of google amazon and facebook it's a medium difficulty problem so let's jump right into it the question is given an integer of array nums return true if there exists a triple of indices i j ... | Increasing Triplet Subsequence | increasing-triplet-subsequence | Given an integer array `nums`, return `true` _if there exists a triple of indices_ `(i, j, k)` _such that_ `i < j < k` _and_ `nums[i] < nums[j] < nums[k]`. If no such indices exists, return `false`.
**Example 1:**
**Input:** nums = \[1,2,3,4,5\]
**Output:** true
**Explanation:** Any triplet where i < j < k is valid.
... | null | Array,Greedy | Medium | 300,2122,2280 |
389 | hey guys welcome back to another video and today we're going to be solving the lead code question find the difference okay so in this question we're given two strings s and t which consist of only lowercase letters string t is generated by random shuffling string s and then added one more letter at some random position... | Find the Difference | find-the-difference | You are given two strings `s` and `t`.
String `t` is generated by random shuffling string `s` and then add one more letter at a random position.
Return the letter that was added to `t`.
**Example 1:**
**Input:** s = "abcd ", t = "abcde "
**Output:** "e "
**Explanation:** 'e' is the letter that was added.
**Exam... | null | Hash Table,String,Bit Manipulation,Sorting | Easy | 136 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.