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 |
|---|---|---|---|---|---|---|---|---|
143 | hey guys welcome back to another video and today we're going to be solving the lika question reorder list all right so in this question we're given a singly linked list right so your first element is pointing the second element points to the third element all the way to the ending which points the element none and then... | 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 |
202 | hey friends so I'm back with another lead code question so this question is happy and number uh so let's go through the question and try to understand what this question says so first of all the questions is that we have to write algorithm to determine a number n is happy in the definition of happy number is that start... | 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 |
5 | everyone welcome to the channel today's question is longest palindromic substring if you're here that means either you're interested in solving lead code problems or you're preparing for a technical interview then you're at the right place and you should definitely consider subscribing to our channel and congratulation... | 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 |
345 | all right let's talk about the reverse vowel software training so you're giving the string s reverse only all the vowels in the string and return it so uh here's the idea so i started in the beginning and then you also start again and it traverses uh your string so for this i'm gonna pull i and it's control j and i go ... | Reverse Vowels of a String | reverse-vowels-of-a-string | Given a string `s`, reverse only all the vowels in the string and return it.
The vowels are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`, and they can appear in both lower and upper cases, more than once.
**Example 1:**
**Input:** s = "hello"
**Output:** "holle"
**Example 2:**
**Input:** s = "leetcode"
**Output:** "leotc... | null | Two Pointers,String | Easy | 344,1089 |
387 | how's it going guys so today we're going to solve first unique character in a string this question is literally cool so what we have to do in this question we have to given like we given a string we have to uh we have to give back the first known repeating character index what is if you look at over here in this one we... | First Unique Character in a String | first-unique-character-in-a-string | Given a string `s`, _find the first non-repeating character in it and return its index_. If it does not exist, return `-1`.
**Example 1:**
**Input:** s = "leetcode"
**Output:** 0
**Example 2:**
**Input:** s = "loveleetcode"
**Output:** 2
**Example 3:**
**Input:** s = "aabb"
**Output:** -1
**Constraints:**
* `... | null | Hash Table,String,Queue,Counting | Easy | 451 |
11 | foreign hi this is Topher from the lonely Dash and today we're going to be covering container with most water number 11 lead code you are given an integer array called height of length n there are n vertical lines drawn such that the two endpoints of the iot line are I comma 0 and I comma height I find two lines that t... | Container With Most Water | container-with-most-water | You are given an integer array `height` of length `n`. There are `n` vertical lines drawn such that the two endpoints of the `ith` line are `(i, 0)` and `(i, height[i])`.
Find two lines that together with the x-axis form a container, such that the container contains the most water.
Return _the maximum amount of water... | The aim is to maximize the area formed between the vertical lines. The area of any container is calculated using the shorter line as length and the distance between the lines as the width of the rectangle.
Area = length of shorter vertical line * distance between lines
We can definitely get the maximum width ... | Array,Two Pointers,Greedy | Medium | 42 |
1,088 | hey everybody this is Larry this is me doing the premium weekly question for week four hit the like button the Subscribe button join me on Discord let me know what you think about this Farm uh I forgot it in the other video but Happy Chinese New Year happy Lunar New Year whatever you want to celebrate uh I'm here for y... | Confusing Number II | number-of-days-in-a-month | A **confusing number** is a number that when rotated `180` degrees becomes a different number with **each digit valid**.
We can rotate digits of a number by `180` degrees to form new digits.
* When `0`, `1`, `6`, `8`, and `9` are rotated `180` degrees, they become `0`, `1`, `9`, `8`, and `6` respectively.
* When ... | Does February have 28 days or 29 days? Think of Leap years. | Math | Easy | null |
848 | hi everyone once again welcome to my channel if you are new to the channel please hit the subscribe button that will encourage me to create more such content so let's solve today problem is 8 4 8 shifting letters so in this problem we are given a string as of lower case letters and an integer array of shifts so what is... | Shifting Letters | shifting-letters | You are given a string `s` of lowercase English letters and an integer array `shifts` of the same length.
Call the `shift()` of a letter, the next letter in the alphabet, (wrapping around so that `'z'` becomes `'a'`).
* For example, `shift('a') = 'b'`, `shift('t') = 'u'`, and `shift('z') = 'a'`.
Now for each `shif... | null | null | Medium | null |
754 | Hello Hi Everyone Welcome To My Channel It's All The Problem Also A Number You Are Standing Position Zion Infinity Number Line And There Is Gold Position Target Half Inch Move You Can Either Go Left Or Right And Urinary Bladder Movie Shooting Take Jump Of Long Date And This Fuel Total Minimum Number of Steps to Request... | Reach a Number | cracking-the-safe | You are standing at position `0` on an infinite number line. There is a destination at position `target`.
You can make some number of moves `numMoves` so that:
* On each move, you can either go left or right.
* During the `ith` move (starting from `i == 1` to `i == numMoves`), you take `i` steps in the chosen dir... | We can think of this problem as the problem of finding an Euler path (a path visiting every edge exactly once) on the following graph: there are $$k^{n-1}$$ nodes with each node having $$k$$ edges. It turns out this graph always has an Eulerian circuit (path starting where it ends.)
We should visit each node in "po... | Depth-First Search,Graph,Eulerian Circuit | Hard | null |
290 | all right today i'm going to talk about this word pattern problem uh let's go to 9d in which you're given two strings initially called pattern and string and you want to see if s follows the same pattern what means here based on the description it says here follow means a full match such as there is a bijection between... | 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 |
41 | hey guys so hope you're all doing great so in this video we're gonna do this uh lead code number 41 which is called the first missing positive it's a really famous question guys it uh like it has been asked by a lot of companies right so you guys might want to do this right because you want to ace those data science in... | First Missing Positive | first-missing-positive | Given an unsorted integer array `nums`, return the smallest missing positive integer.
You must implement an algorithm that runs in `O(n)` time and uses constant extra space.
**Example 1:**
**Input:** nums = \[1,2,0\]
**Output:** 3
**Explanation:** The numbers in the range \[1,2\] are all in the array.
**Example 2:*... | Think about how you would solve the problem in non-constant space. Can you apply that logic to the existing space? We don't care about duplicates or non-positive integers Remember that O(2n) = O(n) | Array,Hash Table | Hard | 268,287,448,770 |
1,641 | Which Hybrid Students Problem Is Account Sorted Over This Software Give One Team Selection Mein Asar Input Thursday Don't Forget To Subscribe Flash Light To From Lead Android Subscribe To 14 Minutes Ago Snowden Filter And Oil To You In The Complain For Watching This Thank You Can't BDO And That's I'm With U It's All Wi... | Count Sorted Vowel Strings | countries-you-can-safely-invest-in | Given an integer `n`, return _the number of strings of length_ `n` _that consist only of vowels (_`a`_,_ `e`_,_ `i`_,_ `o`_,_ `u`_) and are **lexicographically sorted**._
A string `s` is **lexicographically sorted** if for all valid `i`, `s[i]` is the same as or comes before `s[i+1]` in the alphabet.
**Example 1:**
... | null | Database | Medium | 615 |
94 | imagine you get the following question in an interview you are asked to do an in-order traversal of a binary tree in-order traversal of a binary tree in-order traversal of a binary tree you think sure this is easy enough i could do a depth first search and it would take linear time and at worst linear space complexity ... | Binary Tree Inorder Traversal | binary-tree-inorder-traversal | Given the `root` of a binary tree, return _the inorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[1,3,2\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of nodes i... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 98,144,145,173,230,272,285,758,799 |
930 | hi guys this is another nicole problem binary separates with some you can array a oh zeros and ones how many long empty separate have some s but clear subarray means they are continuous so this is the array we want to sum equal to two so there were four sub arrays one zero one so there are four sub arrays okay so guys ... | Binary Subarrays With Sum | all-possible-full-binary-trees | Given a binary array `nums` and an integer `goal`, return _the number of non-empty **subarrays** with a sum_ `goal`.
A **subarray** is a contiguous part of the array.
**Example 1:**
**Input:** nums = \[1,0,1,0,1\], goal = 2
**Output:** 4
**Explanation:** The 4 subarrays are bolded and underlined below:
\[**1,0,1**,0... | null | Dynamic Programming,Tree,Recursion,Memoization,Binary Tree | Medium | null |
256 | At this time we will call, the question is very interesting, related to the SP behind the penthouse during the show days, that I told you, the statement from Noida is there, it will be the same that you, this question is very good, it means a lot of fun. While asking questions, let me explain to you. If you have asked ... | Paint House | paint-house | There is a row of `n` houses, where each house can be painted one of three colors: red, blue, or green. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color.
The cost of painting each house with a certain color is repre... | null | Array,Dynamic Programming | Medium | 198,213,265,276 |
1,358 | Hello hello welcome a gross co to find the number of sub settings of different singh and six all person's directors a b c latest example here is latest homemade software with all the three characters a tambe ke masi so let's see the first position from the worst position Vacancy date from first and second position late... | Number of Substrings Containing All Three Characters | find-positive-integer-solution-for-a-given-equation | Given a string `s` consisting only of characters _a_, _b_ and _c_.
Return the number of substrings containing **at least** one occurrence of all these characters _a_, _b_ and _c_.
**Example 1:**
**Input:** s = "abcabc "
**Output:** 10
**Explanation:** The substrings containing at least one occurrence of the charact... | Loop over 1 ≤ x,y ≤ 1000 and check if f(x,y) == z. | Math,Two Pointers,Binary Search,Interactive | Medium | null |
790 | hello and welcome back this is William today we're tackling another tiling problem which involves tiling dominoes and drama notes on a board this problem is interesting because we're not only dealing with one type of block but two types of blocks the problem we're trying to tackle asks in how many ways can you tile a 2... | 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 |
403 | Hello gas welcome to me YouTube channel so today we are going to solve today's problem 403 frock jump ok so what is this question about I have been given a river and there is a frog in the river ok frock jump Have to cross a river and the river is divided into units, it is okay and whatever the unit is, there is a ston... | Frog Jump | frog-jump | A frog is crossing a river. The river is divided into some number of units, and at each unit, there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.
Given a list of `stones`' positions (in units) in sorted **ascending order**, determine if the frog can cross the river by... | null | Array,Dynamic Programming | Hard | 1952,2262 |
208 | hello everyone today's questions is implemented try brief extreme implemented a try with insert search and start with method so note you may assume that all inputs are consists of the lowercase letter it wasn't all inputs are guaranteed to be non empty string first we will understand the implementation in pen and paper... | Implement Trie (Prefix Tree) | implement-trie-prefix-tree | A [**trie**](https://en.wikipedia.org/wiki/Trie) (pronounced as "try ") or **prefix tree** is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker.
Implement the Trie class:
* `Trie()` ... | null | Hash Table,String,Design,Trie | Medium | 211,642,648,676,1433,1949 |
438 | Welcome to this new inside code video where we will see the "Find all anagrams in a string" problem. So, what does the problem say? It says, given a string s and a non-empty string p, create a function that returns an array that contains all the start indices of p's anagrams in... | Find All Anagrams in a String | find-all-anagrams-in-a-string | Given two strings `s` and `p`, return _an array of all the start indices of_ `p`_'s anagrams in_ `s`. You may return the answer in **any order**.
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:**
*... | null | Hash Table,String,Sliding Window | Medium | 242,567 |
315 | hey what's up guys juan here again so today let's take a look at this lead code problem number 315 count of smaller numbers after itself so you're given a input of integers here and you need to output another same the same side another array is the same size the value of the each position is the it's how many integers ... | Count of Smaller Numbers After Self | count-of-smaller-numbers-after-self | Given an integer array `nums`, return _an integer array_ `counts` _where_ `counts[i]` _is the number of smaller elements to the right of_ `nums[i]`.
**Example 1:**
**Input:** nums = \[5,2,6,1\]
**Output:** \[2,1,1,0\]
**Explanation:**
To the right of 5 there are **2** smaller elements (2 and 1).
To the right of 2 the... | null | Array,Binary Search,Divide and Conquer,Binary Indexed Tree,Segment Tree,Merge Sort,Ordered Set | Hard | 327,406,493,1482,2280 |
410 | hello everyone i hope all of you are doing well so today we will discuss another problem of grid code that is 4 10 split array largest sum so what is the problem statement here so the problem is 410 split array large sum given an array norms which consist of non negative integers and an integer m you can split the arra... | Split Array Largest Sum | split-array-largest-sum | Given an integer array `nums` and an integer `k`, split `nums` into `k` non-empty subarrays such that the largest sum of any subarray is **minimized**.
Return _the minimized largest sum of the split_.
A **subarray** is a contiguous part of the array.
**Example 1:**
**Input:** nums = \[7,2,5,10,8\], k = 2
**Output:*... | null | Array,Binary Search,Dynamic Programming,Greedy | Hard | 1056,1192,2242,2330 |
1,439 | hello everyone this is your daily dose of late code what are you doing what okay let's take a look at the newest question given a matrix each row of the matrix is in increasing order find one number from each row to form a array pick the case smallest array some from all the possible erase in this case k is equal to 2 ... | Find the Kth Smallest Sum of a Matrix With Sorted Rows | running-total-for-different-genders | You are given an `m x n` matrix `mat` that has its rows sorted in non-decreasing order and an integer `k`.
You are allowed to choose **exactly one element** from each row to form an array.
Return _the_ `kth` _smallest array sum among all possible arrays_.
**Example 1:**
**Input:** mat = \[\[1,3,11\],\[2,4,6\]\], k ... | null | Database | Medium | 1327 |
16 | in this video we'll be going over three sum closes so i'm giving a rate numbers of n integers and an integer target find three integers and nums such that sum is closest to target return the sum of the three integers you may assume that each input would have exactly one solution so for example we have negative 1 2 1 an... | 3Sum Closest | 3sum-closest | Given an integer array `nums` of length `n` and an integer `target`, find three integers in `nums` such that the sum is closest to `target`.
Return _the sum of the three integers_.
You may assume that each input would have exactly one solution.
**Example 1:**
**Input:** nums = \[-1,2,1,-4\], target = 1
**Output:** ... | null | Array,Two Pointers,Sorting | Medium | 15,259 |
523 | Hello everyone welcome to my YouTube channel Problem Statement We are given an interior is present or not if present then we have to return true if no good sir is present then we have to return false then we see that What is the definition of goods morning? We will call the one whose length is the list and the sum of t... | Continuous Subarray Sum | continuous-subarray-sum | Given an integer array nums and an integer k, return `true` _if_ `nums` _has a **good subarray** or_ `false` _otherwise_.
A **good subarray** is a subarray where:
* its length is **at least two**, and
* the sum of the elements of the subarray is a multiple of `k`.
**Note** that:
* A **subarray** is a contiguo... | null | Array,Hash Table,Math,Prefix Sum | Medium | 560,2119,2240 |
899 | welcome to september's leeco challenge today's problem is orderly q you are given a string s and an integer k you can choose one of the first k letters of s and append it at the end of the string return the lexographically smallest string you could have after applying the mentioned step any number of moves if we had k ... | Orderly Queue | binary-gap | You are given a string `s` and an integer `k`. You can choose one of the first `k` letters of `s` and append it at the end of the string..
Return _the lexicographically smallest string you could have after applying the mentioned step any number of moves_.
**Example 1:**
**Input:** s = "cba ", k = 1
**Output:** "ac... | null | Math,Bit Manipulation | Easy | null |
152 | hello guys and today we are going to do a problem max product sub array of lead code so let's understand the problem first given an integer error nums find a continuous known empty sub array within the array that has the largest product and return the product so let's understand the problem with an example so here we h... | Maximum Product Subarray | maximum-product-subarray | Given an integer array `nums`, find a subarray that has the largest product, and return _the product_.
The test cases are generated so that the answer will fit in a **32-bit** integer.
**Example 1:**
**Input:** nums = \[2,3,-2,4\]
**Output:** 6
**Explanation:** \[2,3\] has the largest product 6.
**Example 2:**
**I... | null | Array,Dynamic Programming | Medium | 53,198,238,628,713 |
5 | welcome to august leco challenge today's problem is longest palindrome given a string which consists of lowercase or uppercase letters find the length of the longest palindromes that can be built with those letters this is case sensitive so capital a and a is not considered a palindrome here so we can just assume that ... | 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 |
106 | hello guys welcome to deep codes and in today's video we will discuss lead code question 106 that says construct binary tree from in order and post order traversal so here you are given to integer array in order and post order that represent the in order and post or the trouser of a given tree and from the base of this... | Construct Binary Tree from Inorder and Postorder Traversal | construct-binary-tree-from-inorder-and-postorder-traversal | Given two integer arrays `inorder` and `postorder` where `inorder` is the inorder traversal of a binary tree and `postorder` is the postorder traversal of the same tree, construct and return _the binary tree_.
**Example 1:**
**Input:** inorder = \[9,3,15,20,7\], postorder = \[9,15,7,20,3\]
**Output:** \[3,9,20,null,n... | null | Array,Hash Table,Divide and Conquer,Tree,Binary Tree | Medium | 105 |
799 | hi all welcome to learn code repeat today we'll be looking at day 26 of the october elite code challenge the name of the problem is champagne tower let's look into the problem so the problem says we stack glasses in a pyramid where the first row has one glass the second row has two glasses and so on until the hundredth... | 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 |
508 | hi so today we're gonna do this question called as the most frequent subtrees some question goes like to give you the root of a tree you're asked to find the most frequent subtree some of the supplies some of a node is defined as the root itself and the sum of the roots is that there are so and if so were they are the ... | Most Frequent Subtree Sum | most-frequent-subtree-sum | Given the `root` of a binary tree, return the most frequent **subtree sum**. If there is a tie, return all the values with the highest frequency in any order.
The **subtree sum** of a node is defined as the sum of all the node values formed by the subtree rooted at that node (including the node itself).
**Example 1:*... | null | Hash Table,Tree,Depth-First Search,Binary Tree | Medium | 572,2126 |
796 | welcome ladies and gentlemen boys and girls today we're going to solve another coolest question which is rotate string so basically what we did in this question we have to rotate this complete string okay so this question is similar to if you have solved uh any previous question like rotate integers it's quite similar ... | Rotate String | reaching-points | Given two strings `s` and `goal`, return `true` _if and only if_ `s` _can become_ `goal` _after some number of **shifts** on_ `s`.
A **shift** on `s` consists of moving the leftmost character of `s` to the rightmost position.
* For example, if `s = "abcde "`, then it will be `"bcdea "` after one shift.
**Example 1... | null | Math | Hard | null |
237 | foreign list that is head and with only given node we have to delete that node and make the increase so all the values will increase the limit and is guaranteed that given mode is not the last node in the language so they have told the given node it's used to be there it is not the last thing it is somewhere in the mid... | Delete Node in a Linked List | delete-node-in-a-linked-list | There is a singly-linked list `head` and we want to delete a node `node` in it.
You are given the node to be deleted `node`. You will **not be given access** to the first node of `head`.
All the values of the linked list are **unique**, and it is guaranteed that the given node `node` is not the last node in the linke... | null | Linked List | Easy | 203 |
506 | okay 5:06 relative wanks given scores of okay 5:06 relative wanks given scores of okay 5:06 relative wanks given scores of and athletes find their relative lengths and people have to top three higher scores who will be awarded meadows go meadows silver medal and bronze medals polish my oh man my cadence or no often any... | Relative Ranks | relative-ranks | You are given an integer array `score` of size `n`, where `score[i]` is the score of the `ith` athlete in a competition. All the scores are guaranteed to be **unique**.
The athletes are **placed** based on their scores, where the `1st` place athlete has the highest score, the `2nd` place athlete has the `2nd` highest ... | null | Array,Sorting,Heap (Priority Queue) | Easy | null |
188 | hi guys welcome to algorithms made easy my name is khushboo and in this video we are going to see the fourth part of the question best time to buy and sell stocks you are given an integer array prices where price of i is the price of a given stock on ith day and an integer k find the maximum profit you can achieve such... | Best Time to Buy and Sell Stock IV | best-time-to-buy-and-sell-stock-iv | You are given an integer array `prices` where `prices[i]` is the price of a given stock on the `ith` day, and an integer `k`.
Find the maximum profit you can achieve. You may complete at most `k` transactions: i.e. you may buy at most `k` times and sell at most `k` times.
**Note:** You may not engage in multiple tran... | null | Array,Dynamic Programming | Hard | 121,122,123 |
1,903 | Hi friends, so in this video we will see the largest odd number in a string, so let's directly take the example and understand, suppose we have been given the number 1 2 3 4, so this edge string will be given to us, right then its sub string which is the largest. Basically we have to find out the odd sub string, so wha... | 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 |
239 | okay so lead code practice time so in this video there are two goals the first goal is to see how to solve this problem so we are going to find the solution and we are going to do some coding work after that and the second goal is to see how we should behave in a real interview so let's get started so in a real intervi... | Sliding Window Maximum | sliding-window-maximum | You are given an array of integers `nums`, there is a sliding window of size `k` which is moving from the very left of the array to the very right. You can only see the `k` numbers in the window. Each time the sliding window moves right by one position.
Return _the max sliding window_.
**Example 1:**
**Input:** nums... | How about using a data structure such as deque (double-ended queue)? The queue size need not be the same as the window’s size. Remove redundant elements and the queue should store only elements that need to be considered. | Array,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue | Hard | 76,155,159,265,1814 |
1,035 | hey guys persistent program over here and today we're gonna do another leaker question on cross lines now this is a dynamic programming question and it may seem a little bit hard to understand at first but stay with me here and we'll get through it if you haven't subscribed already go ahead and hit that subscribe butto... | Uncrossed Lines | cousins-in-binary-tree | You are given two integer arrays `nums1` and `nums2`. We write the integers of `nums1` and `nums2` (in the order they are given) on two separate horizontal lines.
We may draw connecting lines: a straight line connecting two numbers `nums1[i]` and `nums2[j]` such that:
* `nums1[i] == nums2[j]`, and
* the line we d... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 102 |
329 | hey folks welcome back to another video today we're looking at question three to nine longest increasing path in a matrix the way we'll be approaching this problem is by using dfs but also are using memorization uh so the reason why we need dfs and memorization is because if we just use plain dfs for every single cell ... | 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 |
866 | ah let me send it link so I remember when I did it cool 866 prime pal prime palindrome find the smallest prime power drum greater than or equal to n we call that a number is prime if it's wrong it's only two divisors are 1 and itself and it is greater than 1 for example a number some numbers apply we call that a number... | Prime Palindrome | rectangle-overlap | Given an integer n, return _the smallest **prime palindrome** greater than or equal to_ `n`.
An integer is **prime** if it has exactly two divisors: `1` and itself. Note that `1` is not a prime number.
* For example, `2`, `3`, `5`, `7`, `11`, and `13` are all primes.
An integer is a **palindrome** if it reads the ... | null | Math,Geometry | Easy | 223 |
350 | hello and welcome to another python tutorial of lead quote uh today let's do 350 intersection of two arrays it's an easy question given to raise write a function to compute their intersections so example one numbers one equals one two one knobs two equals two and output is two because that's the com that's the intersec... | 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 |
143 | hey what's up guys Nick white here I do technical stuff on twitch and YouTube check the description for all my information that joined the discord follow me on github trying to build a community here I do these problems all the time I put a lot of work into this if you can support me on patreon I really appreciate that... | 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 |
397 | all right so we're back i'm going to try another problem and i don't know how this is going to go but i wanted to quickly look at another question have some time before the bible study it's going to start a little bit later than i thought so we can do that and that's all well and good we'll get that going um let me pul... | Integer Replacement | integer-replacement | Given a positive integer `n`, you can apply one of the following operations:
1. If `n` is even, replace `n` with `n / 2`.
2. If `n` is odd, replace `n` with either `n + 1` or `n - 1`.
Return _the minimum number of operations needed for_ `n` _to become_ `1`.
**Example 1:**
**Input:** n = 8
**Output:** 3
**Explanat... | null | Dynamic Programming,Greedy,Bit Manipulation,Memoization | Medium | null |
395 | Hello General Elections Kapoor, Today we discuss the solution to some problem. Repeating characters of longest serving till list is this addel is challenge loot code for the protection is type hind this bill is central and attached to the report related question of given string like this Zor Ke Subah To Return The Leng... | Longest Substring with At Least K Repeating Characters | longest-substring-with-at-least-k-repeating-characters | Given a string `s` and an integer `k`, return _the length of the longest substring of_ `s` _such that the frequency of each character in this substring is greater than or equal to_ `k`.
**Example 1:**
**Input:** s = "aaabb ", k = 3
**Output:** 3
**Explanation:** The longest substring is "aaa ", as 'a' is repeated 3... | null | Hash Table,String,Divide and Conquer,Sliding Window | Medium | 2140,2209 |
390 | all right so hello and welcome good evening i wanted to quickly return to a problem i was working on previously i'm gonna just take a moment to see if this started looks like it did okay great so howdy i was working on this problem this elimination game problem and earlier today and i've been kind of pondering it as i ... | Elimination Game | elimination-game | You have a list `arr` of all integers in the range `[1, n]` sorted in a strictly increasing order. Apply the following algorithm on `arr`:
* Starting from left to right, remove the first number and every other number afterward until you reach the end of the list.
* Repeat the previous step again, but this time fro... | null | Math | Medium | null |
232 | hi guys I'm aita today we should see the problem Implement Q using Stacks so we have to implement a q we know what is q is nothing but first in first out so if we have the elements ordering let's say one comes then two comes three comes four comes the first one to move out will be one first in first next three next fou... | 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 |
491 | um hello so today we are going to do this problem which is part of Fleet code um January daily challenge non-decreasing subsequences so what we non-decreasing subsequences so what we non-decreasing subsequences so what we have here is an array of numbers and we want to return all the different possible non-decreasing s... | Non-decreasing Subsequences | increasing-subsequences | Given an integer array `nums`, return _all the different possible non-decreasing subsequences of the given array with at least two elements_. You may return the answer in **any order**.
**Example 1:**
**Input:** nums = \[4,6,7,7\]
**Output:** \[\[4,6\],\[4,6,7\],\[4,6,7,7\],\[4,7\],\[4,7,7\],\[6,7\],\[6,7,7\],\[7,7\]... | null | Array,Hash Table,Backtracking,Bit Manipulation | Medium | 646 |
539 | minimum time difference uh for this question we are given a list of time in this format and uh the problem is asking us to find the minimum minutes difference between any of the two time points in the list so uh take an example here we have uh 2359 and we have zero right so the difference between these two times is one... | Minimum Time Difference | minimum-time-difference | Given a list of 24-hour clock time points in **"HH:MM "** format, return _the minimum **minutes** difference between any two time-points in the list_.
**Example 1:**
**Input:** timePoints = \["23:59","00:00"\]
**Output:** 1
**Example 2:**
**Input:** timePoints = \["00:00","23:59","00:00"\]
**Output:** 0
**Constrai... | null | Array,Math,String,Sorting | Medium | 2266 |
1,409 | hello everybody so in this video we will be looking at a lead code problem cure is on a permutation with key so it is a medium level problem with more dislike than like but still we are doing it so the problem statement says that we are given an array of queries array queries that only contains positive integer between... | Queries on a Permutation With Key | minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix | Given the array `queries` of positive integers between `1` and `m`, you have to process all `queries[i]` (from `i=0` to `i=queries.length-1`) according to the following rules:
* In the beginning, you have the permutation `P=[1,2,3,...,m]`.
* For the current `i`, find the position of `queries[i]` in the permutation... | Flipping same index two times is like not flipping it at all. Each index can be flipped one time. Try all possible combinations. O(2^(n*m)). | Array,Bit Manipulation,Breadth-First Search,Matrix | Hard | 2259,2268,2314 |
1,605 | hey there welcome back to lead coding today we are solving find weld matrix given row sum and column sum in this problem we are given two arrays row sum and column sum of non-negative integers where row sum i of non-negative integers where row sum i of non-negative integers where row sum i is the sum of elements in the... | Find Valid Matrix Given Row and Column Sums | minimum-number-of-days-to-make-m-bouquets | You are given two arrays `rowSum` and `colSum` of non-negative integers where `rowSum[i]` is the sum of the elements in the `ith` row and `colSum[j]` is the sum of the elements of the `jth` column of a 2D matrix. In other words, you do not know the elements of the matrix, but you do know the sums of each row and column... | If we can make m or more bouquets at day x, then we can still make m or more bouquets at any day y > x. We can check easily if we can make enough bouquets at day x if we can get group adjacent flowers at day x. | Array,Binary Search | Medium | 2134,2257 |
843 | okay kids we're here for guess the words and it's marked as hard don't try this at home it says this problem is an interactive problem new to the leak code platform you're given a word list of unique words each word is six letters log and one word in this list is chosen as secret you may call master guess word to guess... | Guess the Word | binary-trees-with-factors | You are given an array of unique strings `words` where `words[i]` is six letters long. One word of `words` was chosen as a secret word.
You are also given the helper object `Master`. You may call `Master.guess(word)` where `word` is a six-letter-long string, and it must be from `words`. `Master.guess(word)` returns:
... | null | Array,Hash Table,Dynamic Programming | Medium | null |
155 | Hello Everyone Welcome 2153 Electronic Car subscribe Video subscribe The Video then subscribe to subscribe this Video plz subscribe Channel subscribe APresentation Ko Minimal Start 15705 All The Five Veer Subscribe Let's Bring In More Than 120 Will Do Civil Computer Top More Video Subscribe To Play List Country To Next... | Min Stack | min-stack | Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
Implement the `MinStack` class:
* `MinStack()` initializes the stack object.
* `void push(int val)` pushes the element `val` onto the stack.
* `void pop()` removes the element on the top of the stack.
* `int top(... | Consider each node in the stack having a minimum value. (Credits to @aakarshmadhavan) | Stack,Design | Easy | 239,716 |
410 | Hello guys welcome to another video not just coding suggestion problem scars and splashed jasam shayanam which consists of native in teachers and the two countries have every right to minimize the largest among themselves quote example to understand its existence and share it say it is equal to One Is Equal To One Day ... | Split Array Largest Sum | split-array-largest-sum | Given an integer array `nums` and an integer `k`, split `nums` into `k` non-empty subarrays such that the largest sum of any subarray is **minimized**.
Return _the minimized largest sum of the split_.
A **subarray** is a contiguous part of the array.
**Example 1:**
**Input:** nums = \[7,2,5,10,8\], k = 2
**Output:*... | null | Array,Binary Search,Dynamic Programming,Greedy | Hard | 1056,1192,2242,2330 |
68 | hi guys let's do the 68 problem at Lee cortex justification given an array of general letter and length L for Model X I start each line has exactly all characters and is fully left-to-right characters and is fully left-to-right characters and is fully left-to-right justifies justified you should pack your words in a gr... | Text Justification | text-justification | Given an array of strings `words` and a width `maxWidth`, format the text such that each line has exactly `maxWidth` characters and is fully (left and right) justified.
You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces `' '` when necessary so that ea... | null | Array,String,Simulation | Hard | 1714,2260 |
698 | hey what's up guys this is john here and so this time uh let's take a look at this uh problem number 698 partition to k equal sub equals sum subsets yeah this is very classic problem for the uh the recursion plus the uh the backtracking now uh very classic one i'm gonna give it my own like here so basically you're give... | Partition to K Equal Sum Subsets | partition-to-k-equal-sum-subsets | Given an integer array `nums` and an integer `k`, return `true` if it is possible to divide this array into `k` non-empty subsets whose sums are all equal.
**Example 1:**
**Input:** nums = \[4,3,2,3,5,2,1\], k = 4
**Output:** true
**Explanation:** It is possible to divide it into 4 subsets (5), (1, 4), (2,3), (2,3) w... | We can figure out what target each subset must sum to. Then, let's recursively search, where at each call to our function, we choose which of k subsets the next value will join. | Array,Dynamic Programming,Backtracking,Bit Manipulation,Memoization,Bitmask | Medium | 416,2135 |
353 | hey guys this is John so from today I'll be doing some lead code problem-solving be doing some lead code problem-solving be doing some lead code problem-solving videos since I'm also doing lead called problems and I've been doing these called problems for a while and figure out it's a good idea to make some videos not ... | Design Snake Game | design-snake-game | Design a [Snake game](https://en.wikipedia.org/wiki/Snake_(video_game)) that is played on a device with screen size `height x width`. [Play the game online](http://patorjk.com/games/snake/) if you are not familiar with the game.
The snake is initially positioned at the top left corner `(0, 0)` with a length of `1` uni... | null | Array,Design,Queue,Matrix | Medium | null |
331 | Looted 100 picture which this support color liquid problem provinces of a free hotel civilization of ancient pim double problem in this problem viewers subscribe and foot and they need to determine weather subscribe and note hua tha boat input tax wind notice tap your Dance or party the ring jogging or this house that ... | Verify Preorder Serialization of a Binary Tree | verify-preorder-serialization-of-a-binary-tree | One way to serialize a binary tree is to use **preorder traversal**. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as `'#'`.
For example, the above binary tree can be serialized to the string `"9,3,4,#,#,1,#,#,2,#,6,#,# "`, where `'#'` repres... | null | String,Stack,Tree,Binary Tree | Medium | null |
238 | hey guys it's iran with another coding interview tutorial and this time we have product of array except soft this one is labeled as a medium difficulty probably because of this follow-up part which i'm also going to follow-up part which i'm also going to follow-up part which i'm also going to cover in this video so let... | Product of Array Except Self | product-of-array-except-self | Given an integer array `nums`, return _an array_ `answer` _such that_ `answer[i]` _is equal to the product of all the elements of_ `nums` _except_ `nums[i]`.
The product of any prefix or suffix of `nums` is **guaranteed** to fit in a **32-bit** integer.
You must write an algorithm that runs in `O(n)` time and without... | null | Array,Prefix Sum | Medium | 42,152,265,2267 |
135 | Hello gas welcome to me YouTube channel so today we are going to solve problem 135 candy so what is this question I have been told and I have to distribute candies among them and children is ok so candice distribute in two conditions Sir of the first condition, whatever the challan is, he should get at least one candy ... | 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,935 | hi there i'm texastim.dev hi there i'm texastim.dev hi there i'm texastim.dev and this is my ongoing project to grind through all the algorithm problems on leak code so thanks for joining me today why don't we hop on over and see what problems are available today i've done just about all the easy ones sometimes they ad... | Maximum Number of Words You Can Type | minimum-number-of-operations-to-reinitialize-a-permutation | There is a malfunctioning keyboard where some letter keys do not work. All other keys on the keyboard work properly.
Given a string `text` of words separated by a single space (no leading or trailing spaces) and a string `brokenLetters` of all **distinct** letter keys that are broken, return _the **number of words** i... | It is safe to assume the number of operations isn't more than n The number is small enough to apply a brute force solution. | Array,Math,Simulation | Medium | null |
285 | solve question 285 in order successor in bst from bitcoin giving the root of a binary circuitry and a node p in it return the in order successor of that node in the binary circuitry if the given node has no inorder successor in the tree return not so what is this question is asking us it's asking us to return the in or... | Inorder Successor in BST | inorder-successor-in-bst | Given the `root` of a binary search tree and a node `p` in it, return _the in-order successor of that node in the BST_. If the given node has no in-order successor in the tree, return `null`.
The successor of a node `p` is the node with the smallest key greater than `p.val`.
**Example 1:**
**Input:** root = \[2,1,3\... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | 94,173,509 |
1,929 | Work in this field Ajay Ko That [ That [ That Hello Everyone Welcome to New Mode Thursday Problem Answer of Length A Answer Icon In Dance Plus Oil Nickel 2012 Ab Hum Ise Double Meaning School Ki Ab Usme Kya Bole Naam Set has come, that answer is bicycle, then remove the answer which is our that bean will remain the num... | Concatenation of Array | maximum-value-at-a-given-index-in-a-bounded-array | Given an integer array `nums` of length `n`, you want to create an array `ans` of length `2n` where `ans[i] == nums[i]` and `ans[i + n] == nums[i]` for `0 <= i < n` (**0-indexed**).
Specifically, `ans` is the **concatenation** of two `nums` arrays.
Return _the array_ `ans`.
**Example 1:**
**Input:** nums = \[1,2,1\... | What if the problem was instead determining if you could generate a valid array with nums[index] == target? To generate the array, set nums[index] to target, nums[index-i] to target-i, and nums[index+i] to target-i. Then, this will give the minimum possible sum, so check if the sum is less than or equal to maxSum. n is... | Binary Search,Greedy | Medium | null |
18 | what's goin everybody welcome to Python liquor solution on tutorial number 18 for some so if a new here work on be sure to check nearly blot account and there are a lot of important articles here you can carry lead code and you're able to see all the tutorials here so in the last tutorial we learned how we can get on t... | 4Sum | 4sum | Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that:
* `0 <= a, b, c, d < n`
* `a`, `b`, `c`, and `d` are **distinct**.
* `nums[a] + nums[b] + nums[c] + nums[d] == target`
You may return the answer in **any order**.
**Examp... | null | Array,Two Pointers,Sorting | Medium | 1,15,454,2122 |
1,099 | to solve two sum less than K given an array of norms of integers and integer K return the maximum sum such that there exists I less than J with nums I plus nums J equals to sum and sum is less than K if no i j exists satisfying this equation return negative 1. this problem can be solved with a two pointer algorithm so ... | Two Sum Less Than K | path-with-maximum-minimum-value | Given an array `nums` of integers and integer `k`, return the maximum `sum` such that there exists `i < j` with `nums[i] + nums[j] = sum` and `sum < k`. If no `i`, `j` exist satisfying this equation, return `-1`.
**Example 1:**
**Input:** nums = \[34,23,1,24,75,33,54,8\], k = 60
**Output:** 58
**Explanation:** We can... | What if we sort each cell of the matrix by the value? Don't include small values in your path if you can only include large values. Let's keep adding a possible cell to use in the path incrementally with decreasing values. If the start and end cells are connected then we don't need to add more cells. Use union-find dat... | Array,Depth-First Search,Breadth-First Search,Union Find,Heap (Priority Queue),Matrix | Medium | 1753 |
1,791 | Come in, what's going on, how are you all? I hope people are having a lot of fun, so today with a new question which is going to be a very basic entries question of graph theory, so this is the next report, then you can see a lot of 70 center graphs. That means that this question subscribe to subscribe I you should kno... | Find Center of Star Graph | richest-customer-wealth | There is an undirected **star** graph consisting of `n` nodes labeled from `1` to `n`. A star graph is a graph where there is one **center** node and **exactly** `n - 1` edges that connect the center node with every other node.
You are given a 2D integer array `edges` where each `edges[i] = [ui, vi]` indicates that th... | Calculate the wealth of each customer Find the maximum element in array. | Array,Matrix | Easy | null |
447 | cool 4:47 number of boomerangs given cool 4:47 number of boomerangs given cool 4:47 number of boomerangs given endpoints in a plane that all pairwise to sting a boomerang is a couple of points IJ K such that the distance between I and J equals the distance between I and K the word of the tupple matters find it number b... | Number of Boomerangs | number-of-boomerangs | You are given `n` `points` in the plane that are all **distinct**, where `points[i] = [xi, yi]`. A **boomerang** is a tuple of points `(i, j, k)` such that the distance between `i` and `j` equals the distance between `i` and `k` **(the order of the tuple matters)**.
Return _the number of boomerangs_.
**Example 1:**
... | null | Array,Hash Table,Math | Medium | 356 |
107 | Hello friends good evening today we are going to solve our lead code problems uh problem number 107 this is a b tree tral uh B tree label order traversal too and so let's look into the question it's saying that given the root of the boundary tree given the root of the B tree return the bottom of label order Travers tra... | Binary Tree Level Order Traversal II | binary-tree-level-order-traversal-ii | Given the `root` of a binary tree, return _the bottom-up level order traversal of its nodes' values_. (i.e., from left to right, level by level from leaf to root).
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[15,7\],\[9,20\],\[3\]\]
**Example 2:**
**Input:** root = \[1\]
**Output:** \[... | null | Tree,Breadth-First Search,Binary Tree | Medium | 102,637 |
1,304 | let's go over number 1304 and find n unique integers sum up to zero the problem says given that integer n so we're given a number return any array containing n unique integers such that they add up to zero so this problem is relatively straightforward so we're given a number and which is going to be an integer so whole... | Find N Unique Integers Sum up to Zero | longest-happy-string | Given an integer `n`, return **any** array containing `n` **unique** integers such that they add up to `0`.
**Example 1:**
**Input:** n = 5
**Output:** \[-7,-1,1,3,4\]
**Explanation:** These arrays also are accepted \[-5,-1,1,2,3\] , \[-3,-1,2,-2,4\].
**Example 2:**
**Input:** n = 3
**Output:** \[-1,0,1\]
**Exampl... | Use a greedy approach. Use the letter with the maximum current limit that can be added without breaking the condition. | String,Greedy,Heap (Priority Queue) | Medium | 778 |
791 | hi everyone once again welcome to the channel today we are going to solve a very important problem custom sort string this problem got us 10 times in last six month facebook and this problem seems very straightforward not that tricky but this problem basically teach some lesson to the especially for the java developers... | Custom Sort String | split-bst | You are given two strings order and s. All the characters of `order` are **unique** and were sorted in some custom order previously.
Permute the characters of `s` so that they match the order that `order` was sorted. More specifically, if a character `x` occurs before a character `y` in `order`, then `x` should occur ... | Use recursion. If root.val <= V, you split root.right into two halves, then join it's left half back on root.right. | Tree,Binary Search Tree,Recursion,Binary Tree | Medium | 450 |
739 | Loot Hello Everyone Welcome To Cases Of Family On Sunlight Boxer Today's Question Today's Questions Delhi Temperature In This Question Veer Video Subscribe 4,650 Subscribe 4,650 Subscribe 4,650 Subscribe Temperature Gauge Temperature Subscribe Quote Degree Temperature So Let's Get Valve Similarly Force With Respect To ... | Daily Temperatures | daily-temperatures | Given an array of integers `temperatures` represents the daily temperatures, return _an array_ `answer` _such that_ `answer[i]` _is the number of days you have to wait after the_ `ith` _day to get a warmer temperature_. If there is no future day for which this is possible, keep `answer[i] == 0` instead.
**Example 1:**... | If the temperature is say, 70 today, then in the future a warmer temperature must be either 71, 72, 73, ..., 99, or 100. We could remember when all of them occur next. | Array,Stack,Monotonic Stack | Medium | 496,937 |
199 | question 199 of loot code binary tree right side view given the root of a binary tree imagine yourself standing on the right side of it turn the values of the node you can see ordered from top to bottom so here we have a binary tree and we just want to return the right side view so there are two ways to do this you can... | Binary Tree Right Side View | binary-tree-right-side-view | Given the `root` of a binary tree, imagine yourself standing on the **right side** of it, return _the values of the nodes you can see ordered from top to bottom_.
**Example 1:**
**Input:** root = \[1,2,3,null,5,null,4\]
**Output:** \[1,3,4\]
**Example 2:**
**Input:** root = \[1,null,3\]
**Output:** \[1,3\]
**Examp... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 116,545 |
1,457 | Hello guys welcome if we get into that Disney Today Will Be Distancing Question Cylinders Five Inventory In This Question Were Given By Native And Values And Exit From 12918 Put It To Front Row Effective Value In This Room Number Must Subscribe With Values 2321 Liked Must Subscribe With Values 2321 Liked Must Subsc... | Pseudo-Palindromic Paths in a Binary Tree | minimum-difficulty-of-a-job-schedule | Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be **pseudo-palindromic** if at least one permutation of the node values in the path is a palindrome.
_Return the number of **pseudo-palindromic** paths going from the root node to leaf nodes._
**Example 1:**
**Input:*... | Use DP. Try to cut the array into d non-empty sub-arrays. Try all possible cuts for the array. Use dp[i][j] where DP states are i the index of the last cut and j the number of remaining cuts. Complexity is O(n * n * d). | Array,Dynamic Programming | Hard | null |
223 | Hi gas welcome and welcome back to my channel so today our problem is rectangle area so what have I given us in this problem statement, here I have given us two rectangles and have given the coordinates of both, okay let us find here. What is the area covered by both the rectangles? Okay, so now what we do here is let ... | Rectangle Area | rectangle-area | Given the coordinates of two **rectilinear** rectangles in a 2D plane, return _the total area covered by the two rectangles_.
The first rectangle is defined by its **bottom-left** corner `(ax1, ay1)` and its **top-right** corner `(ax2, ay2)`.
The second rectangle is defined by its **bottom-left** corner `(bx1, by1)` ... | null | Math,Geometry | Medium | 866 |
1,771 | so hello coders welcome to my channel and in this video i will be explaining this problem maximize palindrome length from subsequence and you know to be honest it is a pretty tough problem but don't worry if you watch this video how to solve this problem the thought process and the algorithm is going to be crystal clea... | Maximize Palindrome Length From Subsequences | sell-diminishing-valued-colored-balls | You are given two strings, `word1` and `word2`. You want to construct a string in the following manner:
* Choose some **non-empty** subsequence `subsequence1` from `word1`.
* Choose some **non-empty** subsequence `subsequence2` from `word2`.
* Concatenate the subsequences: `subsequence1 + subsequence2`, to make ... | Greedily sell the most expensive ball. There is some value k where all balls of value > k are sold, and some, (maybe 0) of balls of value k are sold. Use binary search to find this value k, and use maths to find the total sum. | Array,Math,Binary Search,Greedy,Sorting,Heap (Priority Queue) | Medium | 2263 |
48 | hello friends welcome to coding host youtube channel in this video i will explain you lead code problem rotate image so in this question we have a matrix representing an image and we have to rotate the image by 90 degrees clockwise so we have to modify the given 2d matrix and we cannot allocate another 2d matrix so in ... | 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 |
174 | everyone how's it going in today's video we'll be discussing about there's really addressing dynamic programming problem called dungeon game and before we proceed further I just want to give like a kind of a fair warning that this is not a very big interest problem and if you don't have a lot of experience with dynamic... | Dungeon Game | dungeon-game | The demons had captured the princess and imprisoned her in **the bottom-right corner** of a `dungeon`. The `dungeon` consists of `m x n` rooms laid out in a 2D grid. Our valiant knight was initially positioned in **the top-left room** and must fight his way through `dungeon` to rescue the princess.
The knight has an i... | null | Array,Dynamic Programming,Matrix | Hard | 62,64,741,2354 |
76 | hello guys welcome back to take do and in this video we will see the minimum window substring problem which is from lead code number 76 and this is from the array topic let us now look at the problem statement in this problem we are given two strings s and t of length M comma n return the minimum window substring of s ... | 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 |
62 | alright hello guys welcome to another video we'll be talking about number 62 unique paths so this problem is a medium problem and it says a robot is located at the top-left corner of am x ndred at the top-left corner of am x ndred at the top-left corner of am x ndred mark to start so this grid right here the robot can ... | 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,202 | hi everyone right Kelvin here so let's decide about weekly contest 155 third question smallest ring with swaps so we are given a string s an array of pairs in this the string pairs where there is a be like so it means like if we connect 0 & 3 0 entry is in one group and 0 & 2 0 & 3 0 entry is in one group a... | Smallest String With Swaps | palindrome-removal | You are given a string `s`, and an array of pairs of indices in the string `pairs` where `pairs[i] = [a, b]` indicates 2 indices(0-indexed) of the string.
You can swap the characters at any pair of indices in the given `pairs` **any number of times**.
Return the lexicographically smallest string that `s` can be chang... | Use dynamic programming. Let dp[i][j] be the solution for the sub-array from index i to index j. Notice that if we have S[i] == S[j] one transition could be just dp(i + 1, j + 1) because in the last turn we would have a palindrome and we can extend this palindrome from both sides, the other transitions are not too diff... | Array,Dynamic Programming | Hard | null |
1,695 | hello everyone welcome to coders camp we are at 28th day of may lead code challenge and the problem we are going to cover in this video is maximum rho value the input given here is an integer array and we have to return an integer value again which is the maximum score we can get by erasing exactly one subarry and it i... | Maximum Erasure Value | maximum-sum-obtained-of-any-permutation | You are given an array of positive integers `nums` and want to erase a subarray containing **unique elements**. The **score** you get by erasing the subarray is equal to the **sum** of its elements.
Return _the **maximum score** you can get by erasing **exactly one** subarray._
An array `b` is called to be a subarray... | Indexes with higher frequencies should be bound with larger values | Array,Greedy,Sorting,Prefix Sum | Medium | null |
1,235 | hello guys this is interview prep hello world here today we are going to discuss the lead code problem maximum profit and job scheduling so let me explain about the problem so this problem is given as we have n jobs where every job is set scheduled to be done from a start time i to start time j and the profit that you ... | Maximum Profit in Job Scheduling | maximum-profit-in-job-scheduling | We have `n` jobs, where every job is scheduled to be done from `startTime[i]` to `endTime[i]`, obtaining a profit of `profit[i]`.
You're given the `startTime`, `endTime` and `profit` arrays, return the maximum profit you can take such that there are no two jobs in the subset with overlapping time range.
If you choose... | null | null | Hard | null |
787 | hello guys welcome to deep codes and in today's video we will discuss lead code patient 787 that's this cheapest flights within K stops so here we are given ncts and a flights array uh where each index represent the flight from City I to CTI with a price uh so yeah and you can make case stops in between starting from s... | 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,614 | hey kids i'm back well it's been at least over a month lots of stuff has happened um but i decide to get back in the game mostly to ask one question do you remember when everybody used to speak english when some people were able to write an actual sentence when you just want to get to the point and not all not add a bu... | Maximum Nesting Depth of the Parentheses | maximum-nesting-depth-of-the-parentheses | A string is a **valid parentheses string** (denoted **VPS**) if it meets one of the following:
* It is an empty string `" "`, or a single character not equal to `"( "` or `") "`,
* It can be written as `AB` (`A` concatenated with `B`), where `A` and `B` are **VPS**'s, or
* It can be written as `(A)`, where `A` i... | null | null | Easy | null |
606 | Loot guys welcome and welcome back to my channel so what is our problem today Construct a string from every such problems What is given in the statement here we are given a binary tree and what we have to do is to construct a string which That it is made of princess and interior, you will get this intense value in the ... | Construct String from Binary Tree | construct-string-from-binary-tree | Given the `root` of a binary tree, construct a string consisting of parenthesis and integers from a binary tree with the preorder traversal way, and return it.
Omit all the empty parenthesis pairs that do not affect the one-to-one mapping relationship between the string and the original binary tree.
**Example 1:**
*... | null | String,Tree,Depth-First Search,Binary Tree | Easy | 536,652 |
426 | this video we're going to look at a legal problem called convert binary search tree to sorted doubly linked list so convert a binary search tree to a sorted circular doubly link listing place so you can see here this is our binary search tree and we want to convert this into a doubly linked list that's circular right u... | Convert Binary Search Tree to Sorted Doubly Linked List | convert-binary-search-tree-to-sorted-doubly-linked-list | Convert a **Binary Search Tree** to a sorted **Circular Doubly-Linked List** in place.
You can think of the left and right pointers as synonymous to the predecessor and successor pointers in a doubly-linked list. For a circular doubly linked list, the predecessor of the first element is the last element, and the succe... | null | null | Medium | null |
394 | hello friends now let's solve the decode the string problem let's see the statement given an encoded string return its decoded string and we see the examples if it's three open square brackets a closed square bracket and there are two busy I will return that means this a rapacious red hands so we return AAA and this me... | 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,547 | hey what's up guys john here and so today uh let's take a look at this uh this week's uh weekly contest one of the problem so number 1547 it's hard to believe it's over 1 1500 problems already okay minimum cost to cut a stick it's a hard problem it's a very classic problem i don't know it's a hard or like medium hard b... | Minimum Cost to Cut a Stick | destination-city | Given a wooden stick of length `n` units. The stick is labelled from `0` to `n`. For example, a stick of length **6** is labelled as follows:
Given an integer array `cuts` where `cuts[i]` denotes a position you should perform a cut at.
You should perform the cuts in order, you can change the order of the cuts as you ... | Start in any city and use the path to move to the next city. Eventually, you will reach a city with no path outgoing, this is the destination city. | Hash Table,String | Easy | null |
338 | hello everyone welcome back here's van absent today we got a interesting problem to solve counting bits from lead code so it's a fairly easy problem but a trick lies in solving it in linear time so if you are ready let's jump in so here is the problem we are given an integer uh let's say and we need to return an array ... | Counting Bits | counting-bits | Given an integer `n`, return _an array_ `ans` _of length_ `n + 1` _such that for each_ `i` (`0 <= i <= n`)_,_ `ans[i]` _is the **number of**_ `1`_**'s** in the binary representation of_ `i`.
**Example 1:**
**Input:** n = 2
**Output:** \[0,1,1\]
**Explanation:**
0 --> 0
1 --> 1
2 --> 10
**Example 2:**
**Input:** n =... | You should make use of what you have produced already. Divide the numbers in ranges like [2-3], [4-7], [8-15] and so on. And try to generate new range from previous. Or does the odd/even status of the number help you in calculating the number of 1s? | Dynamic Programming,Bit Manipulation | Easy | 191 |
990 | Hello welcome to Delhi practice of DSA question and today equality equations so question seems very hard to read but let us understand what is in the question, what was given to us an equation, it is given to us is the equation of string which is string. Okay and in what way is this given to us, two equations like equa... | Satisfiability of Equality Equations | verifying-an-alien-dictionary | You are given an array of strings `equations` that represent relationships between variables where each string `equations[i]` is of length `4` and takes one of two different forms: `"xi==yi "` or `"xi!=yi "`.Here, `xi` and `yi` are lowercase letters (not necessarily different) that represent one-letter variable names.
... | null | Array,Hash Table,String | Easy | null |
771 | day two of uh may lead coding challenge and the problem is least code problem number 771 and it's a simple application of asset uh where we are asked to find how many of the stones you are given is jewel so you are given uh an array where you are given different types of jewels so for example if this is the javel's arr... | 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,680 | Hello hello viewers welcome to my interesting video the series according school cant imagine or quantity binary numbers given interior invested in the decimal value benefiting from bank wedding - representations of 120 no.in for wedding - representations of 120 no.in for wedding - representations of 120 no.in for no7 g... | Concatenation of Consecutive Binary Numbers | count-all-possible-routes | Given an integer `n`, return _the **decimal value** of the binary string formed by concatenating the binary representations of_ `1` _to_ `n` _in order, **modulo**_ `109 + 7`.
**Example 1:**
**Input:** n = 1
**Output:** 1
**Explanation: ** "1 " in binary corresponds to the decimal value 1.
**Example 2:**
**Input:**... | Use dynamic programming to solve this problem with each state defined by the city index and fuel left. Since the array contains distinct integers fuel will always be spent in each move and so there can be no cycles. | Array,Dynamic Programming,Memoization | Hard | null |
1,248 | Jhaal Hi Guys Welcome Back To My Channel I Hope You All Are Doing Good So Laddu Samay Problems And Dynamic Programming For Long Time Letter To Your Mother And Sister [ Long Time Letter To Your Mother And Sister [ Long Time Letter To Your Mother And Sister Ain't Interesting Ain't Interesting Ain't Interesting Problem So... | Count Number of Nice Subarrays | binary-tree-coloring-game | Given an array of integers `nums` and an integer `k`. A continuous subarray is called **nice** if there are `k` odd numbers on it.
Return _the number of **nice** sub-arrays_.
**Example 1:**
**Input:** nums = \[1,1,2,1,1\], k = 3
**Output:** 2
**Explanation:** The only sub-arrays with 3 odd numbers are \[1,1,2,1\] an... | The best move y must be immediately adjacent to x, since it locks out that subtree. Can you count each of (up to) 3 different subtrees neighboring x? | Tree,Depth-First Search,Binary Tree | Medium | null |
4 | So Hello Everyone Welcome Back To Me YouTube Channel So Today We Are Going To Solve This September You Can Say This Note D Constraint Given In This Question Give This Problem Statement Bill B Of Medium Difficulty Level Right Statement And This Constant Bill Automatically Recess Some Difficulty In solving this problem s... | Median of Two Sorted Arrays | median-of-two-sorted-arrays | Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays.
The overall run time complexity should be `O(log (m+n))`.
**Example 1:**
**Input:** nums1 = \[1,3\], nums2 = \[2\]
**Output:** 2.00000
**Explanation:** merged array = \[1,2,3\] and median is ... | null | Array,Binary Search,Divide and Conquer | Hard | null |
399 | hey everyone in this site hope you are doing good so let's start with the questions on the question is evaluate division okay so you are given an array of variables per equations and an array of real number values okay so you are given two array one is equation another is value so where equation is a i comma b i and va... | Evaluate Division | evaluate-division | You are given an array of variable pairs `equations` and an array of real numbers `values`, where `equations[i] = [Ai, Bi]` and `values[i]` represent the equation `Ai / Bi = values[i]`. Each `Ai` or `Bi` is a string that represents a single variable.
You are also given some `queries`, where `queries[j] = [Cj, Dj]` rep... | Do you recognize this as a graph problem? | Array,Depth-First Search,Breadth-First Search,Union Find,Graph,Shortest Path | Medium | null |
1,862 | hey everybody this is larry this is me going with q4 to buy wiggly contest 52 some of the ford pairs so this one it's kind of tricky um especially with the mod and stuff and i had to make sure that i get the mod right but the key thing to notice is that the biggest number is going to be 10 times uh or 10 to the fifth w... | 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 |
1,922 | Hello Guy Today We Are Going To See The Lid Code Question Count Code Numbers A Digit String E Code If Eight Indices Are Even And Digits At Odd Indices Are Prime Number Then The Numbers Are From Row To Na So For Example 2582 E Good Because 2 and 8 are at even position and the digit f and are at odd position and prime so... | Count Good Numbers | count-good-numbers | A digit string is **good** if the digits **(0-indexed)** at **even** indices are **even** and the digits at **odd** indices are **prime** (`2`, `3`, `5`, or `7`).
* For example, `"2582 "` is good because the digits (`2` and `8`) at even positions are even and the digits (`5` and `2`) at odd positions are prime. Howe... | null | null | Medium | null |
208 | all right everybody so welcome back today we'll be looking at a leode problem called Implement try otherwise known as a prefix tree now this problem is unique in the sense that it deals with a data structure or essentially we're being asked to create a data structure that is not very well covered and not a lot of peopl... | Implement Trie (Prefix Tree) | implement-trie-prefix-tree | A [**trie**](https://en.wikipedia.org/wiki/Trie) (pronounced as "try ") or **prefix tree** is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker.
Implement the Trie class:
* `Trie()` ... | null | Hash Table,String,Design,Trie | Medium | 211,642,648,676,1433,1949 |
146 | how are you cash part two let's recap what we have so far so we start at the not left and right where the board value is zero in here so here is zero eight nine three and then we insert the uh address at 900 with the value one so this is 0 1 and 0. then we insert two in here so next up to the previous of 900 is 893 so ... | LRU Cache | lru-cache | Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**.
Implement the `LRUCache` class:
* `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`.
* `int get(int key)` Return the valu... | null | Hash Table,Linked List,Design,Doubly-Linked List | Medium | 460,588,604,1903 |
268 | welcome to march's leeco challenge today's problem is missing number given an array nums containing n distinct integers in the range of 0 to n return the only number in the range that is missing from the array follow-up can you implement using only follow-up can you implement using only follow-up can you implement usin... | Missing Number | missing-number | Given an array `nums` containing `n` distinct numbers in the range `[0, n]`, return _the only number in the range that is missing from the array._
**Example 1:**
**Input:** nums = \[3,0,1\]
**Output:** 2
**Explanation:** n = 3 since there are 3 numbers, so all numbers are in the range \[0,3\]. 2 is the missing number... | null | Array,Hash Table,Math,Bit Manipulation,Sorting | Easy | 41,136,287,770,2107 |
547 | um hello so today we are going to do this problem which is part of Fleet code daily challenge number of provinces so what this problem says is we just have n cities and some of them are connected While others are not and basically S3 is connected directly to another city so I'll say CTA is connected to B if um if we ha... | Number of Provinces | number-of-provinces | There are `n` cities. Some of them are connected, while some are not. If city `a` is connected directly with city `b`, and city `b` is connected directly with city `c`, then city `a` is connected indirectly with city `c`.
A **province** is a group of directly or indirectly connected cities and no other cities outside ... | null | Depth-First Search,Breadth-First Search,Union Find,Graph | Medium | 323,657,734,737,1085,2206 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.