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 |
|---|---|---|---|---|---|---|---|---|
92 | okay hello so today we're looking at question 92 reverse linked list given the head of a singly linked list and two integers left and right where left is less than or equal to right reverse the notes of the list from position left to position right and return the reversed linked list here we're given two examples uh ex... | 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 |
865 | Quick Profit Loot See The Question Select With All The Best Phone In This Question Mez Pe What Is This What Is Distance To Must Subscribe Now To Subscribe My Channel Subscribe subscribe The Channel and subscribe the two Note 4 Do Which Contents All The Subscribe The Channel A Supposed to give one and me to find the tre... | Smallest Subtree with all the Deepest Nodes | robot-room-cleaner | Given the `root` of a binary tree, the depth of each node is **the shortest distance to the root**.
Return _the smallest subtree_ such that it contains **all the deepest nodes** in the original tree.
A node is called **the deepest** if it has the largest depth possible among any node in the entire tree.
The **subtre... | null | Backtracking,Interactive | Hard | 286,1931,1959,2203 |
1,749 | what's up guys welcome it's uh day 47 of the 100 days elite code um we got a good problem here it's a medium problem it's maximum absolute sum of mne sub array let's get right to it so it's a medium problem uh you're given an integer array nums the absolute sum of a sub array uh num and it basically just uh puts in mat... | Maximum Absolute Sum of Any Subarray | sellers-with-no-sales | You are given an integer array `nums`. The **absolute sum** of a subarray `[numsl, numsl+1, ..., numsr-1, numsr]` is `abs(numsl + numsl+1 + ... + numsr-1 + numsr)`.
Return _the **maximum** absolute sum of any **(possibly empty)** subarray of_ `nums`.
Note that `abs(x)` is defined as follows:
* If `x` is a negative... | null | Database | Easy | 1724 |
290 | everyone welcome back and let's write some more neat code today so today let's solve the problem word pattern we're given a pattern and a string s and we want to know if s follows the same pattern what do they mean by follows the same pattern well let's take a look at an example a pattern in this case is just going to ... | 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 |
51 | hello guys today we are going to see the r code question 51 that is n Queens uh this is a problem related to backtracking and recursion uh the N Queens puzzle is the problem of placing the N Queens on N cross n Chase board such that no two queen attack each other given an integer n return all the distinct solutions to ... | N-Queens | n-queens | The **n-queens** puzzle is the problem of placing `n` queens on an `n x n` chessboard such that no two queens attack each other.
Given an integer `n`, return _all distinct solutions to the **n-queens puzzle**_. You may return the answer in **any order**.
Each solution contains a distinct board configuration of the n-... | null | Array,Backtracking | Hard | 52,1043 |
771 | hello friends so today we're going to discuss again next problem in the latest hash table series and as you can see the second easy problem is jewels and stones so you are given a string j consisting of different types of stones that are jewels so as you can see in this string all the jewels are present and s represent... | Jewels and Stones | encode-n-ary-tree-to-binary-tree | You're given strings `jewels` representing the types of stones that are jewels, and `stones` representing the stones you have. Each character in `stones` is a type of stone you have. You want to know how many of the stones you have are also jewels.
Letters are case sensitive, so `"a "` is considered a different type o... | null | Tree,Depth-First Search,Breadth-First Search,Design,Binary Tree | Hard | 765 |
97 | hello friends my name is Tushar and today we are going to talk about the questions straight into the living problem so the question is given three strings you have to tell if third string is an interleaving of first and second string or not by actually living I mean that if third-straight should be that if third-straig... | Interleaving String | interleaving-string | Given strings `s1`, `s2`, and `s3`, find whether `s3` is formed by an **interleaving** of `s1` and `s2`.
An **interleaving** of two strings `s` and `t` is a configuration where `s` and `t` are divided into `n` and `m` substrings respectively, such that:
* `s = s1 + s2 + ... + sn`
* `t = t1 + t2 + ... + tm`
* `|... | null | String,Dynamic Programming | Medium | null |
316 | hello everyone I should be live now and okay I hope everyone can hear and see me clearly if that is the case you can just type yes in the chat box can you guys hear and see me you can okay all good yeah I'm good how is everyone how are you all did you get some time to try your hands out on this question how many of you... | 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 |
134 | hey guys welcome back to another video and today we're going to be following the lead code question gas station all right so let's start off by just reading the question and then i'll explain what the question actually means okay so in this question there are n gas stations along a circular route where the amount of ga... | 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 |
6 | okay question six leak code zigzag conversion the string paypal is hiring is written in a zigzag pattern on a given number of rows like this you may want to display this pattern in a fixed font for better legibility and then read line by line so we have p a h n etc so we need to convert this string into this so going d... | Zigzag Conversion | zigzag-conversion | The string `"PAYPALISHIRING "` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S I I G
Y I R
And then read line by line: `"PAHNAPLSIIGYIR "`
Write the code that will take a string and make this co... | null | String | Medium | null |
394 | hello everyone welcome to another episode of the blasphemy by uh my name is atul john and it's been a long time since we did a video so i think it's time for us to get back on track and start working on some problems right so just a couple of things that are going on in my life i recently uh took up a role with cisco i... | 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 |
303 | all right let's talk about range some query immutable so given integer array numbers handle multiple query of the following type so you have the class num3 and you need to know there's a constructor and initialize it in array and also the sum range which takes two argument which is left and right so you have to return ... | 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,644 | hello and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem 1644 lowest common ancestor of a binary tree 2. let's read the question prompt given the root of a binary tree return the lowest common ancestor lca of two nodes p and q either node p or q does not exist in the... | Lowest Common Ancestor of a Binary Tree II | maximum-number-of-non-overlapping-substrings | Given the `root` of a binary tree, return _the lowest common ancestor (LCA) of two given nodes,_ `p` _and_ `q`. If either node `p` or `q` **does not exist** in the tree, return `null`. All values of the nodes in the tree are **unique**.
According to the **[definition of LCA on Wikipedia](https://en.wikipedia.org/wiki/... | Notice that it's impossible for any two valid substrings to overlap unless one is inside another. We can start by finding the starting and ending index for each character. From these indices, we can form the substrings by expanding each character's range if necessary (if another character exists in the range with small... | String,Greedy | Hard | null |
1,091 | So hi gas this is today's daily lead code problem the name of this problem is shortest pathri matrix and in this problem you have to return a n cross n key and you have to return d length of d shortest clear text in d matrix you have to return a shortest text and This is no clear pass written -1 ok obviously no clear p... | 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,061 | thank you welcome you all to the channel one stop for Python and this is the first video in the daily lead code series uh the very basic motive behind starting this series is that people are not that friendly while writing code in Python therefore this video is for newbies and also for the mid-level programmers who als... | Lexicographically Smallest Equivalent String | number-of-valid-subarrays | You are given two strings of the same length `s1` and `s2` and a string `baseStr`.
We say `s1[i]` and `s2[i]` are equivalent characters.
* For example, if `s1 = "abc "` and `s2 = "cde "`, then we have `'a' == 'c'`, `'b' == 'd'`, and `'c' == 'e'`.
Equivalent characters follow the usual rules of any equivalence rela... | Given a data structure that answers queries of the type to find the minimum in a range of an array (Range minimum query (RMQ) sparse table) in O(1) time. How can you solve this problem? For each starting index do a binary search with an RMQ to find the ending possible position. | Array,Stack,Monotonic Stack | Hard | 2233 |
532 | hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you have not liked the video please like it subscribe to my channel and hit the bell icon so that you get notified whenever i post a new video so without any further ado let's get started so... | K-diff Pairs in an Array | k-diff-pairs-in-an-array | Given an array of integers `nums` and an integer `k`, return _the number of **unique** k-diff pairs in the array_.
A **k-diff** pair is an integer pair `(nums[i], nums[j])`, where the following are true:
* `0 <= i, j < nums.length`
* `i != j`
* `nums[i] - nums[j] == k`
**Notice** that `|val|` denotes the absol... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Medium | 530,2116,2150 |
232 | hi guys today I'm going to solve lead code question number 232 that is Implement a q using a stack in this question we have to basically create a q using Stacks so first we have to keep in mind that Q follows the first and first out method that is fif however stacks on the other hand follow the last in first out method... | Implement Queue using Stacks | implement-queue-using-stacks | Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (`push`, `peek`, `pop`, and `empty`).
Implement the `MyQueue` class:
* `void push(int x)` Pushes element x to the back of the queue.
* `int pop()` Removes the element from th... | null | Stack,Design,Queue | Easy | 225 |
1,029 | hello friends today we like status fish from him problem number 1 0 to 9 to 15 skip you said this question you are given that when people are applying for a company and young people find to me and the company are paying for the cost and the ayat person replied to that a city it cost the company first I and if it cost f... | 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 |
1,603 | hey everyone welcome back today we are going to solve problem number 1603 design parking system first we'll see the explanation of the problem statement then the logic and the code let's dive into the solution so here I have taken the first example from the late crop site so in this problem we need to design a parking ... | Design Parking System | running-sum-of-1d-array | Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size.
Implement the `ParkingSystem` class:
* `ParkingSystem(int big, int medium, int small)` Initializes object of the `ParkingSystem` class. The number of slot... | Think about how we can calculate the i-th number in the running sum from the (i-1)-th number. | Array,Prefix Sum | Easy | null |
1,675 | High Gauge Our question today is Minimum Division Hey, so basically in this question we will be given an Hey and we will perform operation on Era, if and is the element of Hey, then we will divide it by Tu, if Eric element is OD then we will divide it by If we multiply by tu, then by doing this, basically what do we ha... | Minimize Deviation in Array | magnetic-force-between-two-balls | You are given an array `nums` of `n` positive integers.
You can perform two types of operations on any element of the array any number of times:
* If the element is **even**, **divide** it by `2`.
* For example, if the array is `[1,2,3,4]`, then you can do this operation on the last element, and the array wil... | If you can place balls such that the answer is x then you can do it for y where y < x. Similarly if you cannot place balls such that the answer is x then you can do it for y where y > x. Binary search on the answer and greedily see if it is possible. | Array,Binary Search,Sorting | Medium | 2188 |
849 | Jhala Hello and welcome to your consideration question maximum subscribe to aao na dil at least one lamp's 35th labs subscribe to subscribe And subscribe The Amazing and mist appointed vitamin E ki koi directly write candidate setting on your head in between how to PT The second Chief Selector of the States passed left... | Maximize Distance to Closest Person | maximize-distance-to-closest-person | You are given an array representing a row of `seats` where `seats[i] = 1` represents a person sitting in the `ith` seat, and `seats[i] = 0` represents that the `ith` seat is empty **(0-indexed)**.
There is at least one empty seat, and at least one person sitting.
Alex wants to sit in the seat such that the distance b... | null | null | Medium | null |
58 | hi my name is david today we're going to do a leak code problem number 58 length of last word this is an easy level problem i want to solve it in javascript so we're giving a string as consisting of some words separated by some number of spaces return the length of the last word in the string so we can look at an examp... | Length of Last Word | length-of-last-word | Given a string `s` consisting of words and spaces, return _the length of the **last** word in the string._
A **word** is a maximal substring consisting of non-space characters only.
**Example 1:**
**Input:** s = "Hello World "
**Output:** 5
**Explanation:** The last word is "World " with length 5.
**Example 2:**
... | null | String | Easy | null |
762 | hello welcome to the solving of another leapfrog problem that is problem number 762 that is prime number of set bits in binary representation so the problem statement given here is given two integers left and right return the count of numbers in the inclusive range of left and right having a prime number of set bits in... | Prime Number of Set Bits in Binary Representation | find-anagram-mappings | Given two integers `left` and `right`, return _the **count** of numbers in the **inclusive** range_ `[left, right]` _having a **prime number of set bits** in their binary representation_.
Recall that the **number of set bits** an integer has is the number of `1`'s present when written in binary.
* For example, `21`... | Create a hashmap so that D[x] = i whenever B[i] = x. Then, the answer is [D[x] for x in A]. | Array,Hash Table | Easy | null |
1,002 | okay the question is find common characters and i'm going to summarize the question i'm not going to read it and so the question is actually telling you to find a common character for a given string array and for each string you do store each character and counting the number of the frequency so b occurred one e occur ... | Find Common Characters | maximum-width-ramp | Given a string array `words`, return _an array of all characters that show up in all strings within the_ `words` _(including duplicates)_. You may return the answer in **any order**.
**Example 1:**
**Input:** words = \["bella","label","roller"\]
**Output:** \["e","l","l"\]
**Example 2:**
**Input:** words = \["cool"... | null | Array,Stack,Monotonic Stack | Medium | null |
238 | in this video we'll go over lead code question number 238 product of array except self given an integer array nums we have to return an array products such that the ith element in products is equal to the product of all the elements of nums except the ith element of nums there's also two restrictions the algorithm must... | 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,669 | hello guys my name is lazaro and today we'll be doing a decode problem this problem is called merge in between linked lists you're given two linked lists list one and list two of sizes n and m respectively now this right here already tells me that both lists would not have the same size they could have the same size bu... | 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 |
299 | MP3 Hello Sunao I Hope You Are Doing Well So today we will discuss the next question of the album master sheet. The name of the question is that of Britain. So first of all friend and my request is that it is okay to like this question because There are 20 very good questions and one of them gives a very nice idea to y... | Bulls and Cows | bulls-and-cows | You are playing the **[Bulls and Cows](https://en.wikipedia.org/wiki/Bulls_and_Cows)** game with your friend.
You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint with the following info:
* The number of "bulls ", which are digits in the ... | null | Hash Table,String,Counting | Medium | null |
1,862 | That welcome back price today lotu year print code problem 1962 time to flower tree aa so let's locator description give research problem notes with 902 - 1410 is the root node problem notes with 902 - 1410 is the root node problem notes with 902 - 1410 is the root node and parental mode of noida this is father aaye na... | Sum of Floored Pairs | count-apples-and-oranges | Given an integer array `nums`, return the sum of `floor(nums[i] / nums[j])` for all pairs of indices `0 <= i, j < nums.length` in the array. Since the answer may be too large, return it **modulo** `109 + 7`.
The `floor()` function returns the integer part of the division.
**Example 1:**
**Input:** nums = \[2,5,9\]
*... | null | Database | Medium | null |
637 | hi guys welcome to algorithms made easy in this video we will see the question average of levels in a binary tree given a non-empty binary tree we need to a non-empty binary tree we need to a non-empty binary tree we need to return the average value of the nodes on each level in the form of an array in this particular ... | Average of Levels in Binary Tree | average-of-levels-in-binary-tree | Given the `root` of a binary tree, return _the average value of the nodes on each level in the form of an array_. Answers within `10-5` of the actual answer will be accepted.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[3.00000,14.50000,11.00000\]
Explanation: The average value of nodes on... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 102,107 |
349 | hello and welcome to another video in this video we're going to be doing a similar problem to yesterday and it's going to be intersection of two arrays so in this problem given to arrays return an array of their intersection each element must be unique and you may return the result in any order so the way you can get a... | 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 |
350 | hey guys how's everything going this is chaser in this video I'm going to take another take a look at another easy problem the 350 intersection of two arrays - I will give in to erase like 1 arrays - I will give in to erase like 1 arrays - I will give in to erase like 1 2 1 and 2 we write the function to compute their ... | Intersection of Two Arrays II | intersection-of-two-arrays-ii | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must appear as many times as it shows in both arrays and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2,2\]
**Example 2:**
**I... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 349,1044,1392,2282 |
1,732 | okay super easy questions today you give it an array in the array you have the net gain and altitude between two points and you want to turn at which we want to turn the highest altitude of any point that we get up to so in this example they have a biker going uphill all right so say for example this if these are the g... | Find the Highest Altitude | minimum-one-bit-operations-to-make-integers-zero | There is a biker going on a road trip. The road trip consists of `n + 1` points at different altitudes. The biker starts his trip on point `0` with altitude equal `0`.
You are given an integer array `gain` of length `n` where `gain[i]` is the **net gain in altitude** between points `i` and `i + 1` for all (`0 <=... | The fastest way to convert n to zero is to remove all set bits starting from the leftmost one. Try some simple examples to learn the rule of how many steps are needed to remove one set bit. consider n=2^k case first, then solve for all n. | Dynamic Programming,Bit Manipulation,Memoization | Hard | 2119 |
334 | There is gas, thousands of questions are going to be seen, their zinc is different subjects, so for money it is said that one is given, that is running, there are 3 such numbers, they are in increasing order and their index will also increase, inverter tap topper. We can come to the question that who has taken the samp... | Increasing Triplet Subsequence | increasing-triplet-subsequence | Given an integer array `nums`, return `true` _if there exists a triple of indices_ `(i, j, k)` _such that_ `i < j < k` _and_ `nums[i] < nums[j] < nums[k]`. If no such indices exists, return `false`.
**Example 1:**
**Input:** nums = \[1,2,3,4,5\]
**Output:** true
**Explanation:** Any triplet where i < j < k is valid.
... | null | Array,Greedy | Medium | 300,2122,2280 |
783 | hello everyone welcome or welcome back to coding Champs in today's video we are going to be solving the problem minimum distance between BST notes BST stands for binary search tree and before solving the problem if you are not yet subscribed to codingcharms consider subscribing for coding and interview related videos a... | Minimum Distance Between BST Nodes | search-in-a-binary-search-tree | Given the `root` of a Binary Search Tree (BST), return _the minimum difference between the values of any two different nodes in the tree_.
**Example 1:**
**Input:** root = \[4,2,6,1,3\]
**Output:** 1
**Example 2:**
**Input:** root = \[1,0,48,null,null,12,49\]
**Output:** 1
**Constraints:**
* The number of nodes... | null | Tree,Binary Search Tree,Binary Tree | Easy | 270,784 |
239 | hello everyone today we are going to solve this sliding window maximum problem sliding the so now our audio is working correctly so what we have to do in this problem we will be given an error and inside that area we will also be given a window let's say the window of three so in this area what you have to do you have ... | 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 |
105 | so hello everyone ajam problem solving a construct binary tree from pre-order it in order traversal so pre-order it in order traversal so pre-order it in order traversal so i see coding videos and then i commented like do commentary along with it so please consider subscribing this channel as it really helps the channe... | 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 |
743 | hello welcome back today I will solve Reco 743 Network delay time we given a network of end notes labels one to n and we are given also the time it takes for a signal to travel from one note to another we will also given the source node and the question is what's the minimum time it will take for signal to travel from ... | Network Delay Time | closest-leaf-in-a-binary-tree | You are given a network of `n` nodes, labeled from `1` to `n`. You are also given `times`, a list of travel times as directed edges `times[i] = (ui, vi, wi)`, where `ui` is the source node, `vi` is the target node, and `wi` is the time it takes for a signal to travel from source to target.
We will send a signal from a... | Convert the tree to a general graph, and do a breadth-first search. Alternatively, find the closest leaf for every node on the path from root to target. | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
495 | welcome to september's leco challenge today's problem is teemo attacking in lol world league of legends there is a hero called teemo and his attacking can make his enemy ash be in poison condition now given teemo's attacking ascending time series so that's going to be a sorted list of integers towards ash and the poiso... | Teemo Attacking | teemo-attacking | Our hero Teemo is attacking an enemy Ashe with poison attacks! When Teemo attacks Ashe, Ashe gets poisoned for a exactly `duration` seconds. More formally, an attack at second `t` will mean Ashe is poisoned during the **inclusive** time interval `[t, t + duration - 1]`. If Teemo attacks again **before** the poison effe... | null | Array,Simulation | Easy | 56,605,649 |
72 | hello everyone let's solve today's problem edit distance at the distance is also known as living time distance it is a measure of the similarity between two strings of characters it is defined as minimum number of insertions deletions or replacement required to transform one string into the another in this problem word... | Edit Distance | edit-distance | Given two strings `word1` and `word2`, return _the minimum number of operations required to convert `word1` to `word2`_.
You have the following three operations permitted on a word:
* Insert a character
* Delete a character
* Replace a character
**Example 1:**
**Input:** word1 = "horse ", word2 = "ros "
**O... | null | String,Dynamic Programming | Hard | 161,583,712,1105,2311 |
3 | hello everyone welcome to code and learn in this video we are going to look at lead code problem three finding the log as substring without repeating characters in a given string let's go over the problem statement first given a string as find the length of longest substring without repeating correctors so we will be g... | Longest Substring Without Repeating Characters | longest-substring-without-repeating-characters | Given a string `s`, find the length of the **longest** **substring** without repeating characters.
**Example 1:**
**Input:** s = "abcabcbb "
**Output:** 3
**Explanation:** The answer is "abc ", with the length of 3.
**Example 2:**
**Input:** s = "bbbbb "
**Output:** 1
**Explanation:** The answer is "b ", with t... | null | Hash Table,String,Sliding Window | Medium | 159,340,1034,1813,2209 |
232 | all right so this question is called implement Q using Stax it says implement the following operations of with Q using stacks push which pushes an element in the back of a Q pop which removes the element from in front of the Q peak which gets the front element and empty which returns whether the queue is empty so it gi... | Implement Queue using Stacks | implement-queue-using-stacks | Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (`push`, `peek`, `pop`, and `empty`).
Implement the `MyQueue` class:
* `void push(int x)` Pushes element x to the back of the queue.
* `int pop()` Removes the element from th... | null | Stack,Design,Queue | Easy | 225 |
509 | um hello so today we are going to do this problem called Fibonacci numbers um so basically what the problem says is that um it's a standard a Fibonacci problem um it's usually um given as um as a problem either for a collision or a dynamic programming but here basically it's Fibonacci Sequence and we have F of zero is ... | Fibonacci Number | inorder-successor-in-bst-ii | The **Fibonacci numbers**, commonly denoted `F(n)` form a sequence, called the **Fibonacci sequence**, such that each number is the sum of the two preceding ones, starting from `0` and `1`. That is,
F(0) = 0, F(1) = 1
F(n) = F(n - 1) + F(n - 2), for n > 1.
Given `n`, calculate `F(n)`.
**Example 1:**
**Input:** n = ... | null | Tree,Binary Search Tree,Binary Tree | Medium | 285 |
885 | Hello everyone welcome back to me channel once again so here people are going to talk finally lead code in the big of spiral matrix 3 and this problem was striking this problem basically the sequence of this is spiral matrix one two three four and its full one And all the three videos which I have already uploaded on t... | Spiral Matrix III | exam-room | You start at the cell `(rStart, cStart)` of an `rows x cols` grid facing east. The northwest corner is at the first row and column in the grid, and the southeast corner is at the last row and column.
You will walk in a clockwise spiral shape to visit every position in this grid. Whenever you move outside the grid's bo... | null | Design,Ordered Set | Medium | 879 |
54 | lead code 54 spiral Matrix in JavaScript this is a messy problem it's got four pointers and four functions that update those pointers each function that updates the pointer also has to keep track of where it is along the position for that pointer and it's messy and I'll get into it um I have a demo that goes along with... | Spiral Matrix | spiral-matrix | Given an `m x n` `matrix`, return _all elements of the_ `matrix` _in spiral order_.
**Example 1:**
**Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[1,2,3,6,9,8,7,4,5\]
**Example 2:**
**Input:** matrix = \[\[1,2,3,4\],\[5,6,7,8\],\[9,10,11,12\]\]
**Output:** \[1,2,3,4,8,12,11,10,9,5,6,7\]
**Const... | Well for some problems, the best way really is to come up with some algorithms for simulation. Basically, you need to simulate what the problem asks us to do. We go boundary by boundary and move inwards. That is the essential operation. First row, last column, last row, first column and then we move inwards by 1 and th... | Array,Matrix,Simulation | Medium | 59,921 |
1,996 | Ajay Ko Hello Hi Friends Welcome Back Today We Are Going To Solve There Problem In This Six Number Disorder Actor-Singer Kam So Let's Go Through The Disorder Actor-Singer Kam So Let's Go Through The Disorder Actor-Singer Kam So Let's Go Through The Description Of The Problem And Will Look Better While Examples Explain ... | The Number of Weak Characters in the Game | number-of-ways-to-rearrange-sticks-with-k-sticks-visible | You are playing a game that contains multiple characters, and each of the characters has **two** main properties: **attack** and **defense**. You are given a 2D integer array `properties` where `properties[i] = [attacki, defensei]` represents the properties of the `ith` character in the game.
A character is said to be... | Is there a way to build the solution from a base case? How many ways are there if we fix the position of one stick? | Math,Dynamic Programming,Combinatorics | Hard | null |
172 | Hello Everyone Myself Devanshu Kumar And Today I Solved Question No. 172 Of Lead Code And The Question Says Given An Integer And Return The Number Of Trailing Zero In A Factorial So The Question Is Telling Us Given An Integer A And after calculating the factorial, we have to tell by counting how many zeros are there in... | Factorial Trailing Zeroes | factorial-trailing-zeroes | Given an integer `n`, return _the number of trailing zeroes in_ `n!`.
Note that `n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1`.
**Example 1:**
**Input:** n = 3
**Output:** 0
**Explanation:** 3! = 6, no trailing zero.
**Example 2:**
**Input:** n = 5
**Output:** 1
**Explanation:** 5! = 120, one trailing zero.
**Exa... | null | Math | Medium | 233,809,2222 |
1,458 | Hello everyone welcome to my channel quote sorry with mike so today we are going to do video number 67 of our dynamic prime playlist ok so the lead number is 1458 today is a hard mark but it is quite easy actually this is a dp named lcs The concept is Longest Common Subsequence. The code is an exact copy for those who ... | 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 |
138 | Hello Hi Everyone Welcome To My Channel It's All The Problem Copy List With Random Pointer Sudhir Very Famous Problem Benefits Of Interviews Frequently Which Problem Is Gothami In 2019 One Of The Company When It Was Entering So You Can Watch This Video And Read This Problem Statement This And Services Pure Problem Is G... | Copy List with Random Pointer | copy-list-with-random-pointer | A linked list of length `n` is given such that each node contains an additional random pointer, which could point to any node in the list, or `null`.
Construct a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) of the list. The deep copy should consist of exactly `n` **brand new** nodes, where e... | Just iterate the linked list and create copies of the nodes on the go. Since a node can be referenced from multiple nodes due to the random pointers, make sure you are not making multiple copies of the same node. You may want to use extra space to keep old node ---> new node mapping to prevent creating multiples copies... | Hash Table,Linked List | Medium | 133,1624,1634 |
824 | Hello guys welcome to front in DC today they will go through there no problem if video channel please like Thursday subscribe definitely subscribe to this website with all through but follow according to rule first apple me to interest remember and Heart to the Video then subscribe to the Page if you liked The Video th... | Goat Latin | number-of-lines-to-write-string | You are given a string `sentence` that consist of words separated by spaces. Each word consists of lowercase and uppercase letters only.
We would like to convert the sentence to "Goat Latin " (a made-up language similar to Pig Latin.) The rules of Goat Latin are as follows:
* If a word begins with a vowel (`'a'`, `... | null | Array,String | Easy | null |
118 | hey what's up guys it is Nick white here and I do tech and coding stuff on Twitch YouTube check the description you get all my stuff and we are just doing a we're doing all the leak code problems alright so I'm still in the easy ones so and I'm trying to get better at explaining them over time which I definitely will b... | Pascal's Triangle | pascals-triangle | Given an integer `numRows`, return the first numRows of **Pascal's triangle**.
In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown:
**Example 1:**
**Input:** numRows = 5
**Output:** \[\[1\],\[1,1\],\[1,2,1\],\[1,3,3,1\],\[1,4,6,4,1\]\]
**Example 2:**
**Input:** numRows = ... | null | Array,Dynamic Programming | Easy | 119 |
117 | hey everybody this is larry this is day six of the dissembly code daily challenge uh hit the like button hit the subscriber and drum and disco let me know what you think about today's farm populate populating next white point is in each note too and i usually solve this live um including the explanation so if you want ... | 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 |
971 | hey what's up guys uh this is chung here so today uh daily challenge problem number 971 flip binary tree to match pre-order traversal um to match pre-order traversal um to match pre-order traversal um so this is like another three problem basically you're given like a tree uh and then you're also given like the uh a vo... | Flip Binary Tree To Match Preorder Traversal | shortest-bridge | You are given the `root` of a binary tree with `n` nodes, where each node is uniquely assigned a value from `1` to `n`. You are also given a sequence of `n` values `voyage`, which is the **desired** [**pre-order traversal**](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order) of the binary tree.
Any node in the bi... | null | Array,Depth-First Search,Breadth-First Search,Matrix | Medium | null |
168 | hello in this video we are going to discuss the lead code problem number 168 Excel sheet column title in this problem they will give you a number right they will give you a number like what this they will give you and number you need to return the Excel sheets column title right for example yeah Excel sheet is like thi... | Excel Sheet Column Title | excel-sheet-column-title | Given an integer `columnNumber`, return _its corresponding column title as it appears in an Excel sheet_.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
**Example 1:**
**Input:** columnNumber = 1
**Output:** "A "
**Example 2:**
**Input:** columnNumber = 28
**Output:** "AB "
**Example 3:**... | null | Math,String | Easy | 171,2304 |
1,405 | everyone welcome back and let's write some more neat code today so today let's solve the problem longest happy string a string s is defined as being happy if it follows uh if it satisfies the following conditions it has to be made up of only a b and c characters it cannot contain three consecutive a's three consecutive... | Longest Happy String | all-people-report-to-the-given-manager | A string `s` is called **happy** if it satisfies the following conditions:
* `s` only contains the letters `'a'`, `'b'`, and `'c'`.
* `s` does not contain any of `"aaa "`, `"bbb "`, or `"ccc "` as a substring.
* `s` contains **at most** `a` occurrences of the letter `'a'`.
* `s` contains **at most** `b` occurr... | null | Database | Medium | null |
100 | hi my name is david today we're going to do number 100 same tree this is an easy level problem on lead code i want to solve it in javascript so we're giving the roots of two pi binary trees p and q here and here's the binary tree function and we want to see if they're identical or not so we can look at this example one... | 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 |
307 | Hello friends to Jhal Ajay, once again welcome all of you to my YouTube channel Tehri, so what is the question of the list in today's video, Rains is our problem of the day. In today's question, a little towards the concept segment. If you watch the complete video then you will understand the concept but please do like... | Range Sum Query - Mutable | range-sum-query-mutable | Given an integer array `nums`, handle multiple queries of the following types:
1. **Update** the value of an element in `nums`.
2. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`.
Implement the `NumArray` class:
* `NumArray(int[] nums)` Initi... | null | Array,Design,Binary Indexed Tree,Segment Tree | Medium | 303,308 |
56 | hello guys welcome to algorithms made easy today we will be discussing the question merge intervals in this question we are given intervals array and we need to merge all the overlapping intervals and return an array of the non-overlapping intervals array of the non-overlapping intervals array of the non-overlapping in... | Merge Intervals | merge-intervals | Given an array of `intervals` where `intervals[i] = [starti, endi]`, merge all overlapping intervals, and return _an array of the non-overlapping intervals that cover all the intervals in the input_.
**Example 1:**
**Input:** intervals = \[\[1,3\],\[2,6\],\[8,10\],\[15,18\]\]
**Output:** \[\[1,6\],\[8,10\],\[15,18\]\... | null | Array,Sorting | Medium | 57,252,253,495,616,715,761,768,1028,2297,2319 |
118 | in this video we'll be going over pascal's triangle so given a non-negative integer known so given a non-negative integer known so given a non-negative integer known rows generate the first numbers of pascal triangle so in this triangle we have an initial row of one and in each of the additional rows we have a one in t... | Pascal's Triangle | pascals-triangle | Given an integer `numRows`, return the first numRows of **Pascal's triangle**.
In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown:
**Example 1:**
**Input:** numRows = 5
**Output:** \[\[1\],\[1,1\],\[1,2,1\],\[1,3,3,1\],\[1,4,6,4,1\]\]
**Example 2:**
**Input:** numRows = ... | null | Array,Dynamic Programming | Easy | 119 |
231 | 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 power of two so in this question we are given an integer n and we have to return true if it is a power of true else we have to return false so the return type is a Boolean so this is the condition we ha... | 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,647 | hey everybody this is larry this is me going with q2 of the weekly contest to 14. minimum deletions to make out this frequency unique so this one requires a little bit of thinking and also a little bit of just thinking about the complexion of the problem so for me it turns out that how i solved it was just using greedy... | Minimum Deletions to Make Character Frequencies Unique | can-convert-string-in-k-moves | A string `s` is called **good** if there are no two different characters in `s` that have the same **frequency**.
Given a string `s`, return _the **minimum** number of characters you need to delete to make_ `s` _**good**._
The **frequency** of a character in a string is the number of times it appears in the string. F... | Observe that shifting a letter x times has the same effect of shifting the letter x + 26 times. You need to check whether k is large enough to cover all shifts with the same remainder after modulo 26. | Hash Table,String | Medium | null |
312 | A Quiet Guys Welcome To Our Channel Code With Honey And Like Pyaar Dard Ko Statistics And Channel You Can Easily Noticed A Towering Back Again After Few Months Kepler Two And Three Qualities So Also Like It Notice The Day Is Relatives January First So And This Is The Meaning of the name It is soft for wishing everyone ... | Burst Balloons | burst-balloons | You are given `n` balloons, indexed from `0` to `n - 1`. Each balloon is painted with a number on it represented by an array `nums`. You are asked to burst all the balloons.
If you burst the `ith` balloon, you will get `nums[i - 1] * nums[i] * nums[i + 1]` coins. If `i - 1` or `i + 1` goes out of bounds of the array, ... | null | Array,Dynamic Programming | Hard | 1042 |
318 | hello YouTube this is another nickel problem called maximum product of long lenses keeping a screen or rewards find the maximum value of lens for both I multiply Lanza was Jay where are the two Bertino sheis common errors which means that there is no common arrows between the three words you may assume that were workin... | Maximum Product of Word Lengths | maximum-product-of-word-lengths | Given a string array `words`, return _the maximum value of_ `length(word[i]) * length(word[j])` _where the two words do not share common letters_. If no such two words exist, return `0`.
**Example 1:**
**Input:** words = \[ "abcw ", "baz ", "foo ", "bar ", "xtfn ", "abcdef "\]
**Output:** 16
**Explanation:** The two ... | null | Array,String,Bit Manipulation | Medium | null |
1,689 | hey everyone today we're doing leak coat Challenge number 1689 called partitioning into minimum number of deci binary numbers so in this challenge it tells us that a decimal number is called decibinary if each of its digits are either 0 or 1 without any leading zeros for example the numbers 101 and 1100 are decibinary ... | Partitioning Into Minimum Number Of Deci-Binary Numbers | detect-pattern-of-length-m-repeated-k-or-more-times | A decimal number is called **deci-binary** if each of its digits is either `0` or `1` without any leading zeros. For example, `101` and `1100` are **deci-binary**, while `112` and `3001` are not.
Given a string `n` that represents a positive decimal integer, return _the **minimum** number of positive **deci-binary** n... | Use a three-layer loop to check all possible patterns by iterating through all possible starting positions, all indexes less than m, and if the character at the index is repeated k times. | Array,Enumeration | Easy | 1764 |
943 | hey what's up guys uh this is chung here again so this time today's daily challenge problem number 943 find the shortest super stream so this one is a pretty hard problem to be honest okay so you know this description is surprisingly short actually you know given like an array of string words right you need to return t... | Find the Shortest Superstring | sum-of-subarray-minimums | Given an array of strings `words`, return _the smallest string that contains each string in_ `words` _as a substring_. If there are multiple valid strings of the smallest length, return **any of them**.
You may assume that no string in `words` is a substring of another string in `words`.
**Example 1:**
**Input:** wo... | null | Array,Dynamic Programming,Stack,Monotonic Stack | Medium | 2227 |
143 | welcome back to uncle Jess today's question is leak code 143 reorder list so you're given the head of a singly linked list those can be represented as l0 all the way up to Ln and we need to reorder the list in the following form so l0 points to Ln points to L1 points to Ln minus one L2 Ln minus two right so let's not 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 |
1,282 | hey everybody this is Larry this is uh I guess September 11th on uh legal daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's poem 1282 group The People given the group size they belong to all right that's a very title uh that's what it's up what he's... | Group the People Given the Group Size They Belong To | number-of-valid-words-for-each-puzzle | There are `n` people that are split into some unknown number of groups. Each person is labeled with a **unique ID** from `0` to `n - 1`.
You are given an integer array `groupSizes`, where `groupSizes[i]` is the size of the group that person `i` is in. For example, if `groupSizes[1] = 3`, then person `1` must be in a g... | Exploit the fact that the length of the puzzle is only 7. Use bit-masks to represent the word and puzzle strings. For each puzzle, count the number of words whose bit-mask is a sub-mask of the puzzle's bit-mask. | Array,Hash Table,String,Bit Manipulation,Trie | Hard | null |
915 | hello everyone and welcome back to another lee code video so today we're going to be solving the lego question partition array into disjoint intervals all right so in this question we're going to be given an area called nums and the goal is to partition it into two contiguous sub areas called left and right so we have ... | Partition Array into Disjoint Intervals | generate-random-point-in-a-circle | Given an integer array `nums`, partition it into two (contiguous) subarrays `left` and `right` so that:
* Every element in `left` is less than or equal to every element in `right`.
* `left` and `right` are non-empty.
* `left` has the smallest possible size.
Return _the length of_ `left` _after such a partitioni... | null | Math,Geometry,Rejection Sampling,Randomized | Medium | 914 |
967 | Hello friends in today's video Let's solve with good problem of the day for daily challenge problem numbers with same consecutive differences so we need to return all non-negative integers of to return all non-negative integers of to return all non-negative integers of length L and such that the absolute difference bet... | Numbers With Same Consecutive Differences | minimum-falling-path-sum | Given two integers n and k, return _an array of all the integers of length_ `n` _where the difference between every two consecutive digits is_ `k`. You may return the answer in **any order**.
Note that the integers should not have leading zeros. Integers as `02` and `043` are not allowed.
**Example 1:**
**Input:** n... | null | Array,Dynamic Programming,Matrix | Medium | 1224 |
406 | hello everyone today's question is Q reconstruction by height suppose you have a random list of people standing in a queue each person is described by a pair of integers H K where H is the height of the person and K is the number of people in front of this person who has a height greater than or equal to H write an alg... | Queue Reconstruction by Height | queue-reconstruction-by-height | You are given an array of people, `people`, which are the attributes of some people in a queue (not necessarily in order). Each `people[i] = [hi, ki]` represents the `ith` person of height `hi` with **exactly** `ki` other people in front who have a height greater than or equal to `hi`.
Reconstruct and return _the queu... | What can you say about the position of the shortest person?
If the position of the shortest person is i, how many people would be in front of the shortest person? Once you fix the position of the shortest person, what can you say about the position of the second shortest person? | Array,Greedy,Binary Indexed Tree,Segment Tree,Sorting | Medium | 315 |
1,011 | okay they're given the two things one is a real weight and one is the target states they skip so i still sort of i still try to understand the question like exactly okay so he says that's packaged on the other copier belt okay and has the weight of okay so i think every package so it was like weight zero is the zeros p... | Capacity To Ship Packages Within D Days | flip-binary-tree-to-match-preorder-traversal | A conveyor belt has packages that must be shipped from one port to another within `days` days.
The `ith` package on the conveyor belt has a weight of `weights[i]`. Each day, we load the ship with packages on the conveyor belt (in the order given by `weights`). We may not load more weight than the maximum weight capaci... | null | Tree,Depth-First Search,Binary Tree | Medium | null |
62 | welcome back friends today we are going to solve lead code problem 62 unique paths so before we start looking or details of this problem please subscribe to my channel i often create good videos about lead code java solutions and java j2 related interview helpful videos so please subscribe to my channel it helps the ch... | 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 |
101 | foreign so let's code so just a second okay so what do i have to do is this sorry okay so substitute if root is equal to null then obviously return okay let me do this full screen return solve okay root left comma root right again root left or root right function star r2 and then if r1 is equal to null and r2 is equal ... | 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 |
87 | hey so welcome back and this is another daily kill prom so today's March 30th and the deadline for today's problem just passed so I hope you did a good job with it but um yes let's take a peek at what today's question was so it was called scramble string and oh I don't want to give the answer just yet and so it's actua... | Scramble String | scramble-string | We can scramble a string s to get a string t using the following algorithm:
1. If the length of the string is 1, stop.
2. If the length of the string is > 1, do the following:
* Split the string into two non-empty substrings at a random index, i.e., if the string is `s`, divide it to `x` and `y` where `s = x +... | null | String,Dynamic Programming | Hard | null |
93 | Hi gas welcome back to my channel so today our problem is restore ip address so what have you given us in this problem statement here have given us a sting s in which what is there are only digits and what you have to do is to donate here All possible valid IP address can be formed by inserting dot in S OK so what you ... | Restore IP Addresses | restore-ip-addresses | A **valid IP address** consists of exactly four integers separated by single dots. Each integer is between `0` and `255` (**inclusive**) and cannot have leading zeros.
* For example, `"0.1.2.201 "` and `"192.168.1.1 "` are **valid** IP addresses, but `"0.011.255.245 "`, `"192.168.1.312 "` and `"192.168@1.1 "` are **... | null | String,Backtracking | Medium | 752 |
225 | in this video we're going to look at a legal problem called implement stack using cues so the goal is we want to implement a stack data structure which is a lasting first out so the last element that we inserted onto the stack is the first one that we remove out of the stack so we want to implement stack using cues and... | Implement Stack using Queues | implement-stack-using-queues | Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (`push`, `top`, `pop`, and `empty`).
Implement the `MyStack` class:
* `void push(int x)` Pushes element x to the top of the stack.
* `int pop()` Removes the element on the top... | null | Stack,Design,Queue | Easy | 232 |
799 | Everyone Today Will Be Solving This Champion Star Question Bed for the question of list to demand challenge so let's get started in this question in this tag classification of pyramid against forest who has one glass to control is strong glass and should contain dowry And whatever is the roll number, the number landed ... | Champagne Tower | minimum-distance-between-bst-nodes | We stack glasses in a pyramid, where the **first** row has `1` glass, the **second** row has `2` glasses, and so on until the 100th row. Each glass holds one cup of champagne.
Then, some champagne is poured into the first glass at the top. When the topmost glass is full, any excess liquid poured will fall equally to t... | null | Tree,Depth-First Search,Breadth-First Search,Binary Search Tree,Binary Tree | Easy | 94 |
854 | so welcome to this problem number 834 it is the case similar strings it's a lead cold hard problem and it's a problem on strings as the name suggests and as I usually say this is not a hard problem this problem just requires basic understanding of how you know things are did you know representing this problem into an e... | K-Similar Strings | making-a-large-island | Strings `s1` and `s2` are `k`**\-similar** (for some non-negative integer `k`) if we can swap the positions of two letters in `s1` exactly `k` times so that the resulting string equals `s2`.
Given two anagrams `s1` and `s2`, return the smallest `k` for which `s1` and `s2` are `k`**\-similar**.
**Example 1:**
**Input... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Hard | null |
1,288 | Everyone welcome to my channel let's remove all the cover in travels from 100 relationships interview problems on the channel back to back has been sold time when withdrawal remove all in impatient will be subscribed to olive oil this cream withdrawal from doing So will give way that a hum abhi the insight like sis thi... | Remove Covered Intervals | maximum-subarray-sum-with-one-deletion | Given an array `intervals` where `intervals[i] = [li, ri]` represent the interval `[li, ri)`, remove all intervals that are covered by another interval in the list.
The interval `[a, b)` is covered by the interval `[c, d)` if and only if `c <= a` and `b <= d`.
Return _the number of remaining intervals_.
**Example 1:... | How to solve this problem if no deletions are allowed ? Try deleting each element and find the maximum subarray sum to both sides of that element. To do that efficiently, use the idea of Kadane's algorithm. | Array,Dynamic Programming | Medium | null |
258 | so this question is question number 258 and it's add digits given an integer now repeatedly add all its digit until the result has only one digit and returned so how do we do this one so um there are two ways actually let's do the way that first came to my mind and uh if you've uh watched my previous videos that could ... | Add Digits | add-digits | Given an integer `num`, repeatedly add all its digits until the result has only one digit, and return it.
**Example 1:**
**Input:** num = 38
**Output:** 2
**Explanation:** The process is
38 --> 3 + 8 --> 11
11 --> 1 + 1 --> 2
Since 2 has only one digit, return it.
**Example 2:**
**Input:** num = 0
**Output:** 0
*... | A naive implementation of the above process is trivial. Could you come up with other methods? What are all the possible results? How do they occur, periodically or randomly? You may find this Wikipedia article useful. | Math,Simulation,Number Theory | Easy | 202,1082,2076,2264 |
368 | hi guys this is a so we are going to Sol solve the today's lead code question which is largest divisible subset so we are given a number of we are given an array and we need to find the largest subset answer such that every pair of elements in the subset satisfies the condition one of these two condition should be sati... | Largest Divisible Subset | largest-divisible-subset | Given a set of **distinct** positive integers `nums`, return the largest subset `answer` such that every pair `(answer[i], answer[j])` of elements in this subset satisfies:
* `answer[i] % answer[j] == 0`, or
* `answer[j] % answer[i] == 0`
If there are multiple solutions, return any of them.
**Example 1:**
**Inp... | null | Array,Math,Dynamic Programming,Sorting | Medium | null |
203 | Hello Everyone Welcome To Day Twelfth Family Got Talent And Polish Of Making This Video Let's Subscribe Must Visit Subscribe And Will Give You All Subscribe 123 456 Subscribe Do Three Four Five Returns The Video then subscribe In This Example A To Remove Clips Element To Tourist Places Prithvi Subscribe 560 Interested ... | Remove Linked List Elements | remove-linked-list-elements | Given the `head` of a linked list and an integer `val`, remove all the nodes of the linked list that has `Node.val == val`, and return _the new head_.
**Example 1:**
**Input:** head = \[1,2,6,3,4,5,6\], val = 6
**Output:** \[1,2,3,4,5\]
**Example 2:**
**Input:** head = \[\], val = 1
**Output:** \[\]
**Example 3:**... | null | Linked List,Recursion | Easy | 27,237,2216 |
880 | hey everybody this is larry this is day 20 of the league code daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's problem so i do solve and explain these problems live the cool thing maybe is that i go through my thought process and not just the solut... | Decoded String at Index | rectangle-area-ii | You are given an encoded string `s`. To decode the string to a tape, the encoded string is read one character at a time and the following steps are taken:
* If the character read is a letter, that letter is written onto the tape.
* If the character read is a digit `d`, the entire current tape is repeatedly written... | null | Array,Segment Tree,Line Sweep,Ordered Set | Hard | null |
20 | hey everyone welcome to techwired in this video we are going to solve a Lead Core problem called valid parenthesis first we will read the problem statement then we will see the solution using a stack so in this problem we are given three types of brackets we need to check whether the brackets in the input are opened an... | Valid Parentheses | valid-parentheses | Given a string `s` containing just the characters `'('`, `')'`, `'{'`, `'}'`, `'['` and `']'`, determine if the input string is valid.
An input string is valid if:
1. Open brackets must be closed by the same type of brackets.
2. Open brackets must be closed in the correct order.
3. Every close bracket has a corres... | An interesting property about a valid parenthesis expression is that a sub-expression of a valid expression should also be a valid expression. (Not every sub-expression) e.g.
{ { } [ ] [ [ [ ] ] ] } is VALID expression
[ [ [ ] ] ] is VALID sub-expression
{ } [ ] is VALID sub-express... | String,Stack | Easy | 22,32,301,1045,2221 |
1,646 | hi my name is david today we're going to do number one six four six get maximum and generated array this is an easy level problem only code i want to solve it in javascript in this crop we have a function that takes in an integer and with this integer we have these conditions that creates a new array and once you creat... | 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 |
621 | hey what's up guys Nick white here I detect Cody stuff on twitch and YouTube check the description for all of my information please like and subscribe this video as it helps me grow my channel doing the hacker rank doing the leak oh got the playlist algorithm explanations and stuff got hundreds this is task scheduler 6... | Task Scheduler | task-scheduler | Given a characters array `tasks`, representing the tasks a CPU needs to do, where each letter represents a different task. Tasks could be done in any order. Each task is done in one unit of time. For each unit of time, the CPU could complete either one task or just be idle.
However, there is a non-negative integer `n`... | null | Array,Hash Table,Greedy,Sorting,Heap (Priority Queue),Counting | Medium | 358,778,2084 |
958 | hello welcome back to my channel i'm here to do my 100 little challenge today we have the code 958 check completeness of a binary tree given a root of the binary determine if it's a complete binary tree in a complete binary every level except possibly the last is completely field and all nodes in the last level are as ... | Check Completeness of a Binary Tree | sort-array-by-parity-ii | Given the `root` of a binary tree, determine if it is a _complete binary tree_.
In a **[complete binary tree](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between ... | null | Array,Two Pointers,Sorting | Easy | 2271,2283,2327 |
151 | Suggestion or going to solve question number 151 shift setting on list subscribe button subscribe channel that their shoaib start tweet a to whom tweet a 200 Vikramaditya single password have to this accused word supporters and painted storks subscribe warning will start from dengue it boils Creative 1.2515 And Subscri... | Reverse Words in a String | reverse-words-in-a-string | Given an input string `s`, reverse the order of the **words**.
A **word** is defined as a sequence of non-space characters. The **words** in `s` will be separated by at least one space.
Return _a string of the words in reverse order concatenated by a single space._
**Note** that `s` may contain leading or trailing s... | null | Two Pointers,String | Medium | 186 |
151 | in this problem we have to reverse the words of a string and uh within the word the characters will remain the same so here this is one word world followed by this is exclamation so this remains as it is so the last word will become first word second last word will become second word and similarly first word will becom... | Reverse Words in a String | reverse-words-in-a-string | Given an input string `s`, reverse the order of the **words**.
A **word** is defined as a sequence of non-space characters. The **words** in `s` will be separated by at least one space.
Return _a string of the words in reverse order concatenated by a single space._
**Note** that `s` may contain leading or trailing s... | null | Two Pointers,String | Medium | 186 |
242 | hi everyone welcome back to the channel and to and solve e code daily challenge problem 242 so we will be looking to the problem statement which we have received then we'll move towards the solution or the approach which we have used and the solution itself so starting with the problem uh the problem says we will given... | Valid Anagram | valid-anagram | Given two strings `s` and `t`, return `true` _if_ `t` _is an anagram of_ `s`_, and_ `false` _otherwise_.
An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
**Example 1:**
**Input:** s = "anagram", t = "nagaram"
**... | null | Hash Table,String,Sorting | Easy | 49,266,438 |
43 | oh yes let's do it right a problem at Lee code multiply strings given to non-negative integer N 1 and 2 non-negative integer N 1 and 2 non-negative integer N 1 and 2 represented as strings you turn the product of n number one and then two so how we gonna do this we are going to take this piece st. 1 s new strength buck... | Multiply Strings | multiply-strings | Given two non-negative integers `num1` and `num2` represented as strings, return the product of `num1` and `num2`, also represented as a string.
**Note:** You must not use any built-in BigInteger library or convert the inputs to integer directly.
**Example 1:**
**Input:** num1 = "2", num2 = "3"
**Output:** "6"
**Ex... | null | Math,String,Simulation | Medium | 2,66,67,415 |
1,239 | all right let's talk about the maximum length of concatenating string with unique characters so you are given the list of string array and then uh you want to concatenate every substring inside the array and then you have to return the maximum possible length of x right so in this version i'm going to use the different... | Maximum Length of a Concatenated String with Unique Characters | largest-1-bordered-square | You are given an array of strings `arr`. A string `s` is formed by the **concatenation** of a **subsequence** of `arr` that has **unique characters**.
Return _the **maximum** possible length_ of `s`.
A **subsequence** is an array that can be derived from another array by deleting some or no elements without changing ... | For each square, know how many ones are up, left, down, and right of this square. You can find it in O(N^2) using dynamic programming. Now for each square ( O(N^3) ), we can evaluate whether that square is 1-bordered in O(1). | Array,Dynamic Programming,Matrix | Medium | null |
456 | guys welcome to the channel this is vaga we are going to do another leech good question and the question in question is number 132 um no number 456 132 pattern right so we are supposed to get um the 132 pass and in this case the 132 pattern is where one we have um we have a number such that um we have an array right an... | 132 Pattern | 132-pattern | Given an array of `n` integers `nums`, a **132 pattern** is a subsequence of three integers `nums[i]`, `nums[j]` and `nums[k]` such that `i < j < k` and `nums[i] < nums[k] < nums[j]`.
Return `true` _if there is a **132 pattern** in_ `nums`_, otherwise, return_ `false`_._
**Example 1:**
**Input:** nums = \[1,2,3,4\]
... | null | Array,Binary Search,Stack,Monotonic Stack,Ordered Set | Medium | null |
39 | hi everyone welcome back to lead coding i am your host faraz so in this video we are going to solve another question called combination sum and as you guys have already a good practice of recursion and backtracking if you have been following my playlist so you can just try this problem by your own you can go to the des... | 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 |
1,793 | hey everybody this is Larry this is me doing the daily prom uh on October 23rd and we have a new weekly prom as well so let's get to it uh yeah hit the like button hit the Subscribe button join me on Discord let me know what you think about today's problem it's a hard problem maximum score of a good Subway 1793 I'm in ... | Maximum Score of a Good Subarray | minimum-moves-to-make-array-complementary | You are given an array of integers `nums` **(0-indexed)** and an integer `k`.
The **score** of a subarray `(i, j)` is defined as `min(nums[i], nums[i+1], ..., nums[j]) * (j - i + 1)`. A **good** subarray is a subarray where `i <= k <= j`.
Return _the maximum possible **score** of a **good** subarray._
**Example 1:**... | Given a target sum x, each pair of nums[i] and nums[n-1-i] would either need 0, 1, or 2 modifications. Can you find the optimal target sum x value such that the sum of modifications is minimized? Create a difference array to efficiently sum all the modifications. | Array,Hash Table,Prefix Sum | Medium | null |
143 | Hello welcome to Delhi, give a Singapore base in five days to very big companies. I will not take a name but it has been asked inside it, so let me tell you the question, what is the question. The question was that when you three four five one in this way Link list de rakhi hai simple lust hai last has null so we have ... | 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 |
771 | hey everyone welcome to my youtube channel how you all doing so today we'll try to solve lead call problem 771 which is jewels and stones let's solve this if you already tried to solve this problem and you couldn't solve it then hang on to the video we'll try to put some comments first and i'll try to make your life li... | Jewels and Stones | encode-n-ary-tree-to-binary-tree | You're given strings `jewels` representing the types of stones that are jewels, and `stones` representing the stones you have. Each character in `stones` is a type of stone you have. You want to know how many of the stones you have are also jewels.
Letters are case sensitive, so `"a "` is considered a different type o... | null | Tree,Depth-First Search,Breadth-First Search,Design,Binary Tree | Hard | 765 |
1,812 | Hua Hai Hello Everyone Hindi Select City I'm Going To Explain About It Man Yesterday Office Work Hair Give Vote Subscribe Button Subscribe The Video then subscribe to The Amazing In President Appointed Black Color Shot Dead History Click Hair Two Three Layer Subscribe Button Strongly mintu like share and comment it's c... | Determine Color of a Chessboard Square | reformat-phone-number | You are given `coordinates`, a string that represents the coordinates of a square of the chessboard. Below is a chessboard for your reference.
Return `true` _if the square is white, and_ `false` _if the square is black_.
The coordinate will always represent a valid chessboard square. The coordinate will always have t... | Discard all the spaces and dashes. Use a while loop. While the string still has digits, check its length and see which rule to apply. | String | Easy | null |
475 | To Ajay that potatoes are rippling in it, Sachin Gautam himself is going to try skin infection, its name is meters, it is fine till the deposit, day, we try to time it or else you have not got 2 years, one houses characters, keratin, so we are only one. Area, let us tell you on which position it was placed. On the thir... | 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 |
48 | in this video we will be solving rotate image coding and challenge let's first look at the description you are given an end times and 2d matrix representing an image rotate image by 90 degrees clockwise note you are you have to rotate image in place which means you have to modify the input image directly do not okay we... | Rotate Image | rotate-image | You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise).
You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati... | null | Array,Math,Matrix | Medium | 2015 |
1,903 | hello everyone today we are going to go through largest old number in string so uh in this prr we receive as input a string with the variable n and then we are supposed to find out what is the biggest o number we can have from this number uh let's say we have this as input 52 you do agree with me that 52 is an even num... | Largest Odd Number in String | design-most-recently-used-queue | You are given a string `num`, representing a large integer. Return _the **largest-valued odd** integer (as a string) that is a **non-empty substring** of_ `num`_, or an empty string_ `" "` _if no odd integer exists_.
A **substring** is a contiguous sequence of characters within a string.
**Example 1:**
**Input:** nu... | You can store the data in an array and apply each fetch by moving the ith element to the end of the array (i.e, O(n) per operation). A better way is to use the square root decomposition technique. You can build chunks of size sqrt(n). For each fetch operation, You can search for the chunk which has the ith element and ... | Array,Hash Table,Stack,Design,Binary Indexed Tree,Ordered Set | Medium | 146 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.