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 |
|---|---|---|---|---|---|---|---|---|
503 | what's up guys then quite here now I'm not ready to install I check the description for all the stuff I do tech and coding stuff on Twitter Newton blah whatever we're doing Lee code join the discord and check out patreon for premium problems if that's what you're interested in you know so this is you know next greater ... | Next Greater Element II | next-greater-element-ii | Given a circular integer array `nums` (i.e., the next element of `nums[nums.length - 1]` is `nums[0]`), return _the **next greater number** for every element in_ `nums`.
The **next greater number** of a number `x` is the first greater number to its traversing-order next in the array, which means you could search circu... | null | Array,Stack,Monotonic Stack | Medium | 496,556 |
326 | Hello friends so in today's video let's all read code daily challenge problem which is power 3 so we are given integer n and we need to return true if it is a power of 3 otherwise we would return false so this is again a very simple problem what we are given a number n and we need to check if it is a power of any power... | Power of Three | power-of-three | Given an integer `n`, return _`true` if it is a power of three. Otherwise, return `false`_.
An integer `n` is a power of three, if there exists an integer `x` such that `n == 3x`.
**Example 1:**
**Input:** n = 27
**Output:** true
**Explanation:** 27 = 33
**Example 2:**
**Input:** n = 0
**Output:** false
**Explanat... | null | Math,Recursion | Easy | 231,342,1889 |
1,463 | it has been asked by flip cart Amazon and Google hi guys good morning welcome back to the new video in this we're going to see the problem cherry pick two Cherry pickup to but although it is marked as a hard problem but we will relate it with a medium and a medium like medium and a medium easy problem and then from tha... | Cherry Pickup II | the-k-weakest-rows-in-a-matrix | You are given a `rows x cols` matrix `grid` representing a field of cherries where `grid[i][j]` represents the number of cherries that you can collect from the `(i, j)` cell.
You have two robots that can collect cherries for you:
* **Robot #1** is located at the **top-left corner** `(0, 0)`, and
* **Robot #2** is... | Sort the matrix row indexes by the number of soldiers and then row indexes. | Array,Binary Search,Sorting,Heap (Priority Queue),Matrix | Easy | null |
167 | hello everyone welcome to day nine of june lead good challenge my name is sanchez dodeja i'm working as technical architect sd4 at adobe and here i present some two input array is sorted here in this question we are given an array wherein the elements are stored sorted in non-decreasing order what do we need to non-dec... | Two Sum II - Input Array Is Sorted | two-sum-ii-input-array-is-sorted | Given a **1-indexed** array of integers `numbers` that is already **_sorted in non-decreasing order_**, find two numbers such that they add up to a specific `target` number. Let these two numbers be `numbers[index1]` and `numbers[index2]` where `1 <= index1 < index2 <= numbers.length`.
Return _the indices of the two n... | null | Array,Two Pointers,Binary Search | Medium | 1,653,1083 |
829 | how i had a pretty good answer for this question and i would like to share it with you guys 8 29 consecutive numbers sum um i'm going to assume you're already familiar with the question i'm not going to explain it first i want you to think about what it means to be consecutive here's what i think it means my intuition ... | Consecutive Numbers Sum | subdomain-visit-count | Given an integer `n`, return _the number of ways you can write_ `n` _as the sum of consecutive positive integers._
**Example 1:**
**Input:** n = 5
**Output:** 2
**Explanation:** 5 = 2 + 3
**Example 2:**
**Input:** n = 9
**Output:** 3
**Explanation:** 9 = 4 + 5 = 2 + 3 + 4
**Example 3:**
**Input:** n = 15
**Output... | null | Array,Hash Table,String,Counting | Medium | null |
455 | hi everyone welcome to leid syntax today we will be solving the question assign cookies so let's see what is this question assume you are an awesome parent and want to give your children some cookies but you should give each child at most one cookie okay each child eye has a great Factory GI which is the minimum size o... | Assign Cookies | assign-cookies | Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.
Each child `i` has a greed factor `g[i]`, which is the minimum size of a cookie that the child will be content with; and each cookie `j` has a size `s[j]`. If `s[j] >= g[i]`, we can assign ... | null | Array,Greedy,Sorting | Easy | null |
1,028 | hello everyone today we are going to see this problem one zero two eight recover a tree from pre-order traversal recover a tree from pre-order traversal recover a tree from pre-order traversal the question is like we run a pre-order the question is like we run a pre-order the question is like we run a pre-order depth f... | Recover a Tree From Preorder Traversal | interval-list-intersections | We run a preorder depth-first search (DFS) on the `root` of a binary tree.
At each node in this traversal, we output `D` dashes (where `D` is the depth of this node), then we output the value of this node. If the depth of a node is `D`, the depth of its immediate child is `D + 1`. The depth of the `root` node is `0`.
... | null | Array,Two Pointers | Medium | 56,88,761 |
1,684 | okay guys so today we'll be solving the problem count the number of consistent strings on lead code so the question says you're given a string allowed consisting of distinct characters and an array of strings words a string is consistent of all the characters in the string appear in the string allowed return the number... | Count the Number of Consistent Strings | find-latest-group-of-size-m | You are given a string `allowed` consisting of **distinct** characters and an array of strings `words`. A string is **consistent** if all characters in the string appear in the string `allowed`.
Return _the number of **consistent** strings in the array_ `words`.
**Example 1:**
**Input:** allowed = "ab ", words = \[... | Since the problem asks for the latest step, can you start the searching from the end of arr? Use a map to store the current “1” groups. At each step (going backwards) you need to split one group and update the map. | Array,Binary Search,Simulation | Medium | null |
1,189 | hey guys welcome to a new video in today's video we're going to look at a lead code problem and the problem's name is maximum number of balloons so in this question we given a string called text we have to count the number of instances for the word balloon we have to check the characters present inside text and using t... | 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 |
834 | welcome to september's leco challenge this problem is called sum of distances in tree there is an undirected connected tree with n nodes labeled from 0 to n minus 1 and n minus 1 edges you are given the integer n that's the number of nodes and the array edges where edges i equals a and b indicating that there's an edge... | Sum of Distances in Tree | ambiguous-coordinates | There is an undirected connected tree with `n` nodes labeled from `0` to `n - 1` and `n - 1` edges.
You are given the integer `n` and the array `edges` where `edges[i] = [ai, bi]` indicates that there is an edge between nodes `ai` and `bi` in the tree.
Return an array `answer` of length `n` where `answer[i]` is the s... | null | String,Backtracking | Medium | null |
918 | Hello gas fashion review Agarwal welcome you assignment for you made by you so let's know today silicone problem nowadays name of problem of liquid is maximum sam circular medium level problems are very simple problem we don't have any talk so first of all our Let us see what is given to itself within this question and... | Maximum Sum Circular Subarray | reachable-nodes-in-subdivided-graph | Given a **circular integer array** `nums` of length `n`, return _the maximum possible sum of a non-empty **subarray** of_ `nums`.
A **circular array** means the end of the array connects to the beginning of the array. Formally, the next element of `nums[i]` is `nums[(i + 1) % n]` and the previous element of `nums[i]` ... | null | Graph,Heap (Priority Queue),Shortest Path | Hard | 2213,2218 |
1,572 | now we're going to cover a coding interview question matrix diagonal sum here's the problem statement given a square matrix mat return the sum of the matrix diagonals only include the item of all the elements on the primary diagonal and all the elements on the secondary diagonal that are not part of the primary diagona... | Matrix Diagonal Sum | subrectangle-queries | Given a square matrix `mat`, return the sum of the matrix diagonals.
Only include the sum of all the elements on the primary diagonal and all the elements on the secondary diagonal that are not part of the primary diagonal.
**Example 1:**
**Input:** mat = \[\[**1**,2,**3**\],
\[4,**5**,6\],
... | Use brute force to update a rectangle and, response to the queries in O(1). | Array,Design,Matrix | Medium | null |
1,624 | Hello everyone, so first of all, Happy New Year to you, today we have come to the daily practice problem of our lead code, so today's problem brings it in an AC category and says Question Largest substring between two equal characters question. You must have understood what is being said in this question. Let us unders... | Largest Substring Between Two Equal Characters | clone-binary-tree-with-random-pointer | Given a string `s`, return _the length of the longest substring between two equal characters, excluding the two characters._ If there is no such substring return `-1`.
A **substring** is a contiguous sequence of characters within a string.
**Example 1:**
**Input:** s = "aa "
**Output:** 0
**Explanation:** The optim... | Traverse the tree, keep a hashtable with you and create a nodecopy for each node in the tree. Start traversing the original tree again and connect the left, right and random pointers in the cloned tree the same way as the original tree with the help of the hashtable. | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 133,138,1634 |
239 | lead code problem 239 sliding window maximum so this problem gives us an array of integers and there is a sliding window of size k and basically what we have to do is to return the maximum number in the window for returning as an array right so something like this that is a great example right so this window the maximu... | 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 |
1,046 | hello everyone so today in this video we are going to solve question of lead code that is last 200 this is 1046 question need code and this comes under easy category all right so let's start with the problem statement you are given an array of integer stones where stone i is the weight of it stone you are playing a gam... | Last Stone Weight | max-consecutive-ones-iii | You are given an array of integers `stones` where `stones[i]` is the weight of the `ith` stone.
We are playing a game with the stones. On each turn, we choose the **heaviest two stones** and smash them together. Suppose the heaviest two stones have weights `x` and `y` with `x <= y`. The result of this smash is:
* I... | One thing's for sure, we will only flip a zero if it extends an existing window of 1s. Otherwise, there's no point in doing it, right? Think Sliding Window! Since we know this problem can be solved using the sliding window construct, we might as well focus in that direction for hints. Basically, in a given window, we c... | Array,Binary Search,Sliding Window,Prefix Sum | Medium | 340,424,485,487,2134 |
1,675 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem minimize deviation in Array this one is going to blow your mind so we're given an integer array maybe something like one two three four the rules are pretty simple this time if a number in the input array is even then w... | Minimize Deviation in Array | magnetic-force-between-two-balls | You are given an array `nums` of `n` positive integers.
You can perform two types of operations on any element of the array any number of times:
* If the element is **even**, **divide** it by `2`.
* For example, if the array is `[1,2,3,4]`, then you can do this operation on the last element, and the array wil... | If you can place balls such that the answer is x then you can do it for y where y < x. Similarly if you cannot place balls such that the answer is x then you can do it for y where y > x. Binary search on the answer and greedily see if it is possible. | Array,Binary Search,Sorting | Medium | 2188 |
797 | today we're going to be solving lead code problem 797 all paths from source to Target before we go you guys know the drill please like the video and leave a comment helps me out a ton with the YouTube algorithm all right given directed acyclic graph a dag of end nodes labeled from 0 to n minus 1 find all possible paths... | All Paths From Source to Target | rabbits-in-forest | Given a directed acyclic graph (**DAG**) of `n` nodes labeled from `0` to `n - 1`, find all possible paths from node `0` to node `n - 1` and return them in **any order**.
The graph is given as follows: `graph[i]` is a list of all nodes you can visit from node `i` (i.e., there is a directed edge from node `i` to node `... | null | Array,Hash Table,Math,Greedy | Medium | null |
408 | hello welcome back today we have leeco 408 valid word abbreviation so in here is a really long uh description but basically the idea of this question is we'll receive two string one string is called word and another string is abbreviation so we can go through this example here like the abbreviation is as 10 and so we h... | Valid Word Abbreviation | valid-word-abbreviation | A string can be **abbreviated** by replacing any number of **non-adjacent**, **non-empty** substrings with their lengths. The lengths **should not** have leading zeros.
For example, a string such as `"substitution "` could be abbreviated as (but not limited to):
* `"s10n "` ( `"s ubstitutio n "`)
* `"sub4u4 "` ( ... | null | Two Pointers,String | Easy | 411,527,2184 |
81 | hey what's up guys this is sean here so today let's take a look at the today's daily challenge problem number 81 search in rotated storage array number two so actually this one is like an extension of the uh searching rotate this rotated sorted array number one basically you know the only differences for this one is th... | Search in Rotated Sorted Array II | search-in-rotated-sorted-array-ii | There is an integer array `nums` sorted in non-decreasing order (not necessarily with **distinct** values).
Before being passed to your function, `nums` is **rotated** at an unknown pivot index `k` (`0 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nu... | null | Array,Binary Search | Medium | 33 |
1,721 | hello everyone welcome to day 14th of march lead code challenge and i hope all of you are doing really well uh let's go through the question together swapping nodes in a linked list but the question says you are given a linked list and that and an integer k what you need to do you need to swap the two nodes in this lin... | Swapping Nodes in a Linked List | maximum-profit-of-operating-a-centennial-wheel | You are given the `head` of a linked list, and an integer `k`.
Return _the head of the linked list after **swapping** the values of the_ `kth` _node from the beginning and the_ `kth` _node from the end (the list is **1-indexed**)._
**Example 1:**
**Input:** head = \[1,2,3,4,5\], k = 2
**Output:** \[1,4,3,2,5\]
**Ex... | Think simulation Note that the number of turns will never be more than 50 / 4 * n | Array,Simulation | Medium | null |
39 | hi all welcome back to cracking the fang interviews today i'm going to be talking about the combination sub problem uh this is lead code problem number 39 and the problem is popular at apple google amazon netflix amongst other top 10 tech company coding interviews so let's dive into the problem first understand it and ... | Combination Sum | combination-sum | Given an array of **distinct** integers `candidates` and a target integer `target`, return _a list of all **unique combinations** of_ `candidates` _where the chosen numbers sum to_ `target`_._ You may return the combinations in **any order**.
The **same** number may be chosen from `candidates` an **unlimited number of... | null | Array,Backtracking | Medium | 17,40,77,216,254,377 |
396 | okay welcome hello welcome back howdy here we are i wanted to work on a problem before i did anything else and i'm gonna meet up with a the bible study group for later today with my the i'm participating in a bible study later today i don't wanna it's i'm it's i mean it's not it's god it's right i don't know i want to ... | Rotate Function | rotate-function | You are given an integer array `nums` of length `n`.
Assume `arrk` to be an array obtained by rotating `nums` by `k` positions clock-wise. We define the **rotation function** `F` on `nums` as follow:
* `F(k) = 0 * arrk[0] + 1 * arrk[1] + ... + (n - 1) * arrk[n - 1].`
Return _the maximum value of_ `F(0), F(1), ...,... | null | Array,Math,Dynamic Programming | Medium | null |
1,186 | hence today I'm going to talk about the decoder 1186 Mary Simmons sub-arrays Sam decoder 1186 Mary Simmons sub-arrays Sam decoder 1186 Mary Simmons sub-arrays Sam with one cognition the problem is given an array of integers return the maximum sum for sub array with at most one element in Asian you know also talento all... | Maximum Subarray Sum with One Deletion | building-h2o | Given an array of integers, return the maximum sum for a **non-empty** subarray (contiguous elements) with at most one element deletion. In other words, you want to choose a subarray and optionally delete one element from it so that there is still at least one element left and the sum of the remaining elements is maxim... | null | Concurrency | Medium | null |
487 | hello everyone so today we are going to solve Max consecutive ones second it says that given a binary array nums written the max number of consecutive ones in the array if you can flip at most one zero okay so basically what it says that you have to give the max number of consecutive ones and you can ignore one zero yo... | 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 |
1,014 | Hello guys welcome to the video serum to deal problem call website singh pax let's get started tyun subscribe since point to you how to get the score of paramedical maximum what is quora self-motivated settings search tent quora self-motivated settings search tent quora self-motivated settings search tent business plac... | Best Sightseeing Pair | k-closest-points-to-origin | You are given an integer array `values` where values\[i\] represents the value of the `ith` sightseeing spot. Two sightseeing spots `i` and `j` have a **distance** `j - i` between them.
The score of a pair (`i < j`) of sightseeing spots is `values[i] + values[j] + i - j`: the sum of the values of the sightseeing spots... | null | Array,Math,Divide and Conquer,Geometry,Sorting,Heap (Priority Queue),Quickselect | Medium | 215,347,692,1888 |
3 | Open it and confirm that rather the height will increase, the money is for this, the rest is the code word, so you are net savvy, look at the hard work that has been put into this working, so the bigger it is here, the story kept changing in the last, then we made our plan accordingly. It worked fine Hi everyone how ar... | 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 |
91 | hello welcome to my channel today we have leeco 91 decode ways so this question is really popular and uh often asked in the interviews so the question itself is pretty easy to understand and you can see the example right away we're trying to um decode this problem back to the abc character so now you can see we have in... | Decode Ways | decode-ways | A message containing letters from `A-Z` can be **encoded** into numbers using the following mapping:
'A' -> "1 "
'B' -> "2 "
...
'Z' -> "26 "
To **decode** an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For examp... | null | String,Dynamic Programming | Medium | 639,2091 |
443 | hello everyone let's talk about string compression it's lead code 443 question uh what it says we have a array and we should compress like A2 B2 C3 there is two A's so A2 then 2 B B2 and three C and but is uh one case like if there is a single element we should not write uh one here like here is a is single so we shoul... | 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 |
106 | hey guys welcome back to another video and today we're going to be solving the lead code question construct of binary tree from inorder and post-order tree from inorder and post-order tree from inorder and post-order traversal okay so before i get started with the question i just want to mention that if there are any l... | Construct Binary Tree from Inorder and Postorder Traversal | construct-binary-tree-from-inorder-and-postorder-traversal | Given two integer arrays `inorder` and `postorder` where `inorder` is the inorder traversal of a binary tree and `postorder` is the postorder traversal of the same tree, construct and return _the binary tree_.
**Example 1:**
**Input:** inorder = \[9,3,15,20,7\], postorder = \[9,15,7,20,3\]
**Output:** \[3,9,20,null,n... | null | Array,Hash Table,Divide and Conquer,Tree,Binary Tree | Medium | 105 |
1,716 | hi everyone welcome back to a new video today's lead code daily challenges calculate money in a lead code Bank this is an easy level question so let's see what they have told us to do in this question they are telling that hery is a person okay and he wants to save money for his car and he puts some money away every da... | Calculate Money in Leetcode Bank | maximum-non-negative-product-in-a-matrix | Hercy wants to save money for his first car. He puts money in the Leetcode bank **every day**.
He starts by putting in `$1` on Monday, the first day. Every day from Tuesday to Sunday, he will put in `$1` more than the day before. On every subsequent Monday, he will put in `$1` more than the **previous Monday**.
Given... | Use Dynamic programming. Keep the highest value and lowest value you can achieve up to a point. | Array,Dynamic Programming,Matrix | Medium | null |
384 | hey everyone welcome to my channel so in this video i'm going to briefly cover the solution to this question at the same time do some live coding work also i'm going to follow the general interview steps while trying to solve this problem so first of all let's race through this question uh shuffle array so given intege... | Shuffle an Array | shuffle-an-array | Given an integer array `nums`, design an algorithm to randomly shuffle the array. All permutations of the array should be **equally likely** as a result of the shuffling.
Implement the `Solution` class:
* `Solution(int[] nums)` Initializes the object with the integer array `nums`.
* `int[] reset()` Resets the arr... | The solution expects that we always use the original array to shuffle() else some of the test cases fail. (Credits; @snehasingh31) | Array,Math,Randomized | Medium | null |
1,834 | hi guys welcome to algorithms Made Easy my name is khushboo and in this video we are going to see the question single threaded CPU so let's go and take a look at what the question says you are given n tasks labeled from 0 to n minus 1 represented by a 2d integer array tasks where task of I is the combination of two val... | 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 |
769 | hey everybody this is Larry this is February 15 2024 and here I am trying to do a random problem that I haven't done before so let's YOLO let's go orang 6 or 769 I can't even read the 769 Mass Max chunks to make sorted all right so given iner array of length end that represents a peration of inte in the range zero n mi... | Max Chunks To Make Sorted | largest-plus-sign | You are given an integer array `arr` of length `n` that represents a permutation of the integers in the range `[0, n - 1]`.
We split `arr` into some number of **chunks** (i.e., partitions), and individually sort each chunk. After concatenating them, the result should equal the sorted array.
Return _the largest number... | For each direction such as "left", find left[r][c] = the number of 1s you will see before a zero starting at r, c and walking left. You can find this in N^2 time with a dp. The largest plus sign at r, c is just the minimum of left[r][c], up[r][c] etc. | Array,Dynamic Programming | Medium | 221 |
84 | lead quote problem 84 largest rectangle in histogram right so the problem gives us an array of integer Heights and basically there are just a bunch of bar Heights and our job is to return the area of the largest rectangle that can be created from the histogram like for example for this array of integers the greatest on... | 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 |
27 | Hello everyone so in this video where going to discuss a lead code problem remove element show friends of date value from wait are and date you in place so what do you mean by in place and this is our input are and this is d Value of this value which is de of this value they can't use additional data structure and addi... | Remove Element | remove-element | Given an integer array `nums` and an integer `val`, remove all occurrences of `val` in `nums` [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm). The order of the elements may be changed. Then return _the number of elements in_ `nums` _which are not equal to_ `val`.
Consider the number of elements in `nu... | The problem statement clearly asks us to modify the array in-place and it also says that the element beyond the new length of the array can be anything. Given an element, we need to remove all the occurrences of it from the array. We don't technically need to remove that element per-say, right? We can move all the occu... | Array,Two Pointers | Easy | 26,203,283 |
61 | Hello Hi Everyone Welcome To My Channel It's All The Problem Rotate List A Very Famous In Terms Of Interviews And Learning Do Subscribe Online And Basic Important Questions Giving Roti Ke Play List 12345 and subscribe the Video then subscribe to subscribe our 200 paas dry When Solving Problems So Very Simple 200 First ... | Rotate List | rotate-list | Given the `head` of a linked list, rotate the list to the right by `k` places.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], k = 2
**Output:** \[4,5,1,2,3\]
**Example 2:**
**Input:** head = \[0,1,2\], k = 4
**Output:** \[2,0,1\]
**Constraints:**
* The number of nodes in the list is in the range `[0, 500]`.
* ... | null | Linked List,Two Pointers | Medium | 189,725 |
1,184 | hey guys welcome back to my channel and i'm back again with another really interesting coding interview question video and this time guys we are going to solve question number 10184 or lead code called distance between bus stops before i start with the video guys if you have not yet subscribed to my channel then please... | Distance Between Bus Stops | car-pooling | A bus has `n` stops numbered from `0` to `n - 1` that form a circle. We know the distance between all pairs of neighboring stops where `distance[i]` is the distance between the stops number `i` and `(i + 1) % n`.
The bus goes along both directions i.e. clockwise and counterclockwise.
Return the shortest distance betw... | Sort the pickup and dropoff events by location, then process them in order. | Array,Sorting,Heap (Priority Queue),Simulation,Prefix Sum | Medium | 253 |
413 | So Hai Gas Welcome Back Tu Me Channel Hi Elements And Difference Between It Tu Consecutive Element Is D Se Meaning Arithmetic Kab Bolenge Se Hai Ab Confusion What Is The Meaning Of Difference Look One Tu Three Four Taking One Tu Three Tu One Ke Mein Kitna Hai Difference What is the difference between one three and one?... | Arithmetic Slices | arithmetic-slices | An integer array is called arithmetic if it consists of **at least three elements** and if the difference between any two consecutive elements is the same.
* For example, `[1,3,5,7,9]`, `[7,7,7,7]`, and `[3,-1,-5,-9]` are arithmetic sequences.
Given an integer array `nums`, return _the number of arithmetic **subarr... | null | Array,Dynamic Programming | Medium | 446,1752 |
724 | in this video we are going to solve one very famous index let me explain you what is the use case here so you have been given one array and you have to find out one index one number from where all the web edition of all the website element must be equal to addition of the right side of element so in this case I am givi... | Find Pivot Index | find-pivot-index | Given an array of integers `nums`, calculate the **pivot index** of this array.
The **pivot index** is the index where the sum of all the numbers **strictly** to the left of the index is equal to the sum of all the numbers **strictly** to the index's right.
If the index is on the left edge of the array, then the left... | We can precompute prefix sums P[i] = nums[0] + nums[1] + ... + nums[i-1].
Then for each index, the left sum is P[i], and the right sum is P[P.length - 1] - P[i] - nums[i]. | Array,Prefix Sum | Easy | 560,2102,2369 |
3 | Hello guys welcome to bana de video mein seedhi sub heading code viewers problem waste oil will subscribe without feeling character suryavanshi rings to find the length of the longest without editing characters means all the characters with unique in the left side example support zoom string events Which you can observ... | 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 |
32 | That Hello friends, welcome in this video, question number 32 is the longest first parents, this defeat level question is in read and which category is this question, if you see, dip has been said in the read court, but parents, if we are talking about this, then from the track. It can be said that on a very real quest... | Longest Valid Parentheses | longest-valid-parentheses | Given a string containing just the characters `'('` and `')'`, return _the length of the longest valid (well-formed) parentheses_ _substring_.
**Example 1:**
**Input:** s = "(() "
**Output:** 2
**Explanation:** The longest valid parentheses substring is "() ".
**Example 2:**
**Input:** s = ")()()) "
**Output:** ... | null | String,Dynamic Programming,Stack | Hard | 20 |
1,020 | Hello Hi Friends Welcome Back Today We Are Going To Solid Code Problem 1020 Number Of Enclaves Of Very Rudra Description Example Sub Problem Is Just Want To Mention That My Channel Dedicated To Helping People Were Preparing For Coding Interviews And Shower Interviews All My Channel More And More Then to Harold Examples... | 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 |
88 | what's up everybody i hope all of you are doing extremely well my name is akshat gupta and i'm a senior software engineer at rccm welcome to boss twitter academy's youtube channel so today we will be solving the lead code problem number 88 merge sorted array let's try to see how it looks like so the problem says that y... | Merge Sorted Array | merge-sorted-array | You are given two integer arrays `nums1` and `nums2`, sorted in **non-decreasing order**, and two integers `m` and `n`, representing the number of elements in `nums1` and `nums2` respectively.
**Merge** `nums1` and `nums2` into a single array sorted in **non-decreasing order**.
The final sorted array should not be re... | You can easily solve this problem if you simply think about two elements at a time rather than two arrays. We know that each of the individual arrays is sorted. What we don't know is how they will intertwine. Can we take a local decision and arrive at an optimal solution? If you simply consider one element each at a ti... | Array,Two Pointers,Sorting | Easy | 21,1019,1028 |
380 | um hello so today we are going to do this problem which is part of lead code um November daily challenge insert the insert delete um get random in all of one so what the problem says is we have this classroom domains it set um and we initialize it and we want to insert a value um into the set if the value doesn't alrea... | Insert Delete GetRandom O(1) | insert-delete-getrandom-o1 | Implement the `RandomizedSet` class:
* `RandomizedSet()` Initializes the `RandomizedSet` object.
* `bool insert(int val)` Inserts an item `val` into the set if not present. Returns `true` if the item was not present, `false` otherwise.
* `bool remove(int val)` Removes an item `val` from the set if present. Retur... | null | Array,Hash Table,Math,Design,Randomized | Medium | 381 |
139 | welcome to this video now we're going to solve a coding interview question called Break you're given a non-emptive string s and you're given a non-emptive string s and you're given a non-emptive string s and a dictionary word date containing a list of non-empty words of non-empty words of non-empty words determine if s... | 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 |
748 | hey guys this is how's everything going this video I'm going to take a look at 7:48 Julius completing world word is 7:48 Julius completing world word is 7:48 Julius completing world word is easy one why don't why there are C 600 dislikes by the minimun and the word from a dictionary where has all the letters from the s... | Shortest Completing Word | largest-number-at-least-twice-of-others | Given a string `licensePlate` and an array of strings `words`, find the **shortest completing** word in `words`.
A **completing** word is a word that **contains all the letters** in `licensePlate`. **Ignore numbers and spaces** in `licensePlate`, and treat letters as **case insensitive**. If a letter appears more than... | Scan through the array to find the unique largest element `m`, keeping track of it's index `maxIndex`.
Scan through the array again. If we find some `x != m` with `m < 2*x`, we should return `-1`.
Otherwise, we should return `maxIndex`. | Array,Sorting | Easy | 2274,2327 |
20 | let's solve the code 20 where we essentially want to make sure that any parentheses or brackets we open are correctly closed in order although there could be some nesting or multiple openings before a close so to solve this we'll use a stack to keep track of the openings we've seen so far we'll also have a dictionary o... | Valid Parentheses | valid-parentheses | Given a string `s` containing just the characters `'('`, `')'`, `'{'`, `'}'`, `'['` and `']'`, determine if the input string is valid.
An input string is valid if:
1. Open brackets must be closed by the same type of brackets.
2. Open brackets must be closed in the correct order.
3. Every close bracket has a corres... | An interesting property about a valid parenthesis expression is that a sub-expression of a valid expression should also be a valid expression. (Not every sub-expression) e.g.
{ { } [ ] [ [ [ ] ] ] } is VALID expression
[ [ [ ] ] ] is VALID sub-expression
{ } [ ] is VALID sub-express... | String,Stack | Easy | 22,32,301,1045,2221 |
79 | today we're going to be going over the Java solution for lead code 79 word search given an M by n grid of characters bored and a string word return true if word exists into grid the word can be constructed from letters of sequentially adjacent cells where adjacent cells are horizontally or vertically neighboring the sa... | Word Search | word-search | Given an `m x n` grid of characters `board` and a string `word`, return `true` _if_ `word` _exists in the grid_.
The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.
**Example 1:**... | null | Array,Backtracking,Matrix | Medium | 212 |
1,169 | all right let's talk about invalid transception so intersection is possible in value if the marxist one thousands or is occurred within 16 minutes of another transaction with the same name in different cities so we're given a restrained transaction which transaction i consist of comma separated value represent the name... | Invalid Transactions | largest-values-from-labels | A transaction is possibly invalid if:
* the amount exceeds `$1000`, or;
* if it occurs within (and including) `60` minutes of another transaction with the **same name** in a **different city**.
You are given an array of strings `transaction` where `transactions[i]` consists of comma-separated values representing ... | Consider the items in order from largest to smallest value, and greedily take the items if they fall under the use_limit. We can keep track of how many items of each label are used by using a hash table. | Array,Hash Table,Greedy,Sorting,Counting | Medium | null |
462 | hello everyone welcome to our channel code with sunny and today i will be discussing the problem called minimum moves to equal array elements and it is the second one and index number is 462 and the problem is of one of the medium type problems of the later okay so this is the second problem of the series of problems c... | Minimum Moves to Equal Array Elements II | minimum-moves-to-equal-array-elements-ii | Given an integer array `nums` of size `n`, return _the minimum number of moves required to make all array elements equal_.
In one move, you can increment or decrement an element of the array by `1`.
Test cases are designed so that the answer will fit in a **32-bit** integer.
**Example 1:**
**Input:** nums = \[1,2,3... | null | Array,Math,Sorting | Medium | 296,453,2160,2290 |
93 | That Egg these people are going to discuss with him restore ip address servi question is what happened to us we will have a string life a strip will be formed that now we have to divide it into some tips like 9060 we have to put it in the party If we want to invite, we have to divide it into parties in this manner. The... | Restore IP Addresses | restore-ip-addresses | A **valid IP address** consists of exactly four integers separated by single dots. Each integer is between `0` and `255` (**inclusive**) and cannot have leading zeros.
* For example, `"0.1.2.201 "` and `"192.168.1.1 "` are **valid** IP addresses, but `"0.011.255.245 "`, `"192.168.1.312 "` and `"192.168@1.1 "` are **... | null | String,Backtracking | Medium | 752 |
1,313 | uh today we are going to decode the decompress roundless encoders in python so we are given a list of integers representing a less compressed for surroundings encoding uh consider each adjacent pair of elements for each pair there are eight elements with value b in the decompressed list returns the decompress list so u... | Decompress Run-Length Encoded List | count-ways-to-build-rooms-in-an-ant-colony | We are given a list `nums` of integers representing a list compressed with run-length encoding.
Consider each adjacent pair of elements `[freq, val] = [nums[2*i], nums[2*i+1]]` (with `i >= 0`). For each such pair, there are `freq` elements with value `val` concatenated in a sublist. Concatenate all the sublists from l... | Use dynamic programming. Let dp[i] be the number of ways to solve the problem for the subtree of node i. Imagine you are trying to fill an array with the order of traversal, dp[i] equals the multiplications of the number of ways to distribute the subtrees of the children of i on the array using combinatorics, multiplie... | Math,Dynamic Programming,Tree,Graph,Topological Sort,Combinatorics | Hard | null |
78 | foreign School subsets we are given an array of nums of unique elements important in ink return all possible subset the power set the solution set must not contain uh duplicate subsets and we have to return the solution in any order now for example for the example we told me one number of two we can basically have the ... | Subsets | subsets | Given an integer array `nums` of **unique** elements, return _all possible_ _subsets_ _(the power set)_.
The solution set **must not** contain duplicate subsets. Return the solution in **any order**.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[\],\[1\],\[2\],\[1,2\],\[3\],\[1,3\],\[2,3\],\[1,2,3\]\]
... | null | Array,Backtracking,Bit Manipulation | Medium | 90,320,800,2109,2170 |
1,198 | hey guys has been going this is jayster in this video let's solve another problem from lead code it's one nine eight find smallest common element in all rows given the matrix mat where every row is sorted strictly increasing order so there is no duplicating each row return the smallest common element in all rows if the... | Find Smallest Common Element in All Rows | unpopular-books | Given an `m x n` matrix `mat` where every row is sorted in **strictly** **increasing** order, return _the **smallest common element** in all rows_.
If there is no common element, return `-1`.
**Example 1:**
**Input:** mat = \[\[1,2,3,4,5\],\[2,4,5,8,10\],\[3,5,7,9,11\],\[1,3,5,7,9\]\]
**Output:** 5
**Example 2:**
... | null | Database | Medium | null |
4 | Hello everyone welcome back to my channel Ban Sake End Show In this video I am going to talk about the list code top interview questions for the problem medium to short and marriage so before this why upload the video of the third problem in the playlist like this Continue Khatron, if you have n't seen the video of you... | Median of Two Sorted Arrays | median-of-two-sorted-arrays | Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays.
The overall run time complexity should be `O(log (m+n))`.
**Example 1:**
**Input:** nums1 = \[1,3\], nums2 = \[2\]
**Output:** 2.00000
**Explanation:** merged array = \[1,2,3\] and median is ... | null | Array,Binary Search,Divide and Conquer | Hard | null |
518 | in this video we're gonna take a look at a legal problem called coin change number two so basically we're given a coins array as well as the integer amount um and then we're asked to find total unique ways to make up this amount by using these coins right so you can see that uh in this example we can have five right we... | Coin Change II | coin-change-2 | You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money.
Return _the number of combinations that make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `0`.
You may assume that yo... | null | Array,Dynamic Programming | Medium | 1393 |
1,371 | hey what's up guys uh this is chung here so today uh let's take a look at 1371 find the longest stop stream continue involves and even counts so this one is a pretty interesting problem actually you know so given like a string adds right return the size of the longest substring containing each vowel and even number of ... | Find the Longest Substring Containing Vowels in Even Counts | minimum-remove-to-make-valid-parentheses | Given the string `s`, return the size of the longest substring containing each vowel an even number of times. That is, 'a', 'e', 'i', 'o', and 'u' must appear an even number of times.
**Example 1:**
**Input:** s = "eleetminicoworoep "
**Output:** 13
**Explanation:** The longest substring is "leetminicowor " which c... | Each prefix of a balanced parentheses has a number of open parentheses greater or equal than closed parentheses, similar idea with each suffix. Check the array from left to right, remove characters that do not meet the property mentioned above, same idea in backward way. | String,Stack | Medium | 2095,2221 |
382 | foreign with the lonely Dash and today we're going over leap code question 382 linked list random node which states given a singly linked list return a random node's value from the linked list each node must have the same probability of being chosen implement the solution class so that's going to give you a class calle... | Linked List Random Node | linked-list-random-node | Given a singly linked list, return a random node's value from the linked list. Each node must have the **same probability** of being chosen.
Implement the `Solution` class:
* `Solution(ListNode head)` Initializes the object with the head of the singly-linked list `head`.
* `int getRandom()` Chooses a node randoml... | null | Linked List,Math,Reservoir Sampling,Randomized | Medium | 398 |
116 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem populating next right pointers in each node so we're given a perfect binary tree and what that basically means is that it's perfectly balanced so every single node that does have children will have exactly two children ... | 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,061 | hello everyone welcome back to coding Champs in today's video we are going to be solving the problem lexicographically smallest equivalence string in this problem we are given with two strings of same length as 1 and S2 and a string based string we say s 1 of I and S2 of I are equivalent characters so for example if S1... | Lexicographically Smallest Equivalent String | number-of-valid-subarrays | You are given two strings of the same length `s1` and `s2` and a string `baseStr`.
We say `s1[i]` and `s2[i]` are equivalent characters.
* For example, if `s1 = "abc "` and `s2 = "cde "`, then we have `'a' == 'c'`, `'b' == 'd'`, and `'c' == 'e'`.
Equivalent characters follow the usual rules of any equivalence rela... | Given a data structure that answers queries of the type to find the minimum in a range of an array (Range minimum query (RMQ) sparse table) in O(1) time. How can you solve this problem? For each starting index do a binary search with an RMQ to find the ending possible position. | Array,Stack,Monotonic Stack | Hard | 2233 |
39 | the combination some problem on Lee code asks for finding all you need combinations of numbers that sum up to a given Target here are a few ways to solve it we could first use a recursive backtracking algorithm to generate combinations by iterating through each number and checking if it can contribute to the sum if the... | Combination Sum | combination-sum | Given an array of **distinct** integers `candidates` and a target integer `target`, return _a list of all **unique combinations** of_ `candidates` _where the chosen numbers sum to_ `target`_._ You may return the combinations in **any order**.
The **same** number may be chosen from `candidates` an **unlimited number of... | null | Array,Backtracking | Medium | 17,40,77,216,254,377 |
127 | in this video we'll take a look at a legal problem called word ladder so basically the questions that were given a begin word the n word and also the word list which is a dictionary of word list we want to return the number of words in the shortest transformation sequence from the begin word to the n word and we can on... | Word Ladder | word-ladder | A **transformation sequence** from word `beginWord` to word `endWord` using a dictionary `wordList` is a sequence of words `beginWord -> s1 -> s2 -> ... -> sk` such that:
* Every adjacent pair of words differs by a single letter.
* Every `si` for `1 <= i <= k` is in `wordList`. Note that `beginWord` does not need ... | null | Hash Table,String,Breadth-First Search | Hard | 126,433 |
1,295 | hi guys today we are going to do a little problem find number of even numbers of digits given an atom's of integers return how many of them contain an even number of digits so we need to return the count of numbers in the nums arrive which have even number of digits so number like number one 212 has two digits so this ... | Find Numbers with Even Number of Digits | minimum-garden-perimeter-to-collect-enough-apples | Given an array `nums` of integers, return how many of them contain an **even number** of digits.
**Example 1:**
**Input:** nums = \[12,345,2,6,7896\]
**Output:** 2
**Explanation:**
12 contains 2 digits (even number of digits).
345 contains 3 digits (odd number of digits).
2 contains 1 digit (odd number of digits).... | Find a formula for the number of apples inside a square with a side length L. Iterate over the possible lengths of the square until enough apples are collected. | Math,Binary Search | Medium | null |
1,663 | hi everyone welcome to my first video so uh this video is created uh to practice my english and solving problem i explained the tricks in english so anyway i don't think it would be really helpful but uh it's your option to choose whether to access this uh page or not and i hope it will withstand too much time anyway s... | Smallest String With A Given Numeric Value | detect-cycles-in-2d-grid | The **numeric value** of a **lowercase character** is defined as its position `(1-indexed)` in the alphabet, so the numeric value of `a` is `1`, the numeric value of `b` is `2`, the numeric value of `c` is `3`, and so on.
The **numeric value** of a **string** consisting of lowercase characters is defined as the sum of... | Keep track of the parent (previous position) to avoid considering an invalid path. Use DFS or BFS and keep track of visited cells to see if there is a cycle. | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | null |
1,684 | Hello Hi Guys Welcome to my YouTube channel, I am Tiwari and in today's video we are going to talk about the problem of account number and consistent prince's play list and for those who are new on this channel, let me tell them that you can see the I button. Now you can complete and fit a clear channel, this was subsc... | Count the Number of Consistent Strings | find-latest-group-of-size-m | You are given a string `allowed` consisting of **distinct** characters and an array of strings `words`. A string is **consistent** if all characters in the string appear in the string `allowed`.
Return _the number of **consistent** strings in the array_ `words`.
**Example 1:**
**Input:** allowed = "ab ", words = \[... | Since the problem asks for the latest step, can you start the searching from the end of arr? Use a map to store the current “1” groups. At each step (going backwards) you need to split one group and update the map. | Array,Binary Search,Simulation | Medium | null |
888 | uh this question is feel kindly swap so you are given to a red one is Alice the other one is Bob and then I'm going to summarize this question so you need to swap one element from Alice to the bulb and also above two hours and both of the sum should be equal air right so uh this is pretty much a math question so I'm go... | Fair Candy Swap | mirror-reflection | Alice and Bob have a different total number of candies. You are given two integer arrays `aliceSizes` and `bobSizes` where `aliceSizes[i]` is the number of candies of the `ith` box of candy that Alice has and `bobSizes[j]` is the number of candies of the `jth` box of candy that Bob has.
Since they are friends, they wo... | null | Math,Geometry | Medium | null |
1,957 | hey everybody this is larry this is me going with q1 of the buy weekday contest 58. delete characters to make fancy string hit the like button hit the subscribe and join me on discord let me know what you think about this problem uh especially if you came from the contest well come hang out uh on discord where everyone... | Delete Characters to Make Fancy String | closest-room | A **fancy string** is a string where no **three** **consecutive** characters are equal.
Given a string `s`, delete the **minimum** possible number of characters from `s` to make it **fancy**.
Return _the final string after the deletion_. It can be shown that the answer will always be **unique**.
**Example 1:**
**In... | Is there a way to sort the queries so it's easier to search the closest room larger than the size? Use binary search to speed up the search time. | Array,Binary Search,Sorting | Hard | 2179 |
733 | welcome back everyone we're going to be solving Lee code 733 flood fill so we're given an image which is represented by an M by n integer grid where the image of the row column i j represents the pixel value of that image we're also given it three integers uh srsc and color and we need to perform a flood fill on the im... | Flood Fill | flood-fill | An image is represented by an `m x n` integer grid `image` where `image[i][j]` represents the pixel value of the image.
You are also given three integers `sr`, `sc`, and `color`. You should perform a **flood fill** on the image starting from the pixel `image[sr][sc]`.
To perform a **flood fill**, consider the startin... | Write a recursive function that paints the pixel if it's the correct color, then recurses on neighboring pixels. | Array,Depth-First Search,Breadth-First Search,Matrix | Easy | 463 |
1,886 | Everyone Month Sandeep & Everyone Month Sandeep & Everyone Month Sandeep & David Problem 186 6 Install Amaze & David Problem 186 6 Install Amaze & David Problem 186 6 Install Amaze & Size & Craft & Quote - RCM Size & Craft & Quote - RCM Size & Craft & Quote - RCM 's Birth... | Determine Whether Matrix Can Be Obtained By Rotation | minimum-limit-of-balls-in-a-bag | Given two `n x n` binary matrices `mat` and `target`, return `true` _if it is possible to make_ `mat` _equal to_ `target` _by **rotating**_ `mat` _in **90-degree increments**, or_ `false` _otherwise._
**Example 1:**
**Input:** mat = \[\[0,1\],\[1,0\]\], target = \[\[1,0\],\[0,1\]\]
**Output:** true
**Explanation:** W... | Let's change the question if we know the maximum size of a bag what is the minimum number of bags you can make note that as the maximum size increases the minimum number of bags decreases so we can binary search the maximum size | Array,Binary Search | Medium | 1335,2188 |
141 | hey guys Greg here let's solve link list cycle leak code number 141 it's claimed to be an easy but there's actually some tricky components to it and we're going to learn a really useful algorithm now we're given head the head of a linked list as usual and we want to determine if that linked list has a cycle in it now w... | 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 |
724 | in this video we're going to look at a legal problem called find pivot index so given an array of integer nums write a method that returns the pivot index of the array so we define the pivot index as the index where the sum of all numbers on the left of the index is equal to the sum of all numbers to the right of the i... | Find Pivot Index | find-pivot-index | Given an array of integers `nums`, calculate the **pivot index** of this array.
The **pivot index** is the index where the sum of all the numbers **strictly** to the left of the index is equal to the sum of all the numbers **strictly** to the index's right.
If the index is on the left edge of the array, then the left... | We can precompute prefix sums P[i] = nums[0] + nums[1] + ... + nums[i-1].
Then for each index, the left sum is P[i], and the right sum is P[P.length - 1] - P[i] - nums[i]. | Array,Prefix Sum | Easy | 560,2102,2369 |
36 | hello everyone let's look at valley sudoku if you have ever played stuku before this question would be an interesting one let's look at the problem statement we need to determine if a 9 multiply 9 stucco board is valid and we only validate those that has been filled there are a couple of rules we need to follow first e... | 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 |
1,991 | hey everybody this is larry this is me going with q1 of the bi-weekly me going with q1 of the bi-weekly me going with q1 of the bi-weekly contest 60 find the middle index in the way so this one it's kind of brute force um let's see n is a hundred right so you could do this in a number of ways and it'll be good um but t... | Find the Middle Index in Array | league-statistics | Given a **0-indexed** integer array `nums`, find the **leftmost** `middleIndex` (i.e., the smallest amongst all the possible ones).
A `middleIndex` is an index where `nums[0] + nums[1] + ... + nums[middleIndex-1] == nums[middleIndex+1] + nums[middleIndex+2] + ... + nums[nums.length-1]`.
If `middleIndex == 0`, the lef... | null | Database | Medium | null |
696 | hey what's up guys uh this is chung here so today uh let's take a look at today's daily challenge problem number 696 count binary substrings know even though this one is marked as a easy problem i still like to briefly talk about this problem because it's not like very traditional easy problem it's still requires you r... | Count Binary Substrings | count-binary-substrings | Given a binary string `s`, return the number of non-empty substrings that have the same number of `0`'s and `1`'s, and all the `0`'s and all the `1`'s in these substrings are grouped consecutively.
Substrings that occur multiple times are counted the number of times they occur.
**Example 1:**
**Input:** s = "001100... | How many valid binary substrings exist in "000111", and how many in "11100"? What about "00011100"? | Two Pointers,String | Easy | 271 |
16 | this is the 16th leeco Challenge and it is called threesome closest given an integer array Norms of length n and an integer Target find three integers in nums such that the sum is closest to Target return the sum of the three integers you may assume that each input would have exactly one solution so if you're given the... | 3Sum Closest | 3sum-closest | Given an integer array `nums` of length `n` and an integer `target`, find three integers in `nums` such that the sum is closest to `target`.
Return _the sum of the three integers_.
You may assume that each input would have exactly one solution.
**Example 1:**
**Input:** nums = \[-1,2,1,-4\], target = 1
**Output:** ... | null | Array,Two Pointers,Sorting | Medium | 15,259 |
8 | here we have a list of strings that I want to turn into integers the way that we could do that is with list comprehension I'm going to save this into a variable called numb list and then I'm going to say with list comprehension int and that's going to be the for the string number in the string list before we run this I... | String to Integer (atoi) | string-to-integer-atoi | Implement the `myAtoi(string s)` function, which converts a string to a 32-bit signed integer (similar to C/C++'s `atoi` function).
The algorithm for `myAtoi(string s)` is as follows:
1. Read in and ignore any leading whitespace.
2. Check if the next character (if not already at the end of the string) is `'-'` or `... | null | String | Medium | 7,65,2168 |
1,095 | Hi Everyone, today's our lead code daily challenge is Find in Mountain Array, this is a hard level question and it is an interact problem, so what does interact problem mean, whatever our test cases will be in it is already there. It will not be determined. When we run the program, different test cases will be checked.... | Find in Mountain Array | two-city-scheduling | _(This problem is an **interactive problem**.)_
You may recall that an array `arr` is a **mountain array** if and only if:
* `arr.length >= 3`
* There exists some `i` with `0 < i < arr.length - 1` such that:
* `arr[0] < arr[1] < ... < arr[i - 1] < arr[i]`
* `arr[i] > arr[i + 1] > ... > arr[arr.length ... | null | Array,Greedy,Sorting | Medium | null |
367 | hey everybody it's me abdullah welcome back and today we will be doing another lead code 367 valid perfect square this is an easy one given a positive integer num write a function that should return true if it is a perfect square as far so 4 is the perfect square because it is negative 2 x 2 and 9 16 25 and you name it... | 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 |
238 | hello guys Samuel here in this video we are going to be solving the aorin problem product of AR except cell this is a common problem in technical interviews and it doubles as a good brain teaser also so let's di writing giving an integer array Norms return an array answer such that answer I is equal to the product of a... | Product of Array Except Self | product-of-array-except-self | Given an integer array `nums`, return _an array_ `answer` _such that_ `answer[i]` _is equal to the product of all the elements of_ `nums` _except_ `nums[i]`.
The product of any prefix or suffix of `nums` is **guaranteed** to fit in a **32-bit** integer.
You must write an algorithm that runs in `O(n)` time and without... | null | Array,Prefix Sum | Medium | 42,152,265,2267 |
135 | hello everyone so in this video we are going to solve a question of greed code that is candy this is 135th question lead code and this comes under hard category all right let's start with the problem statement there are n children standing in a line each child is assigned a rating value given in the integer area rating... | Candy | candy | There are `n` children standing in a line. Each child is assigned a rating value given in the integer array `ratings`.
You are giving candies to these children subjected to the following requirements:
* Each child must have at least one candy.
* Children with a higher rating get more candies than their neighbors.... | null | Array,Greedy | Hard | null |
210 | so we are looking at leap code number 210 it's course schedule two and i made a video on course schedule one highly recommend checking that out this is just building off of that problem or that pattern that i use to solve that problem and what we're doing here is again we are first assessing what is this question askin... | Course Schedule II | course-schedule-ii | There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`.
* For example, the pair `[0, 1]`, indicates that to take cou... | This problem is equivalent to finding the topological order in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topolo... | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 207,269,310,444,630,1101,2220 |
62 | hello today i'll be going over lead code number 62 unique paths so the problem statement is that a robot is located at the top left corner of an m by n grid and is marked as start in the diagram and the robot can either move only down or right at any point in time and the robot is trying to reach the bottom right corne... | Unique Paths | unique-paths | There is a robot on an `m x n` grid. The robot is initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time.
Given the two integers `m` and `n`, return _the nu... | null | Math,Dynamic Programming,Combinatorics | Medium | 63,64,174,2192 |
1,674 | hey what's up guys this is john here again so today let's take a look at the second last problem of this week's weekly contest number 1674 minimum moves to make array complementary i mean this one is a really hard problem to ma in my opinion i think it's more d it's even more difficult than the uh than the last problem... | Minimum Moves to Make Array Complementary | minimum-operations-to-make-array-equal | You are given an integer array `nums` of **even** length `n` and an integer `limit`. In one move, you can replace any integer from `nums` with another integer between `1` and `limit`, inclusive.
The array `nums` is **complementary** if for all indices `i` (**0-indexed**), `nums[i] + nums[n - 1 - i]` equals the same nu... | Build the array arr using the given formula, define target = sum(arr) / n What is the number of operations needed to convert arr so that all elements equal target ? | Math | Medium | null |
1,577 | Hello hello friends welcome to my channel should we are going to discuss problem from the list weekly contest us loud problem number of way number is equal to a pappu number 00 shri were given to interior is number one and studied and how to From this triplets inspector vaidya make the types of tablet sophie consider o... | 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 |
386 | today we're gonna be working on your code question number 386 lexicographical numbers and you have been given a number and written all the numbers in the range 1 to n sorted in lexicographical order you must write an algorithm that runs in linear time and without any extra space okay so one if we have to return the num... | Lexicographical Numbers | lexicographical-numbers | Given an integer `n`, return all the numbers in the range `[1, n]` sorted in lexicographical order.
You must write an algorithm that runs in `O(n)` time and uses `O(1)` extra space.
**Example 1:**
**Input:** n = 13
**Output:** \[1,10,11,12,13,2,3,4,5,6,7,8,9\]
**Example 2:**
**Input:** n = 2
**Output:** \[1,2\]
*... | null | Depth-First Search,Trie | Medium | null |
239 | hey everyone welcome back today we are going to solve problem number 239 sliding window maximum first we will see the explanation of the problem statement and the logic on the code now let's dive into the solution so in this problem we are given an input array in nums and we have case size so the case size represents t... | 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 |
242 | in this video we'll go over lead code question number 242 valid anagram given two strings we have to return true if they are anagrams of one another and return false otherwise now an anagram is a word that can be formed by rearranging the letters of another word for example Knight and thing are anagrams because you can... | Valid Anagram | valid-anagram | Given two strings `s` and `t`, return `true` _if_ `t` _is an anagram of_ `s`_, and_ `false` _otherwise_.
An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
**Example 1:**
**Input:** s = "anagram", t = "nagaram"
**... | null | Hash Table,String,Sorting | Easy | 49,266,438 |
1,721 | hey so welcome back and this is another daily code problem so today it's called swapping nodes in a linked list and so it's a medium level problem where you're given a linked list here along with an integer a k and all that you want to do is you want to swap the node that is like the kth node from the start which in th... | Swapping Nodes in a Linked List | maximum-profit-of-operating-a-centennial-wheel | You are given the `head` of a linked list, and an integer `k`.
Return _the head of the linked list after **swapping** the values of the_ `kth` _node from the beginning and the_ `kth` _node from the end (the list is **1-indexed**)._
**Example 1:**
**Input:** head = \[1,2,3,4,5\], k = 2
**Output:** \[1,4,3,2,5\]
**Ex... | Think simulation Note that the number of turns will never be more than 50 / 4 * n | Array,Simulation | Medium | null |
1,936 | Hello hello friends today we are going to discuss we medium play list problem dad 1938 minimum number of friends a letter e did you give otherwise strictly increasing in danger rank date represents height of the rings on letter you are currently on the floor 80 And you want to reach the glass thank you are also given a... | 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 |
23 | hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward you have not liked the video please like it subscribe to my channel and hit the bell icon so that you get notified when i post a new video without so without any further ado let's get started s... | Merge k Sorted Lists | merge-k-sorted-lists | You are given an array of `k` linked-lists `lists`, each linked-list is sorted in ascending order.
_Merge all the linked-lists into one sorted linked-list and return it._
**Example 1:**
**Input:** lists = \[\[1,4,5\],\[1,3,4\],\[2,6\]\]
**Output:** \[1,1,2,3,4,4,5,6\]
**Explanation:** The linked-lists are:
\[
1->4... | null | Linked List,Divide and Conquer,Heap (Priority Queue),Merge Sort | Hard | 21,264 |
215 | hello guys welcome to my youtube channel and in this video i will be discussing the problem kth largest element in an array from lead code so let's first read the question given an integer array nums and integer k return the kth largest element in the array note that it is the kth largest element in sorted order not th... | Kth Largest Element in an Array | kth-largest-element-in-an-array | Given an integer array `nums` and an integer `k`, return _the_ `kth` _largest element in the array_.
Note that it is the `kth` largest element in the sorted order, not the `kth` distinct element.
You must solve it in `O(n)` time complexity.
**Example 1:**
**Input:** nums = \[3,2,1,5,6,4\], k = 2
**Output:** 5
**Ex... | null | Array,Divide and Conquer,Sorting,Heap (Priority Queue),Quickselect | Medium | 324,347,414,789,1014,2113,2204,2250 |
210 | hey what's up guys in this video we are going to solve this little problem 201 uh course schedule number two so it's fairly similar to course category number one and uh but it's a little bit more than that so let's say uh the example in here uh number of courses digital two and so we have total two courses and uh that ... | Course Schedule II | course-schedule-ii | There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`.
* For example, the pair `[0, 1]`, indicates that to take cou... | This problem is equivalent to finding the topological order in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topolo... | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 207,269,310,444,630,1101,2220 |
836 | hey how's it going guys today we're going to be liquidating the rectangle overlap question so a rectangle is represented as a list x1 y1 x2 y2 x1 y1 are the coordinates of its bottom left corner and x2y2 are the coordinates of its top right corner two rectangle overlap if the area of their intersection is positive so t... | Rectangle Overlap | race-car | An axis-aligned rectangle is represented as a list `[x1, y1, x2, y2]`, where `(x1, y1)` is the coordinate of its bottom-left corner, and `(x2, y2)` is the coordinate of its top-right corner. Its top and bottom edges are parallel to the X-axis, and its left and right edges are parallel to the Y-axis.
Two rectangles ove... | null | Dynamic Programming | Hard | null |
455 | hello everyone this is sham Chi welcome to the very first video on our YouTube channel as we embark on this exciting journey together I want to extend heartfelt wishes for fantastic new year filled with growth and success for those of you who are new here this is growth with SH where we explore the fascinating world of... | Assign Cookies | assign-cookies | Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.
Each child `i` has a greed factor `g[i]`, which is the minimum size of a cookie that the child will be content with; and each cookie `j` has a size `s[j]`. If `s[j] >= g[i]`, we can assign ... | null | Array,Greedy,Sorting | Easy | null |
847 | hey everybody this is larry this is day 26 of the league code daily challenge hit the like button hit the subscribe button join me on discord let me know what you think um yeah i miss you let me uh you know if you're not a new viewer you know that i usually start with a little bit of uh just i don't know anything reall... | Shortest Path Visiting All Nodes | shortest-path-visiting-all-nodes | You have an undirected, connected graph of `n` nodes labeled from `0` to `n - 1`. You are given an array `graph` where `graph[i]` is a list of all the nodes connected with node `i` by an edge.
Return _the length of the shortest path that visits every node_. You may start and stop at any node, you may revisit nodes mul... | null | null | Hard | null |
13 | Hello Guys Welcome Chalkar Times Deals In This Video You Will See The Question Romantic When Roman Numerals Are Represented By Different Symbols And Rules While Writing Roman Number Largest From Left To Right Away For Not Return Gift Item Number One subscribe And subscribe The Amazing Main Iso Mapping Choose the symbol... | Roman to Integer | roman-to-integer | Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`.
**Symbol** **Value**
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, `2` is written as `II` in Roman numeral, just two ones added... | Problem is simpler to solve by working the string from back to front and using a map. | Hash Table,Math,String | Easy | 12 |
59 | we are given a positive integer n and we need to return a matrix of n rows and N columns filled with the first n Square integers in a spiral order for example if n equal to 3 then we have n Square equal to 9 and therefore this is the Matrix we need to return before continuing you may watch this previous video for a bet... | Spiral Matrix II | spiral-matrix-ii | Given a positive integer `n`, generate an `n x n` `matrix` filled with elements from `1` to `n2` in spiral order.
**Example 1:**
**Input:** n = 3
**Output:** \[\[1,2,3\],\[8,9,4\],\[7,6,5\]\]
**Example 2:**
**Input:** n = 1
**Output:** \[\[1\]\]
**Constraints:**
* `1 <= n <= 20` | null | Array,Matrix,Simulation | Medium | 54,921 |
332 | Hello Guys Welcome To Gautam Samay DC Today We Will Go Through The Dates Problem From June Recording Challenge Reconstructed Very Please Like This Video Fuel forget to subscribe our Channel Sugriv Never Miss Any Update Your Laptop Airline Tickets Are Presented A Foot After Departure Don't Forget Reports From * Reconsid... | Reconstruct Itinerary | reconstruct-itinerary | You are given a list of airline `tickets` where `tickets[i] = [fromi, toi]` represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it.
All of the tickets belong to a man who departs from `"JFK "`, thus, the itinerary must begin with `"JFK "`. If there are multiple... | null | Depth-First Search,Graph,Eulerian Circuit | Hard | 2051,2201 |
700 | hey what's up guys it's Nick Dwight I do tech and coding stuff on twitch and YouTube and I do all the weaker problems so I have a channel YouTube channel yeah a YouTube channel with a playlist with like 50 of them so far and we're gonna keep doing them ten a day or something like that until we do them all so check thos... | 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 |
1,452 | hello friends so today we gonna discuss this problem one four five dual problem named people whose based off favorite companies is not a subset of another list this problem came in the bikini contest one eight nine so now problem statement states that you are given the array favorite companies where favorite company I ... | People Whose List of Favorite Companies Is Not a Subset of Another List | restaurant-growth | Given the array `favoriteCompanies` where `favoriteCompanies[i]` is the list of favorites companies for the `ith` person (**indexed from 0**).
_Return the indices of people whose list of favorite companies is not a **subset** of any other list of favorites companies_. You must return the indices in increasing order.
... | null | Database | Medium | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.