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 |
|---|---|---|---|---|---|---|---|---|
21 | hello everyone let's look at merge 2 sorted list the problem statement is we want to merge to sorted linked list and return it as a new sorted list the new list should be made by splicing together the nodes of the first two lists so here's an example the list one is one two four list two is one three four so the merged... | Merge Two Sorted Lists | merge-two-sorted-lists | You are given the heads of two sorted linked lists `list1` and `list2`.
Merge the two lists in a one **sorted** list. The list should be made by splicing together the nodes of the first two lists.
Return _the head of the merged linked list_.
**Example 1:**
**Input:** list1 = \[1,2,4\], list2 = \[1,3,4\]
**Output:**... | null | Linked List,Recursion | Easy | 23,88,148,244,1774,2071 |
167 | A Proper Check Out Coding Interview Prep Monthly Class for Preparing for Interview Product Base Company A Tempered Glass Problem Solving Patterns in Top Companies with Example You Co Diversification Offline Test Record Created by Practicing Year-Old Software Engineer Year-Old Software Engineer Year-Old Software Enginee... | 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 |
51 | We are going to study, become very strong about typing, be able to solve army questions on your own, talk to everyone, others will understand what we mean, there is an official definition, we can freshen it up in a way that Find All Possible. Solution: You have Find All Possible. Solution: You have Find All Possible. S... | N-Queens | n-queens | The **n-queens** puzzle is the problem of placing `n` queens on an `n x n` chessboard such that no two queens attack each other.
Given an integer `n`, return _all distinct solutions to the **n-queens puzzle**_. You may return the answer in **any order**.
Each solution contains a distinct board configuration of the n-... | null | Array,Backtracking | Hard | 52,1043 |
448 | hello everyone welcome to clash encoder so in this video we will see the question that is find all numbers disappeared in an array so it is an easy level question on the lead code platform and let's see the problem statement so given an array of integers where i and that means every element in the array lies between on... | Find All Numbers Disappeared in an Array | find-all-numbers-disappeared-in-an-array | Given an array `nums` of `n` integers where `nums[i]` is in the range `[1, n]`, return _an array of all the integers in the range_ `[1, n]` _that do not appear in_ `nums`.
**Example 1:**
**Input:** nums = \[4,3,2,7,8,2,3,1\]
**Output:** \[5,6\]
**Example 2:**
**Input:** nums = \[1,1\]
**Output:** \[2\]
**Constrain... | This is a really easy problem if you decide to use additional memory. For those trying to write an initial solution using additional memory, think counters! However, the trick really is to not use any additional space than what is already available to use. Sometimes, multiple passes over the input array help find the s... | Array,Hash Table | Easy | 41,442,2107,2305 |
427 | um hello so today we are going to do this problem which is part of Fleet code daily challenge um construct quad tree um and so here we have an in by n Matrix right so same dimensions for rows and columns and the values are zeros and ones and we want to represent this grid using a quad 3 data structure now what is a qua... | Construct Quad Tree | construct-quad-tree | Given a `n * n` matrix `grid` of `0's` and `1's` only. We want to represent `grid` with a Quad-Tree.
Return _the root of the Quad-Tree representing_ `grid`.
A Quad-Tree is a tree data structure in which each internal node has exactly four children. Besides, each node has two attributes:
* `val`: True if the node r... | null | null | Medium | null |
81 | hello everyone welcome to day 28th of march league code challenge and i hope all of you are having a great time even before jumping onto the details of today's question i hope you solved the yesterday's weekly contest and he performed really well in case you were not able to solve any of the four questions don't get di... | 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 |
133 | welcome to october's lego challenge today's problem is clone graph given a reference of a node in a connected undirected graph return a deep copy clone of the graph each node in the graph contains a value for what it represents and a list of its neighbors so they give you some details about how they want us to do it bu... | Clone Graph | clone-graph | Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph.
Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph.
Each node in the graph contains a value (`int`) and a list (`List[Node]`)... | null | Hash Table,Depth-First Search,Breadth-First Search,Graph | Medium | 138,1624,1634 |
629 | hey what's up guys uh this is chung here again so this time uh lead code number 629 k inverse pairs array okay so given like uh integer arrays nums and so and then we define an inverse pair so the inverse pair is a pair of integer where the index i is smaller than j but the value of index is greater than j right and th... | K Inverse Pairs Array | k-inverse-pairs-array | For an integer array `nums`, an **inverse pair** is a pair of integers `[i, j]` where `0 <= i < j < nums.length` and `nums[i] > nums[j]`.
Given two integers n and k, return the number of different arrays consist of numbers from `1` to `n` such that there are exactly `k` **inverse pairs**. Since the answer can be huge,... | null | Dynamic Programming | Hard | null |
116 | what's up nerds welcome back to time with your favorite software engineer so today i'm going over populating next right pointers in each note first i just want to mention the leeco competition that i'm hacking or not hacking posting and i'm paying the winner ten dollars and we're hosting every month so the invite to th... | 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 |
410 | hi all today in the read code series we'll be attending this preterite logisim problem this is one of my personal favorite and it is pretty interesting so let's start with the problem description uh in this i'll be given an iron nums which consists of non-negative integers which consists of non-negative integers which ... | Split Array Largest Sum | split-array-largest-sum | Given an integer array `nums` and an integer `k`, split `nums` into `k` non-empty subarrays such that the largest sum of any subarray is **minimized**.
Return _the minimized largest sum of the split_.
A **subarray** is a contiguous part of the array.
**Example 1:**
**Input:** nums = \[7,2,5,10,8\], k = 2
**Output:*... | null | Array,Binary Search,Dynamic Programming,Greedy | Hard | 1056,1192,2242,2330 |
1,439 | yeah hello there today I'm looking at the question 14 so Dean I find that the case is smallest the sum of a matrix always sword arrows we have a 2d matrix M rows and columns it's calm at the special property about this matrix is that the rows are sorted the order is in non decreasing order so the first element every ro... | Find the Kth Smallest Sum of a Matrix With Sorted Rows | running-total-for-different-genders | You are given an `m x n` matrix `mat` that has its rows sorted in non-decreasing order and an integer `k`.
You are allowed to choose **exactly one element** from each row to form an array.
Return _the_ `kth` _smallest array sum among all possible arrays_.
**Example 1:**
**Input:** mat = \[\[1,3,11\],\[2,4,6\]\], k ... | null | Database | Medium | 1327 |
1,171 | hi guys today I'm going to solve lead code question number 1171 that is remove Zero Sum consecutive notes from a link list so the question says that given the head of a link list we repeatedly delete consecutive subsequences of nodes that sum to zero until there is no such sequence left and after doing this we have to ... | Remove Zero Sum Consecutive Nodes from Linked List | shortest-path-in-binary-matrix | Given the `head` of a linked list, we repeatedly delete consecutive sequences of nodes that sum to `0` until there are no such sequences.
After doing so, return the head of the final linked list. You may return any such answer.
(Note that in the examples below, all sequences are serializations of `ListNode` objects.)... | Do a breadth first search to find the shortest path. | Array,Breadth-First Search,Matrix | Medium | null |
468 | hello everyone so in this video let us talk about one more problem from lead code the problem name is validate IP address so the problem is not too difficult it only has different conditions and we just have to implement that so let us click over the problem statement and the conditions so you are given a string that i... | Validate IP Address | validate-ip-address | Given a string `queryIP`, return `"IPv4 "` if IP is a valid IPv4 address, `"IPv6 "` if IP is a valid IPv6 address or `"Neither "` if IP is not a correct IP of any type.
**A valid IPv4** address is an IP in the form `"x1.x2.x3.x4 "` where `0 <= xi <= 255` and `xi` **cannot contain** leading zeros. For example, `"192.16... | null | String | Medium | 752 |
303 | welcome to august eco challenge today's problem is range sum query immutable given an injury nums handle multiple queries of the following type calculate the sum of the elements of nums between indices left and right inclusive where left is less or equal to right basically we want to create a number rate class which in... | Range Sum Query - Immutable | range-sum-query-immutable | Given an integer array `nums`, handle multiple queries of the following type:
1. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`.
Implement the `NumArray` class:
* `NumArray(int[] nums)` Initializes the object with the integer array `nums`.
* ... | null | Array,Design,Prefix Sum | Easy | 304,307,325 |
227 | hey guys welcome back to another video and today we're going to be solving the leak code question basic calculator 2. all right so in this question we basically need to implement a basic calculator to evaluate a simple expression string so we're going to be given a string which is going to be our expression and it's go... | Basic Calculator II | basic-calculator-ii | Given a string `s` which represents an expression, _evaluate this expression and return its value_.
The integer division should truncate toward zero.
You may assume that the given expression is always valid. All intermediate results will be in the range of `[-231, 231 - 1]`.
**Note:** You are not allowed to use any ... | null | Math,String,Stack | Medium | 224,282,785 |
329 | welcome back and let's write some more neat code today so today let's solve the problem longest increasing path in a matrix and while this is a hard problem i would definitely say it's one of the more doable hard problems there's nothing crazy involved but it is somewhat difficult we're given an m by n matrix that is f... | Longest Increasing Path in a Matrix | longest-increasing-path-in-a-matrix | Given an `m x n` integers `matrix`, return _the length of the longest increasing path in_ `matrix`.
From each cell, you can either move in four directions: left, right, up, or down. You **may not** move **diagonally** or move **outside the boundary** (i.e., wrap-around is not allowed).
**Example 1:**
**Input:** matr... | null | Dynamic Programming,Depth-First Search,Breadth-First Search,Graph,Topological Sort,Memoization | Hard | null |
1,732 | hello everyone welcome back here is van absin and in today's video we will tackle an interesting problem about finding the highest altitude this time in C sharp and we are given an array that represents the net gain in altitude between points and our job is to find the maximum altitude the biker can reach so let's star... | Find the Highest Altitude | minimum-one-bit-operations-to-make-integers-zero | There is a biker going on a road trip. The road trip consists of `n + 1` points at different altitudes. The biker starts his trip on point `0` with altitude equal `0`.
You are given an integer array `gain` of length `n` where `gain[i]` is the **net gain in altitude** between points `i` and `i + 1` for all (`0 <=... | The fastest way to convert n to zero is to remove all set bits starting from the leftmost one. Try some simple examples to learn the rule of how many steps are needed to remove one set bit. consider n=2^k case first, then solve for all n. | Dynamic Programming,Bit Manipulation,Memoization | Hard | 2119 |
1,252 | okay so let's talk about the cells with all value in the matrix so i'm going to summarize the question so you are given an n by a matrix and you need to increment the row and column cells based on the indices i so in this si is actually like increment all the cells on row i increment all the cells on columns ci and in ... | Cells with Odd Values in a Matrix | break-a-palindrome | There is an `m x n` matrix that is initialized to all `0`'s. There is also a 2D array `indices` where each `indices[i] = [ri, ci]` represents a **0-indexed location** to perform some increment operations on the matrix.
For each location `indices[i]`, do **both** of the following:
1. Increment **all** the cells on ro... | How to detect if there is impossible to perform the replacement? Only when the length = 1. Change the first non 'a' character to 'a'. What if the string has only 'a'? Change the last character to 'b'. | String,Greedy | Medium | null |
518 | Hello hello everyone welcome to my channel today his death sentence of june recording challenge and problems for a change in to flexed problem statement and send a good example software give different denominations and total amount of money and to write to the number of made the Number of subscribe and subscribe this o... | 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,968 | hello and welcome to another Elite code problem today we're going to be doing array with elements not equal to outrage of Neighbors and so in this problem you're given as your index array nums of distinct integers you want to rearrange the elements in the array such that every element in the rearrange the ray is not eq... | Array With Elements Not Equal to Average of Neighbors | maximum-building-height | You are given a **0-indexed** array `nums` of **distinct** integers. You want to rearrange the elements in the array such that every element in the rearranged array is **not** equal to the **average** of its neighbors.
More formally, the rearranged array should have the property such that for every `i` in the range `1... | Is it possible to find the max height if given the height range of a particular building? You can find the height range of a restricted building by doing 2 passes from the left and right. | Array,Math | Hard | null |
476 | hey hello there so I'm gonna talk about today's recording challenge question real quickly it's a fairly easy one that's called a number compliment so we have a positive integer and we want to return its compliment number the compliment is 2 it's done by flipping the bits in the binary representation so for a decimal nu... | Number Complement | number-complement | The **complement** of an integer is the integer you get when you flip all the `0`'s to `1`'s and all the `1`'s to `0`'s in its binary representation.
* For example, The integer `5` is `"101 "` in binary and its **complement** is `"010 "` which is the integer `2`.
Given an integer `num`, return _its complement_.
**... | null | Bit Manipulation | Easy | null |
1,803 | hey what's up guys uh this is chung here so this time 1803 count pairs with xor in the range okay so this one it's the description it's pretty uh simple which uh you're given like a array of integers right and then also two integers low and high and you need to return the number of nice pairs so a nice pair is a pair w... | Count Pairs With XOR in a Range | average-waiting-time | Given a **(0-indexed)** integer array `nums` and two integers `low` and `high`, return _the number of **nice pairs**_.
A **nice pair** is a pair `(i, j)` where `0 <= i < j < nums.length` and `low <= (nums[i] XOR nums[j]) <= high`.
**Example 1:**
**Input:** nums = \[1,4,2,7\], low = 2, high = 6
**Output:** 6
**Explan... | Iterate on the customers, maintaining the time the chef will finish the previous orders. If that time is before the current arrival time, the chef starts immediately. Else, the current customer waits till the chef finishes, and then the chef starts. Update the running time by the time when the chef starts preparing + p... | Array,Simulation | Medium | 2142 |
850 | hey what's up guys chung here again so this time I want to talk about this little problem here number eight hundred and fifty rectangle area - it's a hard and fifty rectangle area - it's a hard and fifty rectangle area - it's a hard problem and it's also a very classic you can call it a line sweep in war sky skyline pr... | Rectangle Area II | insert-into-a-sorted-circular-linked-list | You are given a 2D array of axis-aligned `rectangles`. Each `rectangle[i] = [xi1, yi1, xi2, yi2]` denotes the `ith` rectangle where `(xi1, yi1)` are the coordinates of the **bottom-left corner**, and `(xi2, yi2)` are the coordinates of the **top-right corner**.
Calculate the **total area** covered by all `rectangles` ... | null | Linked List | Medium | 147 |
263 | hey this is toer again with the lonely Dash today we're going over lead code question 263 called ugly number good old ugly number now it says an ugly number is a positive integer whose prime factors are limited to 2 three and five given an integer n return true if n is an ugly number okay so they give us three examples... | Ugly Number | ugly-number | An **ugly number** is a positive integer whose prime factors are limited to `2`, `3`, and `5`.
Given an integer `n`, return `true` _if_ `n` _is an **ugly number**_.
**Example 1:**
**Input:** n = 6
**Output:** true
**Explanation:** 6 = 2 \* 3
**Example 2:**
**Input:** n = 1
**Output:** true
**Explanation:** 1 has n... | null | Math | Easy | 202,204,264 |
1,832 | okay so check if the sentence is penguin so penguin is a sentence where every letter of the english alphabet appears at least once so when you see this kind of uh question you can just use the content array so hinge counts i would say in count 26 because alphabet and what i should do i should convert to char array and ... | Check if the Sentence Is Pangram | minimum-operations-to-make-a-subsequence | A **pangram** is a sentence where every letter of the English alphabet appears at least once.
Given a string `sentence` containing only lowercase English letters, return `true` _if_ `sentence` _is a **pangram**, or_ `false` _otherwise._
**Example 1:**
**Input:** sentence = "thequickbrownfoxjumpsoverthelazydog "
**O... | The problem can be reduced to computing Longest Common Subsequence between both arrays. Since one of the arrays has distinct elements, we can consider that these elements describe an arrangement of numbers, and we can replace each element in the other array with the index it appeared at in the first array. Then the pro... | Array,Hash Table,Binary Search,Greedy | Hard | null |
1,091 | hey guys how's everything going let's continue our journey of each code this is my preparation for my front end position interview in June which is from Facebook so I take this seriously I think I don't think I could pass the interview but I want to try my best to prepare for it because I want to know the distance betw... | Shortest Path in Binary Matrix | maximum-average-subtree | Given an `n x n` binary matrix `grid`, return _the length of the shortest **clear path** in the matrix_. If there is no clear path, return `-1`.
A **clear path** in a binary matrix is a path from the **top-left** cell (i.e., `(0, 0)`) to the **bottom-right** cell (i.e., `(n - 1, n - 1)`) such that:
* All the visite... | Can you find the sum of values and the number of nodes for every sub-tree ? Can you find the sum of values and the number of nodes for a sub-tree given the sum of values and the number of nodes of it's left and right sub-trees ? Use depth first search to recursively find the solution for the children of a node then use... | Tree,Depth-First Search,Binary Tree | Medium | 2126 |
3 | what is up you guys today we're gonna go over another algorithm video longest substring without repeating characters this problem is asked by literally every single company google facebook amazon uber any company you name it they ask this question it's one of the most popular questions on leak code and i figured it'd b... | 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 |
21 | hi everybody welcome back and if you're new here my name is pratiksha makrola and i make videos about lead code solution and system design concepts if you are into that sort of thing hit the subscribe button and the bell button now let's dive into today's problem merge two sorted lists you are given the heads of two so... | Merge Two Sorted Lists | merge-two-sorted-lists | You are given the heads of two sorted linked lists `list1` and `list2`.
Merge the two lists in a one **sorted** list. The list should be made by splicing together the nodes of the first two lists.
Return _the head of the merged linked list_.
**Example 1:**
**Input:** list1 = \[1,2,4\], list2 = \[1,3,4\]
**Output:**... | null | Linked List,Recursion | Easy | 23,88,148,244,1774,2071 |
425 | hey yo what's up guys babybear4812 coming at you one more time today with uh problem four two five word squares so we're doing another hard one it's got a really good like to dislike ratio um decent submission to acceptance rate it looks like only bloomberg has asked it recently which is surprising because i think it's... | Word Squares | word-squares | Given an array of **unique** strings `words`, return _all the_ **[word squares](https://en.wikipedia.org/wiki/Word_square)** _you can build from_ `words`. The same word from `words` can be used **multiple times**. You can return the answer in **any order**.
A sequence of strings forms a valid **word square** if the `k... | null | Array,String,Backtracking,Trie | Hard | 422 |
1,337 | Hello Everyone Welcome Back To My Channel Short Today We Are Going To Discuss The Problem Is This President V Source Cinema Matrix Yoggya And M Crops And Binary Matrix Of Vansh Representing Soldiers And Dros Representing Civilians The Walking 200 Judges Are Position In Front Of the civilians the meaning of soldiers wil... | The K Weakest Rows in a Matrix | design-skiplist | You are given an `m x n` binary matrix `mat` of `1`'s (representing soldiers) and `0`'s (representing civilians). The soldiers are positioned **in front** of the civilians. That is, all the `1`'s will appear to the **left** of all the `0`'s in each row.
A row `i` is **weaker** than a row `j` if one of the following is... | null | Linked List,Design | Hard | 816,817,838 |
230 | lead code problem 230 cave smallest element in a binary search tree so this problem gives us a binary search tree and an integer k which will have to return the K smallest value of all the values of the nodes in the tree so what does that mean so looking at this binary search tree there is one two three and four and si... | Kth Smallest Element in a BST | kth-smallest-element-in-a-bst | Given the `root` of a binary search tree, and an integer `k`, return _the_ `kth` _smallest value (**1-indexed**) of all the values of the nodes in the tree_.
**Example 1:**
**Input:** root = \[3,1,4,null,2\], k = 1
**Output:** 1
**Example 2:**
**Input:** root = \[5,3,6,2,4,null,null,1\], k = 3
**Output:** 3
**Cons... | Try to utilize the property of a BST. Try in-order traversal. (Credits to @chan13) What if you could modify the BST node's structure? The optimal runtime complexity is O(height of BST). | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | 94,671 |
1,673 | hi everyone welcome to my channel let's solve the problem find the most competitive subsequence so given an integer a number and a positive integer k return the most competitive subsequence of nums of size k an array is subsequence is resulting a subsequence obtained by erasing some possibly zero elements from the arra... | Find the Most Competitive Subsequence | find-the-most-competitive-subsequence | Given an integer array `nums` and a positive integer `k`, return _the most **competitive** subsequence of_ `nums` _of size_ `k`.
An array's subsequence is a resulting sequence obtained by erasing some (possibly zero) elements from the array.
We define that a subsequence `a` is more **competitive** than a subsequence ... | null | null | Medium | null |
79 | Jai Hind is problem person search for word in given two three grade of characters in these characters MB from small and to small G and capital to chapter G you just looking perplexed roots se alert and others on Mauni and travels in flood victims will never stop At Nothing Doctor Subscribe To A Sweet Starting With This... | 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 |
328 | so let's continue with our playlist before that hey every welcome back to the channel I hope you guys are doing extremely well so the problem that we will be solving today is odd and even link list what is the problem stating it is stating that you'll be given the head of the link list and your task is to group the odd... | Odd Even Linked List | odd-even-linked-list | Given the `head` of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return _the reordered list_.
The **first** node is considered **odd**, and the **second** node is **even**, and so on.
Note that the relative order inside both the even and odd groups s... | null | Linked List | Medium | 725 |
92 | hello so today we are doing this problem called reverse linked list 2 and basically the problem says we get we are given a linked list and we want to reverse it from position M to n in one pass so basically we don't want to reverse the entire linkedlist necessarily we might given like just a range from M to n and we wa... | Reverse Linked List II | reverse-linked-list-ii | Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], left = 2, right = 4
**Output:** \[1,4,3,2,5\]
**Example 2:**
**I... | null | Linked List | Medium | 206 |
210 | hello everyone welcome to my channel but suzuki me discuss one problem in hit ko det norske don't oo should use that particular problem is political shot white highly recommend you to watch the video after to channel short the language in the i will use This problem subscribe my channel subscribe to this time also to n... | 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 |
374 | hey everybody this is Larry this is day 16 of the November legal daily challenge hit the like button hit the Subscribe button join me on Discord let me see if the extra points no extra coins uh yeah hit the like button to subscribe and join me on Disco let me know what you think about today's farm and again it's later ... | 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 |
746 | hello fellow coders welcome back to goodma Circus today we are swapping our coder hands as we tackle a circuits where every step comes with a cons and our Quest is to reach to the top floor while keeping the cost minimum so let's get started and find the question description in lead code the problem state you are given... | 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,588 | all right so of all auto length subarrays so they give us an array and they just want us to go through all the other length subarrays so sub arrays of blank one length three length five and then just sum up all the values in those auto link club arrays so this problem is actually really chill if you know about one litt... | Sum of All Odd Length Subarrays | sum-of-all-odd-length-subarrays | Given an array of positive integers `arr`, return _the sum of all possible **odd-length subarrays** of_ `arr`.
A **subarray** is a contiguous subsequence of the array.
**Example 1:**
**Input:** arr = \[1,4,2,5,3\]
**Output:** 58
**Explanation:** The odd-length subarrays of arr and their sums are:
\[1\] = 1
\[4\] = 4... | null | null | Easy | null |
1,505 | hey everybody this is larry this is me going over the contest problem for minimum possible integer after at most k adjacent swaps on digits um so yeah so this problem asks you to given the number and it's a big number by that i mean it goes to you know 30 000 digits i think uh and assuming that there's no leading sales... | Minimum Possible Integer After at Most K Adjacent Swaps On Digits | create-target-array-in-the-given-order | You are given a string `num` representing **the digits** of a very large integer and an integer `k`. You are allowed to swap any two adjacent digits of the integer **at most** `k` times.
Return _the minimum integer you can obtain also as a string_.
**Example 1:**
**Input:** num = "4321 ", k = 4
**Output:** "1342 "... | Simulate the process and fill corresponding numbers in the designated spots. | Array,Simulation | Easy | null |
1,816 | hello everyone welcome to another video now this video is about strings um we will be starting with the strings now so um we'll be covering the combination of arrays and strings we have been covering that uh since quite a time and this question is solely completely based on strings we don't have any arrays here we can ... | 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 |
814 | Hua Hai The Place Value Added 23July Liquid Challenge And Aspirations For Every True Meaning In This Place In This Room In This Frame Removed Spider-Man Question Need To Removed Spider-Man Question Need To Removed Spider-Man Question Need To Remove All 20000 For Example Electronic Bulb Screen More Subscribe To Subscrib... | Binary Tree Pruning | smallest-rotation-with-highest-score | Given the `root` of a binary tree, return _the same tree where every subtree (of the given tree) not containing a_ `1` _has been removed_.
A subtree of a node `node` is `node` plus every node that is a descendant of `node`.
**Example 1:**
**Input:** root = \[1,null,0,0,1\]
**Output:** \[1,null,0,null,1\]
**Explanati... | null | Array,Prefix Sum | Hard | null |
16 | hello and welcome in this video we are going to solve question number 16 of late code that is threesome closest so let's first read the problem statement so we have given an array nums of length n and an integer Target okay so we can see that an area of nums and a target one okay find three integers in Num such that th... | 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 |
744 | hello and welcome everyone we've been tracking the sean prasad pattern problem and this spreadsheet is linked in the description so if you want to follow along do check it out recently i started uploading codes in both python and javascript in case that's helpful and we're going through the code walkthrough of the next... | Find Smallest Letter Greater Than Target | network-delay-time | You are given an array of characters `letters` that is sorted in **non-decreasing order**, and a character `target`. There are **at least two different** characters in `letters`.
Return _the smallest character in_ `letters` _that is lexicographically greater than_ `target`. If such a character does not exist, return t... | We visit each node at some time, and if that time is better than the fastest time we've reached this node, we travel along outgoing edges in sorted order. Alternatively, we could use Dijkstra's algorithm. | Depth-First Search,Breadth-First Search,Graph,Heap (Priority Queue),Shortest Path | Medium | 2151,2171 |
636 | price the discussions 636 exclusive time of functions so we are now sinker starter CPU meaning that we can only execute one thing at a time we couldn't do two things at the same time we executing some functions each function has a unique ID between 0 and n minus 1 so they are possibly n different functions we store log... | Exclusive Time of Functions | exclusive-time-of-functions | On a **single-threaded** CPU, we execute a program containing `n` functions. Each function has a unique ID between `0` and `n-1`.
Function calls are **stored in a [call stack](https://en.wikipedia.org/wiki/Call_stack)**: when a function call starts, its ID is pushed onto the stack, and when a function call ends, its I... | null | Array,Stack | Medium | null |
143 | lead code problem 143 reorder list so this problem gives us a head of a linked list and we need to reorder it in a certain way all right so this is basically the uh formula I guess you can call it of how it wants to be ordered and then it says that we cannot modify the value inside the elite nodes right so that means w... | Reorder List | reorder-list | You are given the head of a singly linked-list. The list can be represented as:
L0 -> L1 -> ... -> Ln - 1 -> Ln
_Reorder the list to be on the following form:_
L0 -> Ln -> L1 -> Ln - 1 -> L2 -> Ln - 2 -> ...
You may not modify the values in the list's nodes. Only nodes themselves may be changed.
**Example 1:**
**... | null | Linked List,Two Pointers,Stack,Recursion | Medium | 2216 |
14 | everyone welcome back and let's write some more neat code today so today let's solve the problem longest common prefix we're given a list of strings and we among all these strings we want to return whatever is the longest common prefix now what is a prefix well it's just a portion of the string so for example this stri... | Longest Common Prefix | longest-common-prefix | Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string `" "`.
**Example 1:**
**Input:** strs = \[ "flower ", "flow ", "flight "\]
**Output:** "fl "
**Example 2:**
**Input:** strs = \[ "dog ", "racecar ", "car "\]
**Output:** " "... | null | String | Easy | null |
1,829 | We have come to this question, okay and that is the maximum beat which is basically the maximum beat given and its relation with the gas question is that we have to find a number which will give less so what is it? Our exhaust should be maximized, right, so the question is basically we are given a number and what shoul... | Maximum XOR for Each Query | maximum-units-on-a-truck | You are given a **sorted** array `nums` of `n` non-negative integers and an integer `maximumBit`. You want to perform the following query `n` **times**:
1. Find a non-negative integer `k < 2maximumBit` such that `nums[0] XOR nums[1] XOR ... XOR nums[nums.length-1] XOR k` is **maximized**. `k` is the answer to the `it... | If we have space for at least one box, it's always optimal to put the box with the most units. Sort the box types with the number of units per box non-increasingly. Iterate on the box types and take from each type as many as you can. | Array,Greedy,Sorting | Easy | null |
105 | hello everyone welcome to learn overflow in this video we will discuss another liquid problem that is the construct binary tree from pre-order and inorder binary tree from pre-order and inorder binary tree from pre-order and inorder traversal so uh by question name if you understand that we need to construct our binary... | Construct Binary Tree from Preorder and Inorder Traversal | construct-binary-tree-from-preorder-and-inorder-traversal | Given two integer arrays `preorder` and `inorder` where `preorder` is the preorder traversal of a binary tree and `inorder` is the inorder traversal of the same tree, construct and return _the binary tree_.
**Example 1:**
**Input:** preorder = \[3,9,20,15,7\], inorder = \[9,3,15,20,7\]
**Output:** \[3,9,20,null,null,... | null | Array,Hash Table,Divide and Conquer,Tree,Binary Tree | Medium | 106 |
637 | hey everyone welcome back and today we will be doing another lead chord problem 637 average of levels in binary tree an easy one given the root of the binary return the average value of the nodes on each level in the form of an array answer within 10 raised to the power minus 5 of the actual will be accepted so if we h... | Average of Levels in Binary Tree | average-of-levels-in-binary-tree | Given the `root` of a binary tree, return _the average value of the nodes on each level in the form of an array_. Answers within `10-5` of the actual answer will be accepted.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[3.00000,14.50000,11.00000\]
Explanation: The average value of nodes on... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 102,107 |
817 | cool a 17 linked list components a cube if I say that you mix it if you want to request a hard problem for after this film just put it in the chat and I'll get to it next so that you don't have to like I don't know ways to get a problem or something oh yeah okay cool yeah 8:17 or something oh yeah okay cool yeah 8:17 o... | Linked List Components | design-hashmap | You are given the `head` of a linked list containing unique integer values and an integer array `nums` that is a subset of the linked list values.
Return _the number of connected components in_ `nums` _where two values are connected if they appear **consecutively** in the linked list_.
**Example 1:**
**Input:** head... | null | Array,Hash Table,Linked List,Design,Hash Function | Easy | 816,1337 |
134 | hello everyone welcome back to my channel so today we are going to discuss another problem but before going forward if you have not liked the video please like it subscribe to my channel so that you get notified whenever i post a new video so without any further ado let's get started so problem is gas station there are... | Gas Station | gas-station | There are `n` gas stations along a circular route, where the amount of gas at the `ith` station is `gas[i]`.
You have a car with an unlimited gas tank and it costs `cost[i]` of gas to travel from the `ith` station to its next `(i + 1)th` station. You begin the journey with an empty tank at one of the gas stations.
Gi... | null | Array,Greedy | Medium | 1346 |
336 | The college is welcome and the channel is tested in this video you will talk in water heart problem dalit ko follow players and taxes 316 problems categorized as hata problem dalit ko ok so movie want to the discussion of this problem will solve this problem of trench problem and Exactly Which Interesting Channel Subs ... | Palindrome Pairs | palindrome-pairs | You are given a **0-indexed** array of **unique** strings `words`.
A **palindrome pair** is a pair of integers `(i, j)` such that:
* `0 <= i, j < words.length`,
* `i != j`, and
* `words[i] + words[j]` (the concatenation of the two strings) is a palindrome.
Return _an array of all the **palindrome pairs** of_ `... | null | Array,Hash Table,String,Trie | Hard | 5,214,2237 |
1,046 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem last stone way so this is an easy-ish last stone way so this is an easy-ish last stone way so this is an easy-ish problem i would say but we're also going to be solving the second version of this problem last stone weig... | 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 |
5 | hello guys welcome to another episode of the algorithmic illustrator in this particular episode we're gonna go over the solution to LICO problem number five the longest palindromic substring okay so the problem is given a string s find the longest palindromic substring in s okay so there are two key words important one... | Longest Palindromic Substring | longest-palindromic-substring | Given a string `s`, return _the longest_ _palindromic_ _substring_ in `s`.
**Example 1:**
**Input:** s = "babad "
**Output:** "bab "
**Explanation:** "aba " is also a valid answer.
**Example 2:**
**Input:** s = "cbbd "
**Output:** "bb "
**Constraints:**
* `1 <= s.length <= 1000`
* `s` consist of only dig... | How can we reuse a previously computed palindrome to compute a larger palindrome? If “aba” is a palindrome, is “xabax” a palindrome? Similarly is “xabay” a palindrome? Complexity based hint:
If we use brute-force and check whether for every start and end position a substring is a palindrome we have O(n^2) start - end ... | String,Dynamic Programming | Medium | 214,266,336,516,647 |
283 | hey everyone welcome back to your daily dose of neat code so today let's solve the problem move zero so while this is an easy problem it's also a pretty good problem to learn some you know fundamental tricks to be able to solve harder problems so we're given an array of numbers and we want to move all the zeros within ... | Move Zeroes | move-zeroes | Given an integer array `nums`, move all `0`'s to the end of it while maintaining the relative order of the non-zero elements.
**Note** that you must do this in-place without making a copy of the array.
**Example 1:**
**Input:** nums = \[0,1,0,3,12\]
**Output:** \[1,3,12,0,0\]
**Example 2:**
**Input:** nums = \[0\]... | In-place means we should not be allocating any space for extra array. But we are allowed to modify the existing array. However, as a first step, try coming up with a solution that makes use of additional space. For this problem as well, first apply the idea discussed using an additional array and the in-place solution ... | Array,Two Pointers | Easy | 27 |
436 | hey guys welcome back to another video and today we're going to be solving the lead code question find right interval all right so this question i think the question itself is a little bit confusing to understand so what i'm going to do is i'm first going to read out the entire question and then let's kind of break it ... | Find Right Interval | find-right-interval | You are given an array of `intervals`, where `intervals[i] = [starti, endi]` and each `starti` is **unique**.
The **right interval** for an interval `i` is an interval `j` such that `startj >= endi` and `startj` is **minimized**. Note that `i` may equal `j`.
Return _an array of **right interval** indices for each int... | null | Array,Binary Search,Sorting | Medium | 352 |
1,653 | oh okay hi everyone um okay so i'm just going to explain uh the minimum deletions to make string balance a little good question and the approach it takes to answer so this is the question so you're given a string s consisting only your characters a and b so we have only two characters and you can delete any number of c... | Minimum Deletions to Make String Balanced | number-of-good-leaf-nodes-pairs | You are given a string `s` consisting only of characters `'a'` and `'b'`.
You can delete any number of characters in `s` to make `s` **balanced**. `s` is **balanced** if there is no pair of indices `(i,j)` such that `i < j` and `s[i] = 'b'` and `s[j]= 'a'`.
Return _the **minimum** number of deletions needed to ma... | Start DFS from each leaf node. stop the DFS when the number of steps done > distance. If you reach another leaf node within distance steps, add 1 to the answer. Note that all pairs will be counted twice so divide the answer by 2. | Tree,Depth-First Search,Binary Tree | Medium | null |
18 | Hua Hai Hello Everyone Welcome To Day Sakte Hain To Chaliye Kuch Chale Ne British Passport Song Hindi Special Given In Anywhere In The Table In The Written That All The Unique Combination Of Volunteers The First Person In Totality Of Targeted At Events Subscribe All Possible To Return To Love that a without much a tool... | 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 |
319 | The problem is that this match is a problem, so first of all let's read its test. The problem is that you have to provide an operation for as many numbers as there are number one. The first one will be in the round but you have to turn on all the numbers and words. All the bulb owners have to turn them on. Jeevan quest... | Bulb Switcher | bulb-switcher | There are `n` bulbs that are initially off. You first turn on all the bulbs, then you turn off every second bulb.
On the third round, you toggle every third bulb (turning on if it's off or turning off if it's on). For the `ith` round, you toggle every `i` bulb. For the `nth` round, you only toggle the last bulb.
Retu... | null | Math,Brainteaser | Medium | 672,1037,1491 |
52 | Hello friends this is 52nd problem in a lead code this enqueues 2 is a hard level problem here in this nq's puzzles is the problem of placing nqs on the N by n chat board chess board such that no two queens attack each other there is the same problem which we discussed in our previous problems that is uh increase probl... | N-Queens II | n-queens-ii | The **n-queens** puzzle is the problem of placing `n` queens on an `n x n` chessboard such that no two queens attack each other.
Given an integer `n`, return _the number of distinct solutions to the **n-queens puzzle**_.
**Example 1:**
**Input:** n = 4
**Output:** 2
**Explanation:** There are two distinct solutions ... | null | Backtracking | Hard | 51 |
17 | hey what's up guys Nick white here I do tecnico ting stuff on Twitch in YouTube join the discord follow me on github and if you can support me on patreon I really appreciate that I put premium problems up there this is the letter combinations of a phone number given a string containing digits from two to nine inclusive... | Letter Combinations of a Phone Number | letter-combinations-of-a-phone-number | Given a string containing digits from `2-9` inclusive, return all possible letter combinations that the number could represent. Return the answer in **any order**.
A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.
**Example 1:**
**Input:** di... | null | Hash Table,String,Backtracking | Medium | 22,39,401 |
974 | and here I present solution to day 19th of January lead code challenge the problem that we have in today is subar some divisible by K this is a medium level question on lead code and I totally feel the same we will be using the concept of maps to arrive at the solution and without further Ado let's quickly move on to t... | Subarray Sums Divisible by K | reorder-data-in-log-files | Given an integer array `nums` and an integer `k`, return _the number of non-empty **subarrays** that have a sum divisible by_ `k`.
A **subarray** is a **contiguous** part of an array.
**Example 1:**
**Input:** nums = \[4,5,0,-2,-3,1\], k = 5
**Output:** 7
**Explanation:** There are 7 subarrays with a sum divisible b... | null | Array,String,Sorting | Easy | null |
344 | is welcome to another video for our programming practice session today we are going to do number 344 onlet code reverse string it's pretty easy problem actually uh if you think about it right we are just trying to reverse the string so let's say our string is looks something like this and we want to return we want to m... | 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 |
76 | minimum window substring so basically we are given two strings s and t and we have to find the minimum window in s which contains all the characters in t so firstly we will create a character mapping of T which will tell us the characters and how many times they occur and we will basically use this mapping to validate ... | Minimum Window Substring | minimum-window-substring | Given two strings `s` and `t` of lengths `m` and `n` respectively, return _the **minimum window**_ **_substring_** _of_ `s` _such that every character in_ `t` _(**including duplicates**) is included in the window_. If there is no such substring, return _the empty string_ `" "`.
The testcases will be generated such tha... | Use two pointers to create a window of letters in S, which would have all the characters from T. Since you have to find the minimum window in S which has all the characters from T, you need to expand and contract the window using the two pointers and keep checking the window for all the characters. This approach is als... | Hash Table,String,Sliding Window | Hard | 30,209,239,567,632,727 |
43 | hello and welcome to another leite code solution video this is problem number 43 multiply strings for this problem we're given two non- negative integers num one given two non- negative integers num one given two non- negative integers num one and num two represented as strings return the product of num one and num two... | Multiply Strings | multiply-strings | Given two non-negative integers `num1` and `num2` represented as strings, return the product of `num1` and `num2`, also represented as a string.
**Note:** You must not use any built-in BigInteger library or convert the inputs to integer directly.
**Example 1:**
**Input:** num1 = "2", num2 = "3"
**Output:** "6"
**Ex... | null | Math,String,Simulation | Medium | 2,66,67,415 |
79 | Hi gas welcome and welcome back to my channel so today our problem is word search so what have you given us in this problem statement here we have been given a m * n green of here we have been given a m * n green of here we have been given a m * n green of characters from board names and a word has been given sting. Wh... | 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,955 | Hello Everyone Should Develop's Setting On Thought Provoking And Its Name Account Number Of Special Subsidy 600 800 Sequence Special A Great Consist Of Appointing Number And This Is The Point In This Point Proverbs And Benefits 340 800008 Stuart Broad Sequel So Ifin Like 34 Exam Point Example A Specific Comment And Pac... | Count Number of Special Subsequences | seat-reservation-manager | A sequence is **special** if it consists of a **positive** number of `0`s, followed by a **positive** number of `1`s, then a **positive** number of `2`s.
* For example, `[0,1,2]` and `[0,0,1,1,1,2]` are special.
* In contrast, `[2,1,0]`, `[1]`, and `[0,1,2,0]` are not special.
Given an array `nums` (consisting of... | You need a data structure that maintains the states of the seats. This data structure should also allow you to get the first available seat and flip the state of a seat in a reasonable time. You can let the data structure contain the available seats. Then you want to be able to get the lowest element and erase an eleme... | Design,Heap (Priority Queue) | Medium | 379 |
207 | hey folks welcome back to another video today we are looking at question 207 course schedule so we will be approaching this problem is by keeping a track of um all of the courses um that you as a given course as a prereq so when I say pre-dock I mean prereq so when I say pre-dock I mean prereq so when I say pre-dock I ... | Course Schedule | course-schedule | 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 if a cycle exists 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. Topologica... | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 210,261,310,630 |
189 | Jhal Ka Hello Gas And Problem With This Video Rotator Revenue Minister Ji Problem Andar Light Ko Turn Directions Given Radhe Ke Step Vestige No Negative And Had Tak Hum Virajman Elections But In This Video You Can Leave That Possible Solution And Told At Least Three Different Best and Best Institute in Place with Forei... | 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 |
347 | um hello so today we are going to take a look at this lead code uh problem tab k frequent elements this is part of lead code april challenge um i think it's uh april eight or nine um and the arrays uh the problem says that we get an array of numbers and then integer k and we wanna return the k most frequent elements so... | 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 |
332 | Hello everyone welcome to my channel Court Story Ki Me. So today we are going to do video number 35 before our graph and you will know that I also have a separate playlist of graph concepts and questions where I have explained the graph carefully. A lot of good feedback has been received in it You Can Try Date Playlist... | 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 |
252 | hi everyone today's question is meeting rooms this question is a part of series of questions related to intervals which is currently being asked by a lot of companies including amazon facebook google so the question says given an array of meeting time intervals where intervals of i represents a start time and an end ti... | Meeting Rooms | meeting-rooms | Given an array of meeting time `intervals` where `intervals[i] = [starti, endi]`, determine if a person could attend all meetings.
**Example 1:**
**Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\]
**Output:** false
**Example 2:**
**Input:** intervals = \[\[7,10\],\[2,4\]\]
**Output:** true
**Constraints:**
* ... | null | Array,Sorting | Easy | 56,253 |
1,689 | That welcome to my channel thank you AB to strangers partitioning * Minimum number of strangers partitioning * Minimum number of strangers partitioning * Minimum number of Baikunth number one and number two that do decimal pregnancy as it happens na set it according to the time do the coordinator role of 11:00 Android ... | Partitioning Into Minimum Number Of Deci-Binary Numbers | detect-pattern-of-length-m-repeated-k-or-more-times | A decimal number is called **deci-binary** if each of its digits is either `0` or `1` without any leading zeros. For example, `101` and `1100` are **deci-binary**, while `112` and `3001` are not.
Given a string `n` that represents a positive decimal integer, return _the **minimum** number of positive **deci-binary** n... | Use a three-layer loop to check all possible patterns by iterating through all possible starting positions, all indexes less than m, and if the character at the index is repeated k times. | Array,Enumeration | Easy | 1764 |
377 | Hello Hi Let's Take A Look At Least Code To Bank Problem 377 Combination Sampoorna Today Is The Problem To 10 Followers Were Provided With Inputs Are Of Individuals And Target Expert Ne Teacher And A To Find Out In How Many Possible Combinations Were The Elements Of The Amazing the target and want to know what to wear ... | Combination Sum IV | combination-sum-iv | Given an array of **distinct** integers `nums` and a target integer `target`, return _the number of possible combinations that add up to_ `target`.
The test cases are generated so that the answer can fit in a **32-bit** integer.
**Example 1:**
**Input:** nums = \[1,2,3\], target = 4
**Output:** 7
**Explanation:**
Th... | null | Array,Dynamic Programming | Medium | 39 |
28 | hi today we're going to be going over the Java solution for lead code 28 find the index of the first occurrence in a string given two strings needle and Haystack return the index of the first occurrence of needle in Haystack or negative one if needle is not part of haystack um so going through the examples right here w... | Find the Index of the First Occurrence in a String | implement-strstr | Given two strings `needle` and `haystack`, return the index of the first occurrence of `needle` in `haystack`, or `-1` if `needle` is not part of `haystack`.
**Example 1:**
**Input:** haystack = "sadbutsad ", needle = "sad "
**Output:** 0
**Explanation:** "sad " occurs at index 0 and 6.
The first occurrence is at ... | null | Two Pointers,String,String Matching | Easy | 214,459 |
133 | Everyone welcome to my channel with Mike so today you are ok and I will repeat again if you have not seen my playlist of graph concepts then definitely watch it friend if you want to understand graph from very basic and make it easy ok liquid number 133 Medium level question mark is there but no one friend, this is not... | Clone Graph | clone-graph | Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph.
Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph.
Each node in the graph contains a value (`int`) and a list (`List[Node]`)... | null | Hash Table,Depth-First Search,Breadth-First Search,Graph | Medium | 138,1624,1634 |
352 | hey everybody this is Larry this is day 28 of delete code daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's Farm which apparently I've done uh 352 data stream as disjoint intervals okay let's take a look oh guys so get my diatom non-negative oh guys... | Data Stream as Disjoint Intervals | data-stream-as-disjoint-intervals | Given a data stream input of non-negative integers `a1, a2, ..., an`, summarize the numbers seen so far as a list of disjoint intervals.
Implement the `SummaryRanges` class:
* `SummaryRanges()` Initializes the object with an empty stream.
* `void addNum(int value)` Adds the integer `value` to the stream.
* `int... | null | Binary Search,Design,Ordered Set | Hard | 228,436,715 |
454 | hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you have not liked the video please like it subscribe to my channel and hit the bell icon so that you get notified whenever i post a new video so without any further ado let's get started so... | 4Sum II | 4sum-ii | Given four integer arrays `nums1`, `nums2`, `nums3`, and `nums4` all of length `n`, return the number of tuples `(i, j, k, l)` such that:
* `0 <= i, j, k, l < n`
* `nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0`
**Example 1:**
**Input:** nums1 = \[1,2\], nums2 = \[-2,-1\], nums3 = \[-1,2\], nums4 = \[0,2\]
**Ou... | null | Array,Hash Table | Medium | 18 |
35 | hello everyone welcome back here is Vanessa and I hope you all having a fantastic day today we are diving into a fun yet challenging task uh search insert position so first let me explain the problem we are given a sorted array of distinct integer and the target value and our goal is to return the index if the target i... | Search Insert Position | search-insert-position | Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[1,3,5,6\], target = 5
**Output:** 2
**Exa... | null | Array,Binary Search | Easy | 278 |
1,078 | foreign welcome back to my channel and today we guys are going to solve a new lead code question that is occurrences after big Ram so guys let's start this question the question says given to string first and second consider occurrences in some text of the form first second third we are second uh comes immediately afte... | Occurrences After Bigram | remove-outermost-parentheses | Given two strings `first` and `second`, consider occurrences in some text of the form `"first second third "`, where `second` comes immediately after `first`, and `third` comes immediately after `second`.
Return _an array of all the words_ `third` _for each occurrence of_ `"first second third "`.
**Example 1:**
**In... | Can you find the primitive decomposition? The number of ( and ) characters must be equal. | String,Stack | Easy | null |
342 | hey everybody this is larry this is day four of the august decode daily challenge uh let's get started power four hit the like button hit the subscribe button and join me on discord i'll give it an integer write a function to check whether it's a power four okay so yeah so you could do it with a look pretty trivially u... | Power of Four | power-of-four | Given an integer `n`, return _`true` if it is a power of four. Otherwise, return `false`_.
An integer `n` is a power of four, if there exists an integer `x` such that `n == 4x`.
**Example 1:**
**Input:** n = 16
**Output:** true
**Example 2:**
**Input:** n = 5
**Output:** false
**Example 3:**
**Input:** n = 1
**O... | null | Math,Bit Manipulation,Recursion | Easy | 231,326 |
902 | It happened hello general election kapoor that we notice customized solution to delhi court problem numbers at most and given tickets at its students delegation generate code department functioning switch they certificate se example three 500 and win generator they can write number for three 500 subscribe Number System... | Numbers At Most N Given Digit Set | minimum-number-of-refueling-stops | Given an array of `digits` which is sorted in **non-decreasing** order. You can write numbers using each `digits[i]` as many times as we want. For example, if `digits = ['1','3','5']`, we may write numbers such as `'13'`, `'551'`, and `'1351315'`.
Return _the number of positive integers that can be generated_ that are... | null | Array,Dynamic Programming,Greedy,Heap (Priority Queue) | Hard | null |
460 | hello everyone is called daily challenge problem number 460 LSU casually so it's a really interesting problem in which we have to figure out a way to implement the lfu strategy in caching so in lfu strategy what we do is uh basically we replace the least frequently used element with the new element if the new element i... | LFU Cache | lfu-cache | Design and implement a data structure for a [Least Frequently Used (LFU)](https://en.wikipedia.org/wiki/Least_frequently_used) cache.
Implement the `LFUCache` class:
* `LFUCache(int capacity)` Initializes the object with the `capacity` of the data structure.
* `int get(int key)` Gets the value of the `key` if the... | null | Hash Table,Linked List,Design,Doubly-Linked List | Hard | 146,588 |
494 | all right let's just start talking some questions so you're given integer array nouns and into your target they'll return a number of different expressions that you can build so i'm going to just dive into a dp uh way and then this is a future list i generate so give this guy credit so i'm going to tell you how you act... | Target Sum | target-sum | You are given an integer array `nums` and an integer `target`.
You want to build an **expression** out of nums by adding one of the symbols `'+'` and `'-'` before each integer in nums and then concatenate all the integers.
* For example, if `nums = [2, 1]`, you can add a `'+'` before `2` and a `'-'` before `1` and ... | null | Array,Dynamic Programming,Backtracking | Medium | 282 |
378 | of legal question 378 k smallest element in a sorted matrix giving an n plus n matrix where each of the rows and columns is sorted in ascending order look at this matrix here it's 159 10 13 everything is sorted already so it's something look like this and it's matrix and m plus n here is 3 plus 3 here and return the sm... | Kth Smallest Element in a Sorted Matrix | kth-smallest-element-in-a-sorted-matrix | Given an `n x n` `matrix` where each of the rows and columns is sorted in ascending order, return _the_ `kth` _smallest element in the matrix_.
Note that it is the `kth` smallest element **in the sorted order**, not the `kth` **distinct** element.
You must find a solution with a memory complexity better than `O(n2)`.... | null | Array,Binary Search,Sorting,Heap (Priority Queue),Matrix | Medium | 373,668,719,802 |
1,348 | okay this is a lot of things we are so we are designing tweet counts per frequency to explain you let me first go to the like you know the definition here so you have to build a class tweet comments it has two apis one is tweet name and another is time could be i think it's minute hour and day minute hour or day so tha... | Tweet Counts Per Frequency | tweet-counts-per-frequency | A social media company is trying to monitor activity on their site by analyzing the number of tweets that occur in select periods of time. These periods can be partitioned into smaller **time chunks** based on a certain frequency (every **minute**, **hour**, or **day**).
For example, the period `[10, 10000]` (in **sec... | null | null | Medium | null |
301 | Hello hello everyone welcome back to my channel today I am going to discuss salad problem in remove invalid pain in this so in this problem will be given string talent and latest remove the minimum number of invalid balance this is to make the lion son invalid to Win To Remove Minimum Number Of Vacancies In Which Vitam... | Remove Invalid Parentheses | remove-invalid-parentheses | Given a string `s` that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.
Return _a list of **unique strings** that are valid with the minimum number of removals_. You may return the answer in **any order**.
**Example 1:**
**Input:** s = "()())() "
**... | Since we don't know which of the brackets can possibly be removed, we try out all the options! We can use recursion to try out all possibilities for the given expression. For each of the brackets, we have 2 options:
We keep the bracket and add it to the expression that we are building on the fly during recursion.... | String,Backtracking,Breadth-First Search | Hard | 20,2095 |
1,061 | apologies to all the subscribers of coding decoded I couldn't upload the solutions for daily lead Cod problems from past two days there's a very important office work that is going on my team have been working on it from approximately 1 and a half years now and we have the delivery in the month of January so it's a rea... | 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 |
400 | hey what's up guys john here again so today i want to talk about another leaf called problem here number 400 the end digit yeah I'm not sure why so many people hate this problem I think it's kind of okay yeah I'm gonna I'm not give it either up for download it's a it's an interesting problem here so let's take a look s... | Nth Digit | nth-digit | Given an integer `n`, return the `nth` digit of the infinite integer sequence `[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...]`.
**Example 1:**
**Input:** n = 3
**Output:** 3
**Example 2:**
**Input:** n = 11
**Output:** 0
**Explanation:** The 11th digit of the sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... is a 0, which ... | null | Math,Binary Search | Medium | null |
1,734 | hello everyone so in this video let us talk about a medium level problem from lead code the problem name is decode Zod permutation so the problem statement goes like this that there is an integer array firm that is a permutation of the first and positive integers where n is always odd keep this in mind whenever you see... | Decode XORed Permutation | bank-account-summary-ii | There is an integer array `perm` that is a permutation of the first `n` positive integers, where `n` is always **odd**.
It was encoded into another integer array `encoded` of length `n - 1`, such that `encoded[i] = perm[i] XOR perm[i + 1]`. For example, if `perm = [1,3,2]`, then `encoded = [2,1]`.
Given the `encoded`... | null | Database | Easy | null |
27 | Okay gas welcome and welcome back to my channel so in today's video we will see the second problem of the top interview 150 so the second problem is what is our remove element so what do we do let's see the problem description what is the problem in the statement okay so Look here, the problem statement I have given to... | 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 |
990 | hey everybody this is Larry this is Day 26 of the September Lego day challenge hit the like button hit the Subscribe button drop me a Discord oh nice let me know what you think about days far man in the contest page today there's an unbox surprise yay 10 lead coins happy lead coding yay it's been a while because like A... | Satisfiability of Equality Equations | verifying-an-alien-dictionary | You are given an array of strings `equations` that represent relationships between variables where each string `equations[i]` is of length `4` and takes one of two different forms: `"xi==yi "` or `"xi!=yi "`.Here, `xi` and `yi` are lowercase letters (not necessarily different) that represent one-letter variable names.
... | null | Array,Hash Table,String | Easy | null |
133 | hi everyone welcome back to the channel uh produce already scored daily challenge problem number 133 clone graft so it's a really simple problem in which you know you have to basically copy a given graph in the exact same way and you cannot return the same uh graph as is so what you have to do is you have to create eac... | Clone Graph | clone-graph | Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph.
Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph.
Each node in the graph contains a value (`int`) and a list (`List[Node]`)... | null | Hash Table,Depth-First Search,Breadth-First Search,Graph | Medium | 138,1624,1634 |
343 | hey so welcome back and there's another daily code problem so today is called integer break so this is a medium level dining program problem and so essentially you're just given some number here and we're trying to find what the maximum product is and so what that really means is say if we're getting this number 10 we ... | Integer Break | integer-break | Given an integer `n`, break it into the sum of `k` **positive integers**, where `k >= 2`, and maximize the product of those integers.
Return _the maximum product you can get_.
**Example 1:**
**Input:** n = 2
**Output:** 1
**Explanation:** 2 = 1 + 1, 1 \* 1 = 1.
**Example 2:**
**Input:** n = 10
**Output:** 36
**Exp... | There is a simple O(n) solution to this problem. You may check the breaking results of n ranging from 7 to 10 to discover the regularities. | Math,Dynamic Programming | Medium | 1936 |
1,964 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem find the longest valid obstacle course at each position I don't know what kind of cruel person at least code would give us this problem on just day six of the month but oh well let's get into it anyway I'm a little bit ... | Find the Longest Valid Obstacle Course at Each Position | find-interview-candidates | You want to build some obstacle courses. You are given a **0-indexed** integer array `obstacles` of length `n`, where `obstacles[i]` describes the height of the `ith` obstacle.
For every index `i` between `0` and `n - 1` (**inclusive**), find the length of the **longest obstacle course** in `obstacles` such that:
* ... | null | Database | Medium | null |
349 | foreign foreign hi everyone welcome to my channel this is quantum unicorn the lead code problem we are solving in this video is uh intersection of two arrays the intuition behind this very simple solution is to leverage the properties of sets to find the intersection of two arrays efficiently by converting the input ar... | Intersection of Two Arrays | intersection-of-two-arrays | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must be **unique** and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2\]
**Example 2:**
**Input:** nums1 = \[4,9,5\], nums2 = \... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 350,1149,1392,2190,2282 |
201 | today's problem is to find the bitwise and of a range of numbers here you are given a range uh for example range is 10 to 15 then you have to find a result which will be the bitwise end of 10 11 12 13 14 and 15 we are not allowed to skip any number and one simple approach you can take is that create a result variable w... | Bitwise AND of Numbers Range | bitwise-and-of-numbers-range | Given two integers `left` and `right` that represent the range `[left, right]`, return _the bitwise AND of all numbers in this range, inclusive_.
**Example 1:**
**Input:** left = 5, right = 7
**Output:** 4
**Example 2:**
**Input:** left = 0, right = 0
**Output:** 0
**Example 3:**
**Input:** left = 1, right = 2147... | null | Bit Manipulation | Medium | null |
264 | hello everyone today let's solve ugly number two given to you and return the ugly number um it says every number is a positive number whose prime factors only 2 3 and or 5. here is some example if the giving number is um is equal to 10 will return 12. so how do we get this 12 uh it says 1 is typically treated as an ugl... | Ugly Number II | ugly-number-ii | An **ugly number** is a positive integer whose prime factors are limited to `2`, `3`, and `5`.
Given an integer `n`, return _the_ `nth` _**ugly number**_.
**Example 1:**
**Input:** n = 10
**Output:** 12
**Explanation:** \[1, 2, 3, 4, 5, 6, 8, 9, 10, 12\] is the sequence of the first 10 ugly numbers.
**Example 2:**
... | The naive approach is to call isUgly for every number until you reach the nth one. Most numbers are not ugly. Try to focus your effort on generating only the ugly ones. An ugly number must be multiplied by either 2, 3, or 5 from a smaller ugly number. The key is how to maintain the order of the ugly numbers. Try a simi... | Hash Table,Math,Dynamic Programming,Heap (Priority Queue) | Medium | 23,204,263,279,313,1307 |
1,004 | hi guys this is akash show here from bruti and today we'll be looking at a lead code based problem it's called as max consecutive ones three so this is a sliding window based problem actually so if you haven't already watched my friend ignition video about sliding window and this problem in particular please do go chec... | Max Consecutive Ones III | least-operators-to-express-number | Given a binary array `nums` and an integer `k`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most_ `k` `0`'s.
**Example 1:**
**Input:** nums = \[1,1,1,0,0,0,1,1,1,1,0\], k = 2
**Output:** 6
**Explanation:** \[1,1,1,0,0,**1**,1,1,1,1,**1**\]
Bolded numbers were flipped from 0 to 1.... | null | Math,Dynamic Programming | Hard | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.