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 |
|---|---|---|---|---|---|---|---|---|
328 | hi guys hope you are doing great uh today's question is odd-even link list today's question is odd-even link list today's question is odd-even link list given a singly linked list group all odd nodes together followed by the even notes please note here we are talking about the node number not the values in the nodes yo... | Odd Even Linked List | odd-even-linked-list | Given the `head` of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return _the reordered list_.
The **first** node is considered **odd**, and the **second** node is **even**, and so on.
Note that the relative order inside both the even and odd groups s... | null | Linked List | Medium | 725 |
200 | Hello Hi Everyone Welcome To My Channel Today In This Video Bihar Solving A Very Famous Problem Number Oil This Problem According To Google Microsoft Amazon Interview Selection Problem Statement And Give An Example For Giving A Gross And Degraded Map Of 108 Number Of Land And Water For Connecting Edison Electronic Ciga... | Number of Islands | number-of-islands | Given an `m x n` 2D binary grid `grid` which represents a map of `'1'`s (land) and `'0'`s (water), return _the number of islands_.
An **island** is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
**Exampl... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | 130,286,305,323,694,695,2035,2103 |
1,909 | in this question we are given an array return true if it can be made strictly increasing after removing exactly one element or false otherwise my initial self to approach this question is to go through this array using a loop and also set a counter up front if they see a current element is smaller than the previous ele... | Remove One Element to Make the Array Strictly Increasing | buildings-with-an-ocean-view | Given a **0-indexed** integer array `nums`, return `true` _if it can be made **strictly increasing** after removing **exactly one** element, or_ `false` _otherwise. If the array is already strictly increasing, return_ `true`.
The array `nums` is **strictly increasing** if `nums[i - 1] < nums[i]` for each index `(1 <= ... | You can traverse the buildings from the nearest to the ocean to the furthest. Keep with you the maximum to the right while traversing to determine if you can see the ocean or not. | Array,Stack,Monotonic Stack | Medium | 1305 |
1,844 | lead code 1844 replace all digits with characters so the question in brief is that you'll be given a string something like a b d e f XY z x u c Pi a b something like this and there could be some digits in between right something like um this and this right there could be digit so what you need to do is you need to retu... | Replace All Digits with Characters | maximum-number-of-balls-in-a-box | You are given a **0-indexed** string `s` that has lowercase English letters in its **even** indices and digits in its **odd** indices.
There is a function `shift(c, x)`, where `c` is a character and `x` is a digit, that returns the `xth` character after `c`.
* For example, `shift('a', 5) = 'f'` and `shift('x', 0) =... | Note that both lowLimit and highLimit are of small constraints so you can iterate on all nubmer between them You can simulate the boxes by counting for each box the number of balls with digit sum equal to that box number | Hash Table,Math,Counting | Easy | null |
1,557 | hey so welcome back and this is another daily code problem so today it's called minimum number of vertices to reach all nodes and it's yet again a medium level question but it's a graph problem here and so I actually read this wrong initially so I'm going to try to make sure I explained it to you right so make sure to ... | Minimum Number of Vertices to Reach All Nodes | check-if-a-string-contains-all-binary-codes-of-size-k | Given a **directed acyclic graph**, with `n` vertices numbered from `0` to `n-1`, and an array `edges` where `edges[i] = [fromi, toi]` represents a directed edge from node `fromi` to node `toi`.
Find _the smallest set of vertices from which all nodes in the graph are reachable_. It's guaranteed that a unique solution ... | We need only to check all sub-strings of length k. The number of distinct sub-strings should be exactly 2^k. | Hash Table,String,Bit Manipulation,Rolling Hash,Hash Function | Medium | null |
1,697 | Hello everyone welcome, PAN card problem is a hard level problem, okay so let's quickly understand what is my problem statement, what details are given and what we have to do, okay so more is given in the problem statement. Ok and what is given is my number of nodes, how many notes I have in the question, ok, apart fro... | Checking Existence of Edge Length Limited Paths | strings-differ-by-one-character | An undirected graph of `n` nodes is defined by `edgeList`, where `edgeList[i] = [ui, vi, disi]` denotes an edge between nodes `ui` and `vi` with distance `disi`. Note that there may be **multiple** edges between two nodes.
Given an array `queries`, where `queries[j] = [pj, qj, limitj]`, your task is to determine for e... | BruteForce, check all pairs and verify if they differ in one character. O(n^2 * m) where n is the number of words and m is the length of each string. O(m^2 * n), Use hashset, to insert all possible combinations adding a character "*". For example: If dict[i] = "abc", insert ("*bc", "a*c" and "ab*"). | Hash Table,String,Rolling Hash,Hash Function | Medium | 2256 |
1,816 | hi guys welcome back today let's look at this problem truncate sentence it says a sentence is a list of words that are separated by a single space with no leading or trailing spaces okay that's a very general statement next it says each of the words consist of only uppercase and lowercase english letters no punctuation... | Truncate Sentence | lowest-common-ancestor-of-a-binary-tree-iv | A **sentence** is a list of words that are separated by a single space with no leading or trailing spaces. Each of the words consists of **only** uppercase and lowercase English letters (no punctuation).
* For example, `"Hello World "`, `"HELLO "`, and `"hello world hello world "` are all sentences.
You are given a... | Starting from the root, traverse the left and the right subtrees, checking if one of the nodes exist there. If one of the subtrees doesn't contain any given node, the LCA can be the node returned from the other subtree If both subtrees contain nodes, the LCA node is the current node. | Tree,Depth-First Search,Binary Tree | Medium | 235,236,1218,1780,1790,1816 |
36 | hi everyone welcome to my YouTube channel and for this video we will talk about given a grid like 9x9 grid we have to determine whether this is a valid Sudoku or not so I just want to emphasize that this is not so for this problem we are not trying to come up with a Sudoku server we just want to know whether a given in... | Valid Sudoku | valid-sudoku | Determine if a `9 x 9` Sudoku board is valid. Only the filled cells need to be validated **according to the following rules**:
1. Each row must contain the digits `1-9` without repetition.
2. Each column must contain the digits `1-9` without repetition.
3. Each of the nine `3 x 3` sub-boxes of the grid must contain... | null | Array,Hash Table,Matrix | Medium | 37,2254 |
201 | hey everyone today we'll be solving lead problem number 2011 bitwise and of number range in this problem we are given a number range from left to right inclusively and what we have to do is we have to take the end of all of these number in this range let's say if in an example we are given range from left to right as 5... | Bitwise AND of Numbers Range | bitwise-and-of-numbers-range | Given two integers `left` and `right` that represent the range `[left, right]`, return _the bitwise AND of all numbers in this range, inclusive_.
**Example 1:**
**Input:** left = 5, right = 7
**Output:** 4
**Example 2:**
**Input:** left = 0, right = 0
**Output:** 0
**Example 3:**
**Input:** left = 1, right = 2147... | null | Bit Manipulation | Medium | null |
428 | hey guys welcome back in the last session we learnt how to serialize and deserialize bst and binary tree today we are going to learn how to serialize and this realize an error tree okay in the binary tree approach we used dfs period traversal and we serialized and also we used the same technique pre-order traversal sam... | Serialize and Deserialize N-ary Tree | serialize-and-deserialize-n-ary-tree | Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment.
Design an algorithm to serialize and deserialize an N... | null | null | Hard | null |
394 | Luti 19th Family Trick and Test Questions Quick Questions Verification Horoscope and Giving and Electronic Monitoring Should Give in and Your Destiny After Retired Sperm Decoding Andar Tuition Proves That You Need to Apply for Indian Wedding Night Inco Tracks Her Depot School Se Tube White Vinegar Kalu's and in the pro... | 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 |
799 | Jhaal Hello Hi Guys Welcome To Code Ishwar Today's Question Champagne To Hour In This Question By Step Zinc Pyramid Form Swift Raghavan Classes Tubeless Tension Champion Is Food Hindi First Class Edit Top I Top Model School Any Access Liquid Form Will Fall Equal To 10 Glasses Immediately To The left and right profit in... | 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 |
1,437 | Hello Hi Guys Welcome To Our Jab Mitti In Speedometer Questions Related To All One For At Least Length Of Pleasure They Give 90K Through All The Buttons Are Not Kept Away From A Distance Between To That Similarly For Example 34 Hindi Conference Vacancy In The Land Forms Are Being In The History Of Each And Will Be In B... | Check If All 1's Are at Least Length K Places Away | minimum-insertion-steps-to-make-a-string-palindrome | Given an binary array `nums` and an integer `k`, return `true` _if all_ `1`_'s are at least_ `k` _places away from each other, otherwise return_ `false`.
**Example 1:**
**Input:** nums = \[1,0,0,0,1,0,0,1\], k = 2
**Output:** true
**Explanation:** Each of the 1s are at least 2 places away from each other.
**Example ... | Is dynamic programming suitable for this problem ? If we know the longest palindromic sub-sequence is x and the length of the string is n then, what is the answer to this problem? It is n - x as we need n - x insertions to make the remaining characters also palindrome. | String,Dynamic Programming | Hard | 1356 |
520 | hello everyone in this video we will be solving problem number 520 detect capitals the problem statement is we have been given a string word and we need to return true if the usage of the capital Senate is correct there are three valid patterns in which we need to return true if the string matches that particular patte... | Detect Capital | detect-capital | We define the usage of capitals in a word to be right when one of the following cases holds:
* All letters in this word are capitals, like `"USA "`.
* All letters in this word are not capitals, like `"leetcode "`.
* Only the first letter in this word is capital, like `"Google "`.
Given a string `word`, return `... | null | String | Easy | 2235 |
806 | what's going on everybody today I wanted to go through and walk you through how I solved this number 806 number of lines to right string a problem on leak code this is by no means like the way to do it this is just how I figured it out it has a lot of downvotes I guess it's because I didn't really find it too bad the d... | Number of Lines To Write String | domino-and-tromino-tiling | You are given a string `s` of lowercase English letters and an array `widths` denoting **how many pixels wide** each lowercase English letter is. Specifically, `widths[0]` is the width of `'a'`, `widths[1]` is the width of `'b'`, and so on.
You are trying to write `s` across several lines, where **each line is no long... | null | Dynamic Programming | Medium | null |
228 | okay let's talk about summary range so you are given a sort of unique integer array nums so you have to return the smaller sort this of the range they cover all of the number in the array exactly so i mean you don't have to release a description the idea is if you continuous increasingly you just have to sort into a fo... | Summary Ranges | summary-ranges | You are given a **sorted unique** integer array `nums`.
A **range** `[a,b]` is the set of all integers from `a` to `b` (inclusive).
Return _the **smallest sorted** list of ranges that **cover all the numbers in the array exactly**_. That is, each element of `nums` is covered by exactly one of the ranges, and there is... | null | Array | Easy | 163,352 |
392 | welcome to choice dynamic programming tutorial this is joey lately i have been focusing on some hot dynamic programming problems from lead code and in this video i will continue the trend by focusing on another lead good problem that goes by the title is subsequence without any delay let's check out its problem stateme... | Is Subsequence | is-subsequence | Given two strings `s` and `t`, return `true` _if_ `s` _is a **subsequence** of_ `t`_, or_ `false` _otherwise_.
A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i... | null | Two Pointers,String,Dynamic Programming | Easy | 808,1051 |
384 | Hello how are you I am always doing good welcome to the boys is lips today will do safal and there and when July list challenge is question and answers in this question sholay 3d printed safal android ja re designer algorithm to randomly safal are all the best all The Best Be Like Ali As A Result They Are Hidden Succee... | Shuffle an Array | shuffle-an-array | Given an integer array `nums`, design an algorithm to randomly shuffle the array. All permutations of the array should be **equally likely** as a result of the shuffling.
Implement the `Solution` class:
* `Solution(int[] nums)` Initializes the object with the integer array `nums`.
* `int[] reset()` Resets the arr... | The solution expects that we always use the original array to shuffle() else some of the test cases fail. (Credits; @snehasingh31) | Array,Math,Randomized | Medium | null |
1,466 | hey everybody this is Larry this is day 24 of the legal day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's plan will you order routes to make all paths lead to the city zero yeah hit the like button in the Subscribe button join my Discord I hope you ar... | Reorder Routes to Make All Paths Lead to the City Zero | jump-game-v | There are `n` cities numbered from `0` to `n - 1` and `n - 1` roads such that there is only one way to travel between two different cities (this network form a tree). Last year, The ministry of transport decided to orient the roads in one direction because they are too narrow.
Roads are represented by `connections` wh... | Use dynamic programming. dp[i] is max jumps you can do starting from index i. Answer is max(dp[i]). dp[i] = 1 + max (dp[j]) where j is all indices you can reach from i. | Array,Dynamic Programming,Sorting | Hard | 2001 |
328 | hello guys welcome back to Drake dose and in this video we will see the odd-even linked list problem which is odd-even linked list problem which is odd-even linked list problem which is from lead code day 16 of the May challenge so let us now look at the problem statement given a singly linked list group all the nodes ... | Odd Even Linked List | odd-even-linked-list | Given the `head` of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return _the reordered list_.
The **first** node is considered **odd**, and the **second** node is **even**, and so on.
Note that the relative order inside both the even and odd groups s... | null | Linked List | Medium | 725 |
937 | video we're gonna take a look at a legal problem called reorder data in log files so this question doesn't really have a lot of up votes but this question is very helpful to do in my opinion because one this question is really it's frequently asked by amazon and the other point is that this question i think really test... | Reorder Data in Log Files | online-stock-span | You are given an array of `logs`. Each log is a space-delimited string of words, where the first word is the **identifier**.
There are two types of logs:
* **Letter-logs**: All words (except the identifier) consist of lowercase English letters.
* **Digit-logs**: All words (except the identifier) consist of digits... | null | Stack,Design,Monotonic Stack,Data Stream | Medium | 739 |
304 | welcome to mazelico challenge today's problem is range sum query 2d immutable given a 2d matrix handle multiple queries of the following type calculate the sum of the elements of matrix inside the rectangle defined by its upper left corner given by row one column one and its lower right corner given to us by row two co... | Range Sum Query 2D - Immutable | range-sum-query-2d-immutable | Given a 2D matrix `matrix`, handle multiple queries of the following type:
* Calculate the **sum** of the elements of `matrix` inside the rectangle defined by its **upper left corner** `(row1, col1)` and **lower right corner** `(row2, col2)`.
Implement the `NumMatrix` class:
* `NumMatrix(int[][] matrix)` Initial... | null | Array,Design,Matrix,Prefix Sum | Medium | 303,308 |
1,656 | so I will discuss about a lead code problem on 656 uh designed and ordered stream so uh yeah we'll be given uh HTML paint ID key value pairs I hope you have already delete this problem so I will going to discuss about the code explanation you behind so first of all we see in our solution bar in Paris unexpected use so ... | Design an Ordered Stream | count-good-triplets | There is a stream of `n` `(idKey, value)` pairs arriving in an **arbitrary** order, where `idKey` is an integer between `1` and `n` and `value` is a string. No two pairs have the same `id`.
Design a stream that returns the values in **increasing order of their IDs** by returning a **chunk** (list) of values after each... | Notice that the constraints are small enough for a brute force solution to pass. Loop through all triplets, and count the ones that are good. | Array,Enumeration | Easy | 2122 |
9 | so we have to check if the number is palindrome or not and return a Boolean value according to it first we check if it is negative then we return false we do not have to go in the next step and check for the reverse number then if it is not a negative number we go and make a variable as reverse rev and a temporary vari... | Palindrome Number | palindrome-number | Given an integer `x`, return `true` _if_ `x` _is a_ _**palindrome**__, and_ `false` _otherwise_.
**Example 1:**
**Input:** x = 121
**Output:** true
**Explanation:** 121 reads as 121 from left to right and from right to left.
**Example 2:**
**Input:** x = -121
**Output:** false
**Explanation:** From left to right, i... | Beware of overflow when you reverse the integer. | Math | Easy | 234,1375 |
1,963 | hey everybody this is larry this is me going with q3 of the weekly contest 253 on lead code minimum number of swaps to make the string balance um so this one is a tricky one and the key thing to note about this problem is to hit the like button hit the subscribe button join me on discord give me some support give me so... | Minimum Number of Swaps to Make the String Balanced | find-xor-sum-of-all-pairs-bitwise-and | You are given a **0-indexed** string `s` of **even** length `n`. The string consists of **exactly** `n / 2` opening brackets `'['` and `n / 2` closing brackets `']'`.
A string is called **balanced** if and only if:
* It is the empty string, or
* It can be written as `AB`, where both `A` and `B` are **balanced** s... | Think about (a&b) ^ (a&c). Can you simplify this expression? It is equal to a&(b^c). Then, (arr1[i]&arr2[0])^(arr1[i]&arr2[1]).. = arr1[i]&(arr2[0]^arr2[1]^arr[2]...). Let arr2XorSum = (arr2[0]^arr2[1]^arr2[2]...), arr1XorSum = (arr1[0]^arr1[1]^arr1[2]...) so the final answer is (arr2XorSum&arr1[0]) ^ (arr2XorSum&arr1[... | Array,Math,Bit Manipulation | Hard | null |
24 | Hello everyone so today we will be discussing question number 24 of lead code which is swap nodes in pairs so la jo problem hai na this is a part of my recurring playlist and in the first video of this playlist I have discussed it in detail. How does Rick work, what is his intuition, how do we use it in problems, then ... | Swap Nodes in Pairs | swap-nodes-in-pairs | Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.)
**Example 1:**
**Input:** head = \[1,2,3,4\]
**Output:** \[2,1,4,3\]
**Example 2:**
**Input:** head = \[\]
**Output:** \[\... | null | Linked List,Recursion | Medium | 25,528 |
815 | hey everybody this is Larry this is day 12 of the leod day challenge hit the like button hit the Subscribe button join my Discord let me know what you think about today's Fara uh I'm in miara on top of a mountain I forgot the name already because I've been hiking all day and it's siring uh but yeah uh here in Japan and... | Bus Routes | champagne-tower | You are given an array `routes` representing bus routes where `routes[i]` is a bus route that the `ith` bus repeats forever.
* For example, if `routes[0] = [1, 5, 7]`, this means that the `0th` bus travels in the sequence `1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> ...` forever.
You will start at the bus stop `source` (You... | null | Dynamic Programming | Medium | 1385 |
907 | hello guys and welcome back to lead Logics this is the sum of subarray minimums from lead code this is a lead code medium and the number for this is 907 so in the given problem we are having an integer ARR and we have to find the minimum B where B ranges over every continuous array of ARR and since the answer may be la... | Sum of Subarray Minimums | koko-eating-bananas | Given an array of integers arr, find the sum of `min(b)`, where `b` ranges over every (contiguous) subarray of `arr`. Since the answer may be large, return the answer **modulo** `109 + 7`.
**Example 1:**
**Input:** arr = \[3,1,2,4\]
**Output:** 17
**Explanation:**
Subarrays are \[3\], \[1\], \[2\], \[4\], \[3,1\], \... | null | Array,Binary Search | Medium | 788,1335,2188 |
84 | Hello, my name is Suren, this is a solution with easy to parse, number 84 logies rectangle in histogram, what do you need to do in this problem as input, you are given an array of numbers based on these numbers, you need to build graphs, number is the height of the graph, each column always has a width of one, this is ... | Largest Rectangle in Histogram | largest-rectangle-in-histogram | Given an array of integers `heights` representing the histogram's bar height where the width of each bar is `1`, return _the area of the largest rectangle in the histogram_.
**Example 1:**
**Input:** heights = \[2,1,5,6,2,3\]
**Output:** 10
**Explanation:** The above is a histogram where width of each bar is 1.
The l... | null | Array,Stack,Monotonic Stack | Hard | 85,1918 |
1,300 | hello so continuing on this little code view click on test 16 the second problem was some of the committed array closest to target and so problem is medium problem with 1300 some of mutated array closest to target so the problem says is that given an array and the target value we want to return the integer values such ... | Sum of Mutated Array Closest to Target | critical-connections-in-a-network | Given an integer array `arr` and a target value `target`, return the integer `value` such that when we change all the integers larger than `value` in the given array to be equal to `value`, the sum of the array gets as close as possible (in absolute difference) to `target`.
In case of a tie, return the minimum such in... | Use Tarjan's algorithm. | Depth-First Search,Graph,Biconnected Component | Hard | null |
1,749 | hi friends welcome back today we are going to solve fleet code problems 17 49 maximum absolute sum of and sub array it's a medium complexity problem so uh let's go through the description you are given an integer error numbers the absolute sum of a sub array nums one two nums of are right is absolute of nums one plus n... | 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 |
865 | okay what's up guys John here so today let's take a look at another elite called problem here number 865 a smallest sub tree with all the deepest nodes so this is a this is another tree problem so basically you're given a binary tree and you need to find basically the lowest ancestor for all the deepest nodes right so ... | 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 |
17 | hello and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem number 17 letter combinations of a phone number let's read the question prompt given a string containing digits from two to nine inclusive return all possib possible letter combinations that the number could re... | Letter Combinations of a Phone Number | letter-combinations-of-a-phone-number | Given a string containing digits from `2-9` inclusive, return all possible letter combinations that the number could represent. Return the answer in **any order**.
A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.
**Example 1:**
**Input:** di... | null | Hash Table,String,Backtracking | Medium | 22,39,401 |
1,675 | hello guys welcome to the codeplay today we will be discussing lead code 1675 minimize deviation in array so in this problem we have given an array of n positive integers you can perform two types of operations on any element of the array of any number of times if the element is even divided by two or else if the eleme... | 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 |
1,062 | all right guys let's do this uh given a string is find out the length of the longest repeating substring or sub strings there could be multiple okay yeah but in any case the length would be highest return zero also we have to just return the length and not the substring so return 0 if no repeating substring exists okay... | Longest Repeating Substring | partition-array-into-three-parts-with-equal-sum | Given a string `s`, return _the length of the longest repeating substrings_. If no repeating substring exists, return `0`.
**Example 1:**
**Input:** s = "abcd "
**Output:** 0
**Explanation:** There is no repeating substring.
**Example 2:**
**Input:** s = "abbaba "
**Output:** 2
**Explanation:** The longest repeat... | If we have three parts with the same sum, what is the sum of each?
If you can find the first part, can you find the second part? | Array,Greedy | Easy | 2102 |
136 | what's up guys Xavier Ellen here today I'm going over a single number it's an easy solution on leak code please subscribe to my channel if you haven't already and hit that like button it helps their YouTube algorithm so my channel can grow so yeah today I was learning about house or not learning reviewing hashmaps and ... | Single Number | single-number | Given a **non-empty** array of integers `nums`, every element appears _twice_ except for one. Find that single one.
You must implement a solution with a linear runtime complexity and use only constant extra space.
**Example 1:**
**Input:** nums = \[2,2,1\]
**Output:** 1
**Example 2:**
**Input:** nums = \[4,1,2,1,2... | null | Array,Bit Manipulation | Easy | 137,260,268,287,389 |
237 | Jhal Soft Udayveer Looking at This Problem and Digit No Dinner Least Shows the President She is the Function to Delete a Node in Nursing Play List I Will Not Give You Access to Be Held at Least You Will Gain Access to Not Be Deleted and Avoid the Knot Withdraw 98100 and consider only 100 internal you do to the like thi... | 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 |
61 | hi my name is Angy and welcome back today we'll see how to rotate link list for example if the link list is 1 2 3 4 and five and our K is equals to two we need to rotate twice in first rotation five will come in the starting and our link list would be 5 1 2 3 and four five have come in the starting in the second rotati... | Rotate List | rotate-list | Given the `head` of a linked list, rotate the list to the right by `k` places.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], k = 2
**Output:** \[4,5,1,2,3\]
**Example 2:**
**Input:** head = \[0,1,2\], k = 4
**Output:** \[2,0,1\]
**Constraints:**
* The number of nodes in the list is in the range `[0, 500]`.
* ... | null | Linked List,Two Pointers | Medium | 189,725 |
1,627 | hello friends and welcome to my channel let's have a look at problem 1627 together graph connectivity with threshold in this video we are going to share a solution based on this joint set data structure also known as unit fund this problem is marked hard in leader code however if we carefully analyze the statement of t... | Graph Connectivity With Threshold | last-moment-before-all-ants-fall-out-of-a-plank | We have `n` cities labeled from `1` to `n`. Two different cities with labels `x` and `y` are directly connected by a bidirectional road if and only if `x` and `y` share a common divisor **strictly greater** than some `threshold`. More formally, cities with labels `x` and `y` have a road between them if there exists an ... | The ants change their way when they meet is equivalent to continue moving without changing their direction. Answer is the max distance for one ant to reach the end of the plank in the facing direction. | Array,Brainteaser,Simulation | Medium | 2317 |
64 | Hello hello friends in this session where to introduce another light to problem minimum 5 some divine famous interview mode to turn off day I gave the company poison five numbers only all you need to two apk file path from top to bottom united Egg Identification Subscribe Possible Only Who Died At Any Point In Liquid R... | Minimum Path Sum | minimum-path-sum | Given a `m x n` `grid` filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path.
**Note:** You can only move either down or right at any point in time.
**Example 1:**
**Input:** grid = \[\[1,3,1\],\[1,5,1\],\[4,2,1\]\]
**Output:** 7
**Explanat... | null | Array,Dynamic Programming,Matrix | Medium | 62,174,741,2067,2192 |
101 | Hello gas welcome you are going to do question number 22 of my channel delete code number one zero one is an easy level question but these questions are really good and give options in the starting face of your interviews ok in the beginning we ask such questions. Then gradually they increase the level, then you should... | 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 |
212 | hello everyone Aaron here and welcome back to lead code today we are doing the word search 2 problem so this one is being pre-recorded so if you've seen being pre-recorded so if you've seen being pre-recorded so if you've seen this I must be on holiday and I hope you're all having a wonderful time and I'll be back soon... | Word Search II | word-search-ii | Given an `m x n` `board` of characters and a list of strings `words`, return _all words on the board_.
Each word must be constructed from letters of sequentially adjacent cells, where **adjacent cells** are horizontally or vertically neighboring. The same letter cell may not be used more than once in a word.
**Exampl... | You would need to optimize your backtracking to pass the larger test. Could you stop backtracking earlier? If the current candidate does not exist in all words' prefix, you could stop backtracking immediately. What kind of data structure could answer such query efficiently? Does a hash table work? Why or why not? How a... | Array,String,Backtracking,Trie,Matrix | Hard | 79,1022,1433 |
743 | hello everyone welcome back to my channel in this video i will discuss the question network delay time with the gesture algorithm from the description we can say we have a network of nodes we also have a list of array as times including the value between each nodes and the time and now we have a star node as k from the... | 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 |
26 | so Hello everyone, Let's solve the next problem from the code: Remove duplicate From sorted the code: Remove duplicate From sorted the code: Remove duplicate From sorted array Here the joke is also very similar to the previous problem, open it here, I've already solved it, so let's move on to the description of the ide... | Remove Duplicates from Sorted Array | remove-duplicates-from-sorted-array | Given an integer array `nums` sorted in **non-decreasing order**, remove the duplicates [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm) such that each unique element appears only **once**. The **relative order** of the elements should be kept the **same**. Then return _the number of unique elements in_... | In this problem, the key point to focus on is the input array being sorted. As far as duplicate elements are concerned, what is their positioning in the array when the given array is sorted? Look at the image above for the answer. If we know the position of one of the elements, do we also know the positioning of all th... | Array,Two Pointers | Easy | 27,80 |
345 | all right welcome to this video let's solve Lika prom 345 reverse vowels of a string now of course you can solve this problem by using regular expressions which I see a lot of solutions doing and that's perfectly fine however personally I suck at regular expressions and your asked us and say a whiteboarding interview a... | 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 |
213 | hello everyone I hope you guys are doing good so today we'll be discussing another problem of a blind 75 series problem 230 House robber 2. so I hope you have seen the video of problem House robber the problem that I have covered just before this problem just has a simple deviation from house rubber in this problem we ... | House Robber II | house-robber-ii | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are **arranged in a circle.** That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have a security system connected, and **it will automatical... | Since House[1] and House[n] are adjacent, they cannot be robbed together. Therefore, the problem becomes to rob either House[1]-House[n-1] or House[2]-House[n], depending on which choice offers more money. Now the problem has degenerated to the House Robber, which is already been solved. | Array,Dynamic Programming | Medium | 198,256,276,337,600,656 |
1,759 | all right let's try uh and um medium difficulty problem count of homogeneous substrings given a string as return the number of homogeneous substrings of s since the answer may be too large return it modulo or something a string is homogeneous if all the characters of the string are the same a substring is homogeneous i... | Count Number of Homogenous Substrings | find-the-missing-ids | Given a string `s`, return _the number of **homogenous** substrings of_ `s`_._ Since the answer may be too large, return it **modulo** `109 + 7`.
A string is **homogenous** if all the characters of the string are the same.
A **substring** is a contiguous sequence of characters within a string.
**Example 1:**
**Inpu... | null | Database | Medium | 1357,1420,1467 |
1,420 | hello friends today I'm gonna talk about new Dakota 14 2002 array where you can find the maximun you can Center the K comparisons the party that you are given also of my operation our code that is trying to find the maximum value and the corresponding medicine the index for meat and co-ceo walls is a search cost meat a... | Build Array Where You Can Find The Maximum Exactly K Comparisons | find-the-start-and-end-number-of-continuous-ranges | You are given three integers `n`, `m` and `k`. Consider the following algorithm to find the maximum element of an array of positive integers:
You should build the array arr which has the following properties:
* `arr` has exactly `n` integers.
* `1 <= arr[i] <= m` where `(0 <= i < n)`.
* After applying the menti... | null | Database | Medium | 1357,1759 |
1,218 | hey what's up guys chung here again so today let's take a look at this uh problem here uh number 1218 longest arithmetic subsequence of given difference okay another array problem here so you're given like uh an array here okay an unsorted array okay it could be either zero like uh any integer basically and another dif... | Longest Arithmetic Subsequence of Given Difference | lowest-common-ancestor-of-deepest-leaves | Given an integer array `arr` and an integer `difference`, return the length of the longest subsequence in `arr` which is an arithmetic sequence such that the difference between adjacent elements in the subsequence equals `difference`.
A **subsequence** is a sequence that can be derived from `arr` by deleting some or n... | Do a postorder traversal. Then, if both subtrees contain a deepest leaf, you can mark this node as the answer (so far). The final node marked will be the correct answer. | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 1816 |
1,015 | Hello friends welcome to front my this absolutely smooth individual like this question Beerwah subscribe to the Page if you liked The Video then subscribe to the Channel subscribe and subscribe this Video I will never get rich and organized The Video then subscribe to The Amazing Limited Number of Women subscribe 0 sub... | Smallest Integer Divisible by K | smallest-integer-divisible-by-k | Given a positive integer `k`, you need to find the **length** of the **smallest** positive integer `n` such that `n` is divisible by `k`, and `n` only contains the digit `1`.
Return _the **length** of_ `n`. If there is no such `n`, return -1.
**Note:** `n` may not fit in a 64-bit signed integer.
**Example 1:**
**In... | null | null | Medium | null |
1,071 | Hello friends today I am going to solve liquid problem number 1071 greatest common divisor of strings so in this problem we are given two strings string one and string two and we need to return a larger string X such that the string acts divides both at string 1 and string two so this problem is actually a greatest com... | Greatest Common Divisor of Strings | binary-prefix-divisible-by-5 | For two strings `s` and `t`, we say "`t` divides `s` " if and only if `s = t + ... + t` (i.e., `t` is concatenated with itself one or more times).
Given two strings `str1` and `str2`, return _the largest string_ `x` _such that_ `x` _divides both_ `str1` _and_ `str2`.
**Example 1:**
**Input:** str1 = "ABCABC ", str2... | If X is the first i digits of the array as a binary number, then 2X + A[i] is the first i+1 digits. | Array | Easy | null |
43 | okay let's talk about multiply string so in this question it's so hard to explain and i've tried multiple time recording the video but think about it like when you want to convert to a two individual string right you actually cannot convert the entire uh string to integer at first because you are in a stack overflow so... | 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 |
171 | in this video I will solve it called problem number 171 excel sheet call number so we are given a contact o as appear in an Excel spreadsheet and we need to return its corresponding column number so this problem is the same as converting number from base 26 to a stand so let's look at some examples for example a B to c... | Excel Sheet Column Number | excel-sheet-column-number | Given a string `columnTitle` that represents the column title as appears in an Excel sheet, return _its corresponding column number_.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
**Example 1:**
**Input:** columnTitle = "A "
**Output:** 1
**Example 2:**
**Input:** columnTitle = "AB "
**Ou... | null | Math,String | Easy | 168,2304 |
203 | hey everyone and today we are going to select a little question remembering to this elements so you are giving head of link to this and the integer bar remove all the nodes of the linked list that has node bar equal bar and returns a new head so let's see the example so you are given one two six three four five six and... | 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 |
1,594 | Loot Gaye Loot In This Video Tamilnadu Medicine Problem Maximum Nupur Ne Matrix 200 Person Me Matrix Of Information And You Will Be Started With 0 Fashion And Unique To Avoid Affordable For Children Last Point Name Addison Antioxidant Productive Work Number 66 On Confined Maximum On Top Secretary Organization Here I Do... | Maximum Non Negative Product in a Matrix | maximum-non-negative-product-in-a-matrix | You are given a `m x n` matrix `grid`. Initially, you are located at the top-left corner `(0, 0)`, and in each step, you can only **move right or down** in the matrix.
Among all possible paths starting from the top-left corner `(0, 0)` and ending in the bottom-right corner `(m - 1, n - 1)`, find the path with the **ma... | null | null | Medium | null |
813 | hello guys welcome to my youtube channel today I am going to be explaining a question called largest sum of averages let me start off by explaining to you the question so we are given an input array a we have to divide a into at most key groups score is defined as the sum of the averages of each of these groups our tas... | Largest Sum of Averages | all-paths-from-source-to-target | You are given an integer array `nums` and an integer `k`. You can partition the array into **at most** `k` non-empty adjacent subarrays. The **score** of a partition is the sum of the averages of each subarray.
Note that the partition must use every integer in `nums`, and that the score is not necessarily an integer.
... | null | Backtracking,Depth-First Search,Breadth-First Search,Graph | Medium | 2090 |
347 | So give us gas 68, our top key frequent elements, easy question and a very good question, you will understand it, but we have to see the approach, how are we going to do it, we have to check that we have given the name of the name, hey, this is the input. I have given and I want to tell you the two elements which have ... | Top K Frequent Elements | top-k-frequent-elements | Given an integer array `nums` and an integer `k`, return _the_ `k` _most frequent elements_. You may return the answer in **any order**.
**Example 1:**
**Input:** nums = \[1,1,1,2,2,3\], k = 2
**Output:** \[1,2\]
**Example 2:**
**Input:** nums = \[1\], k = 1
**Output:** \[1\]
**Constraints:**
* `1 <= nums.lengt... | null | Array,Hash Table,Divide and Conquer,Sorting,Heap (Priority Queue),Bucket Sort,Counting,Quickselect | Medium | 192,215,451,659,692,1014,1919 |
47 | okay lit code number 47 permutations two just like the previous task we have a number sequence we have to return all the permutations of it but this time we have two unique permutations and it warns us that there can be repeating numbers so i'm pretty sure that the same code written in the previous one would work but i... | Permutations II | permutations-ii | Given a collection of numbers, `nums`, that might contain duplicates, return _all possible unique permutations **in any order**._
**Example 1:**
**Input:** nums = \[1,1,2\]
**Output:**
\[\[1,1,2\],
\[1,2,1\],
\[2,1,1\]\]
**Example 2:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,... | null | Array,Backtracking | Medium | 31,46,267,1038 |
408 | uh so this question is about the word abbreviation so uh this is pretty straightforward um you are allowed to like replace an integer to what uh to the charts you have in the uh stream world and then you are you have some constraint like you cannot like replacing a substring on this neighbor uh right after right so 5 i... | Valid Word Abbreviation | valid-word-abbreviation | A string can be **abbreviated** by replacing any number of **non-adjacent**, **non-empty** substrings with their lengths. The lengths **should not** have leading zeros.
For example, a string such as `"substitution "` could be abbreviated as (but not limited to):
* `"s10n "` ( `"s ubstitutio n "`)
* `"sub4u4 "` ( ... | null | Two Pointers,String | Easy | 411,527,2184 |
997 | hello everyone welcome back to lead coding today we are solving find the town judge is a basic graph problem and let us go through the description of the problem in a town there are n people labeled from 1 to n there's a rumor that one of the people is secretly down judge so for the town church there are three conditio... | Find the Town Judge | find-the-town-judge | In a town, there are `n` people labeled from `1` to `n`. There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
1. The town judge trusts nobody.
2. Everybody (except for the town judge) trusts the town judge.
3. There is exactly one person that satisfies properties **... | null | null | Easy | null |
983 | um and also today we are going to do this problem which is part of Fleet code daily challenge minimum cost for tickets so basically you have you plant some travel um some train traveling when you are in advance um in the days of the year in which you will travel are given as an integer array of days right and each day ... | Minimum Cost For Tickets | validate-stack-sequences | You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array `days`. Each day is an integer from `1` to `365`.
Train tickets are sold in **three different ways**:
* a **1-day** pass is sold for `costs[0]` dollars,
* a **7-day** pass is sold... | null | Array,Stack,Simulation | Medium | null |
130 | Hey how's it hangin guys so in this video we'll discuss about this problem surrounded regions so in this problem we will be given a two-dimensional array will be given a two-dimensional array will be given a two-dimensional array consisting of X and O's so something like this now in this problem x will capture oh now t... | Surrounded Regions | surrounded-regions | Given an `m x n` matrix `board` containing `'X'` and `'O'`, _capture all regions that are 4-directionally surrounded by_ `'X'`.
A region is **captured** by flipping all `'O'`s into `'X'`s in that surrounded region.
**Example 1:**
**Input:** board = \[\[ "X ", "X ", "X ", "X "\],\[ "X ", "O ", "O ", "X "\],\[ "X ", "... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | 200,286 |
135 | Hello Everyone Suggestion Question List Candidates And Acidity Change Font Saudi Arabia And Children Standing In A Line In Children Insider Trading Value In Teachers Day Greetings And Your Given You All Giving And To Children Subject The Video then subscribe to The Amazing Candidate Twitter The Video then subscribe to ... | 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,713 | hello welcome today let's try to solve another lyrical problem 1713 minimum of reasons to make a subsequence so we are giving a Target array at our array so the target is a 513 and the other array is nine four two three and four so we just need to like add some numbers inside of the Ring to make this target array is th... | Minimum Operations to Make a Subsequence | dot-product-of-two-sparse-vectors | You are given an array `target` that consists of **distinct** integers and another integer array `arr` that **can** have duplicates.
In one operation, you can insert any integer at any position in `arr`. For example, if `arr = [1,4,1,2]`, you can add `3` in the middle and make it `[1,4,3,1,2]`. Note that you can inser... | Because the vector is sparse, use a data structure that stores the index and value where the element is nonzero. | Array,Hash Table,Two Pointers,Design | Medium | null |
1,927 | hey everybody this is larry this is me going with q33 of the bi-weekly contest 56 sum game so of the bi-weekly contest 56 sum game so of the bi-weekly contest 56 sum game so i actually did not solve this during the contest though a lot of it's because i spent too long on q4 i actually got this near the end after i kind... | Sum Game | maximum-ascending-subarray-sum | Alice and Bob take turns playing a game, with **Alice** **starting first**.
You are given a string `num` of **even length** consisting of digits and `'?'` characters. On each turn, a player will do the following if there is still at least one `'?'` in `num`:
1. Choose an index `i` where `num[i] == '?'`.
2. Replace ... | It is fast enough to check all possible subarrays The end of each ascending subarray will be the start of the next | Array | Easy | 2205 |
210 | to solve legal question 210 course schedule number two and it's a median legal question so there are tons a total of number of courses that you have to take let's say look at this example the number of courses equals two and labeled from zero to number of courses minus one so basically if number of courses equals two t... | Course Schedule II | course-schedule-ii | There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`.
* For example, the pair `[0, 1]`, indicates that to take cou... | This problem is equivalent to finding the topological order in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topolo... | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 207,269,310,444,630,1101,2220 |
112 | hi everyone welcome to my YouTube channel and in this video we will look at problem 112 from the code so this is the continuation from my previous video there are four problems in this you know in this series path sum so this is the second iteration of the problem series so here is the problem statement and post this v... | Path Sum | path-sum | Given the `root` of a binary tree and an integer `targetSum`, return `true` if the tree has a **root-to-leaf** path such that adding up all the values along the path equals `targetSum`.
A **leaf** is a node with no children.
**Example 1:**
**Input:** root = \[5,4,8,11,null,13,4,7,2,null,null,null,1\], targetSum = 22... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 113,124,129,437,666 |
236 | we are given a root of the tree and also two random nodes of that tree we need to find out the lowest common ancestor of these two random nodes for example if P equal to 5 and Q equal to 1 are the two nodes given then the node 3 will be the lowest ancestor common to both these nodes 5 and 1. an important thing to note ... | Lowest Common Ancestor of a Binary Tree | lowest-common-ancestor-of-a-binary-tree | Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
According to the [definition of LCA on Wikipedia](https://en.wikipedia.org/wiki/Lowest_common_ancestor): "The lowest common ancestor is defined between two nodes `p` and `q` as the lowest node in `T` that has both `p` and `q` as... | null | Tree,Depth-First Search,Binary Tree | Medium | 235,1190,1354,1780,1790,1816,2217 |
850 | Hey hello there today I'm looking at the question 850 rectangle - so the question 850 rectangle - so the question 850 rectangle - so the question can be pretty much the summarized with a single image here that's the question provides we have a 2d plan and we've got a bunch of different rectangles we can off different s... | Rectangle Area II | insert-into-a-sorted-circular-linked-list | You are given a 2D array of axis-aligned `rectangles`. Each `rectangle[i] = [xi1, yi1, xi2, yi2]` denotes the `ith` rectangle where `(xi1, yi1)` are the coordinates of the **bottom-left corner**, and `(xi2, yi2)` are the coordinates of the **top-right corner**.
Calculate the **total area** covered by all `rectangles` ... | null | Linked List | Medium | 147 |
1,673 | hey what's up guys this is jung so this time 1673 find the most competitive subsequence so this is today's daily challenge so you're given like integer arrays nums and a positive integer k and you need to return the most competitive subsequence of numbers of size k and an array okay so that's the definition of subseque... | Find the Most Competitive Subsequence | find-the-most-competitive-subsequence | Given an integer array `nums` and a positive integer `k`, return _the most **competitive** subsequence of_ `nums` _of size_ `k`.
An array's subsequence is a resulting sequence obtained by erasing some (possibly zero) elements from the array.
We define that a subsequence `a` is more **competitive** than a subsequence ... | null | null | Medium | null |
41 | Hello hi and welcome to line repeat status problem is first in singh positive like date 30th september light co challenge electronics available proven problem status given unsupported all points polished missing positive in teacher 's request scientific example 120 jaunpur 's request scientific example 120 jaunpur 's r... | 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,877 | hello guys so my name is vessing and today 17 November 2023 and uh today we are going to uh discuss about today's lead code problem that is 1879 problem number 1879 and uh the problem statement is minimize the maximum some pair okay so we have to minimize what we have to minimize the maximum some pair okay so we have t... | Minimize Maximum Pair Sum in Array | find-followers-count | The **pair sum** of a pair `(a,b)` is equal to `a + b`. The **maximum pair sum** is the largest **pair sum** in a list of pairs.
* For example, if we have pairs `(1,5)`, `(2,3)`, and `(4,4)`, the **maximum pair sum** would be `max(1+5, 2+3, 4+4) = max(6, 5, 8) = 8`.
Given an array `nums` of **even** length `n`, pai... | null | Database | Easy | null |
871 | That the students were only good singers Traditional minimum number of Muslims Top 10 we destination and starts from President gives pain on the number of top tourist destination that also it is giving details not possible to reach the destination in the here facility to open diners Definition of Smart U Letter Creativ... | Minimum Number of Refueling Stops | keys-and-rooms | A car travels from a starting position to a destination which is `target` miles east of the starting position.
There are gas stations along the way. The gas stations are represented as an array `stations` where `stations[i] = [positioni, fueli]` indicates that the `ith` gas station is `positioni` miles east of the sta... | null | Depth-First Search,Breadth-First Search,Graph | Medium | 261 |
890 | hey everybody this is larry this is day 30 of the july leco daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's prom ah no three points okay this is gonna be my 850 day streak so let's get to it find and replace pattern given string words in a pattern... | Find and Replace Pattern | lemonade-change | Given a list of strings `words` and a string `pattern`, return _a list of_ `words[i]` _that match_ `pattern`. You may return the answer in **any order**.
A word matches the pattern if there exists a permutation of letters `p` so that after replacing every letter `x` in the pattern with `p(x)`, we get the desired word.... | null | Array,Greedy | Easy | null |
122 | let's see another common problem that is asked in facebook interviews and it's from lead core problem number 122 and it's called best time to buy and sell stock and its version is two because there is one simpler version also version 1. this is version 2 so let's see the problem so you are given the stock prices on dif... | Best Time to Buy and Sell Stock II | best-time-to-buy-and-sell-stock-ii | You are given an integer array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
On each day, you may decide to buy and/or sell the stock. You can only hold **at most one** share of the stock at any time. However, you can buy it then immediately sell it on the **same day**.
Find and return _t... | null | Array,Dynamic Programming,Greedy | Medium | 121,123,188,309,714 |
1,845 | hello everyone welcome to my programming club today we will be solving another daily lead code problem and the problem's name is seat reservation manager so you have to design a system that manages the reservation state of N seats numbered from 1 to nement the following seat manager class seat manager uh constru will i... | Seat Reservation Manager | largest-submatrix-with-rearrangements | Design a system that manages the reservation state of `n` seats that are numbered from `1` to `n`.
Implement the `SeatManager` class:
* `SeatManager(int n)` Initializes a `SeatManager` object that will manage `n` seats numbered from `1` to `n`. All seats are initially available.
* `int reserve()` Fetches the **sm... | For each column, find the number of consecutive ones ending at each position. For each row, sort the cumulative ones in non-increasing order and "fit" the largest submatrix. | Array,Greedy,Sorting,Matrix | Medium | 695 |
708 | and welcome back to the cracking Fang YouTube channel today we're going to be solving lead code problem 708 insert into circular linked list before we get into the question you guys know the drill please subscribe to the channel it really helps me grow alright given a circular linked list node which is sorted in non-de... | Insert into a Sorted Circular Linked List | insert-into-a-sorted-circular-linked-list | Given a Circular Linked List node, which is sorted in non-descending order, write a function to insert a value `insertVal` into the list such that it remains a sorted circular list. The given node can be a reference to any single node in the list and may not necessarily be the smallest value in the circular list.
If t... | null | null | Medium | null |
501 | hey everyone welcome back and today we'll be doing another lead code 501 find the mode in binary search tree an easy one given the root of the binary search tree return all the modes the most frequently occurred element in it and that's it just return the most frequently occurred element in it and let's get started so ... | Find Mode in Binary Search Tree | find-mode-in-binary-search-tree | Given the `root` of a binary search tree (BST) with duplicates, return _all the [mode(s)](https://en.wikipedia.org/wiki/Mode_(statistics)) (i.e., the most frequently occurred element) in it_.
If the tree has more than one mode, return them in **any order**.
Assume a BST is defined as follows:
* The left subtree of... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | 98 |
120 | hello everyone in this video we are going to see the lead code question number 120 triangle given a triangle array return the minimum pot sum from top to bottom for each step you may move to the adjacent number of the row below more formally if you are on index I on the current row you may move to either index I or ind... | Triangle | triangle | Given a `triangle` array, return _the minimum path sum from top to bottom_.
For each step, you may move to an adjacent number of the row below. More formally, if you are on index `i` on the current row, you may move to either index `i` or index `i + 1` on the next row.
**Example 1:**
**Input:** triangle = \[\[2\],\[... | null | Array,Dynamic Programming | Medium | null |
81 | hello everyone welcome to my programming Club today we will be solving another daily need for challenge and the challenge name is search in rotated sorted array for two so this is a follow pronoun for this problem such in rotate subject array let's quickly read the wrong statement out and then see what we have to do th... | Search in Rotated Sorted Array II | search-in-rotated-sorted-array-ii | There is an integer array `nums` sorted in non-decreasing order (not necessarily with **distinct** values).
Before being passed to your function, `nums` is **rotated** at an unknown pivot index `k` (`0 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nu... | null | Array,Binary Search | Medium | 33 |
459 | Ki a hello hi description aman decide aur aa jaa rahe bijli iska guava do karane video me banegi third hai third question he is rather doing challenge see question what is shifted something pattern so why not distract can be constructed by taking substring operate and depending Multiple Officer Chintu Yadav Pumik Hujum... | Repeated Substring Pattern | repeated-substring-pattern | Given a string `s`, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.
**Example 1:**
**Input:** s = "abab "
**Output:** true
**Explanation:** It is the substring "ab " twice.
**Example 2:**
**Input:** s = "aba "
**Output:** false
**Example 3:**
... | null | String,String Matching | Easy | 28,686 |
322 | leak code question 322 coin change so you're given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money return the fewest number of coins that you need to make up that amount if that amount of money cannot be made up by any combination of the co... | Coin Change | coin-change | You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money.
Return _the fewest number of coins that you need to make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `-1`.
You may a... | null | Array,Dynamic Programming,Breadth-First Search | Medium | 1025,1393,2345 |
1,752 | Hello Happy Birthday Bhaiya Ko Interwoven Any Problem Research One Only Are Short End State Government Interior 173 Return Value History Sadhe And Problem Hai That End Would Be Given Declared Welcome New 2018 How To Enter Final Year Shiva Are 3512 Time And Obscene Short End Routed through if the output is dry sonth hai... | Check if Array Is Sorted and Rotated | arithmetic-subarrays | Given an array `nums`, return `true` _if the array was originally sorted in non-decreasing order, then rotated **some** number of positions (including zero)_. Otherwise, return `false`.
There may be **duplicates** in the original array.
**Note:** An array `A` rotated by `x` positions results in an array `B` of the sa... | To check if a given sequence is arithmetic, just check that the difference between every two consecutive elements is the same. If and only if a set of numbers can make an arithmetic sequence, then its sorted version makes an arithmetic sequence. So to check a set of numbers, sort it, and check if that sequence is arith... | Array,Sorting | Medium | 413,1626 |
219 | Hello welcome back friends loot problem 219 content duplicate 250 start looking details into this problem is mentioned that if one to three digit code solution videos in java and java j2ee related interview helpful videos come also have a positive created play list for list solutions advisor important you No Java Inter... | Contains Duplicate II | contains-duplicate-ii | Given an integer array `nums` and an integer `k`, return `true` _if there are two **distinct indices**_ `i` _and_ `j` _in the array such that_ `nums[i] == nums[j]` _and_ `abs(i - j) <= k`.
**Example 1:**
**Input:** nums = \[1,2,3,1\], k = 3
**Output:** true
**Example 2:**
**Input:** nums = \[1,0,1,1\], k = 1
**Outp... | null | Array,Hash Table,Sliding Window | Easy | 217,220 |
46 | morning everyone this is logic coding today we are going to look at another backtracking problem called permutation so permutation and combination is a type of problem that backtracking and recursion can give us all the possible results so in this one it's pretty straightforward we're given a vector of a integers array... | Permutations | permutations | Given an array `nums` of distinct integers, return _all the possible permutations_. You can return the answer in **any order**.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,1\],\[3,1,2\],\[3,2,1\]\]
**Example 2:**
**Input:** nums = \[0,1\]
**Output:** \[\[0,1\],\[1,0\... | null | Array,Backtracking | Medium | 31,47,60,77 |
793 | anyways what's up this is your girl and today we'll be discussing problem 793 or fleetwood so follow those who would not read the question i just pause the video here and please read the question okay I hope you must have read the question and question is not at all difficult in understanding so straight we move to the... | Preimage Size of Factorial Zeroes Function | swap-adjacent-in-lr-string | Let `f(x)` be the number of zeroes at the end of `x!`. Recall that `x! = 1 * 2 * 3 * ... * x` and by convention, `0! = 1`.
* For example, `f(3) = 0` because `3! = 6` has no zeroes at the end, while `f(11) = 2` because `11! = 39916800` has two zeroes at the end.
Given an integer `k`, return the number of non-negativ... | Think of the L and R's as people on a horizontal line, where X is a space. The people can't cross each other, and also you can't go from XRX to RXX. | Two Pointers,String | Medium | null |
148 | Hello and welcome to the channel, so today's question is 148 Saltless Four will come here, 3 will come here, okay what are you doing now, what is your method of merging them, batter, so equals have been added. And slow is equals then added ok and one you prefer take divide karnal demand people then what will you do vil... | Sort List | sort-list | Given the `head` of a linked list, return _the list after sorting it in **ascending order**_.
**Example 1:**
**Input:** head = \[4,2,1,3\]
**Output:** \[1,2,3,4\]
**Example 2:**
**Input:** head = \[-1,5,3,4,0\]
**Output:** \[-1,0,3,4,5\]
**Example 3:**
**Input:** head = \[\]
**Output:** \[\]
**Constraints:**
* ... | null | Linked List,Two Pointers,Divide and Conquer,Sorting,Merge Sort | Medium | 21,75,147,1992 |
1,483 | hey everybody this is Larry I'm doing this problem as part of a contest so you're gonna watch me live as I go through my darts I'm coding they've been explanation near the end and for more context they'll be a link below on this actual screencast of the contest how did you do let me know you do hit the like button eith... | Kth Ancestor of a Tree Node | rank-teams-by-votes | You are given a tree with `n` nodes numbered from `0` to `n - 1` in the form of a parent array `parent` where `parent[i]` is the parent of `ith` node. The root of the tree is node `0`. Find the `kth` ancestor of a given node.
The `kth` ancestor of a tree node is the `kth` node in the path from that node to the root no... | Build array rank where rank[i][j] is the number of votes for team i to be the j-th rank. Sort the trams by rank array. if rank array is the same for two or more teams, sort them by the ID in ascending order. | Array,Hash Table,String,Sorting,Counting | Medium | 947 |
814 | hello everyone and welcome back to another video so today we're going to be solving the lead code question binary tree pruning all right so in this question we're going to be given the root of a binary tree and the goal is to return the same tree where every subtree of the given tree not containing a one has been remov... | Binary Tree Pruning | smallest-rotation-with-highest-score | Given the `root` of a binary tree, return _the same tree where every subtree (of the given tree) not containing a_ `1` _has been removed_.
A subtree of a node `node` is `node` plus every node that is a descendant of `node`.
**Example 1:**
**Input:** root = \[1,null,0,0,1\]
**Output:** \[1,null,0,null,1\]
**Explanati... | null | Array,Prefix Sum | Hard | null |
1 | so hello everyone i am straight i am a software development engineer so we are starting with this lead code premium top interview problem series we will be discussing each and every problem which are mentioned on the lead code top interviews and also this will help you to crack your next coding interview in the top not... | Two Sum | two-sum | Given an array of integers `nums` and an integer `target`, return _indices of the two numbers such that they add up to `target`_.
You may assume that each input would have **_exactly_ one solution**, and you may not use the _same_ element twice.
You can return the answer in any order.
**Example 1:**
**Input:** nums... | A really brute force way would be to search for all possible pairs of numbers but that would be too slow. Again, it's best to try out brute force solutions for just for completeness. It is from these brute force solutions that you can come up with optimizations. So, if we fix one of the numbers, say x, we have to scan ... | Array,Hash Table | Easy | 15,18,167,170,560,653,1083,1798,1830,2116,2133,2320 |
1,401 | Everyone welcome to our episode of Late today which is our problem date is a very interesting problem a little bit based on mathematics geometry and I hope you enjoy it let's quickly jump to the problem so what is the problem status is it's a circle and Rectangle Overlapping Lead Code 14 Problem What does the circle re... | Circle and Rectangle Overlapping | number-of-burgers-with-no-waste-of-ingredients | You are given a circle represented as `(radius, xCenter, yCenter)` and an axis-aligned rectangle represented as `(x1, y1, x2, y2)`, where `(x1, y1)` are the coordinates of the bottom-left corner, and `(x2, y2)` are the coordinates of the top-right corner of the rectangle.
Return `true` _if the circle and rectangle are... | Can we have an answer if the number of tomatoes is odd ? If we have answer will be there multiple answers or just one answer ? Let us define number of jumbo burgers as X and number of small burgers as Y
We have to find an x and y in this equation 1. 4X + 2Y = tomato 2. X + Y = cheese | Math | Medium | null |
1,491 | welcome to this video now we're going to solve a coding interview problem average salary excluding the minimum and maximum salary here's the problem statement given an array of unique integers salary where salary i is the salary of employee i return the average salary of employees excluding the minimum and maximum sala... | Average Salary Excluding the Minimum and Maximum Salary | number-of-times-binary-string-is-prefix-aligned | You are given an array of **unique** integers `salary` where `salary[i]` is the salary of the `ith` employee.
Return _the average salary of employees excluding the minimum and maximum salary_. Answers within `10-5` of the actual answer will be accepted.
**Example 1:**
**Input:** salary = \[4000,3000,1000,2000\]
**Ou... | If in the step x all bulb shines then bulbs 1,2,3,..,x should shines too. | Array | Medium | 319,672 |
236 | all right today i'm going to talk about this bit code problem 236 those common ancestor of a binary tree so you're given a binary tree and you want to find the lowest common answers of the two nodes that are also given to you p and q and the those found analysis is defined here is basically a note that has pnq as its a... | Lowest Common Ancestor of a Binary Tree | lowest-common-ancestor-of-a-binary-tree | Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
According to the [definition of LCA on Wikipedia](https://en.wikipedia.org/wiki/Lowest_common_ancestor): "The lowest common ancestor is defined between two nodes `p` and `q` as the lowest node in `T` that has both `p` and `q` as... | null | Tree,Depth-First Search,Binary Tree | Medium | 235,1190,1354,1780,1790,1816,2217 |
229 | Hello everyone, today's question of ours is Majority Element 2. Recently we had done a question on Majority Element. Before this we had done a question on Majority Element. So in that we had to find only one element which increases n times. This question was the one which increases n times. Batu works more often than t... | Majority Element II | majority-element-ii | Given an integer array of size `n`, find all elements that appear more than `⌊ n/3 ⌋` times.
**Example 1:**
**Input:** nums = \[3,2,3\]
**Output:** \[3\]
**Example 2:**
**Input:** nums = \[1\]
**Output:** \[1\]
**Example 3:**
**Input:** nums = \[1,2\]
**Output:** \[1,2\]
**Constraints:**
* `1 <= nums.length <... | How many majority elements could it possibly have?
Do you have a better hint? Suggest it! | Array,Hash Table,Sorting,Counting | Medium | 169,1102 |
1,297 | hello so today continuing on contest 168 let's take a look at this problem called maximum number of occurrences of a substrate and so the problem says that we'll get a string s and we want to return the maximum number of occurrences of any substring under these two rows the first rule is that the number of unique chara... | Maximum Number of Occurrences of a Substring | maximum-number-of-balloons | Given a string `s`, return the maximum number of ocurrences of **any** substring under the following rules:
* The number of unique characters in the substring must be less than or equal to `maxLetters`.
* The substring size must be between `minSize` and `maxSize` inclusive.
**Example 1:**
**Input:** s = "aababc... | Count the frequency of letters in the given string. Find the letter than can make the minimum number of instances of the word "balloon". | Hash Table,String,Counting | Easy | null |
1,770 | so hello everyone welcome to my channel so in this video i will be explaining this problem maximum score from performing multiplication operations so you know this is a pretty easy problem from dynamic programming so i will in this video i will tell you how to identify dynamic pro programming inject problems in general... | Maximum Score from Performing Multiplication Operations | minimum-deletions-to-make-character-frequencies-unique | You are given two **0-indexed** integer arrays `nums` and `multipliers` of size `n` and `m` respectively, where `n >= m`.
You begin with a score of `0`. You want to perform **exactly** `m` operations. On the `ith` operation (**0-indexed**) you will:
* Choose one integer `x` from **either the start or the end** of t... | As we can only delete characters, if we have multiple characters having the same frequency, we must decrease all the frequencies of them, except one. Sort the alphabet characters by their frequencies non-increasingly. Iterate on the alphabet characters, keep decreasing the frequency of the current character until it re... | String,Greedy,Sorting | Medium | 1355,2212 |
494 | Hello guys welcome to the video this series target the pirates sub selection inter national symbols plus and minus to Left Side You Find The Number Of Two For The Example To Interest Received Notification 1962 Answers In The Answer Will Have To The Number Of The Thing You Want To Make A Call To The Giver - Plus Two Plu... | Target Sum | target-sum | You are given an integer array `nums` and an integer `target`.
You want to build an **expression** out of nums by adding one of the symbols `'+'` and `'-'` before each integer in nums and then concatenate all the integers.
* For example, if `nums = [2, 1]`, you can add a `'+'` before `2` and a `'-'` before `1` and ... | null | Array,Dynamic Programming,Backtracking | Medium | 282 |
1,935 | hi welcome guys yeah welcome to my id call sony section so the resume is 1935 maximum number of words you can type so there's a male function keyboard which wears some keys do not work and all actually is on keyboard property and a given string text of words separated by a single space and a string of broken letters of... | 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 |
803 | hey what's up guys john here again and this time let's take a look at another lead called problem here number eight zero three bricks falling when hit hard yes it is a hard problem okay so let's take a look at the description here you're given like a 2d grid with only one n zeros and one represents a break zero it mean... | Bricks Falling When Hit | cheapest-flights-within-k-stops | You are given an `m x n` binary `grid`, where each `1` represents a brick and `0` represents an empty space. A brick is **stable** if:
* It is directly connected to the top of the grid, or
* At least one other brick in its four adjacent cells is **stable**.
You are also given an array `hits`, which is a sequence ... | null | Dynamic Programming,Depth-First Search,Breadth-First Search,Graph,Heap (Priority Queue),Shortest Path | Medium | 568,2230 |
1,944 | hey what's up guys this is john here again so uh this time i'll be called 1944 number of visible people in the queue uh this one um it's um i wouldn't say it's a hard one it's a medium more like a medium one so we have n people standing in the queue right and they numbered from zero to n minus one in left to right orde... | Number of Visible People in a Queue | truncate-sentence | There are `n` people standing in a queue, and they numbered from `0` to `n - 1` in **left to right** order. You are given an array `heights` of **distinct** integers where `heights[i]` represents the height of the `ith` person.
A person can **see** another person to their right in the queue if everybody in between is ... | It's easier to solve this problem on an array of strings so parse the string to an array of words After return the first k words as a sentence | Array,String | Easy | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.