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 |
|---|---|---|---|---|---|---|---|---|
7 | hey yo what's up my little coders let me show you today how to solve the lethal question number seven reverse integer and as you already could guess we just basically need to return the reversed integer if we get let's say 123 we need to return 321 similar pattern applies for the negative numbers and if we have some tr... | Reverse Integer | reverse-integer | Given a signed 32-bit integer `x`, return `x` _with its digits reversed_. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-231, 231 - 1]`, then return `0`.
**Assume the environment does not allow you to store 64-bit integers (signed or unsigned).**
**Example 1:**
**Input:** x = 123
... | null | Math | Medium | 8,190,2238 |
1,704 | Hello everyone welcome, are you my channel or not? Now let's see how likes are defining this. Google Facebook Microsoft Amazon has asked these questions. Generally such questions are asked in screening, phone interviews have been done, such questions have been asked in such situations. The questions are asked are a bit... | Determine if String Halves Are Alike | special-positions-in-a-binary-matrix | You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half.
Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppe... | Keep track of 1s in each row and in each column. Then while iterating over matrix, if the current position is 1 and current row as well as current column contains exactly one occurrence of 1. | Array,Matrix | Easy | null |
337 | hello everyone welcome to this video so in this video we will see the question that is 337 house robert three so this is the continuation for the two videos that i made before this that were for house robber one and two so before watching this video i will recommend you to solve those question first that is house rubbe... | House Robber III | house-robber-iii | The thief has found himself a new place for his thievery again. There is only one entrance to this area, called `root`.
Besides the `root`, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will automatically contact the police if ... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Medium | 198,213 |
1,060 | all right so two discussing as 1016 missing element in solid array we are given a sorted array of unique numbers so these uniqueness of numbers is telling us there is no tie we wouldn't have some kind of you put like a four seven nine ten that's not the case that's the we don't need to worry about those kind of cases s... | Missing Element in Sorted Array | longest-repeating-substring | Given an integer array `nums` which is sorted in **ascending order** and all of its elements are **unique** and given also an integer `k`, return the `kth` missing number starting from the leftmost number of the array.
**Example 1:**
**Input:** nums = \[4,7,9,10\], k = 1
**Output:** 5
**Explanation:** The first missi... | Generate all substrings in O(N^2) time with hashing. Choose those hashing of strings with the largest length. | String,Binary Search,Dynamic Programming,Rolling Hash,Suffix Array,Hash Function | Medium | null |
1,926 | hello everyone welcome back here is benampson and today we diving into intriguing lead code uh challenge uh it's problem number one nine two six uh nearest exits from entrance enemies so this problem is a classic example of how to use breakfast search BFS to find the shortest path in a two-dimensional the shortest path... | Nearest Exit from Entrance in Maze | products-price-for-each-store | You are given an `m x n` matrix `maze` (**0-indexed**) with empty cells (represented as `'.'`) and walls (represented as `'+'`). You are also given the `entrance` of the maze, where `entrance = [entrancerow, entrancecol]` denotes the row and column of the cell you are initially standing at.
In one step, you can move o... | null | Database | Easy | 1948 |
200 | hey guys it's off by one here and today we're going to be solving number of islands in this problem we're given a 2d grid which is represented in ones and zeros where one is land and zero is water and the one is returned the number of islands so what is an Island an island is defined as being surrounded by water and fo... | Number of Islands | number-of-islands | Given an `m x n` 2D binary grid `grid` which represents a map of `'1'`s (land) and `'0'`s (water), return _the number of islands_.
An **island** is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
**Exampl... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | 130,286,305,323,694,695,2035,2103 |
496 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem next greater element one and i'm actually going to be doing both solutions for this problem so over here you can see that there is a follow-up for this so there's going to follow-up for this so there's going to follow-u... | Next Greater Element I | next-greater-element-i | The **next greater element** of some element `x` in an array is the **first greater** element that is **to the right** of `x` in the same array.
You are given two **distinct 0-indexed** integer arrays `nums1` and `nums2`, where `nums1` is a subset of `nums2`.
For each `0 <= i < nums1.length`, find the index `j` such ... | null | Array,Hash Table,Stack,Monotonic Stack | Easy | 503,556,739,2227 |
349 | hi everyone this is MK and here is another Lico da challenge um today we have a quote from the shaing Redemption I love this line where Andy says hope is a good thing maybe the best of things and no good thing ever dies okay today's problem is an easy problem uh I will solve it with two different approaches first a Bru... | 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 |
990 | hello everyone today I will solve the question satisfability of equality equation in this question they will give us a vector of strings and inside that factor of questioning there will be the equations that equation will be only of the double equal to or not equal so what we need to do we need to check if it is possib... | 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 |
1,652 | hey everybody this is larry this is me going over q1 of the bi-weekly me going over q1 of the bi-weekly me going over q1 of the bi-weekly contest 39 defuse the bomb uh i hope this doesn't get me a wizard from the fbi but this is actually just hopefully you're watching it just to see me explain this problem because i th... | Defuse the Bomb | minimum-suffix-flips | You have a bomb to defuse, and your time is running out! Your informer will provide you with a **circular** array `code` of length of `n` and a key `k`.
To decrypt the code, you must replace every number. All the numbers are replaced **simultaneously**.
* If `k > 0`, replace the `ith` number with the sum of the **n... | Consider a strategy where the choice of bulb with number i is increasing. In such a strategy, you no longer need to worry about bulbs that have been set to the left. | String,Greedy | Medium | null |
899 | in this video we will solve orderly Q so let's see the problem statement it says that you are given as string s and an integer k and we can choose one of the first K letters so if you see this example b a c a k is 3 that means among the these three letters the first K letters you can pick one of these and move it to th... | Orderly Queue | binary-gap | You are given a string `s` and an integer `k`. You can choose one of the first `k` letters of `s` and append it at the end of the string..
Return _the lexicographically smallest string you could have after applying the mentioned step any number of moves_.
**Example 1:**
**Input:** s = "cba ", k = 1
**Output:** "ac... | null | Math,Bit Manipulation | Easy | null |
392 | Hello gaze myself Amrita welcome back to our channel techno sage so this is our recurring court series in which I will be solving lead code problems if you also wish you join you can subscribe our channel and will solve lead code problems now let's move ahead with today's problem. Today C Will Be Solving Problem No. 39... | Is Subsequence | is-subsequence | Given two strings `s` and `t`, return `true` _if_ `s` _is a **subsequence** of_ `t`_, or_ `false` _otherwise_.
A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i... | null | Two Pointers,String,Dynamic Programming | Easy | 808,1051 |
1,431 | uh we're going to go over 1431 kids with greatest number of candies so the question says given the array of candies and the integer extra candies where candies at index i represent the number of candies that the eighth kid has okay for each kid check if there is a way to distribute extra candies so we're going to distr... | Kids With the Greatest Number of Candies | all-ancestors-of-a-node-in-a-directed-acyclic-graph | There are `n` kids with candies. You are given an integer array `candies`, where each `candies[i]` represents the number of candies the `ith` kid has, and an integer `extraCandies`, denoting the number of extra candies that you have.
Return _a boolean array_ `result` _of length_ `n`_, where_ `result[i]` _is_ `true` _i... | Consider how reversing each edge of the graph can help us. How can performing BFS/DFS on the reversed graph help us find the ancestors of every node? | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 1912 |
670 | hey guys so welcome back in this video we'll be trying to solve the six seventieth lead code problem that is maximum swap okay so given a non-negative swap okay so given a non-negative swap okay so given a non-negative integer you could swap two digits at most once to get the maximum value number return the maximum val... | Maximum Swap | maximum-swap | You are given an integer `num`. You can swap two digits at most once to get the maximum valued number.
Return _the maximum valued number you can get_.
**Example 1:**
**Input:** num = 2736
**Output:** 7236
**Explanation:** Swap the number 2 and the number 7.
**Example 2:**
**Input:** num = 9973
**Output:** 9973
**E... | null | Math,Greedy | Medium | 321 |
70 | how's it going everybody in this video we are going to go over the leak code problem climbing stairs so this is a really useful problem to go over if you have never done dynamic programming before this is like the most basic level of dynamic programming before we get started I want to let you know about my technical in... | Climbing Stairs | climbing-stairs | You are climbing a staircase. It takes `n` steps to reach the top.
Each time you can either climb `1` or `2` steps. In how many distinct ways can you climb to the top?
**Example 1:**
**Input:** n = 2
**Output:** 2
**Explanation:** There are two ways to climb to the top.
1. 1 step + 1 step
2. 2 steps
**Example 2:**
... | To reach nth step, what could have been your previous steps? (Think about the step sizes) | Math,Dynamic Programming,Memoization | Easy | 747,1013,1236 |
90 | okay welcome back to algo js today's question is leak code 90 subsets 2 given an initial array nums that may contain duplicates return all possible subsets the power set the solution set must not contain duplicate subsets return the solution in any order so in example one we have nums array which is equal to one to two... | Subsets II | subsets-ii | Given an integer array `nums` that may contain duplicates, 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,2\]
**Output:** \[\[\],\[1\],\[1,2\],\[1,2,2\],\[2\],\[2,2\]\]
**Example... | null | Array,Backtracking,Bit Manipulation | Medium | 78,2109 |
382 | hello hi guys good morning in this video we're gonna see linked list random node before starting just a random request to you guys if you like the video then please hit the like button it do helps me a lot if you like the video if not then it's okay you can also press the dislike button whatever you want but if you lik... | 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 |
1,765 | hey everybody this is larry this is me going with q3 of the bi-weekly me going with q3 of the bi-weekly me going with q3 of the bi-weekly contest 46 map of the highest peak so hit the like button hit the subscribe button join me on discord let me know what you think about this prom so this prom is a little bit awkward ... | Map of Highest Peak | merge-in-between-linked-lists | You are given an integer matrix `isWater` of size `m x n` that represents a map of **land** and **water** cells.
* If `isWater[i][j] == 0`, cell `(i, j)` is a **land** cell.
* If `isWater[i][j] == 1`, cell `(i, j)` is a **water** cell.
You must assign each cell a height in a way that follows these rules:
* The... | Check which edges need to be changed. Let the next node of the (a-1)th node of list1 be the 0-th node in list 2. Let the next node of the last node of list2 be the (b+1)-th node in list 1. | Linked List | Medium | null |
704 | Hello Everyone Welcome Back To My Channel Short Today Khayal Ko Increase Ko Shraddha Problem And Here Problem Is Binary Search Tree Will Be Discussing Va - Binary Search Tree Will Be Discussing Va - Binary Search Tree Will Be Discussing Va - Versus Yes This Sach Works And Sports Rosemary Fundamental Topic Write In Data... | Binary Search | binary-search | Given an array of integers `nums` which is sorted in ascending order, and an integer `target`, write a function to search `target` in `nums`. If `target` exists, then return its index. Otherwise, return `-1`.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[-1,0,3,5,... | null | null | Easy | null |
5 | hi everyone today we are going to solve the problem longest palindromic substring the problem statement is given a string s written the longest palindromic substring in string s if you don't know what a palindromic substring is let us consider the given string so we need to find the longest palindromic substring so wha... | 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 |
518 | welcome to joey's tech my friends in this video of choice tech you are going to learn to solve a coin change 2 problem from lead code we are going to solve this problem using the dynamic programming technique so why not go directly to the problem statement you are given an array of coins basically these integers repres... | 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 |
303 | welcome back to fast talk channel in this video try to expand 303 range some query mutable even an integer array Norms handle multiple queries of the following type calculate the sum of the elements of nouns between indices left and right and close the fare left is less or equal to right implement the number Ray cost n... | 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 |
1,616 | Hi Halloween welcomeback chicken driver withholder fighting Liverpool Destiny episode wikikopi so Fortuner challenge for speaking to Strings so before we love you so much often twinbet finished uh cardboard lemon Twist Shout your server more Travel the second care@jne. co.id methods love you how are you marry me is one... | Split Two Strings to Make Palindrome | minimum-difference-between-largest-and-smallest-value-in-three-moves | You are given two strings `a` and `b` of the same length. Choose an index and split both strings **at the same index**, splitting `a` into two strings: `aprefix` and `asuffix` where `a = aprefix + asuffix`, and splitting `b` into two strings: `bprefix` and `bsuffix` where `b = bprefix + bsuffix`. Check if `aprefix + bs... | The minimum difference possible is is obtained by removing 3 elements between the 3 smallest and 3 largest values in the array. | Array,Greedy,Sorting | Medium | null |
1,685 | hey everybody so today we're going to talk about the leite code daily problem um from well I guess Friday November 24th to Saturday November 25th and that's the sum of absolute differences in a sorted array now this is a decently straightforward greedy problem use prefix sums to find the answer you need to do a little ... | Sum of Absolute Differences in a Sorted Array | stone-game-v | You are given an integer array `nums` sorted in **non-decreasing** order.
Build and return _an integer array_ `result` _with the same length as_ `nums` _such that_ `result[i]` _is equal to the **summation of absolute differences** between_ `nums[i]` _and all the other elements in the array._
In other words, `result[i... | We need to try all possible divisions for the current row to get the max score. As calculating all possible divisions will lead us to calculate some sub-problems more than once, we need to think of dynamic programming. | Array,Math,Dynamic Programming,Game Theory | Hard | 909,1240,1522,1617,1788,1808,2002,2156 |
1,508 | limbs from the bi-weekly contest from limbs from the bi-weekly contest from limbs from the bi-weekly contest from lead code violently contests 30 we can discuss the first three problems in this video and then the last question is sort of DP and game theory so we will discuss this in a lecture so let's start the first t... | Range Sum of Sorted Subarray Sums | longest-happy-prefix | You are given the array `nums` consisting of `n` positive integers. You computed the sum of all non-empty continuous subarrays from the array and then sorted them in non-decreasing order, creating a new array of `n * (n + 1) / 2` numbers.
_Return the sum of the numbers from index_ `left` _to index_ `right` (**indexed ... | Use Longest Prefix Suffix (KMP-table) or String Hashing. | String,Rolling Hash,String Matching,Hash Function | Hard | 2326 |
300 | hello friends today I will explain the longest increasing subsequence problem there are two classic solutions to this problem let's first see the statement even an unsorted array of integers find the length of longest increasing subsequence so for this given example the longest increasing subsequence should be two thre... | Longest Increasing Subsequence | longest-increasing-subsequence | Given an integer array `nums`, return _the length of the longest **strictly increasing**_ _**subsequence**_.
**Example 1:**
**Input:** nums = \[10,9,2,5,3,7,101,18\]
**Output:** 4
**Explanation:** The longest increasing subsequence is \[2,3,7,101\], therefore the length is 4.
**Example 2:**
**Input:** nums = \[0,1,... | null | Array,Binary Search,Dynamic Programming | Medium | 334,354,646,673,712,1766,2096,2234 |
383 | in this tutorial I am going to discuss a programming question ransom note so the problem statement has given an arbitrary and some note string and another string containing letters from all the magazines we have to write a function that will return true if the ransom note can be constructed from the magazines otherwise... | Ransom Note | ransom-note | Given two strings `ransomNote` and `magazine`, return `true` _if_ `ransomNote` _can be constructed by using the letters from_ `magazine` _and_ `false` _otherwise_.
Each letter in `magazine` can only be used once in `ransomNote`.
**Example 1:**
**Input:** ransomNote = "a", magazine = "b"
**Output:** false
**Example ... | null | Hash Table,String,Counting | Easy | 691 |
53 | question 53 of elite code maximum subarray given an integer array nums find the contiguous subarray containing at least one number which has the largest sum and return its sum a sub array is a contiguous part of an array okay so in the example here we have a nums array which is just an array full of integers and our ou... | Maximum Subarray | maximum-subarray | Given an integer array `nums`, find the subarray with the largest sum, and return _its sum_.
**Example 1:**
**Input:** nums = \[-2,1,-3,4,-1,2,1,-5,4\]
**Output:** 6
**Explanation:** The subarray \[4,-1,2,1\] has the largest sum 6.
**Example 2:**
**Input:** nums = \[1\]
**Output:** 1
**Explanation:** The subarray \... | null | Array,Divide and Conquer,Dynamic Programming | Easy | 121,152,697,1020,1849,1893 |
489 | A decoction from here, people have cleared the robot in the room, model is cigarette, tried to destroy cancer, visit channel, subscribe Kundan Avatar movie robot and you can make robot left and their make turn right and left hand free leg, but on this picture recovery let's move left or right and also given point robot... | Robot Room Cleaner | kth-smallest-instructions | You are controlling a robot that is located somewhere in a room. The room is modeled as an `m x n` binary grid where `0` represents a wall and `1` represents an empty slot.
The robot starts at an unknown location in the room that is guaranteed to be empty, and you do not have access to the grid, but you can move the r... | There are nCr(row + column, row) possible instructions to reach (row, column). Try building the instructions one step at a time. How many instructions start with "H", and how does this compare with k? | Array,Math,Dynamic Programming,Combinatorics | Hard | null |
1,448 | hello everyone welcome back to lead coding today we are solving the problem called good note in a binary tree so we are given a binary tree and we have to return the number of good nodes in that tree so how do we classify your node to be a good node so a node is considered as good if it has the maximum value among all ... | Count Good Nodes in Binary Tree | maximum-69-number | Given a binary tree `root`, a node _X_ in the tree is named **good** if in the path from root to _X_ there are no nodes with a value _greater than_ X.
Return the number of **good** nodes in the binary tree.
**Example 1:**
**Input:** root = \[3,1,4,3,null,1,5\]
**Output:** 4
**Explanation:** Nodes in blue are **good*... | Convert the number in an array of its digits. Brute force on every digit to get the maximum number. | Math,Greedy | Easy | null |
219 | okay let's talk about contains duplicates here so in this question you are supposed to uh supposed to understand the hash map is the easy way and the hashmap should be uh you are sorting the value which is numsai and key for numsai value for index and you traverse every single l in array and if you find the key inside ... | Contains Duplicate II | contains-duplicate-ii | Given an integer array `nums` and an integer `k`, return `true` _if there are two **distinct indices**_ `i` _and_ `j` _in the array such that_ `nums[i] == nums[j]` _and_ `abs(i - j) <= k`.
**Example 1:**
**Input:** nums = \[1,2,3,1\], k = 3
**Output:** true
**Example 2:**
**Input:** nums = \[1,0,1,1\], k = 1
**Outp... | null | Array,Hash Table,Sliding Window | Easy | 217,220 |
36 | hi friends welcome back today we are going to solve one very famous and popular coding interval question asked by amazon google microsoft facebook and many other companies it's on lead code 36 valid sudoku so as you can see from the like dislike ratio this is quite popular coding problem uh in the interviews as well so... | 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,402 | hey everyone welcome to Tech quiet in this video we are going to solve problem number 1402 reducing dishes first we will see the explanation of the problem statement then the logic and the code now let's dive into the solution so here I've taken the first example from the Lego website so in this problem we are given an... | Reducing Dishes | count-square-submatrices-with-all-ones | A chef has collected data on the `satisfaction` level of his `n` dishes. Chef can cook any dish in 1 unit of time.
**Like-time coefficient** of a dish is defined as the time taken to cook that dish including previous dishes multiplied by its satisfaction level i.e. `time[i] * satisfaction[i]`.
Return _the maximum sum... | Create an additive table that counts the sum of elements of submatrix with the superior corner at (0,0). Loop over all subsquares in O(n^3) and check if the sum make the whole array to be ones, if it checks then add 1 to the answer. | Array,Dynamic Programming,Matrix | Medium | 2192,2193 |
140 | okay so I'm gonna talk about 140 would break - which is a follow up a to 139 break - which is a follow up a to 139 break - which is a follow up a to 139 would break I did a video about a 100 students I a few weeks ago check out the link over there so let's quickly summarizes of what this two questions are asking we hav... | Word Break II | word-break-ii | Given a string `s` and a dictionary of strings `wordDict`, add spaces in `s` to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in **any order**.
**Note** that the same word in the dictionary may be reused multiple times in the segmentation.
**Example 1:**
**Input:... | null | Hash Table,String,Dynamic Programming,Backtracking,Trie,Memoization | Hard | 139,472 |
932 | The whole world is welcome to our channel co division in this video you will be talking about and medium type problem play list cold beautiful are its indexes 932 and width medium problem dalit code ok so one thing but it's quite noticing what is like you can see The number of dislikes is six number 56 minutes problem ... | Beautiful Array | monotonic-array | An array `nums` of length `n` is **beautiful** if:
* `nums` is a permutation of the integers in the range `[1, n]`.
* For every `0 <= i < j < n`, there is no index `k` with `i < k < j` where `2 * nums[k] == nums[i] + nums[j]`.
Given the integer `n`, return _any **beautiful** array_ `nums` _of length_ `n`. There w... | null | Array | Easy | 2316 |
191 | hello hi everyone welcome back to the channel so I hope you're doing extremely well so today we'll be solving this problem number of one bits so basically we given an unsigned integer and we have to return the number of one bits that this integer has that's the problem statement of this problem so how we going to solve... | Number of 1 Bits | number-of-1-bits | Write a function that takes the binary representation of an unsigned integer and returns the number of '1' bits it has (also known as the [Hamming weight](http://en.wikipedia.org/wiki/Hamming_weight)).
**Note:**
* Note that in some languages, such as Java, there is no unsigned integer type. In this case, the input ... | null | Bit Manipulation | Easy | 190,231,338,401,461,693,767 |
450 | welcome to august eco challenge today's problem is delete node in a binary search tree given a root node reference of a binary search tree and a key delete the node with the given key in the bst so basically we want to search for the node for the given key and then delete it we want to do this in o of height of the tre... | Delete Node in a BST | delete-node-in-a-bst | Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return _the **root node reference** (possibly updated) of the BST_.
Basically, the deletion can be divided into two stages:
1. Search for a node to remove.
2. If the node is found, delete the node.
**Example 1:**
**Inpu... | null | Tree,Binary Search Tree,Binary Tree | Medium | 791 |
226 | foreign number 226 invert binary tray so you are given the root of a binary tree in with day 3 and they return its root so here you can say will be given one binary tray you need to create the image of that binary tray that means invert of that binary tray and you need to return the root of that tree so there are two a... | Invert Binary Tree | invert-binary-tree | Given the `root` of a binary tree, invert the tree, and return _its root_.
**Example 1:**
**Input:** root = \[4,2,7,1,3,6,9\]
**Output:** \[4,7,2,9,6,3,1\]
**Example 2:**
**Input:** root = \[2,1,3\]
**Output:** \[2,3,1\]
**Example 3:**
**Input:** root = \[\]
**Output:** \[\]
**Constraints:**
* The number of n... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
875 | hello guys welcome to another video in the series of coding today we are going to solve the problem which is called coco eating bananas so there's a guy coco who loves to eat bananas and there are piles of bananas that are given now he has to eat them within etch hours otherwise the guards will come back so coco can de... | Koko Eating Bananas | longest-mountain-in-array | Koko loves to eat bananas. There are `n` piles of bananas, the `ith` pile has `piles[i]` bananas. The guards have gone and will come back in `h` hours.
Koko can decide her bananas-per-hour eating speed of `k`. Each hour, she chooses some pile of bananas and eats `k` bananas from that pile. If the pile has less than `k... | null | Array,Two Pointers,Dynamic Programming,Enumeration | Medium | 1766,2205 |
374 | hey folks welcome back to another video today we're looking at question 374 guest number higher or lower the way we'll be approaching this problem is by using binary search the way binary search works is that you have a lower bound and an upper bound and you choose a number in between these two bounds to figure out how... | Guess Number Higher or Lower | guess-number-higher-or-lower | We are playing the Guess Game. The game is as follows:
I pick a number from `1` to `n`. You have to guess which number I picked.
Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess.
You call a pre-defined API `int guess(int num)`, which returns three possible re... | null | Binary Search,Interactive | Easy | 278,375,658 |
1,060 | hello guys this is um thomas right here and today i thought i'd go through another um excuse me um i thought i'd go through another binary search this question actually facebook um likes a lot because in the solution section somebody from facebook i think had it for on-site as a question right for on-site as a question... | Missing Element in Sorted Array | longest-repeating-substring | Given an integer array `nums` which is sorted in **ascending order** and all of its elements are **unique** and given also an integer `k`, return the `kth` missing number starting from the leftmost number of the array.
**Example 1:**
**Input:** nums = \[4,7,9,10\], k = 1
**Output:** 5
**Explanation:** The first missi... | Generate all substrings in O(N^2) time with hashing. Choose those hashing of strings with the largest length. | String,Binary Search,Dynamic Programming,Rolling Hash,Suffix Array,Hash Function | Medium | null |
207 | hey everyone in this video let's take a look at question 207 course schedule only code this is part of our blind 75 list of questions so let's begin in this question there are total of numb courses that you can take labeled from zero to num courses minus one so given an array prerequisite where prerequisites of I equal... | 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 |
1,743 | hello and welcome to another video in this problem we're going to be working on restore the array from adjacent Pairs and in this problem you have an integer array nums that consists of n unique elements but you have forgotten it however you do remember every pair of adjacent elements so you're given a 2d integer array... | Restore the Array From Adjacent Pairs | count-substrings-that-differ-by-one-character | There is an integer array `nums` that consists of `n` **unique** elements, but you have forgotten it. However, you do remember every pair of adjacent elements in `nums`.
You are given a 2D integer array `adjacentPairs` of size `n - 1` where each `adjacentPairs[i] = [ui, vi]` indicates that the elements `ui` and `vi` a... | Take every substring of s, change a character, and see how many substrings of t match that substring. Use a Trie to store all substrings of t as a dictionary. | Hash Table,String,Dynamic Programming | Medium | 2256 |
508 | so hello everyone so today we are having another problem the problem is like this suppose you we have given a tree or difficulty and this is another decision other tree so the problem that we have given it so this is the tree that we have given and we need to find so the thing that we need is most frequent substrate an... | Most Frequent Subtree Sum | most-frequent-subtree-sum | Given the `root` of a binary tree, return the most frequent **subtree sum**. If there is a tie, return all the values with the highest frequency in any order.
The **subtree sum** of a node is defined as the sum of all the node values formed by the subtree rooted at that node (including the node itself).
**Example 1:*... | null | Hash Table,Tree,Depth-First Search,Binary Tree | Medium | 572,2126 |
1,202 | so for this problem we're given an input string and an array of pairs where each pair is an index in the string and the requirement that we need is to return the smallest string possible that can be changed to after using the swaps and the way we swap is using the pairs that were given in the area of pairs so for an ex... | Smallest String With Swaps | palindrome-removal | You are given a string `s`, and an array of pairs of indices in the string `pairs` where `pairs[i] = [a, b]` indicates 2 indices(0-indexed) of the string.
You can swap the characters at any pair of indices in the given `pairs` **any number of times**.
Return the lexicographically smallest string that `s` can be chang... | Use dynamic programming. Let dp[i][j] be the solution for the sub-array from index i to index j. Notice that if we have S[i] == S[j] one transition could be just dp(i + 1, j + 1) because in the last turn we would have a palindrome and we can extend this palindrome from both sides, the other transitions are not too diff... | Array,Dynamic Programming | Hard | null |
66 | hello and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem 66 plus 1. you are given a large integer represented as an integer array digits where each digits of i is the ith digit of the integer the digits are ordered from the most significant to least significant in le... | Plus One | plus-one | You are given a **large integer** represented as an integer array `digits`, where each `digits[i]` is the `ith` digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading `0`'s.
Increment the large integer by one and re... | null | Array,Math | Easy | 43,67,369,1031 |
239 | That Welcome To My YouTube Channel Today Will See How To Place It Means To Technical Problem That Don't Know What Medical Protection Is Bill Planning For Loan Tours Great Detail My Technical Interview Questions For People And Well-Wishers Been Spreading In To Approach Well-Wishers Been Spreading In To Approach Well-Wis... | 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 |
920 | hello everyone welcome back here is when I'm saying today we are tackling an exciting political problem number 920 number of music played so this problem is rated as hard uh but we will try to solve it so our mission is to determine the number of unique playlists we can create given certain conditions so this condition... | Number of Music Playlists | uncommon-words-from-two-sentences | Your music player contains `n` different songs. You want to listen to `goal` songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that:
* Every song is played **at least once**.
* A song can only be played again only if `k` other songs have been played.
Given `n`, `g... | null | Hash Table,String | Easy | 2190 |
1,869 | okay let's do Lee code 1869 longer contiguous segments of ones and zeros in JavaScript what we're doing here is we're looking through this input string and we're seeing are the ones in a row longer than the zeros that are all in a row so then we want to return true or false from that so uh this one there's more zeros t... | Longer Contiguous Segments of Ones than Zeros | longer-contiguous-segments-of-ones-than-zeros | Given a binary string `s`, return `true` _if the **longest** contiguous segment of_ `1`'_s is **strictly longer** than the **longest** contiguous segment of_ `0`'_s in_ `s`, or return `false` _otherwise_.
* For example, in `s = "110100010 "` the longest continuous segment of `1`s has length `2`, and the longest cont... | null | null | Easy | null |
39 | Previous Welcome to My Channel Short Today Will Start With and Backtracking Foundations Combination Series and the First Problem Hui to This Thirty-nine Combination Samudra to This Thirty-nine Combination Samudra to This Thirty-nine Combination Samudra Appointment Se 10 Gives Enough Heat in Teachers Candidates Need to ... | 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 |
21 | welcome to leak codes blank read 75 where I'll be solving the top 75 lead code questions this questions called merge two sorted lists and we want to merge two sorted linked lists and return it as a new sorted list so basically this is a two-pointer solution we want to start at two-pointer solution we want to start at t... | 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 |
174 | Hello Guys Today We Are Going To See Problem Cold Danger Game From Its Elements Let Me See The Problem First Give The Matrix 800 Likes And Tried To Bottom Corner Subscribe Points Subscribe My Channel I Will Get A Sort Of This To Financial Minimum Health Should Not be able to rescue the British rule it can only move to ... | Dungeon Game | dungeon-game | The demons had captured the princess and imprisoned her in **the bottom-right corner** of a `dungeon`. The `dungeon` consists of `m x n` rooms laid out in a 2D grid. Our valiant knight was initially positioned in **the top-left room** and must fight his way through `dungeon` to rescue the princess.
The knight has an i... | null | Array,Dynamic Programming,Matrix | Hard | 62,64,741,2354 |
856 | Hello Win World Cup 2015 Four Inch And Apologies For Missing After Few Days Setting Perspective Unfortunately He Has Not Well Today I Am Feeling Button The Video then subscribe to subscribe this Video plz subscribe and subscribe to subscribe that and they never be seen at That Time From String Were Stranded 22181 More ... | Score of Parentheses | consecutive-numbers-sum | Given a balanced parentheses string `s`, return _the **score** of the string_.
The **score** of a balanced parentheses string is based on the following rule:
* `"() "` has score `1`.
* `AB` has score `A + B`, where `A` and `B` are balanced parentheses strings.
* `(A)` has score `2 * A`, where `A` is a balanced ... | null | Math,Enumeration | Hard | null |
41 | Examination is required, whether tobacco or code, Smallest positive way, Singh number is a very important question about the question which is talked about in the international media, a new kind of technique is going to be seen in this, some more different processes, we will discuss in this video, without any Delay, le... | First Missing Positive | first-missing-positive | Given an unsorted integer array `nums`, return the smallest missing positive integer.
You must implement an algorithm that runs in `O(n)` time and uses constant extra space.
**Example 1:**
**Input:** nums = \[1,2,0\]
**Output:** 3
**Explanation:** The numbers in the range \[1,2\] are all in the array.
**Example 2:*... | Think about how you would solve the problem in non-constant space. Can you apply that logic to the existing space? We don't care about duplicates or non-positive integers Remember that O(2n) = O(n) | Array,Hash Table | Hard | 268,287,448,770 |
42 | Hello guys welcome back two decades and this video will see the trap in rain water problem with juice from list no-42 problem with juice from list no-42 problem with juice from list no-42 show latest reader problem statement in this problem given in negative entries representing elevation map with and this time this on... | Trapping Rain Water | trapping-rain-water | Given `n` non-negative integers representing an elevation map where the width of each bar is `1`, compute how much water it can trap after raining.
**Example 1:**
**Input:** height = \[0,1,0,2,1,0,1,3,2,1,2,1\]
**Output:** 6
**Explanation:** The above elevation map (black section) is represented by array \[0,1,0,2,1,... | null | Array,Two Pointers,Dynamic Programming,Stack,Monotonic Stack | Hard | 11,238,407,756 |
1,253 | hello so today we are solving the second problem of this late code we click on test 162 and the first problem says that we get a sorry the second problem which is one two five three construct reconstruct a 2d row a to rule binary matrix so it's a matrix with them with n columns and just two rows all the girls and it's ... | Reconstruct a 2-Row Binary Matrix | sort-the-matrix-diagonally | Given the following details of a matrix with `n` columns and `2` rows :
* The matrix is a binary matrix, which means each element in the matrix can be `0` or `1`.
* The sum of elements of the 0-th(upper) row is given as `upper`.
* The sum of elements of the 1-st(lower) row is given as `lower`.
* The sum of ele... | Use a data structure to store all values of each diagonal. How to index the data structure with the id of the diagonal? All cells in the same diagonal (i,j) have the same difference so we can get the diagonal of a cell using the difference i-j. | Array,Sorting,Matrix | Medium | null |
260 | Launcher madigol Seven Jessy Colosseum cow 6516 Wik KW version to gytuan one touch the should learn to lovers I juicery I trace Riau Oh yes bio.one juicery I trace Riau Oh yes bio.one juicery I trace Riau Oh yes bio.one Sopo Jarwo Adit Syaikh Syuaib OK Wih Whenever you are single Speed Up Racing Shop Whenever you are... | Single Number III | single-number-iii | Given an integer array `nums`, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in **any order**.
You must write an algorithm that runs in linear runtime complexity and uses only constant extra space.
... | null | Array,Bit Manipulation | Medium | 136,137 |
101 | Now in this short we will see the trading approach. In the previous short we had seen the recursive approach, so in the Italian approach you will have to make mistake many times, everything will be correct only then you will make the return true. Okay, now look, you have to do a check, root no. If you take root then ta... | Symmetric Tree | symmetric-tree | Given the `root` of a binary tree, _check whether it is a mirror of itself_ (i.e., symmetric around its center).
**Example 1:**
**Input:** root = \[1,2,2,3,4,4,3\]
**Output:** true
**Example 2:**
**Input:** root = \[1,2,2,null,3,null,3\]
**Output:** false
**Constraints:**
* The number of nodes in the tree is in... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
763 | in this video we're going to take a look at a legal problem called partition labels so a string as of lowercase english letter is given we want to partition the string into as many parts as possible so that each letter appears in at most in one part so return a list of integers representing the size of these parts so h... | Partition Labels | special-binary-string | You are given a string `s`. We want to partition the string into as many parts as possible so that each letter appears in at most one part.
Note that the partition is done so that after concatenating all the parts in order, the resultant string should be `s`.
Return _a list of integers representing the size of these ... | Draw a line from (x, y) to (x+1, y+1) if we see a "1", else to (x+1, y-1).
A special substring is just a line that starts and ends at the same y-coordinate, and that is the lowest y-coordinate reached.
Call a mountain a special substring with no special prefixes - ie. only at the beginning and end is the lowest y-coo... | String,Recursion | Hard | 678 |
387 | hey everyone welcome back and today I'll be doing another lead code 387 first unique character in the string this is an easy one given a string find the first non-repeating character in it and first non-repeating character in it and first non-repeating character in it and return its index if it is not exist return minu... | First Unique Character in a String | first-unique-character-in-a-string | Given a string `s`, _find the first non-repeating character in it and return its index_. If it does not exist, return `-1`.
**Example 1:**
**Input:** s = "leetcode"
**Output:** 0
**Example 2:**
**Input:** s = "loveleetcode"
**Output:** 2
**Example 3:**
**Input:** s = "aabb"
**Output:** -1
**Constraints:**
* `... | null | Hash Table,String,Queue,Counting | Easy | 451 |
116 | The aim of the early pension survey was only to go till the last, we asked very good questions on the method, I hope you all are driving the placements of history and I am learning a lot from you, if you spread the word and keep watching, then as far as I am fit. I am getting that brother, the body is going very well, ... | 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 |
100 | Hello hello everybody welcome to my channel today's world thirteen and chili coding and problems entry fans problem 12182 is the function to sacrifice of same and not to do subscribe and not have the same way you so example1 beetroot 0 flu positive will right side extra Subscribe definitely tree with rude boy but didn'... | Same Tree | same-tree | Given the roots of two binary trees `p` and `q`, write a function to check if they are the same or not.
Two binary trees are considered the same if they are structurally identical, and the nodes have the same value.
**Example 1:**
**Input:** p = \[1,2,3\], q = \[1,2,3\]
**Output:** true
**Example 2:**
**Input:** p... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
143 | hi guys in this video i'm gonna go through this legal number 143 in reorder list and this question was asked by amazon expedia for the past six months um so the reason why i think this is a good question is that this one utilize a uh monument method commonly used for um for a linked list so let's dive in to uh to see 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 |
482 | hey guys welcome back to this new video and in this video we will explore a problem that was asked in google a couple of times so this problem is named as license key formatting and this is based on a string formatting as the name suggests so you can see the description here you are given a license key represented as a... | License Key Formatting | license-key-formatting | You are given a license key represented as a string `s` that consists of only alphanumeric characters and dashes. The string is separated into `n + 1` groups by `n` dashes. You are also given an integer `k`.
We want to reformat the string `s` such that each group contains exactly `k` characters, except for the first g... | null | String | Easy | null |
549 | let's go to question number 549 binary 3 longest conjective sequence second this is a medium question let's get into it okay it has a lot of summer okay good given a binary tree you need to find the length of longest conjective path in binary tree especially this path can be either increased or decreasing for example o... | Binary Tree Longest Consecutive Sequence II | binary-tree-longest-consecutive-sequence-ii | Given the `root` of a binary tree, return _the length of the longest consecutive path in the tree_.
A consecutive path is a path where the values of the consecutive nodes in the path differ by one. This path can be either increasing or decreasing.
* For example, `[1,2,3,4]` and `[4,3,2,1]` are both considered valid... | null | Tree,Depth-First Search,Binary Tree | Medium | 298,1416 |
723 | beard's getting long hey yo what's up guys babybear4812 coming at you one more time today we're gonna be solving problem number seven two three candy crush based on everybody's uh favorite old school phone game i guess it's old school at this point um it's a really good problem and i it hasn't received much attention y... | Candy Crush | candy-crush | This question is about implementing a basic elimination algorithm for Candy Crush.
Given an `m x n` integer array `board` representing the grid of candy where `board[i][j]` represents the type of candy. A value of `board[i][j] == 0` represents that the cell is empty.
The given board represents the state of the game f... | Carefully perform the "crush" and "gravity" steps. In the crush step, flag each candy that should be removed, then go through and crush each flagged candy. In the gravity step, collect the candy in each column and then rewrite the column appropriately. Do these steps repeatedly until there's no work left to do. | Array,Two Pointers,Matrix,Simulation | Medium | null |
238 | hello everyone welcome today 27th of remember eco challenge and i hope all of you are having a great time without much to do let's look at today's question is product of aris accept self in this question we are given an area of integers and we need to return another array that represents the product of all the numbers ... | 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 |
1,458 | Hello Friends Today Due To Loot That Is About Your Swapna Dosh Amritlal Khanted And According To The Last Test - Chup Ke And According To The Last Test - Chup Ke And According To The Last Test - Chup Ke Nishchay Ko Fold Doctors Without Sab Theek Hai To Ke Simple Rukh Begat Dekhtein Dance Fix Into Cash Withdrawal 3D Rag... | Max Dot Product of Two Subsequences | sort-integers-by-the-number-of-1-bits | Given two arrays `nums1` and `nums2`.
Return the maximum dot product between **non-empty** subsequences of nums1 and nums2 with the same length.
A subsequence of a array is a new array which is formed from the original array by deleting some (can be none) of the characters without disturbing the relative positions of... | Simulate the problem. Count the number of 1's in the binary representation of each integer. Sort by the number of 1's ascending and by the value in case of tie. | Array,Bit Manipulation,Sorting,Counting | Easy | 2204 |
441 | 200 Hello Guys Today They Have Gone Too Far From This Question Off List Switch To This Arranging Coins is Fickle Mathematics Question That's It Nothing Else Ok I Am The Giver In This Your Encounter Is Ok This Is A Game Of Money Ok Now Who Am I You are making a staircase but a simple question, I understand well, now you... | Arranging Coins | arranging-coins | You have `n` coins and you want to build a staircase with these coins. The staircase consists of `k` rows where the `ith` row has exactly `i` coins. The last row of the staircase **may be** incomplete.
Given the integer `n`, return _the number of **complete rows** of the staircase you will build_.
**Example 1:**
**I... | null | Math,Binary Search | Easy | null |
212 | WhatsApp to Ajay, then on this question you have got a Today Hey, character Jhal and by adopting the word Ay, you have got Sapoch Hai, okay, this is the 2nd year of the character, Today Hey is 84 and along with it, there is another string. You will get makeup that Priyanka is coming, okay, nothing else to do, on both t... | Word Search II | word-search-ii | Given an `m x n` `board` of characters and a list of strings `words`, return _all words on the board_.
Each word must 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 in a word.
**Exampl... | You would need to optimize your backtracking to pass the larger test. Could you stop backtracking earlier? If the current candidate does not exist in all words' prefix, you could stop backtracking immediately. What kind of data structure could answer such query efficiently? Does a hash table work? Why or why not? How a... | Array,String,Backtracking,Trie,Matrix | Hard | 79,1022,1433 |
279 | Hello, this is a perfect square and take it four times and it will become the total. Okay, what else can you do? If you want to give it as a return, then let's see another example like if there is 26, then how can it become 26, so this answer becomes maximum 26 and How can it be made and how can it be made then how wil... | Perfect Squares | perfect-squares | Given an integer `n`, return _the least number of perfect square numbers that sum to_ `n`.
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. For example, `1`, `4`, `9`, and `16` are perfect squares while `3` and `11` are not.
**Example ... | null | Math,Dynamic Programming,Breadth-First Search | Medium | 204,264 |
92 | wasn't it quite here dude tech encoding stuff on twitch on YouTube check the description for all my information I have a patreon if you want to support me on there I do the premium problems discord is a great way to get in contact with everyone building the community there and then you can follow me on github too thank... | 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 |
1,726 | hey everyone this is steve today let's go through one legal problem 1726 tuple with the same product uh let's take a look at the problem first given a random number of distinct positive integers written the number of tuples a b c d such that a times b equals to c times d where there are constraints of a b c d so the ab... | Tuple with Same Product | coordinate-with-maximum-network-quality | Given an array `nums` of **distinct** positive integers, return _the number of tuples_ `(a, b, c, d)` _such that_ `a * b = c * d` _where_ `a`_,_ `b`_,_ `c`_, and_ `d` _are elements of_ `nums`_, and_ `a != b != c != d`_._
**Example 1:**
**Input:** nums = \[2,3,4,6\]
**Output:** 8
**Explanation:** There are 8 valid tup... | The constraints are small enough to consider every possible coordinate and calculate its quality. | Array,Enumeration | Medium | null |
117 | hey guys welcome back to my channel and i'm back again with another really interesting coding interview question video this time guys we are going to solve question number 117 populating next write pointers in each note part two before i start with the problem statement guys just want to request you that if you have no... | Populating Next Right Pointers in Each Node II | populating-next-right-pointers-in-each-node-ii | Given a binary tree
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 right node, the next pointer should be set to `NULL`.
Initially, all next pointers are set to `NULL`.
**Example 1:**
**Input:** root = \[1,2,3... | null | Linked List,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 116 |
231 | hey everyone today we'll be solving lead problem number 231 power of two in this problem we will be given an integer n and we have to check whether it is a power of two or not if it's power of two returning true otherwise we will return false they have also given the definition an integer N is a power of two if it can ... | Power of Two | power-of-two | Given an integer `n`, return _`true` if it is a power of two. Otherwise, return `false`_.
An integer `n` is a power of two, if there exists an integer `x` such that `n == 2x`.
**Example 1:**
**Input:** n = 1
**Output:** true
**Explanation:** 20 = 1
**Example 2:**
**Input:** n = 16
**Output:** true
**Explanation:**... | null | Math,Bit Manipulation,Recursion | Easy | 191,326,342 |
1,655 | hey everybody this is larry this is me going over q4 of the recent lead code uh by weekly contest 39. uh wow i'm just taking a notice that um it's a six pointer but that was kind of hard and a lot of people kind of took the time of it like the top people so i think they kind of under i mean the way the points don't rea... | Distribute Repeating Integers | move-sub-tree-of-n-ary-tree | You are given an array of `n` integers, `nums`, where there are at most `50` unique values in the array. You are also given an array of `m` customer order quantities, `quantity`, where `quantity[i]` is the amount of integers the `ith` customer ordered. Determine if it is possible to distribute `nums` such that:
* Th... | Disconnect node p from its parent and append it to the children list of node q. If q was in the sub-tree of node p (case 1), get the parent node of p and replace p in its children list with q. If p was the root of the tree, make q the root of the tree. | Tree,Depth-First Search | Hard | 1650 |
113 | we're going to look at a legal problem called path some number two so i made a video called paths on the number one so this problem is kind of similar to that and but this question kind of uh involves backtracking um not just dfs but also backtracking as well so if you have a look at that video i highly recommend to ch... | Path Sum II | path-sum-ii | Given the `root` of a binary tree and an integer `targetSum`, return _all **root-to-leaf** paths where the sum of the node values in the path equals_ `targetSum`_. Each path should be returned as a list of the node **values**, not node references_.
A **root-to-leaf** path is a path starting from the root and ending at... | null | Backtracking,Tree,Depth-First Search,Binary Tree | Medium | 112,257,437,666,2217 |
1,346 | Ko Absolutely Do A New Video This Video Or Going To Discuss Any Rate Problems From Digit Code And Problem Is Part Number 134 6 And 222 Problem Statement Problem Share And Subscribe Must Subscribe 2001 Any Particular That If Example If this is the current example, is there any double of your tank, otherwise is there no ... | Check If N and Its Double Exist | maximize-the-topmost-element-after-k-moves | Given an array `arr` of integers, check if there exist two indices `i` and `j` such that :
* `i != j`
* `0 <= i, j < arr.length`
* `arr[i] == 2 * arr[j]`
**Example 1:**
**Input:** arr = \[10,2,5,3\]
**Output:** true
**Explanation:** For i = 0 and j = 2, arr\[i\] == 10 == 2 \* 5 == 2 \* arr\[j\]
**Example 2:**... | For each index i, how can we check if nums[i] can be present at the top of the pile or not after k moves? For which conditions will we end up with an empty pile? | Array,Greedy | Medium | 134 |
316 | hey guys peng here so today we're going to talk about remove duplicate letters so given a string s remove duplicate letters so that every letter appears once only once the result is the smallest in lexicographical order among all possible results so if you see this example bc abc you know the result is abc's the smalle... | Remove Duplicate Letters | remove-duplicate-letters | Given a string `s`, remove duplicate letters so that every letter appears once and only once. You must make sure your result is **the smallest in lexicographical order** among all possible results.
**Example 1:**
**Input:** s = "bcabc "
**Output:** "abc "
**Example 2:**
**Input:** s = "cbacdcbc "
**Output:** "a... | Greedily try to add one missing character. How to check if adding some character will not cause problems ? Use bit-masks to check whether you will be able to complete the sub-sequence if you add the character at some index i. | String,Stack,Greedy,Monotonic Stack | Medium | 2157 |
62 | hello and welcome today we're doing a question from leaked co2 called unique paths it is a medium let's get started a robot located at the top-left corner a robot located at the top-left corner a robot located at the top-left corner of a M by n grid mark to start in the diagram below the robot can only move either down... | 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 |
394 | hello everyone so today we will be solving lead code problem 394 that is decode string so we are given an encoded string and we have to return its decoded string so there are certain rules mentioned here let's move over to our drawing explanation and write the code and then do a dry run and understand this problem stat... | Decode String | decode-string | Given an encoded string, return its decoded string.
The encoding rule is: `k[encoded_string]`, where the `encoded_string` inside the square brackets is being repeated exactly `k` times. Note that `k` is guaranteed to be a positive integer.
You may assume that the input string is always valid; there are no extra white... | null | String,Stack,Recursion | Medium | 471,726,1076 |
822 | hey everybody this is Larry this is me doing a bonus extra question trying to get myself you know I mean try to get myself to do a problem that I haven't done before uh that's basically and get my money's worth on uh you know RNG give me a good one L I mean a lead code AI why am I talking to myself it's kind of weird a... | Card Flipping Game | unique-morse-code-words | You are given two **0-indexed** integer arrays `fronts` and `backs` of length `n`, where the `ith` card has the positive integer `fronts[i]` printed on the front and `backs[i]` printed on the back. Initially, each card is placed on a table such that the front number is facing up and the other is facing down. You may fl... | null | Array,Hash Table,String | Easy | null |
298 | Hello friends welcome to my channel let's have a look at problem 298 binary tree longest conductive sequence in this video we are going to share a treatment based on recursion first we'll read through the statement to digest the problem requirements and then we do the analysis and share the code first the statement giv... | Binary Tree Longest Consecutive Sequence | binary-tree-longest-consecutive-sequence | Given the `root` of a binary tree, return _the length of the longest **consecutive sequence path**_.
A **consecutive sequence path** is a path where the values **increase by one** along the path.
Note that the path can start **at any node** in the tree, and you cannot go from a node to its parent in the path.
**Exam... | null | Tree,Depth-First Search,Binary Tree | Medium | 128,549,1416 |
994 | hello everyone welcome to codas camp we are a 29th day of october eco challenge and the problem we are going to cover in this video is rotting oranges so the input given here is the m cross en matrix with values 0 1 and 2 so here the values represent 0 represent an empty cell 1 represent fresh orange and 2 represent ro... | Rotting Oranges | prison-cells-after-n-days | You are given an `m x n` `grid` where each cell can have one of three values:
* `0` representing an empty cell,
* `1` representing a fresh orange, or
* `2` representing a rotten orange.
Every minute, any fresh orange that is **4-directionally adjacent** to a rotten orange becomes rotten.
Return _the minimum nu... | null | Array,Hash Table,Math,Bit Manipulation | Medium | null |
146 | here today we are going to be doing a very popular delete code and that is leak code 146 LRU cache LRU steps released recently used if you're not aware and yeah let's hop right into it this is a very popular programming question and that is quite difficult hard I don't think if you unless you've done it before I don't ... | LRU Cache | lru-cache | Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**.
Implement the `LRUCache` class:
* `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`.
* `int get(int key)` Return the valu... | null | Hash Table,Linked List,Design,Doubly-Linked List | Medium | 460,588,604,1903 |
905 | 9:05 saw it away by parody given in a 9:05 saw it away by parody given in a 9:05 saw it away by parody given in a way a of non-negative integers we turn way a of non-negative integers we turn way a of non-negative integers we turn in a way consisting of only given elements of a file by order odd element effect you may ... | Sort Array By Parity | length-of-longest-fibonacci-subsequence | Given an integer array `nums`, move all the even integers at the beginning of the array followed by all the odd integers.
Return _**any array** that satisfies this condition_.
**Example 1:**
**Input:** nums = \[3,1,2,4\]
**Output:** \[2,4,3,1\]
**Explanation:** The outputs \[4,2,3,1\], \[2,4,1,3\], and \[4,2,1,3\] w... | null | Array,Hash Table,Dynamic Programming | Medium | 1013 |
76 | this is the recap of singapore javascript in a real meet up on August 25th the first question is a little question given two strings find the minimum window in ass by window it just means substring find the minimum window in ass that contains all the characters in T now you do not have to maintain the same order for ex... | 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 |
961 | Ipu Hegar Horseman You I Hope For Doing Welcome To Jalan Khor So English Play List Will Have Complete Web Complete Yesterday Should Be Pretty Something Or ₹100 It Today Will Do Should Be Pretty Something Or ₹100 It Today Will Do Should Be Pretty Something Or ₹100 It Today Will Do And Repeated Element In Size Dresses Pa... | N-Repeated Element in Size 2N Array | long-pressed-name | You are given an integer array `nums` with the following properties:
* `nums.length == 2 * n`.
* `nums` contains `n + 1` **unique** elements.
* Exactly one element of `nums` is repeated `n` times.
Return _the element that is repeated_ `n` _times_.
**Example 1:**
**Input:** nums = \[1,2,3,3\]
**Output:** 3
**... | null | Two Pointers,String | Easy | null |
105 | hello viewers of algorithm videos I'm Nick white I do technical stuff on Twitch in YouTube check the description you get all my stuff like and subscribe this so I can grow my thing I'm basically walking people through a code for algorithms data structures because they don't understand it they get it confused this is ba... | 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 |
560 | hey everyone welcome back and let's write some more neat code today so today let's solve sub array sum equals k so simply we are given an array of integers nums and we are given a target integer k and we want to return the total number of contiguous subarrays which sum up to the value k this is our target value so how ... | Subarray Sum Equals K | subarray-sum-equals-k | Given an array of integers `nums` and an integer `k`, return _the total number of subarrays whose sum equals to_ `k`.
A subarray is a contiguous **non-empty** sequence of elements within an array.
**Example 1:**
**Input:** nums = \[1,1,1\], k = 2
**Output:** 2
**Example 2:**
**Input:** nums = \[1,2,3\], k = 3
**Ou... | Will Brute force work here? Try to optimize it. Can we optimize it by using some extra space? What about storing sum frequencies in a hash table? Will it be useful? sum(i,j)=sum(0,j)-sum(0,i), where sum(i,j) represents the sum of all the elements from index i to j-1.
Can we use this property to optimize it. | Array,Hash Table,Prefix Sum | Medium | 1,523,713,724,1016,1776,2211,2369 |
1,492 | Hello Hi Everyone Welcome To My Channel It's All The Problem Wicket Factor Of And Give Into Positive Interest And K Factor Of Sciences And Models i20 Straightforward List Of All Factors Sorted In Ascending Order Return For - 110 Edison's Return For - 110 Edison's Return For - 110 Edison's Factors Which Are Very Straigh... | The kth Factor of n | time-needed-to-inform-all-employees | You are given two positive integers `n` and `k`. A factor of an integer `n` is defined as an integer `i` where `n % i == 0`.
Consider a list of all factors of `n` sorted in **ascending order**, return _the_ `kth` _factor_ in this list or return `-1` if `n` has less than `k` factors.
**Example 1:**
**Input:** n = 12,... | The company can be represented as a tree, headID is always the root. Store for each node the time needed to be informed of the news. Answer is the max time a leaf node needs to be informed. | Tree,Depth-First Search,Breadth-First Search | Medium | 104,124 |
19 | yeah what is up there's a being on here today I'm going over Amazon asked question I think Facebook acid as well so remove Ed's note for any of this medium problem and leak code there scription reads given a link place moved and snowed from the end of list and return its head so they just give us a linked list we want ... | Remove Nth Node From End of List | remove-nth-node-from-end-of-list | Given the `head` of a linked list, remove the `nth` node from the end of the list and return its head.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], n = 2
**Output:** \[1,2,3,5\]
**Example 2:**
**Input:** head = \[1\], n = 1
**Output:** \[\]
**Example 3:**
**Input:** head = \[1,2\], n = 1
**Output:** \[1\]
**C... | Maintain two pointers and update one with a delay of n steps. | Linked List,Two Pointers | Medium | 528,1618,2216 |
1,027 | And friend, today's question is very important for you. Interview and today's question is a very good question but it comes in the category of hard question. If you look at Expert Vijay, then what is an expert in gaming, what to do in this? We are given a number and we have to find out the length of the longest subscri... | Longest Arithmetic Subsequence | sum-of-even-numbers-after-queries | Given an array `nums` of integers, return _the length of the longest arithmetic subsequence in_ `nums`.
**Note** that:
* A **subsequence** is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.
* A sequence `seq` is arithmetic if `s... | null | Array,Simulation | Medium | null |
1,611 | hello hi guys good morning welcome back to the new video in this video minimum one bit operations to make integers zero firstly it's a hard problem but the only way to think of these problem is to break it down to the smaller problems but it is easy to say that we can break it down but to know how and when and what to ... | Minimum One Bit Operations to Make Integers Zero | making-file-names-unique | Given an integer `n`, you must transform it into `0` using the following operations any number of times:
* Change the rightmost (`0th`) bit in the binary representation of `n`.
* Change the `ith` bit in the binary representation of `n` if the `(i-1)th` bit is set to `1` and the `(i-2)th` through `0th` bits are set... | Keep a map of each name and the smallest valid integer that can be appended as a suffix to it. If the name is not present in the map, you can use it without adding any suffixes. If the name is present in the map, append the smallest proper suffix, and add the new name to the map. | Array,Hash Table,String | Medium | null |
1,697 | Hello gas, I am Lalit Aggarwal. Dose on welcome discussion, I have understood the problem very well, the one who is sitting behind, there are six things to do. Look, this question was a bit of a trick, it is a genuine question method, because what concept is hidden in this question? In this question, only a normal grap... | Checking Existence of Edge Length Limited Paths | strings-differ-by-one-character | An undirected graph of `n` nodes is defined by `edgeList`, where `edgeList[i] = [ui, vi, disi]` denotes an edge between nodes `ui` and `vi` with distance `disi`. Note that there may be **multiple** edges between two nodes.
Given an array `queries`, where `queries[j] = [pj, qj, limitj]`, your task is to determine for e... | BruteForce, check all pairs and verify if they differ in one character. O(n^2 * m) where n is the number of words and m is the length of each string. O(m^2 * n), Use hashset, to insert all possible combinations adding a character "*". For example: If dict[i] = "abc", insert ("*bc", "a*c" and "ab*"). | Hash Table,String,Rolling Hash,Hash Function | Medium | 2256 |
1,092 | 1092 shortest common super sequence oh actually super serious not sub Stevens I come in two strings string one is going to we turn the shortest string that has folks sharing one and shrink to our sub sequences excuse me have multiple answers exists you may return any of them hmm like a cell phone related problem before... | Shortest Common Supersequence | maximum-difference-between-node-and-ancestor | Given two strings `str1` and `str2`, return _the shortest string that has both_ `str1` _and_ `str2` _as **subsequences**_. If there are multiple valid strings, return **any** of them.
A string `s` is a **subsequence** of string `t` if deleting some number of characters from `t` (possibly `0`) results in the string `s`... | For each subtree, find the minimum value and maximum value of its descendants. | Tree,Depth-First Search,Binary Tree | Medium | null |
1,782 | hello everyone let's solve this recall problem today it's a um this problem is the last problem used by weekly contests and it's actually a heart problem and the acceptance rate is pretty low it's only a little bit above 10 percent okay so let's take a look at this problem yes problem is actually um pretty hard to unde... | Count Pairs Of Nodes | smallest-string-with-a-given-numeric-value | You are given an undirected graph defined by an integer `n`, the number of nodes, and a 2D integer array `edges`, the edges in the graph, where `edges[i] = [ui, vi]` indicates that there is an **undirected** edge between `ui` and `vi`. You are also given an integer array `queries`.
Let `incident(a, b)` be defined as t... | Think greedily. If you build the string from the end to the beginning, it will always be optimal to put the highest possible character at the current index. | String,Greedy | Medium | null |
160 | Hello, I am a developer child Gary Ni. The problem to be solved this time is Intern Section 160 of Two Linked Lists. Head a and head key, which are the heads of two single linked lists, are given as arguments. This problem can be solved by re-tanning the intersecting part. problem can be solved by re-tanning the inters... | Intersection of Two Linked Lists | intersection-of-two-linked-lists | Given the heads of two singly linked-lists `headA` and `headB`, return _the node at which the two lists intersect_. If the two linked lists have no intersection at all, return `null`.
For example, the following two linked lists begin to intersect at node `c1`:
The test cases are generated such that there are no cycle... | null | Hash Table,Linked List,Two Pointers | Easy | 599 |
1,679 | Had happened here today's problem list number of time of sun given in food of interior and below jobs page numbers for every side reaction and at every step number subscribe to achcha lagata hai too many times alternative friend number side problem let's get into and solution are Number Three to subscribe and subscribe... | Max Number of K-Sum Pairs | shortest-subarray-to-be-removed-to-make-array-sorted | You are given an integer array `nums` and an integer `k`.
In one operation, you can pick two numbers from the array whose sum equals `k` and remove them from the array.
Return _the maximum number of operations you can perform on the array_.
**Example 1:**
**Input:** nums = \[1,2,3,4\], k = 5
**Output:** 2
**Explana... | The key is to find the longest non-decreasing subarray starting with the first element or ending with the last element, respectively. After removing some subarray, the result is the concatenation of a sorted prefix and a sorted suffix, where the last element of the prefix is smaller than the first element of the suffix... | Array,Two Pointers,Binary Search,Stack,Monotonic Stack | Medium | null |
227 | video we're going to look at your problem called basic calculator number two so if you haven't checked out my other video called basic calculator number one i highly recommend to check out that video before this one but basically this question uh we're basically trying to evaluate a given string expression and this str... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.