id int64 1 2k | content stringlengths 272 88.9k | title stringlengths 3 77 | title_slug stringlengths 3 79 | question_content stringlengths 230 5k | question_hints stringclasses 695
values | tag stringclasses 618
values | level stringclasses 3
values | similar_question_ids stringclasses 822
values |
|---|---|---|---|---|---|---|---|---|
1,199 | hi everyone with Kelvin here so let's discuss about daily contest 9 for question minimum time to build block so we are given lease of block and each of the block have different time required to build it and block I equals T so and initially we have only one worker and then we have choice either to split the worker with... | Minimum Time to Build Blocks | hexspeak | You are given a list of blocks, where `blocks[i] = t` means that the `i`\-th block needs `t` units of time to be built. A block can only be built by exactly one worker.
A worker can either split into two workers (number of workers increases by one) or build a block then go home. Both decisions cost some time.
The tim... | Convert the given number to hexadecimal. Replace all 0 and 1 with 'O' and 'I'. Check if the final string has any numerical digits. | Math,String | Easy | null |
1,971 | foreign so if I read the problem description so you are given uh set of edges and then and basically number of nodes in the graph and then you need to determine if there is a path execution Source in destination so source is given uh here and then there's an SMS also here so based on this you need to Traverse in the cu... | Find if Path Exists in Graph | incremental-memory-leak | There is a **bi-directional** graph with `n` vertices, where each vertex is labeled from `0` to `n - 1` (**inclusive**). The edges in the graph are represented as a 2D integer array `edges`, where each `edges[i] = [ui, vi]` denotes a bi-directional edge between vertex `ui` and vertex `vi`. Every vertex pair is connecte... | What is the upper bound for the number of seconds? Simulate the process of allocating memory. | Simulation | Medium | null |
475 | So friends, in this video I will teach you how to solve this problem, I will tell you in a much better way that if you watch this video till the end, then I guarantee you that you will be able to solve this question very easily. The question is Winter is coming during d contact your first whenever tu designer standard ... | Heaters | heaters | Winter is coming! During the contest, your first job is to design a standard heater with a fixed warm radius to warm all the houses.
Every house can be warmed, as long as the house is within the heater's warm radius range.
Given the positions of `houses` and `heaters` on a horizontal line, return _the minimum radius ... | null | Array,Two Pointers,Binary Search,Sorting | Medium | null |
1,610 | hey what's up guys this is sean here so uh let's take a look at this week's weekly contest number 1610 maximum number of visible points um so this one okay i know it's got a lot of downloads you know i'm gonna give it my own upboards so basically this problem is more like a geometry problem you know basically you are g... | Maximum Number of Visible Points | xor-operation-in-an-array | You are given an array `points`, an integer `angle`, and your `location`, where `location = [posx, posy]` and `points[i] = [xi, yi]` both denote **integral coordinates** on the X-Y plane.
Initially, you are facing directly east from your position. You **cannot move** from your position, but you can **rotate**. In othe... | Simulate the process, create an array nums and return the Bitwise XOR of all elements of it. | Math,Bit Manipulation | Easy | null |
62 | hey guys today we are going to talk about the lit code problem unique path the link for the problem is at the description you need to read the problem before you watch my solution my intuition of this problem was treating the robot's path as binary 3 form let's look at this grid 3x3 so in the grid we can add one row to... | Unique Paths | unique-paths | There is a robot on an `m x n` grid. The robot is initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time.
Given the two integers `m` and `n`, return _the nu... | null | Math,Dynamic Programming,Combinatorics | Medium | 63,64,174,2192 |
1,846 | yeah hi hello so we are today going to see uh the maximum element after decreasing and rearranging right uh so in this question what it is given is like let's understand the question first so you are given an array of positive integer right and we have to perform some operations possibly not so basically they are sayin... | Maximum Element After Decreasing and Rearranging | maximum-element-after-decreasing-and-rearranging | You are given an array of positive integers `arr`. Perform some operations (possibly none) on `arr` so that it satisfies these conditions:
* The value of the **first** element in `arr` must be `1`.
* The absolute difference between any 2 adjacent elements must be **less than or equal to** `1`. In other words, `abs... | null | null | Medium | null |
689 | hey what's up guys sean here and so today let's continue on our lead called problem-solving journey here and so problem-solving journey here and so problem-solving journey here and so today let's take a look at this problem number 689 maximum sum of three non-overlapping sub-arrays okay so non-overlapping sub-arrays ok... | Maximum Sum of 3 Non-Overlapping Subarrays | maximum-sum-of-3-non-overlapping-subarrays | Given an integer array `nums` and an integer `k`, find three non-overlapping subarrays of length `k` with maximum sum and return them.
Return the result as a list of indices representing the starting position of each interval (**0-indexed**). If there are multiple answers, return the lexicographically smallest one.
*... | null | Array,Dynamic Programming | Hard | 123 |
19 | hey guys Greg here let's solve remove nth node from end of list Le code number 19 it's uh probably one of the easier medium questions I would have to say so we're given the head of a linked list and we want to remove the nth node from the end of the list and as usual return the link list head so for example here we're ... | 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,376 | hey everybody this is Larry this is day three of the June nickel day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today it's problem it's a beautiful Saturday here in Irvine uh Irwin in Armenia I hope everyone's doing okay I hope you enjoyed our drum video o... | Time Needed to Inform All Employees | time-needed-to-inform-all-employees | A company has `n` employees with a unique ID for each employee from `0` to `n - 1`. The head of the company is the one with `headID`.
Each employee has one direct manager given in the `manager` array where `manager[i]` is the direct manager of the `i-th` employee, `manager[headID] = -1`. Also, it is guaranteed that th... | null | null | Medium | null |
76 | welcome back this is logic coding today i've been making tons of videos because tomorrow i have my um on-site interview for one of the my um on-site interview for one of the my um on-site interview for one of the self-driving companies i haven't been self-driving companies i haven't been self-driving companies i haven'... | 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 |
13 | hello everyone and welcome to python programming practice in this episode we are going to be covering lead code number 13 roman 2 integer this is an easy difficulty problem so it shouldn't be super hard to get through i'll start by reading the problem description so roman numerals are represented by seven different sym... | Roman to Integer | roman-to-integer | Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`.
**Symbol** **Value**
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, `2` is written as `II` in Roman numeral, just two ones added... | Problem is simpler to solve by working the string from back to front and using a map. | Hash Table,Math,String | Easy | 12 |
1,816 | Scientist Hello Hi Guys Aaye Ho Olive Oil Doing Good Welcome To Land Co Disney Interior Complete Notification Aa Home Made Hair Oil Se Giving Gifts From Outside In Solving Samudra Question And Please Don't Depend On PM Ast Un Not Be Just Make You Dependable On Me Too Go and more then come back in this you are K Singh's... | 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 |
423 | Hello Everyone Welcome To Lotus Camp Suggestion To Interwar Reconstruct Original Default English Prostate Se Half Inch It Likes That Saudi Arabia Knowledge Input Porn Hadith Characters And You Will Get 0230 So A Problem Statement To The Full Form Of Loot To But Not For Any Rate State Presidents subscribe and subscribe ... | Reconstruct Original Digits from English | reconstruct-original-digits-from-english | Given a string `s` containing an out-of-order English representation of digits `0-9`, return _the digits in **ascending** order_.
**Example 1:**
**Input:** s = "owoztneoer"
**Output:** "012"
**Example 2:**
**Input:** s = "fviefuro"
**Output:** "45"
**Constraints:**
* `1 <= s.length <= 105`
* `s[i]` is one of ... | null | Hash Table,Math,String | Medium | null |
1,632 | Ajay Ko Hello Everyone Welcome Back to Back Puri So the name of the question which we are going to talk about today is Color Transformer Tricks, so first let us understand the question and then we will also talk about the solution on it. Okay, so what can I say for this? It is being said that you have done the matricul... | Rank Transform of a Matrix | number-of-good-ways-to-split-a-string | Given an `m x n` `matrix`, return _a new matrix_ `answer` _where_ `answer[row][col]` _is the_ _**rank** of_ `matrix[row][col]`.
The **rank** is an **integer** that represents how large an element is compared to other elements. It is calculated using the following rules:
* The rank is an integer starting from `1`.
*... | Use two HashMap to store the counts of distinct letters in the left and right substring divided by the current index. | String,Dynamic Programming,Bit Manipulation | Medium | null |
329 | hello and welcome to another Elite code problem so today we're going to be doing problem number 329 longest increasing path in a matrix and I don't think this problem is too difficult so let's get into it so for an M by n integers Matrix we can return the length of the longest increasing path in The Matrix we can eithe... | 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 |
471 | hey what's up guys this is sean here again so uh today let's take a look at this uh problem number 471 encode string with shortest length um i think this one's like pretty difficult problem you know i think for me anything that's has a string it's a string plus dp it's a it's definitely a hard problem okay so the descr... | Encode String with Shortest Length | encode-string-with-shortest-length | Given a string `s`, encode the string such that its encoded length is the shortest.
The encoding rule is: `k[encoded_string]`, where the `encoded_string` inside the square brackets is being repeated exactly `k` times. `k` should be a positive integer.
If an encoding process does not make the string shorter, then do n... | null | String,Dynamic Programming | Hard | 394,726 |
135 | hello friends so now let us go over another problem from lead code the problem name is candy cool so let us go to the problem statement first it states that there are n children standing in a line and each child is assigned a rating value given in the integer error ratings so every child is assigned some rating as you ... | Candy | candy | There are `n` children standing in a line. Each child is assigned a rating value given in the integer array `ratings`.
You are giving candies to these children subjected to the following requirements:
* Each child must have at least one candy.
* Children with a higher rating get more candies than their neighbors.... | null | Array,Greedy | Hard | null |
1,576 | hi everyone my name is steve and today we're going to go through legal problem 1576 replace all question marks to avoid consecutive repeating characters let's take a look at the problem first give it a string s containing only lower english letters and the question mark character to convert all of the question mark cha... | Replace All ?'s to Avoid Consecutive Repeating Characters | reorder-routes-to-make-all-paths-lead-to-the-city-zero | Given a string `s` containing only lowercase English letters and the `'?'` character, convert **all** the `'?'` characters into lowercase letters such that the final string does not contain any **consecutive repeating** characters. You **cannot** modify the non `'?'` characters.
It is **guaranteed** that there are no ... | Treat the graph as undirected. Start a dfs from the root, if you come across an edge in the forward direction, you need to reverse the edge. | Depth-First Search,Breadth-First Search,Graph | Medium | null |
105 | Hello everyone welcome to another problem in Record June Challenge so today the problem is Construct Binary Tree from Free Water and Inorder Traversal so what would have been given in this problem we have been given pre-quarter and in this we have been pre-quarter and in this we have been pre-quarter and in this we hav... | 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 |
763 | lead code practice question in this video there are two goals the first goal is to find the solution for this specific question and then we are going to do some coding work and the second goal is to see how to solve this problem in a real interview so let's get started so in the real interview the first step is always ... | 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 |
226 | today we will solve a very simple binary tree problem it's lead code 226 and it's called inward binary tree so here you are given a binary tree and uh you have to invert it that is you can assume a mirror keep a mirror here and then whatever is the left becomes right and right becomes left so let's see an example so th... | 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 |
918 | 183 So Maximum Some Circular White Ok Subscribe This Channel More Than Maximum First of all we were turning on the gas Bhigo-Bhigo After the end I was stupid Bhigo-Bhigo After the end I was stupid Bhigo-Bhigo After the end I was stupid and they could solve Maximum All the records used to be studded and Okay, so before ... | Maximum Sum Circular Subarray | reachable-nodes-in-subdivided-graph | Given a **circular integer array** `nums` of length `n`, return _the maximum possible sum of a non-empty **subarray** of_ `nums`.
A **circular array** means the end of the array connects to the beginning of the array. Formally, the next element of `nums[i]` is `nums[(i + 1) % n]` and the previous element of `nums[i]` ... | null | Graph,Heap (Priority Queue),Shortest Path | Hard | 2213,2218 |
257 | question 257 of the code binary tree path so given the root of a binary tree return all root to leaf path in any order a leaf is a node with no children so in our first example we have an output of one two five one three and that is exactly the two root to leave paths we have here so we have one two and five is a leaf ... | Binary Tree Paths | binary-tree-paths | Given the `root` of a binary tree, return _all root-to-leaf paths in **any order**_.
A **leaf** is a node with no children.
**Example 1:**
**Input:** root = \[1,2,3,null,5\]
**Output:** \[ "1->2->5 ", "1->3 "\]
**Example 2:**
**Input:** root = \[1\]
**Output:** \[ "1 "\]
**Constraints:**
* The number of nodes ... | null | String,Backtracking,Tree,Depth-First Search,Binary Tree | Easy | 113,1030,2217 |
1,553 | hey everybody this is larry this is me going over q4 of the recent contest minimum number of days to eat and oranges so okay i'll be straight with about this poem i don't know how to solve it um i know i finished nine from the contest i've solved this problem in five minutes or i you know submitted it and got ac so i d... | Minimum Number of Days to Eat N Oranges | count-triplets-that-can-form-two-arrays-of-equal-xor | There are `n` oranges in the kitchen and you decided to eat some of these oranges every day as follows:
* Eat one orange.
* If the number of remaining oranges `n` is divisible by `2` then you can eat `n / 2` oranges.
* If the number of remaining oranges `n` is divisible by `3` then you can eat `2 * (n / 3)` oran... | We are searching for sub-array of length ≥ 2 and we need to split it to 2 non-empty arrays so that the xor of the first array is equal to the xor of the second array. This is equivalent to searching for sub-array with xor = 0. Keep the prefix xor of arr in another array, check the xor of all sub-arrays in O(n^2), if th... | Array,Hash Table,Math,Bit Manipulation,Prefix Sum | Medium | null |
997 | Hello everyone welcome to my channel 97 but this question is quite popular it has not been asked a lot of time it has been asked multiple times find de town the name of the question is company someone has asked Uber Amazon Microsoft but it has been asked multiple times This question is ok. By looking at the input and o... | Find the Town Judge | find-the-town-judge | In a town, there are `n` people labeled from `1` to `n`. There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
1. The town judge trusts nobody.
2. Everybody (except for the town judge) trusts the town judge.
3. There is exactly one person that satisfies properties **... | null | null | Easy | null |
1,518 | uh hey everybody this is larry uh me going over water bottles 1518. um yeah and this is the recent q1 uh hit the like button hit the subscribe button let me know what you think uh but basically this one is just simulation uh the keep the thing to note is that you may have extra empty bottles left over to use for future... | Water Bottles | total-sales-amount-by-year | There are `numBottles` water bottles that are initially full of water. You can exchange `numExchange` empty water bottles from the market with one full water bottle.
The operation of drinking a full water bottle turns it into an empty bottle.
Given the two integers `numBottles` and `numExchange`, return _the **maximu... | null | Database | Hard | null |
790 | Hello friends today I'm going to solve with good problem number 790 Domino and throw me no dialing so in this problem we are given two types of tiles one is a two is to one Domino shape another is a Terminal ship so basically these are the two tiles the shape of the two tiles and what we need to do is we need to feel a... | Domino and Tromino Tiling | global-and-local-inversions | You have two types of tiles: a `2 x 1` domino shape and a tromino shape. You may rotate these shapes.
Given an integer n, return _the number of ways to tile an_ `2 x n` _board_. Since the answer may be very large, return it **modulo** `109 + 7`.
In a tiling, every square must be covered by a tile. Two tilings are dif... | Where can the 0 be placed in an ideal permutation? What about the 1? | Array,Math | Medium | null |
1,685 | Hello friends welcome back today in this video we are going to solve the medium level problem of lead code named sum of absolute differences in a sorted array so the problem statement is something like this we have been given an array which is sorted in a Non-decreasing order and we have been told Non-decreasing order ... | 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 |
398 | hey welcome guys welcome to my episode section so let's solve this three hundred ninety eight random p indices so given an array is not possible duplicate random output index regard target now you can actually the current diagrams is this in array so basically you have an array and uh there will be duplicate object and... | Random Pick Index | random-pick-index | Given an integer array `nums` with possible **duplicates**, randomly output the index of a given `target` number. You can assume that the given target number must exist in the array.
Implement the `Solution` class:
* `Solution(int[] nums)` Initializes the object with the array `nums`.
* `int pick(int target)` Pic... | null | Hash Table,Math,Reservoir Sampling,Randomized | Medium | 382,894,912 |
1,380 | can discuss this question problem number one three eight zero lucky number in bad wrecks the problem statements states that you're given M cross n matrix of distant numbers distant is very important in this question and Jen you have to rate up all the lucky numbers in the matrix in any order so what is Ashley on a numb... | Lucky Numbers in a Matrix | number-of-closed-islands | Given an `m x n` matrix of **distinct** numbers, return _all **lucky numbers** in the matrix in **any** order_.
A **lucky number** is an element of the matrix such that it is the minimum element in its row and maximum in its column.
**Example 1:**
**Input:** matrix = \[\[3,7,8\],\[9,11,13\],\[15,16,17\]\]
**Output:*... | Exclude connected group of 0s on the corners because they are not closed island. Return number of connected component of 0s on the grid. | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | null |
1,218 | hey everyone welcome back to the channel and today let's solve the lead code problem for the daily challenge uh so this is the longest arithmetic subsequence of given difference so we're given an integer array and an integer difference and we need to return the length of the longest subsequence in area which is an arit... | Longest Arithmetic Subsequence of Given Difference | lowest-common-ancestor-of-deepest-leaves | Given an integer array `arr` and an integer `difference`, return the length of the longest subsequence in `arr` which is an arithmetic sequence such that the difference between adjacent elements in the subsequence equals `difference`.
A **subsequence** is a sequence that can be derived from `arr` by deleting some or n... | Do a postorder traversal. Then, if both subtrees contain a deepest leaf, you can mark this node as the answer (so far). The final node marked will be the correct answer. | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 1816 |
202 | hi guys welcome back to the channel and today we are back with another very famous question and the question is happy number and before diving into the question if you're new to the channel please consider subscribing because we are going to sort of a load of interview questions and I think that can definitely help you... | Happy Number | happy-number | Write an algorithm to determine if a number `n` is happy.
A **happy number** is a number defined by the following process:
* Starting with any positive integer, replace the number by the sum of the squares of its digits.
* Repeat the process until the number equals 1 (where it will stay), or it **loops endlessly ... | null | Hash Table,Math,Two Pointers | Easy | 141,258,263,2076 |
129 | question one two nine of the code sum root to leaf numbers so you're given the root of a binary tree containing digits from zero to nine only each root to leaf path in the tree represents a number for example the root to leaf path one two three represents the numbers 1 2 3. return the total sum of all root to leaf numb... | Sum Root to Leaf Numbers | sum-root-to-leaf-numbers | You are given the `root` of a binary tree containing digits from `0` to `9` only.
Each root-to-leaf path in the tree represents a number.
* For example, the root-to-leaf path `1 -> 2 -> 3` represents the number `123`.
Return _the total sum of all root-to-leaf numbers_. Test cases are generated so that the answer w... | null | Tree,Depth-First Search,Binary Tree | Medium | 112,124,1030 |
851 | hi everyone today we will be solving the code question number 851 cloud and rich let's see what the problem statement is so you are given a group of n people labeled from 0 to n minus 1 where each person has a different amount of money and different level of whiteness so uh in the input format you are given a richer ar... | Loud and Rich | goat-latin | There is a group of `n` people labeled from `0` to `n - 1` where each person has a different amount of money and a different level of quietness.
You are given an array `richer` where `richer[i] = [ai, bi]` indicates that `ai` has more money than `bi` and an integer array `quiet` where `quiet[i]` is the quietness of th... | null | String | Easy | null |
788 | welcome to joey's tech i am joey and in this video we are going to look into the problem of rotated digits this problem is on the lead good website number 788 this is a simple math problem that we will solve using the classic dynamic programming technique i am sure that you are going to enjoy learning this dp problem t... | Rotated Digits | minimize-max-distance-to-gas-station | An integer `x` is a **good** if after rotating each digit individually by 180 degrees, we get a valid number that is different from `x`. Each digit must be rotated - we cannot choose to leave it alone.
A number is valid if each digit remains a digit after rotation. For example:
* `0`, `1`, and `8` rotate to themsel... | Use a binary search. We'll binary search the monotone function "possible(D) = can we use K or less gas stations to ensure each adjacent distance between gas stations is at most D?" | Array,Binary Search | Hard | 907 |
918 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem maximum some circular sub array it's pretty similar to leak code 53 which I already have a solution on which is the maximum subarray sum problem this is pretty similar just a slight variation which is that instead of be... | Maximum Sum Circular Subarray | reachable-nodes-in-subdivided-graph | Given a **circular integer array** `nums` of length `n`, return _the maximum possible sum of a non-empty **subarray** of_ `nums`.
A **circular array** means the end of the array connects to the beginning of the array. Formally, the next element of `nums[i]` is `nums[(i + 1) % n]` and the previous element of `nums[i]` ... | null | Graph,Heap (Priority Queue),Shortest Path | Hard | 2213,2218 |
1,290 | Jhal Hello Guys Welcome Parivartan Midning Coaching Classes Appointed Rich And Subscribe Directly 282 Select Nav Vikram Again Right 10 2013 Wash Channel Subscribe 101 Vidron In Two 2012 Plus One Witch Will Give 5 That Bigg Boss Logic And Write The Result Specified Phone With Dialogue Between Second Difficulty He Didn't... | Convert Binary Number in a Linked List to Integer | make-array-strictly-increasing | Given `head` which is a reference node to a singly-linked list. The value of each node in the linked list is either `0` or `1`. The linked list holds the binary representation of a number.
Return the _decimal value_ of the number in the linked list.
The **most significant bit** is at the head of the linked list.
**E... | Use dynamic programming. The state would be the index in arr1 and the index of the previous element in arr2 after sorting it and removing duplicates. | Array,Binary Search,Dynamic Programming | Hard | null |
860 | hello so today we are doing this problem called lemonade change problem number 860 so the problem says that we have a lemonade stand and each lemonade Custis five dollars and who have customers that are standing in a queue and each one of them orders one at a time with a specific set of bills these bills are $5 $10 and... | Lemonade Change | design-circular-queue | At a lemonade stand, each lemonade costs `$5`. Customers are standing in a queue to buy from you and order one at a time (in the order specified by bills). Each customer will only buy one lemonade and pay with either a `$5`, `$10`, or `$20` bill. You must provide the correct change to each customer so that the net tran... | null | Array,Linked List,Design,Queue | Medium | 859,1767 |
1,631 | welcome to january's lego challenge today's problem is path with minimum effort you are a hiker preparing for an upcoming hike you are given heights a 2d array of size rows times columns where heights roll column represents the height of that cell you are situated in the top left cell and you hope to travel to the bott... | Path With Minimum Effort | number-of-sub-arrays-with-odd-sum | You are a hiker preparing for an upcoming hike. You are given `heights`, a 2D array of size `rows x columns`, where `heights[row][col]` represents the height of cell `(row, col)`. You are situated in the top-left cell, `(0, 0)`, and you hope to travel to the bottom-right cell, `(rows-1, columns-1)` (i.e., **0-indexed**... | Can we use the accumulative sum to keep track of all the odd-sum sub-arrays ? if the current accu sum is odd, we care only about previous even accu sums and vice versa. | Array,Math,Dynamic Programming,Prefix Sum | Medium | 2242 |
429 | welcome back to uncle Jess today's question is leak code 429 NRA three-level order trousal so given an three-level order trousal so given an three-level order trousal so given an NRA return the level ordered reversal of its nodes values NRA 3 input serialization is represented in their level order traversal each group ... | N-ary Tree Level Order Traversal | n-ary-tree-level-order-traversal | Given an n-ary tree, return the _level order_ traversal of its nodes' values.
_Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples)._
**Example 1:**
**Input:** root = \[1,null,3,2,4,null,5,6\]
**Output:** \[\[1\],\[3,2,4\],\... | null | null | Medium | null |
124 | hey guys it's iran with another coding interview tutorial and this time we have binary tree maximum past sum it's labeled as elite code hard and it's not a simple question but i promise it's doable so let's start with the problem description a path in a binary tree is a sequence of nodes where each pair of adjacent nod... | Binary Tree Maximum Path Sum | binary-tree-maximum-path-sum | A **path** in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence **at most once**. Note that the path does not need to pass through the root.
The **path sum** of a path is the sum of the node's values in the path.
... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Hard | 112,129,666,687,1492 |
367 | welcome back everyone we're going to be solving Lee code 367 valid perfect square so we're given a positive integer num and we want to return true if num is a perfect square or false otherwise and they Define a perfect square as an integer that is the square of an integer in other words it is the product of some intege... | Valid Perfect Square | valid-perfect-square | Given a positive integer num, return `true` _if_ `num` _is a perfect square or_ `false` _otherwise_.
A **perfect square** is an integer that is the square of an integer. In other words, it is the product of some integer with itself.
You must not use any built-in library function, such as `sqrt`.
**Example 1:**
**In... | null | Math,Binary Search | Easy | 69,633 |
367 | hi quarters in today's video we'll discuss two problems problem number 367 and 69 on lead code the first problem will form the basis for the second problem and in second question we will order the return statement of template 1 which is very important so let's get started as I mentioned earlier we'll be given the numbe... | Valid Perfect Square | valid-perfect-square | Given a positive integer num, return `true` _if_ `num` _is a perfect square or_ `false` _otherwise_.
A **perfect square** is an integer that is the square of an integer. In other words, it is the product of some integer with itself.
You must not use any built-in library function, such as `sqrt`.
**Example 1:**
**In... | null | Math,Binary Search | Easy | 69,633 |
1,624 | uh hello guys uh today's problem is regarding the largest subring between two equal characters so let's see the what the problem says given a string s the length of the longest substring between the two equal characters including the two excluding the two characters if there is no such characters return minus one so he... | Largest Substring Between Two Equal Characters | clone-binary-tree-with-random-pointer | Given a string `s`, return _the length of the longest substring between two equal characters, excluding the two characters._ If there is no such substring return `-1`.
A **substring** is a contiguous sequence of characters within a string.
**Example 1:**
**Input:** s = "aa "
**Output:** 0
**Explanation:** The optim... | Traverse the tree, keep a hashtable with you and create a nodecopy for each node in the tree. Start traversing the original tree again and connect the left, right and random pointers in the cloned tree the same way as the original tree with the help of the hashtable. | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 133,138,1634 |
787 | in this video lecture we'll be solving this problem cheapest flights within case tops so we're given and cities connected by some number of flights so we have solved this problem using BFS approach in the previous video I've attached the link to that video in the description below so make sure to check it out so in thi... | Cheapest Flights Within K Stops | sliding-puzzle | There are `n` cities connected by some number of flights. You are given an array `flights` where `flights[i] = [fromi, toi, pricei]` indicates that there is a flight from city `fromi` to city `toi` with cost `pricei`.
You are also given three integers `src`, `dst`, and `k`, return _**the cheapest price** from_ `src` _... | Perform a breadth-first-search, where the nodes are the puzzle boards and edges are if two puzzle boards can be transformed into one another with one move. | Array,Breadth-First Search,Matrix | Hard | null |
1,846 | hello everyone and good morning to all of you today we have problem which name is maximum element after decreasing and rearranging lead code 1846 problem so before going forward in this video please make sure that you have liked and subscribed to this Channel and also it's my advice to all of you that please read the p... | Maximum Element After Decreasing and Rearranging | maximum-element-after-decreasing-and-rearranging | You are given an array of positive integers `arr`. Perform some operations (possibly none) on `arr` so that it satisfies these conditions:
* The value of the **first** element in `arr` must be `1`.
* The absolute difference between any 2 adjacent elements must be **less than or equal to** `1`. In other words, `abs... | null | null | Medium | null |
875 | Hello everyone welcome and welcome back to my channel Sourav Entries Ko Suna Do Problem Being Robbed Am Not Agree With You Pls Like And Subscribe My Channel Subha Because Notified When Ever Portion Units Without Any Positive Let's Get Started Research Problems Making Meeting Bananas Very Easy And Interesting Problem Li... | 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 |
134 | hi everyone thank you for watching this video if you like this kind of video please subscribe to my channel to receive any incoming video soon we will try to solve the so-called soon we will try to solve the so-called soon we will try to solve the so-called gas station 134 problem available on lead code platform if you... | 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 |
1,639 | hey everybody this is larry happy halloween yay uh this is me going over q4 of the week uh recent weekly by weekly contest 30a and i that's a mouthful uh hit the like button hit the subscribe button join me on discord and the problem was number of ways to form a target string given a dictionary so this one was a little... | Number of Ways to Form a Target String Given a Dictionary | friendly-movies-streamed-last-month | You are given a list of strings of the **same length** `words` and a string `target`.
Your task is to form `target` using the given `words` under the following rules:
* `target` should be formed from left to right.
* To form the `ith` character (**0-indexed**) of `target`, you can choose the `kth` character of th... | null | Database | Easy | null |
205 | Hello hello everyone welcome twelfth exactly entered a specific string in this question will give into strips acidity continue to determine the tenth and downwards of not that definition of life for more for this award to strings acidity rs modification in this can we do Subscribe to and electronic one example and in p... | Isomorphic Strings | isomorphic-strings | Given two strings `s` and `t`, _determine if they are isomorphic_.
Two strings `s` and `t` are isomorphic if the characters in `s` can be replaced to get `t`.
All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same characte... | null | Hash Table,String | Easy | 290 |
119 | hey YouTube Welcome again today we have this problem is uh Pascal's triangle the second one I guess the first one we solved before uh give it an integer row index return the row index value basically if we have a row index of three we should turn one three one so basically this is the uh the Pascal triangle basically e... | Pascal's Triangle II | pascals-triangle-ii | Given an integer `rowIndex`, return the `rowIndexth` (**0-indexed**) row of the **Pascal's triangle**.
In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown:
**Example 1:**
**Input:** rowIndex = 3
**Output:** \[1,3,3,1\]
**Example 2:**
**Input:** rowIndex = 0
**Output:** \[... | null | Array,Dynamic Programming | Easy | 118,2324 |
165 | hi all welcome to the channel hope you are all doing well so today's problem is uh compile number version which is the day nine of the september lead code challenge let's look at the problem okay so the problem is uh compare version numbers so basically they are given two strings version one and version two and this is... | Compare Version Numbers | compare-version-numbers | Given two version numbers, `version1` and `version2`, compare them.
Version numbers consist of **one or more revisions** joined by a dot `'.'`. Each revision consists of **digits** and may contain leading **zeros**. Every revision contains **at least one character**. Revisions are **0-indexed from left to right**, wit... | null | Two Pointers,String | Medium | null |
518 | welcome back and there's another daily code prompt so today it's called coin change two and so this is a dynamic program problem where essentially we're given an amount and a set of coins here and so we're going to try to use these coins to make up say this five dollars and essentially we're counting up all the possibl... | 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,706 | Challenge Where Will The Ball Fall What to do in this question is basically you are given a grid of MXN ok and what is there in the grade van is van and -1 is van means like this and minus van -1 is van means like this and minus van -1 is van means like this and minus van means like this ok So like this grade de rakhi ... | Where Will the Ball Fall | min-cost-to-connect-all-points | You have a 2-D `grid` of size `m x n` representing a box, and you have `n` balls. The box is open on the top and bottom sides.
Each cell in the box has a diagonal board spanning two corners of the cell that can redirect a ball to the right or to the left.
* A board that redirects the ball to the right spans the top... | Connect each pair of points with a weighted edge, the weight being the manhattan distance between those points. The problem is now the cost of minimum spanning tree in graph with above edges. | Array,Union Find,Minimum Spanning Tree | Medium | 2287 |
329 | Oh, in the name of God, the Most Gracious, the Most Merciful. May the peace, mercy, and blessings of God be upon you. Today I will explain with you the issue of Longest in the Crazing Bus in Matrix. The issue is the image of it. Hard on the code on the top of the Interfuse Problems. He starts out like this. He tries it... | 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,087 | okay hollered at a hot dish what is the challenge a gender shooting what your honor Louis XI Li colder Bonnie one image it should be Josh gates is it under I shall show concern on this is a me a traditional PR da Liang I said pursue the diva about one third or fourth century technology and just one tip i conce recipien... | Brace Expansion | longest-arithmetic-subsequence | You are given a string `s` representing a list of words. Each letter in the word has one or more options.
* If there is one option, the letter is represented as is.
* If there is more than one option, then curly braces delimit the options. For example, `"{a,b,c} "` represents options `[ "a ", "b ", "c "]`.
For ex... | null | Array,Hash Table,Binary Search,Dynamic Programming | Medium | null |
79 | hello and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem 79 word search given an m by n grid of characters board and a string word return true if the word exists in the grid the word can be constructed from letters of sequentially adjacent cells where adjacent cells ... | 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,026 | Hello friends, welcome to all of you, I am going to solve an interesting problem in today's video on YouTube channel. Before starting that problem, many congratulations to all of you for this year. Give you so much strength that whatever you want to check in this year, you can do it well, so let's talk about today's is... | Maximum Difference Between Node and Ancestor | string-without-aaa-or-bbb | Given the `root` of a binary tree, find the maximum value `v` for which there exist **different** nodes `a` and `b` where `v = |a.val - b.val|` and `a` is an ancestor of `b`.
A node `a` is an ancestor of `b` if either: any child of `a` is equal to `b` or any child of `a` is an ancestor of `b`.
**Example 1:**
**Input... | null | String,Greedy | Medium | null |
1,502 | hey everybody this is Larry this is me doing day six of the leeco daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's problem uh 1502 can make a arithmetic progression from sequence oh so this is just like relatively similar to yesterday uh yeah that'... | Can Make Arithmetic Progression From Sequence | construct-k-palindrome-strings | A sequence of numbers is called an **arithmetic progression** if the difference between any two consecutive elements is the same.
Given an array of numbers `arr`, return `true` _if the array can be rearranged to form an **arithmetic progression**. Otherwise, return_ `false`.
**Example 1:**
**Input:** arr = \[3,5,1\]... | If the s.length < k we cannot construct k strings from s and answer is false. If the number of characters that have odd counts is > k then the minimum number of palindrome strings we can construct is > k and answer is false. Otherwise you can construct exactly k palindrome strings and answer is true (why ?). | Hash Table,String,Greedy,Counting | Medium | null |
526 | hey what's up guys this is chung here again so this time 526 beautiful arrangement so you're given like n integers from 1 to n and we define a beautiful arrangement as an array that is constructed by these n numbers successfully if one of the following is true for each of the number basically at each of the position ri... | Beautiful Arrangement | beautiful-arrangement | Suppose you have `n` integers labeled `1` through `n`. A permutation of those `n` integers `perm` (**1-indexed**) is considered a **beautiful arrangement** if for every `i` (`1 <= i <= n`), **either** of the following is true:
* `perm[i]` is divisible by `i`.
* `i` is divisible by `perm[i]`.
Given an integer `n`,... | null | Array,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask | Medium | 667 |
1,646 | hey everybody this is larry this is day 15 of the january leco daily challenge uh hit the like button hit the subscribe button drop me on this car let me know what you think the mid of the month two weeks in wow time really fries huh um i updated adjusted the volume a little bit so let me know what you think uh and yea... | Get Maximum in Generated Array | kth-missing-positive-number | You are given an integer `n`. A **0-indexed** integer array `nums` of length `n + 1` is generated in the following way:
* `nums[0] = 0`
* `nums[1] = 1`
* `nums[2 * i] = nums[i]` when `2 <= 2 * i <= n`
* `nums[2 * i + 1] = nums[i] + nums[i + 1]` when `2 <= 2 * i + 1 <= n`
Return _the **maximum** integer in the... | Keep track of how many positive numbers are missing as you scan the array. | Array,Binary Search | Easy | 2305 |
1,762 | okay let's go uh because of the liquid 1762 buildings with the ocean view the question is that uh it describes that there are in buildings in your life they are giving a integer array has a size 8 that represented the height of the building online so the height is a building this already represents the building height ... | Buildings With an Ocean View | furthest-building-you-can-reach | There are `n` buildings in a line. You are given an integer array `heights` of size `n` that represents the heights of the buildings in the line.
The ocean is to the right of the buildings. A building has an ocean view if the building can see the ocean without obstructions. Formally, a building has an ocean view if al... | Assume the problem is to check whether you can reach the last building or not. You'll have to do a set of jumps, and choose for each one whether to do it using a ladder or bricks. It's always optimal to use ladders in the largest jumps. Iterate on the buildings, maintaining the largest r jumps and the sum of the remain... | Array,Greedy,Heap (Priority Queue) | Medium | null |
1 | hey welcome to this new series that i'm starting it is called tentatively called a leeco the day keeps the doctors away so welcome to my channel uh if this is your first time i really appreciate you being here uh what we're going to be doing in this series is we are going to be going through each leeco problem one by o... | Two Sum | two-sum | Given an array of integers `nums` and an integer `target`, return _indices of the two numbers such that they add up to `target`_.
You may assume that each input would have **_exactly_ one solution**, and you may not use the _same_ element twice.
You can return the answer in any order.
**Example 1:**
**Input:** nums... | A really brute force way would be to search for all possible pairs of numbers but that would be too slow. Again, it's best to try out brute force solutions for just for completeness. It is from these brute force solutions that you can come up with optimizations. So, if we fix one of the numbers, say x, we have to scan ... | Array,Hash Table | Easy | 15,18,167,170,560,653,1083,1798,1830,2116,2133,2320 |
1,721 | hello guys welcome back today we are going to understand to delete good question today we have the lead question lead code question is 1721 and we have to do the swapping of notes in a linked list means we have given a head of the link list and integer K as you can see in the input right we have given head is one two t... | Swapping Nodes in a Linked List | maximum-profit-of-operating-a-centennial-wheel | You are given the `head` of a linked list, and an integer `k`.
Return _the head of the linked list after **swapping** the values of the_ `kth` _node from the beginning and the_ `kth` _node from the end (the list is **1-indexed**)._
**Example 1:**
**Input:** head = \[1,2,3,4,5\], k = 2
**Output:** \[1,4,3,2,5\]
**Ex... | Think simulation Note that the number of turns will never be more than 50 / 4 * n | Array,Simulation | Medium | null |
389 | hi everyone i'm bianchakravati and today i'll be discussing late codes 389 problem that is find the difference so this is february 22 challenges day six prop sorry day seven problem and yeah it's an easy problem that is based on hash maps okay so let me like it yeah so we have been given two strings here s and t and st... | Find the Difference | find-the-difference | You are given two strings `s` and `t`.
String `t` is generated by random shuffling string `s` and then add one more letter at a random position.
Return the letter that was added to `t`.
**Example 1:**
**Input:** s = "abcd ", t = "abcde "
**Output:** "e "
**Explanation:** 'e' is the letter that was added.
**Exam... | null | Hash Table,String,Bit Manipulation,Sorting | Easy | 136 |
79 | Hello friends today I'm going to solve liquid problem number 79 word search in this problem we are given an M by n grid of characters board and a string word and we need to return a true if that word exists in this string else we are going to return of false and things to keep in mind is that we can only Traverse from ... | 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 |
728 | hello welcome to my channel again i'm here to do my 100 lego challenge and today we have lit code 728 and self-dividing numbers so a and self-dividing numbers so a and self-dividing numbers so a self-dividing number is a number that self-dividing number is a number that self-dividing number is a number that is dividabl... | Self Dividing Numbers | self-dividing-numbers | A **self-dividing number** is a number that is divisible by every digit it contains.
* For example, `128` is **a self-dividing number** because `128 % 1 == 0`, `128 % 2 == 0`, and `128 % 8 == 0`.
A **self-dividing number** is not allowed to contain the digit zero.
Given two integers `left` and `right`, return _a l... | For each number in the range, check whether it is self dividing by converting that number to a character array (or string in Python), then checking that each digit is nonzero and divides the original number. | Math | Easy | 507 |
35 | in this video we'll be going over search insert position so 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 so in our for example we have numbers 1 3 5 and six and our target is five target is fou... | 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,498 | hey so welcome back in this another daily go prom so today it was called number of subsequences that satisfy the given sum condition and it's a medium level question and so it's a little like twosome where if you're given this array here and as well as a Target that you're trying to achieve and you're trying to find th... | Number of Subsequences That Satisfy the Given Sum Condition | find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree | You are given an array of integers `nums` and an integer `target`.
Return _the number of **non-empty** subsequences of_ `nums` _such that the sum of the minimum and maximum element on it is less or equal to_ `target`. Since the answer may be too large, return it **modulo** `109 + 7`.
**Example 1:**
**Input:** nums =... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
394 | hello everyone welcome to coderscamp we are at 19th dave december league co challenge and the problem we are going to cover in this video is decode string so the input given here is a string yes which is in the encoded format and we have to return the decoded form of the given input encoded string so if for example if ... | 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 |
1,189 | Next question is lead code one 89 maximum number of balloons you will be given a string as written here ok you have to make words balloons ok how many awards can you make i.e. how many awards can you make i.e. how many awards can you make i.e. how many balloons can you make it will return to you Obviously once you have... | Maximum Number of Balloons | encode-number | Given a string `text`, you want to use the characters of `text` to form as many instances of the word **"balloon "** as possible.
You can use each character in `text` **at most once**. Return the maximum number of instances that can be formed.
**Example 1:**
**Input:** text = "nlaebolko "
**Output:** 1
**Example 2... | Try to find the number of binary digits returned by the function. The pattern is to start counting from zero after determining the number of binary digits. | Math,String,Bit Manipulation | Medium | 1070 |
907 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem sum of subarray minimums we're given an integer array and minb is basically defined as given some subarray like this one we are going to go through every single possible subarray now how many subarrays are there for an ... | Sum of Subarray Minimums | koko-eating-bananas | Given an array of integers arr, find the sum of `min(b)`, where `b` ranges over every (contiguous) subarray of `arr`. Since the answer may be large, return the answer **modulo** `109 + 7`.
**Example 1:**
**Input:** arr = \[3,1,2,4\]
**Output:** 17
**Explanation:**
Subarrays are \[3\], \[1\], \[2\], \[4\], \[3,1\], \... | null | Array,Binary Search | Medium | 788,1335,2188 |
25 | okay let's look at question 25 reverse notes in k group we have a linked list it's actually a group of K reverse notes in group of K naught K group so let's look at that the question we have a linked list we want to reverse the notes of our linked list K note at the time and return the handle to the modified a linked l... | Reverse Nodes in k-Group | reverse-nodes-in-k-group | Given the `head` of a linked list, reverse the nodes of the list `k` at a time, and return _the modified list_.
`k` is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of `k` then left-out nodes, in the end, should remain as it is.
You may not alt... | null | Linked List,Recursion | Hard | 24,528,2196 |
367 | square or false otherwise so a perfect square is an integer that is a square of an integer in other words it is a product of some integer within itself so as you know one and one would be one two so four three reasons all these are perfect squares and whether here we have to check whether the given integer is a perfect... | Valid Perfect Square | valid-perfect-square | Given a positive integer num, return `true` _if_ `num` _is a perfect square or_ `false` _otherwise_.
A **perfect square** is an integer that is the square of an integer. In other words, it is the product of some integer with itself.
You must not use any built-in library function, such as `sqrt`.
**Example 1:**
**In... | null | Math,Binary Search | Easy | 69,633 |
1,834 | all right what's up what is up guys today i'm going to talk about question 1834 single starting cpu now the question is the cpu is only single threaded and we have tasks scheduled at each time for example at one two three four and each test task takes a third amount of time and if a task that is scheduled after another... | Single-Threaded CPU | minimum-number-of-people-to-teach | You are given `n` tasks labeled from `0` to `n - 1` represented by a 2D integer array `tasks`, where `tasks[i] = [enqueueTimei, processingTimei]` means that the `ith` task will be available to process at `enqueueTimei` and will take `processingTimei` to finish processing.
You have a single-threaded CPU... | You can just use brute force and find out for each language the number of users you need to teach Note that a user can appear in multiple friendships but you need to teach that user only once | Array,Greedy | Medium | null |
394 | welcome to this new video where we'll solve a challenging coding problem the decode string problem we have an encoded string as and we want to decode it the encoding rule is a positive integer k followed by an encoded string between brackets that has to be repeated k times in the final output for example if we have ac3... | 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 |
219 | hey everybody welcome back to another lead code problem 219 contains duplicate 2 we have already done duplicate one and this is also an easy one and given an integer array nums and an integer care return true if there are two distinct indices I and J in the arrays such that nums at I is equal to nums at J and absolute ... | 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 |
290 | hey guys welcome to a new video in today's video we're going to look at a lead code problem and the problem's name is word pattern so in this question you're given a string called pattern and you're also given a string as consisting of multiple words or a single word now we have to check if the words present inside the... | Word Pattern | word-pattern | Given a `pattern` and a string `s`, find if `s` follows the same pattern.
Here **follow** means a full match, such that there is a bijection between a letter in `pattern` and a **non-empty** word in `s`.
**Example 1:**
**Input:** pattern = "abba ", s = "dog cat cat dog "
**Output:** true
**Example 2:**
**Input:*... | null | Hash Table,String | Easy | 205,291 |
210 | okay so lead code practice question in this video there are two goals the first goal is to see how to solve this problem of course so first of all we find the solution and then we do some coding work and the second goal is to see how we should behave in a real interview so let's get started so in a real interview remem... | 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 |
135 | hello everyone welcome to quartus camp we are our 27th day of june litco challenge and the problem we are going to cover today is candy so the input given here is an integer array that represent the rating for the children present and we have to return the minimum number of candies we need to distribute to the children... | Candy | candy | There are `n` children standing in a line. Each child is assigned a rating value given in the integer array `ratings`.
You are giving candies to these children subjected to the following requirements:
* Each child must have at least one candy.
* Children with a higher rating get more candies than their neighbors.... | null | Array,Greedy | Hard | null |
1,004 | hello and welcome back to the cracking fan YouTube channel today we're going to be solving leak code problem 1004 Max consecutive ones three before we get into the question prompt I just want to ask you guys to help me out please leave a like and a comment on the video the comment can literally be anything smash your f... | 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 |
763 | hey guys welcome back to another video and today we're going to be solving the lead code question partition labels all right so in this question we're given a string s of lowercase english letters so we want to partition the string into as many parts as possible so that each letter appears in at most one part and after... | 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 |
1,029 | Jhaal Hello Everyone Welcome to our channel attracts you, so from today we are starting the series of lift problem that day and today our first question is that two cities safe during question, what are you saying that the company is that line. Do an interview at Twenty People's website. It is telling you an important ... | Two City Scheduling | vertical-order-traversal-of-a-binary-tree | A company is planning to interview `2n` people. Given the array `costs` where `costs[i] = [aCosti, bCosti]`, the cost of flying the `ith` person to city `a` is `aCosti`, and the cost of flying the `ith` person to city `b` is `bCosti`.
Return _the minimum cost to fly every person to a city_ such that exactly `n` people... | null | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Hard | null |
609 | hello everyone today's lead code challenges find the duplicate files in systems we have given with a path and our goal is to find the file which contains the duplicate content so here you can see in example file path is root a one dot txt and 2.ps txt so one dot a one dot txt and 2.ps txt so one dot a one dot txt and 2... | Find Duplicate File in System | find-duplicate-file-in-system | Given a list `paths` of directory info, including the directory path, and all the files with contents in this directory, return _all the duplicate files in the file system in terms of their paths_. You may return the answer in **any order**.
A group of duplicate files consists of at least two files that have the same ... | null | Array,Hash Table,String | Medium | 2079 |
336 | Jhal Hello Everyone Tapa Sadhana Hai Self Trier He is 336 Loot Question and Rome Patient This is a shaped question Let's see Question What to do Ignore List of unique words written All the best of this painting IS S IF She is the giver list Superhit continuation of two words vada plus varche is petrol take some example... | 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 |
515 | hey guys thanks for joining in this video we're going to take a look at problem 515 on leak code find the largest value in each tree row so we'll do here is first we'll go with the problem description and take a look at the examples they provide then we'll discuss different ways we can implement a solution to the probl... | Find Largest Value in Each Tree Row | find-largest-value-in-each-tree-row | Given the `root` of a binary tree, return _an array of the largest value in each row_ of the tree **(0-indexed)**.
**Example 1:**
**Input:** root = \[1,3,2,5,3,null,9\]
**Output:** \[1,3,9\]
**Example 2:**
**Input:** root = \[1,2,3\]
**Output:** \[1,3\]
**Constraints:**
* The number of nodes in the tree will be... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
1,721 | Hello product value has to be taken out from the beginning and cap note has to be taken out from and both of them have to be folded. Actually, if we have to take out the starting then we will have to see that it is left of ours, how will this of ours come out, this of ours will come out like this, ours. The value on th... | Swapping Nodes in a Linked List | maximum-profit-of-operating-a-centennial-wheel | You are given the `head` of a linked list, and an integer `k`.
Return _the head of the linked list after **swapping** the values of the_ `kth` _node from the beginning and the_ `kth` _node from the end (the list is **1-indexed**)._
**Example 1:**
**Input:** head = \[1,2,3,4,5\], k = 2
**Output:** \[1,4,3,2,5\]
**Ex... | Think simulation Note that the number of turns will never be more than 50 / 4 * n | Array,Simulation | Medium | null |
295 | hello everyone let's solve another lead code problem and today's problem is problem 295 finding median from data Stream So as you know the median the definition of a median is the middle value of an ordered integer list suppose here is one ordered integer list 2 3 4 sorry uh so the median is three uh and if there are l... | Find Median from Data Stream | find-median-from-data-stream | The **median** is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two middle values.
* For example, for `arr = [2,3,4]`, the median is `3`.
* For example, for `arr = [2,3]`, the median is `(2 + 3) / 2 = 2.5`.
Implement the M... | null | Two Pointers,Design,Sorting,Heap (Priority Queue),Data Stream | Hard | 480,1953,2207 |
1,091 | in this video we're going to take a look at a legal problem called shortest path in binary matrix so we're given a 2d array and 0 symbolizes empty and one symbolizes a block right so we're trying to find the shortest path from the top left which is right here and to the bottom right which is right here basically if we ... | 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 |
1,943 | hey everybody this is laurie this is me going cute for you to buy weekly contest 57 describe the painting so this one is a tricky hit the like button hit the subscribe button join me on discord especially if you like doing contest problems then you know you can go over right after the contest together so anyway describ... | Describe the Painting | count-pairs-of-equal-substrings-with-minimum-difference | There is a long and thin painting that can be represented by a number line. The painting was painted with multiple overlapping segments where each segment was painted with a **unique** color. You are given a 2D integer array `segments`, where `segments[i] = [starti, endi, colori]` represents the **half-closed segment**... | If the chosen substrings are of size larger than 1, then you can remove all but the first character from both substrings, and you'll get equal substrings of size 1, with the same a but less j. Hence, it's always optimal to choose substrings of size 1. If you choose a specific letter, then it's optimal to choose its fir... | Hash Table,String,Greedy | Medium | null |
67 | foreign so before I actually kick off this video I have a couple of questions for you there are two first why sixty percent of you are not subscribed and second why do we don't have any females in the team we only have some genders over here all right enough now you want to get yourself in a Big Fish Company like Tesla... | Add Binary | add-binary | Given two binary strings `a` and `b`, return _their sum as a binary string_.
**Example 1:**
**Input:** a = "11", b = "1"
**Output:** "100"
**Example 2:**
**Input:** a = "1010", b = "1011"
**Output:** "10101"
**Constraints:**
* `1 <= a.length, b.length <= 104`
* `a` and `b` consist only of `'0'` or `'1'` chara... | null | Math,String,Bit Manipulation,Simulation | Easy | 2,43,66,1031 |
1,047 | hello today we're going to have leeco1047 remove all adjacent duplicates in strings without further explanation we can go straight to the example and can talk about it right now so the idea of this question is basically if we have abb aca and we will uh put a first and we put b in here and i'll keep putting more charac... | Remove All Adjacent Duplicates In String | maximize-sum-of-array-after-k-negations | You are given a string `s` consisting of lowercase English letters. A **duplicate removal** consists of choosing two **adjacent** and **equal** letters and removing them.
We repeatedly make **duplicate removals** on `s` until we no longer can.
Return _the final string after all such duplicate removals have been made_... | null | Array,Greedy,Sorting | Easy | 2204 |
1,669 | okay hello so today we're looking at question 1669 much in between linked lists you're given two linked lists list one and list two of sizes n and m respectively remove list one's notes from the eighth note to the b note and put this two in the place so here they have an illustration for us like a diagram i suppose um ... | Merge In Between Linked Lists | minimum-cost-to-cut-a-stick | You are given two linked lists: `list1` and `list2` of sizes `n` and `m` respectively.
Remove `list1`'s nodes from the `ath` node to the `bth` node, and put `list2` in their place.
The blue edges and nodes in the following figure indicate the result:
_Build the result list and return its head._
**Example 1:**
**In... | Build a dp array where dp[i][j] is the minimum cost to achieve all the cuts between i and j. When you try to get the minimum cost between i and j, try all possible cuts k between them, dp[i][j] = min(dp[i][k] + dp[k][j]) + (j - i) for all possible cuts k between them. | Array,Dynamic Programming | Hard | 2251 |
818 | so today we will be solving one more lead code question that is race car this is a problem which is being asked by multiple organizations like Google Amazon Microsoft and today we will be solving this particular question so this question says that your car starts at position zero and speed plus 1 on an infinite line yo... | Race Car | similar-rgb-color | Your car starts at position `0` and speed `+1` on an infinite number line. Your car can go into negative positions. Your car drives automatically according to a sequence of instructions `'A'` (accelerate) and `'R'` (reverse):
* When you get an instruction `'A'`, your car does the following:
* `position += spee... | null | Math,String,Enumeration | Easy | null |
1,685 | hey how's it going leak code 1685 sum of absolute difference in assorted array for some reason I thought I'd done this but uh doesn't say solved so you're given an integer array nums sorted in non- decreasing order build sorted in non- decreasing order build sorted in non- decreasing order build and return an integer a... | 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 |
239 | Hello Hi Everyone Welcome To My Channel It's All The Problem Sliding Window Maximum This Is Very Famous Interview Problem Share Governor Of India That Is Sliding Window Size Between Moving From The Very Fact That You Can Only See The Number One Position And Every Women For Example Problem appointed the element maximum ... | 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 |
732 | My Current Implement My Calendar First Option Interior's Representing D Largest Interior True Date Exist's Booking In D Calendar Okay if the first one what does it mean I am initially we have now to return maximum possible time so who knows any multiple If the events are overlapping, then the number of events that are ... | My Calendar III | my-calendar-iii | A `k`\-booking happens when `k` events have some non-empty intersection (i.e., there is some time that is common to all `k` events.)
You are given some events `[startTime, endTime)`, after each given event, return an integer `k` representing the maximum `k`\-booking between all the previous events.
Implement the `MyC... | Treat each interval [start, end) as two events "start" and "end", and process them in sorted order. | Design,Segment Tree,Ordered Set | Hard | 729,731 |
35 | okay let's talk about search insert position and uh you need a logo method and let's just jump to my example so one three five six targets five so i need to point at one point in the beginning the other one point at the end but the last point actually point at after the value six so which is index four okay and i need ... | 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 |
5 | hello everyone welcome back to my channel so today we are going to solve another problem is longest palindromic substring so in this problem we'll be given a string and we need to return the longest palindromic substrate let's see what this uh this mean so this string is given babad so the longest palindromic substring... | 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 |
316 | okay this question is giving me a lot of trouble basically given a string remove all duplicate letters such that the resulting string is less ecographically smallest so that basically means if i remove say for example an a here so i get this that's not that's greater lexicographically than if i remove the second egg be... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.