id
int64
1
2k
content
stringlengths
272
88.9k
title
stringlengths
3
77
title_slug
stringlengths
3
79
question_content
stringlengths
230
5k
question_hints
stringclasses
695 values
tag
stringclasses
618 values
level
stringclasses
3 values
similar_question_ids
stringclasses
822 values
1,640
hey everybody this is larry just me going over q1 of the recently code contest 213 check away formation through concatenation so this one is actually kind of really tricky for q1 uh at least there's a lot of making sure you're doing it right but the idea the thing to notice is that all the numbers are distinct right be...
Check Array Formation Through Concatenation
design-a-file-sharing-system
You are given an array of **distinct** integers `arr` and an array of integer arrays `pieces`, where the integers in `pieces` are **distinct**. Your goal is to form `arr` by concatenating the arrays in `pieces` **in any order**. However, you are **not** allowed to reorder the integers in each array `pieces[i]`. Return...
Try to solve it by keeping for each file chunk, the users who have this chunk. Try to solve it by keeping all the users in the system with their owned chunks, and when you request a chunk, check all users for it.
Hash Table,Design,Heap (Priority Queue),Data Stream
Medium
355
418
hey what's up guys john here again today let's take a look at this lead called problem here number 418 sentence screen fitting it's very interesting problem here you're given like a 2d screen here rows times columns and a sentence represented by the list of non-empty words you need to find out of non-empty words you ne...
Sentence Screen Fitting
sentence-screen-fitting
Given a `rows x cols` screen and a `sentence` represented as a list of strings, return _the number of times the given sentence can be fitted on the screen_. The order of words in the sentence must remain unchanged, and a word cannot be split into two lines. A single space must separate two consecutive words in a line....
null
String,Dynamic Programming,Simulation
Medium
2082
1,696
Hello everyone welcome back, the channel itself is going to discuss the next problem, the problem of challenge to Jio Net is jump game, what is this problem, what has happened to this problem, do we agree that whatever every induction is telling is fine and in this we have to What I have to do is to go from the zero in...
Jump Game VI
strange-printer-ii
You are given a **0-indexed** integer array `nums` and an integer `k`. You are initially standing at index `0`. In one move, you can jump at most `k` steps forward without going outside the boundaries of the array. That is, you can jump from index `i` to any index in the range `[i + 1, min(n - 1, i + k)]` **inclusive*...
Try thinking in reverse. Given the grid, how can you tell if a colour was painted last?
Array,Graph,Topological Sort,Matrix
Hard
664
929
everyone welcome back and let's write some more neat code today so today let's solve the problem unique email addresses from today's leak code challenge problem so basically we're given a list of email addresses and we want to count how many unique email addresses there are within the list that we're given and then ret...
Unique Email Addresses
groups-of-special-equivalent-strings
Every **valid email** consists of a **local name** and a **domain name**, separated by the `'@'` sign. Besides lowercase letters, the email may contain one or more `'.'` or `'+'`. * For example, in `"alice@leetcode.com "`, `"alice "` is the **local name**, and `"leetcode.com "` is the **domain name**. If you add pe...
null
Array,Hash Table,String
Medium
null
1,686
200 Hello friends welcome back in the police were going to see the problem of this contest from stones game six right sources pe amazing problem which were pretty amazing intuition in this problem solver problems television point climate change in which will start from now what is pain Tool in stones subscribe na inves...
Stone Game VI
fix-product-name-format
Alice and Bob take turns playing a game, with Alice starting first. There are `n` stones in a pile. On each player's turn, they can **remove** a stone from the pile and receive points based on the stone's value. Alice and Bob may **value the stones differently**. You are given two integer arrays of length `n`, `alice...
null
Database
Easy
null
429
hello guys today i will solve the question an array tree level order travels the question number is 429 and the question type is medium so the question statement is given an error tree return the level order traversal of its node's value and a tree input serialization is represented in their level uh level order traver...
N-ary Tree Level Order Traversal
n-ary-tree-level-order-traversal
Given an n-ary tree, return the _level order_ traversal of its nodes' values. _Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples)._ **Example 1:** **Input:** root = \[1,null,3,2,4,null,5,6\] **Output:** \[\[1\],\[3,2,4\],\...
null
null
Medium
null
1,523
hello everyone and welcome back to my channel the faceless engineer and today we will be solving lead code problem number 1523 count odd numbers in interval reach okay so to solve any problem the first step is to read the problem and understand it and then formulate a solution in your head or a copy or wherever you are...
Count Odd Numbers in an Interval Range
capital-gainloss
Given two non-negative integers `low` and `high`. Return the _count of odd numbers between_ `low` _and_ `high` _(inclusive)_. **Example 1:** **Input:** low = 3, high = 7 **Output:** 3 **Explanation:** The odd numbers between 3 and 7 are \[3,5,7\]. **Example 2:** **Input:** low = 8, high = 10 **Output:** 1 **Explana...
null
Database
Medium
null
1,766
hello everyone let's stop through co-prime today co-prime today co-prime today it's a very typical and dfs problem so let's just take a look at some examples for this example for each node it asks us to find the closest ancestor that whose value is co-prime with current node so for co-prime with current node so for co-...
Tree of Coprimes
minimum-number-of-removals-to-make-mountain-array
There is a tree (i.e., a connected, undirected graph that has no cycles) consisting of `n` nodes numbered from `0` to `n - 1` and exactly `n - 1` edges. Each node has a value associated with it, and the **root** of the tree is node `0`. To represent this tree, you are given an integer array `nums` and a 2D array `edge...
Think the opposite direction instead of minimum elements to remove the maximum mountain subsequence Think of LIS it's kind of close
Array,Binary Search,Dynamic Programming,Greedy
Hard
300,875,882,978,1185
835
hey everybody this is Larry this is day 27 of the liquidation hit the like button hit the Subscribe button join me on Discord let me know what you think about today's farm and as you can see I am back in New York and therefore slightly uh yeah I don't know I just got up to fight um so many delays so uh so it's kind of ...
Image Overlap
linked-list-components
You are given two images, `img1` and `img2`, represented as binary, square matrices of size `n x n`. A binary matrix has only `0`s and `1`s as values. We **translate** one image however we choose by sliding all the `1` bits left, right, up, and/or down any number of units. We then place it on top of the other image. W...
null
Hash Table,Linked List
Medium
2299
747
hey everyone today I'll be doing another loot code problem 747 largest number at least twice so further this is an easy one we have to return the index of the number that is the largest one and it should be the double of the element that is the second largest in our list so three six is the double of three so we'll be ...
Largest Number At Least Twice of Others
min-cost-climbing-stairs
You are given an integer array `nums` where the largest integer is **unique**. Determine whether the largest element in the array is **at least twice** as much as every other number in the array. If it is, return _the **index** of the largest element, or return_ `-1` _otherwise_. **Example 1:** **Input:** nums = \[3...
Say f[i] is the final cost to climb to the top from step i. Then f[i] = cost[i] + min(f[i+1], f[i+2]).
Array,Dynamic Programming
Easy
70
1,201
welcome to my YouTube channel and in this video we will look at problem 1201 from the code here is the problem statement and post this video for a second try to come up with your own solution or slow quote I do want to mention that do not get discouraged if you cannot find a way to solve this problem that's why I made ...
Ugly Number III
delete-tree-nodes
An **ugly number** is a positive integer that is divisible by `a`, `b`, or `c`. Given four integers `n`, `a`, `b`, and `c`, return the `nth` **ugly number**. **Example 1:** **Input:** n = 3, a = 2, b = 3, c = 5 **Output:** 4 **Explanation:** The ugly numbers are 2, 3, 4, 5, 6, 8, 9, 10... The 3rd is 4. **Example 2:...
Traverse the tree using depth first search. Find for every node the sum of values of its sub-tree. Traverse the tree again from the root and return once you reach a node with zero sum of values in its sub-tree.
Tree,Depth-First Search,Breadth-First Search
Medium
null
81
hey everybody this is Larry this is day 10 of the leeco daily challenge hit the like button to the Subscribe and join me on Discord let me know what you think about today's poem and of course it seems like today's form is another binary search problem which is kind of frankly uh it makes this format very um very silly ...
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
141
hey what's up guys Nick white here doing another leaf killer video I do them all so if you're interested in getting these explained either just check them out this is a linked list cycle question basically we're given a linked list and don't worry about this input they don't even give us this input that they're talking...
Linked List Cycle
linked-list-cycle
Given `head`, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that tail's `next` pointer is co...
null
Hash Table,Linked List,Two Pointers
Easy
142,202
1,624
so hello everyone today we are going to solve today lead code daily challenge so the question is largeest subring between two equal characters okay so now we read the description given an string s written the length of longest sub string between two equal characters excluding the two character if there is no such subst...
Largest Substring Between Two Equal Characters
clone-binary-tree-with-random-pointer
Given a string `s`, return _the length of the longest substring between two equal characters, excluding the two characters._ If there is no such substring return `-1`. A **substring** is a contiguous sequence of characters within a string. **Example 1:** **Input:** s = "aa " **Output:** 0 **Explanation:** The optim...
Traverse the tree, keep a hashtable with you and create a nodecopy for each node in the tree. Start traversing the original tree again and connect the left, right and random pointers in the cloned tree the same way as the original tree with the help of the hashtable.
Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
133,138,1634
1,286
hey what's up guys john here again and so this time let's take a look at another discord problem uh number one 1286 iterator of four combinations and so this one is like more like a design problem but it's a good one like it so it asks you to design an iterator class which has a constructor that takes the string charac...
Iterator for Combination
constrained-subsequence-sum
Design the `CombinationIterator` class: * `CombinationIterator(string characters, int combinationLength)` Initializes the object with a string `characters` of **sorted distinct** lowercase English letters and a number `combinationLength` as arguments. * `next()` Returns the next combination of length `combinationL...
Use dynamic programming. Let dp[i] be the solution for the prefix of the array that ends at index i, if the element at index i is in the subsequence. dp[i] = nums[i] + max(0, dp[i-k], dp[i-k+1], ..., dp[i-1]) Use a heap with the sliding window technique to optimize the dp.
Array,Dynamic Programming,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue
Hard
null
76
Hi guys aam Nishant Chahar welcome back to lap in today's video we are going to question minimum window substring ok in this what is given to us given two strings s and t of length m and n respectively a return the minimum window substring of s that content Every character of t including duplicates is included in the w...
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
66
hey welcome to this video we're gonna be doing lico problem 66 plus one so what's gonna happen is they're gonna give you an array of numbers that should represent a number itself so an array of 1 2 &amp; 3 in it will represent the number 1 2 &amp; 3 in it will represent the number 1 2 &amp; 3 in it will represent the n...
Plus One
plus-one
You are given a **large integer** represented as an integer array `digits`, where each `digits[i]` is the `ith` digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading `0`'s. Increment the large integer by one and re...
null
Array,Math
Easy
43,67,369,1031
266
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 will find the solution and then put some code here and the second goal is to see how to behave in a real interview so let's get started so in the real interview the first step is always try to u...
Palindrome Permutation
palindrome-permutation
Given a string `s`, return `true` _if a permutation of the string could form a_ _**palindrome**_ _and_ `false` _otherwise_. **Example 1:** **Input:** s = "code " **Output:** false **Example 2:** **Input:** s = "aab " **Output:** true **Example 3:** **Input:** s = "carerac " **Output:** true **Constraints:** ...
Consider the palindromes of odd vs even length. What difference do you notice? Count the frequency of each character. If each character occurs even number of times, then it must be a palindrome. How about character which occurs odd number of times?
Hash Table,String,Bit Manipulation
Easy
5,242,267,409
352
hello everyone welcome to another one of my lead code videos and this one we'll do today's daily challenge which is also a hard problem data stream as disjoint intervals so hopefully this isn't as hard as yesterday's Daily challenge which was a bit tricky but let's go over this one so basically where you're going to im...
Data Stream as Disjoint Intervals
data-stream-as-disjoint-intervals
Given a data stream input of non-negative integers `a1, a2, ..., an`, summarize the numbers seen so far as a list of disjoint intervals. Implement the `SummaryRanges` class: * `SummaryRanges()` Initializes the object with an empty stream. * `void addNum(int value)` Adds the integer `value` to the stream. * `int...
null
Binary Search,Design,Ordered Set
Hard
228,436,715
345
this question is question number 345 reverse vowels of a string given a string answer versus only all the vowels in the string and return it so for example if you have hello you're going to you're gonna take eno put in the stack and then return h o l e because you're taking the one that is up the stack here and then pu...
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
133
all right welcome back everyone this video will be on question 133 clone graph on leak code this is part of our blind 75 playlist on liquid which we go through the blind 75 questions so let's begin so in this question we're basically given a node which is part of a connected undirected graph and I want to return a deep...
Clone Graph
clone-graph
Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph. Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph. Each node in the graph contains a value (`int`) and a list (`List[Node]`)...
null
Hash Table,Depth-First Search,Breadth-First Search,Graph
Medium
138,1624,1634
267
hello friends today nests of the palindrome permutation - problem given a palindrome permutation - problem given a palindrome permutation - problem given a string s return other palindromic permutations without duplicates of it return an empty list if no palindromic permutation could be fun let us see this given two ex...
Palindrome Permutation II
palindrome-permutation-ii
Given a string s, return _all the palindromic permutations (without duplicates) of it_. You may return the answer in **any order**. If `s` has no palindromic permutation, return an empty list. **Example 1:** **Input:** s = "aabb" **Output:** \["abba","baab"\] **Example 2:** **Input:** s = "abc" **Output:** \[\] *...
If a palindromic permutation exists, we just need to generate the first half of the string. To generate all distinct permutations of a (half of) string, use a similar approach from: Permutations II or Next Permutation.
Hash Table,String,Backtracking
Medium
31,47,266
203
Hello friends, welcome to your channel, today is our day 72. Due to the challenge, let's start today's question directly on the screen. So what is today's question saying? If you look at today's question, the number of today's question is 203 and the name of the end question. Remove linklist elements, the name of the q...
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
155
today's questions is mean stack design is stack that support was popped off and retrieving the minimum element in constant time suppose push the element onto stack pop remove the element onto top of the stack top keep the top element and give me the minimum element in the stack there are difficulties you always have to...
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
165
This Tum Ho Ajay Ko 128 Sanwariyo Alok Pandey Doing Good Welcome To The Language Learning Saturday Vishal Hum Withdrawal Question Hai And Is Computer Version Number Antiseptic Reception On Karo That And Select All Best Soya To Given To Number Two Vardhan Number One Weight 1812 Managing Two Can Stop One or More Preventi...
Compare Version Numbers
compare-version-numbers
Given two version numbers, `version1` and `version2`, compare them. Version numbers consist of **one or more revisions** joined by a dot `'.'`. Each revision consists of **digits** and may contain leading **zeros**. Every revision contains **at least one character**. Revisions are **0-indexed from left to right**, wit...
null
Two Pointers,String
Medium
null
1,268
hello everyone welcome to quartus camp we are the last day of mail eco challenge and the problem we are going to cover in this video is search suggestion system so the input given here is an array of string which is products and a string search word and we have to design a system that suggests at most three product nam...
Search Suggestions System
market-analysis-i
You are given an array of strings `products` and a string `searchWord`. Design a system that suggests at most three product names from `products` after each character of `searchWord` is typed. Suggested products should have common prefix with `searchWord`. If there are more than three products with a common prefix ret...
null
Database
Medium
null
107
hello friends welcome to joy of life so today we are going to do another medium level problem the problem number is 107. it's binary tree level order traversal 2. so i thought of completing this entire set of binary tree level order traversal problems that is there in lead code before continuing with any other videos l...
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,871
hello welcome today let try to solve lead code problem 1871 Jump game 7 so we are giving a string s so for the S it is always be zero and one and we are also have a condition so the first condition is I plus mean would be less than equal to Z less than equal to mean with I plus Max jump yeah so for this formula basical...
Jump Game VII
palindrome-partitioning-iv
You are given a **0-indexed** binary string `s` and two integers `minJump` and `maxJump`. In the beginning, you are standing at index `0`, which is equal to `'0'`. You can move from index `i` to index `j` if the following conditions are fulfilled: * `i + minJump <= j <= min(i + maxJump, s.length - 1)`, and * `s[j]...
Preprocess checking palindromes in O(1) Note that one string is a prefix and another one is a suffix you can try brute forcing the rest
String,Dynamic Programming
Hard
131,132,1403
92
i want to add a solid question called reverse linkages too uh so this question we want to reverse a part of the linked list i bounded by this level boundary and right boundary and keep the wrestling list on tree so these question rates are basically very similar to previous question called reversing this but previous q...
Reverse Linked List II
reverse-linked-list-ii
Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_. **Example 1:** **Input:** head = \[1,2,3,4,5\], left = 2, right = 4 **Output:** \[1,4,3,2,5\] **Example 2:** **I...
null
Linked List
Medium
206
1,200
200 Hello guys today they are going to software problem of deposit code minimum active difference so here we have a bird sum okay inside which is different in every state so we have to find out all the efforts whose minimum episode difference of elements okay If I am any two elements, if I am their different rooms, the...
Minimum Absolute Difference
remove-interval
Given an array of **distinct** integers `arr`, find all pairs of elements with the minimum absolute difference of any two elements. Return a list of pairs in ascending order(with respect to pairs), each pair `[a, b]` follows * `a, b` are from `arr` * `a < b` * `b - a` equals to the minimum absolute difference o...
Solve the problem for every interval alone. Divide the problem into cases according to the position of the two intervals.
Array
Medium
null
1,046
i'm going to show you how to solve legal question 1046 last stone way it's an easy legal question so you are giving an array of integer stones where stone's eye is the weight of the ice stone so basically if you look at the array here the zero stone weighs two the second stone weighs seven and third stone weighs four t...
Last Stone Weight
max-consecutive-ones-iii
You are given an array of integers `stones` where `stones[i]` is the weight of the `ith` stone. We are playing a game with the stones. On each turn, we choose the **heaviest two stones** and smash them together. Suppose the heaviest two stones have weights `x` and `y` with `x <= y`. The result of this smash is: * I...
One thing's for sure, we will only flip a zero if it extends an existing window of 1s. Otherwise, there's no point in doing it, right? Think Sliding Window! Since we know this problem can be solved using the sliding window construct, we might as well focus in that direction for hints. Basically, in a given window, we c...
Array,Binary Search,Sliding Window,Prefix Sum
Medium
340,424,485,487,2134
740
Hello Today in this video will go away from the list the problem is Middle East and North so let's go to problem segment first state that you are well in tears are name and want to maximize number of point to that was performing certain operation Number Time School Joint Operation Tweets Fuel Fiber And Delete It's Two ...
Delete and Earn
delete-and-earn
You are given an integer array `nums`. You want to maximize the number of points you get by performing the following operation any number of times: * Pick any `nums[i]` and delete it to earn `nums[i]` points. Afterwards, you must delete **every** element equal to `nums[i] - 1` and **every** element equal to `nums[i]...
If you take a number, you might as well take them all. Keep track of what the value is of the subset of the input with maximum M when you either take or don't take M.
Array,Hash Table,Dynamic Programming
Medium
198
5
hello everyone welcome back here is vanson with another live coding uh session so today we will be tackling the classic problem of finding the longest palindrome substring in a given uh string so let's dive uh in so it's uh Lal daily challenge uh longest palindrome uh substring so given a string s the task is to return...
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
93
welcome to jbk school today we are gonna solve daily question 19 3 restore IP addresses so there is s string and then we are gonna push valid IP address in the lizard so valid address is um if you look at here um first of all it should be between 0 and 25 so it can't be 25 to 20 256 and then if there is something like ...
Restore IP Addresses
restore-ip-addresses
A **valid IP address** consists of exactly four integers separated by single dots. Each integer is between `0` and `255` (**inclusive**) and cannot have leading zeros. * For example, `"0.1.2.201 "` and `"192.168.1.1 "` are **valid** IP addresses, but `"0.011.255.245 "`, `"192.168.1.312 "` and `"192.168@1.1 "` are **...
null
String,Backtracking
Medium
752
140
200 Hello Friends Welcome Back Anand Iss Video Gaya Kyun Andhe Problem Soft Skill Develop Classified Iss Problem Sort Of Thing Girls Problem Pimples Wrinkles Loop Adishesh The Subscribe The Channel Subscribe Net Problem Health Explanation I Will Just Sample Very Easier Max Pal subscribe to the Page if you liked The Vid...
Word Break II
word-break-ii
Given a string `s` and a dictionary of strings `wordDict`, add spaces in `s` to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in **any order**. **Note** that the same word in the dictionary may be reused multiple times in the segmentation. **Example 1:** **Input:...
null
Hash Table,String,Dynamic Programming,Backtracking,Trie,Memoization
Hard
139,472
86
hey what's up guys Nick White's do tech encoding stuff on twitch and YouTube if you're interested in everything just check the description below I do all of the lis code problems and I've done a ton of them so just check them out on my youtube page this is partition list it's a medium level problem in a value X partiti...
Partition List
partition-list
Given the `head` of a linked list and a value `x`, partition it such that all nodes **less than** `x` come before nodes **greater than or equal** to `x`. You should **preserve** the original relative order of the nodes in each of the two partitions. **Example 1:** **Input:** head = \[1,4,3,2,5,2\], x = 3 **Output:**...
null
Linked List,Two Pointers
Medium
2265
92
Ki welcome din statement bhojan kuen aur to solar police problem which gives clean chit to sacrifice of verses in the father subscribe and subscribe the Channel Please subscribe and subscribe this 12345 they subscribe and subscribe hua tha vikas which is mere and unauthorized do subscribe my channel ko Subscribe 102 Su...
Reverse Linked List II
reverse-linked-list-ii
Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_. **Example 1:** **Input:** head = \[1,2,3,4,5\], left = 2, right = 4 **Output:** \[1,4,3,2,5\] **Example 2:** **I...
null
Linked List
Medium
206
37
okay with code 37 so docusolver pretty straightforward description we have the sudoku board partially filled and we have to provide a full board which will be fully filled with satisfying all the sudoku rules all the rows or the columns and all these tiny boxes here should have all the numbers from one to nine without ...
Sudoku Solver
sudoku-solver
Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy **all of the following rules**: 1. Each of the digits `1-9` must occur exactly once in each row. 2. Each of the digits `1-9` must occur exactly once in each column. 3. Each of the digits `1-9` must occur exactly onc...
null
Array,Backtracking,Matrix
Hard
36,1022
214
i will congrats yeah so let's solve in this uh short is uh shortest paradigm yeah so uh you're given a string s you can convert s to paragraph by adding charges in front of it we don't show this version you can find by performing this transformation so for example aacecaa you can add the one a's or become a c e c a so ...
Shortest Palindrome
shortest-palindrome
You are given a string `s`. You can convert `s` to a palindrome by adding characters in front of it. Return _the shortest palindrome you can find by performing this transformation_. **Example 1:** **Input:** s = "aacecaaa" **Output:** "aaacecaaa" **Example 2:** **Input:** s = "abcd" **Output:** "dcbabcd" **Constr...
null
String,Rolling Hash,String Matching,Hash Function
Hard
5,28,336
490
hey guys how's it going in this video i'm gonna go through this elite call number 490 uh the maze so this question was asked by um mostly by my amazon by amazon also a little bit about google microsoft and bloomberg uh i also be dense uh so without further ado let's dive in so i think um this graph is pretty uh intuiti...
The Maze
the-maze
There is a ball in a `maze` with empty spaces (represented as `0`) and walls (represented as `1`). The ball can go through the empty spaces by rolling **up, down, left or right**, but it won't stop rolling until hitting a wall. When the ball stops, it could choose the next direction. Given the `m x n` `maze`, the ball...
null
Depth-First Search,Breadth-First Search,Graph
Medium
499,505
1,042
hi everyone today we will be solving lead code question 1042 flower planting with no adjacent let's see what the question is in the question we are given n gardens labeled from 1 to n and uh we are given some kind of an input format in which we are given a paths array and uh so basically parts of i denotes a vector of ...
Flower Planting With No Adjacent
minimum-cost-to-merge-stones
You have `n` gardens, labeled from `1` to `n`, and an array `paths` where `paths[i] = [xi, yi]` describes a bidirectional path between garden `xi` to garden `yi`. In each garden, you want to plant one of 4 types of flowers. All gardens have **at most 3** paths coming into or leaving it. Your task is to choose a flowe...
null
Array,Dynamic Programming
Hard
312,1126
472
hello and welcome back to the cracking Fang YouTube channel today we're going to be solving lead code problem 472 concatenated words before we get into the question prompt I just want to ask you guys please subscribe to the channel it really helps me grow given an array of strings words without duplicates return all th...
Concatenated Words
concatenated-words
Given an array of strings `words` (**without duplicates**), return _all the **concatenated words** in the given list of_ `words`. A **concatenated word** is defined as a string that is comprised entirely of at least two shorter words (not necesssarily distinct) in the given array. **Example 1:** **Input:** words = \...
null
Array,String,Dynamic Programming,Depth-First Search,Trie
Hard
140
42
foreign my dear friends now it's time for us to discuss the optimized way of doing this see now what has happened is because there were Loops within a loop our time complexity was Big O of n Square now I am telling you that there is a way in which this big O of n Square can be made into Big O of n now how do we do that...
Trapping Rain Water
trapping-rain-water
Given `n` non-negative integers representing an elevation map where the width of each bar is `1`, compute how much water it can trap after raining. **Example 1:** **Input:** height = \[0,1,0,2,1,0,1,3,2,1,2,1\] **Output:** 6 **Explanation:** The above elevation map (black section) is represented by array \[0,1,0,2,1,...
null
Array,Two Pointers,Dynamic Programming,Stack,Monotonic Stack
Hard
11,238,407,756
374
everyone welcome to my channel so in this video i'm going to cover the solution to this question do some live coding work also at the same time i'm going to try to follow the general steps you should follow in the coding interview so first of all um i would really appreciate that if you can help the squad's channel so ...
Guess Number Higher or Lower
guess-number-higher-or-lower
We are playing the Guess Game. The game is as follows: I pick a number from `1` to `n`. You have to guess which number I picked. Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess. You call a pre-defined API `int guess(int num)`, which returns three possible re...
null
Binary Search,Interactive
Easy
278,375,658
1,189
hey what's up it is time again you know what time it is a 9 41 april 15th 2021 april is almost is halfway done almost halfway done first halfway done and um things are looking pretty spring-like right now uh spring-like right now uh spring-like right now uh and with that being said i've decided to play for you sam rach...
Maximum Number of Balloons
encode-number
Given a string `text`, you want to use the characters of `text` to form as many instances of the word **"balloon "** as possible. You can use each character in `text` **at most once**. Return the maximum number of instances that can be formed. **Example 1:** **Input:** text = "nlaebolko " **Output:** 1 **Example 2...
Try to find the number of binary digits returned by the function. The pattern is to start counting from zero after determining the number of binary digits.
Math,String,Bit Manipulation
Medium
1070
35
hello guys welcome to deep codes and in today's video we will discuss little question 35 that says search insert position so yeah here we are given one sorted item of distinct integers and a Target value and we need to return the index of its Target is found and if not then return the index where it would be inserted o...
Search Insert Position
search-insert-position
Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You must write an algorithm with `O(log n)` runtime complexity. **Example 1:** **Input:** nums = \[1,3,5,6\], target = 5 **Output:** 2 **Exa...
null
Array,Binary Search
Easy
278
1,095
Hello, my name is Suren, this is a solution with analysis of the litcode of problem number 1095 find in Mountain array, as input you are given an array that is considered a Mountain array and what is a Mountain array, this is an array that looks like a mountain. According to the condition, the length is not less than t...
Find in Mountain Array
two-city-scheduling
_(This problem is an **interactive problem**.)_ You may recall that an array `arr` is a **mountain array** if and only if: * `arr.length >= 3` * There exists some `i` with `0 < i < arr.length - 1` such that: * `arr[0] < arr[1] < ... < arr[i - 1] < arr[i]` * `arr[i] > arr[i + 1] > ... > arr[arr.length ...
null
Array,Greedy,Sorting
Medium
null
113
A Question Between Have Given For Binary Tree And Will Also Give Some Switch To Return Emergency Trans Through Which Way Travels Kasam Answer Notes Will Give The Song Again Question On Is So First Make Better To The Path And Will Make Another Wave Vector To Spinal Store The power fifth returns for the question on in 12...
Path Sum II
path-sum-ii
Given the `root` of a binary tree and an integer `targetSum`, return _all **root-to-leaf** paths where the sum of the node values in the path equals_ `targetSum`_. Each path should be returned as a list of the node **values**, not node references_. A **root-to-leaf** path is a path starting from the root and ending at...
null
Backtracking,Tree,Depth-First Search,Binary Tree
Medium
112,257,437,666,2217
299
so this is the solution for the problem bulls and cows we are given two strings secret and guess so we are supposed to return the total number of cows and total number of Bowls in the format we will discuss later uh so the way we calculate Bulls is Bulls are defined um you know as if you have a number in gas at an inde...
Bulls and Cows
bulls-and-cows
You are playing the **[Bulls and Cows](https://en.wikipedia.org/wiki/Bulls_and_Cows)** game with your friend. You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint with the following info: * The number of "bulls ", which are digits in the ...
null
Hash Table,String,Counting
Medium
null
214
welcome to computer say yeah today we are going to be solving lead code 214 shortest palindrome it's a hard problem so it's a hard problem but I picked this one because it's if you split it in two very basic but it's actually quite straightforward so I don't honestly don't know why I mean the solution is not necessaril...
Shortest Palindrome
shortest-palindrome
You are given a string `s`. You can convert `s` to a palindrome by adding characters in front of it. Return _the shortest palindrome you can find by performing this transformation_. **Example 1:** **Input:** s = "aacecaaa" **Output:** "aaacecaaa" **Example 2:** **Input:** s = "abcd" **Output:** "dcbabcd" **Constr...
null
String,Rolling Hash,String Matching,Hash Function
Hard
5,28,336
206
today we're looking at elite code number 206 reversing a linked list this is a classic problem and if you've never done it before it is tricky it trips up people there's it's just a matter of keeping your pointers organized but we'll go through this and we'll figure out a way to kind of look at this in a way if it come...
Reverse Linked List
reverse-linked-list
Given the `head` of a singly linked list, reverse the list, and return _the reversed list_. **Example 1:** **Input:** head = \[1,2,3,4,5\] **Output:** \[5,4,3,2,1\] **Example 2:** **Input:** head = \[1,2\] **Output:** \[2,1\] **Example 3:** **Input:** head = \[\] **Output:** \[\] **Constraints:** * The number...
null
Linked List,Recursion
Easy
92,156,234,2196,2236
1,582
uh hey everybody this is larry this is me going with q1 of the recent uh leeco contest special positions in binary matrix so hit the like button hit the subscribe and join me in discord and you're going to see me solve it live uh during the contest after my explanation uh or in my template explanation but basically for...
Special Positions in a Binary Matrix
design-browser-history
Given an `m x n` binary matrix `mat`, return _the number of special positions in_ `mat`_._ A position `(i, j)` is called **special** if `mat[i][j] == 1` and all other elements in row `i` and column `j` are `0` (rows and columns are **0-indexed**). **Example 1:** **Input:** mat = \[\[1,0,0\],\[0,0,1\],\[1,0,0\]\] **O...
Use two stack one for back history and one for forward history and simulate the functions. Can you do faster by using different data structure ?
Array,Linked List,Stack,Design,Doubly-Linked List,Data Stream
Medium
null
248
hey what's up guys John here okay today I want to talk about this problem here to number 248 strobe all chromatic number three I don't know if I pronounce this one correctly anyway strobe all struggle grammar grammatic number three fine alright so let's take a look so a strobe all struggle chromatic number is a number ...
Strobogrammatic Number III
strobogrammatic-number-iii
Given two strings low and high that represent two integers `low` and `high` where `low <= high`, return _the number of **strobogrammatic numbers** in the range_ `[low, high]`. A **strobogrammatic number** is a number that looks the same when rotated `180` degrees (looked at upside down). **Example 1:** **Input:** lo...
null
Array,String,Recursion
Hard
246,247
84
in this problem we will solve how to find the largest rectangle in a histogram so you are given a number of values which compose a histogram so we have a histogram like this and the bars have different heights so in this case this is seven this is three then six so these are the different heights and we can form differ...
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
380
hey everybody this is Larry this is day 29 I think of the November legal daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's problem huh what happened to you uh yeah it's a little bit later in the days I don't think I'm gonna do musi oh yes 10 coins h...
Insert Delete GetRandom O(1)
insert-delete-getrandom-o1
Implement the `RandomizedSet` class: * `RandomizedSet()` Initializes the `RandomizedSet` object. * `bool insert(int val)` Inserts an item `val` into the set if not present. Returns `true` if the item was not present, `false` otherwise. * `bool remove(int val)` Removes an item `val` from the set if present. Retur...
null
Array,Hash Table,Math,Design,Randomized
Medium
381
133
hey guys it's off by one here and today we're going to be solving clone graph in this problem we're given a reference of a node in a connected undirected graph so what does this part mean that's confusing so all that means is let's say we have three nodes one oh that should be a two and then three well a normal graph t...
Clone Graph
clone-graph
Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph. Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph. Each node in the graph contains a value (`int`) and a list (`List[Node]`)...
null
Hash Table,Depth-First Search,Breadth-First Search,Graph
Medium
138,1624,1634
1,060
hey what's up guys chung here so this time let's take a look at another lead called problem 1060 missing element in sorted array okay so you're given like a sorted array of unique numbers right which means there's no duplicate numbers and you need to find the case missing numbers starting from the leftmost number after...
Missing Element in Sorted Array
longest-repeating-substring
Given an integer array `nums` which is sorted in **ascending order** and all of its elements are **unique** and given also an integer `k`, return the `kth` missing number starting from the leftmost number of the array. **Example 1:** **Input:** nums = \[4,7,9,10\], k = 1 **Output:** 5 **Explanation:** The first missi...
Generate all substrings in O(N^2) time with hashing. Choose those hashing of strings with the largest length.
String,Binary Search,Dynamic Programming,Rolling Hash,Suffix Array,Hash Function
Medium
null
1,744
hey everybody this is larry this is me going over q3 of the leeco week uh weekly contest 226. uh can you eat your favorite candy on your favorite day uh hit the like button hit the subscribe button join me on discord send me some of your favorite candy what do you like eating candy i'm curious um excuse me so for this ...
Can You Eat Your Favorite Candy on Your Favorite Day?
number-of-ways-to-form-a-target-string-given-a-dictionary
You are given a **(0-indexed)** array of positive integers `candiesCount` where `candiesCount[i]` represents the number of candies of the `ith` type you have. You are also given a 2D array `queries` where `queries[i] = [favoriteTypei, favoriteDayi, dailyCapi]`. You play a game with the following rules: * You start ...
For each index i, store the frequency of each character in the ith row. Use dynamic programing to calculate the number of ways to get the target string using the frequency array,
Array,String,Dynamic Programming
Hard
null
201
Hello friends in today's video we are going to discuss lead code problem bit wise end of numbers in range ok we are given two integers left and right that represent the range left to right and we have to return the bit wise end of all the Numbers in the range means you are given a range on left and right and you have t...
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
901
Examination Sarai will be good. We have progressed a lot in this type of serials. Now the questions that will come are few good questions and we will learn a lot. Should we sit as if this question is online stock style right, then this question is easy. Its stock market voice ca n't ask this question so some that point...
Online Stock Span
advantage-shuffle
Design an algorithm that collects daily price quotes for some stock and returns **the span** of that stock's price for the current day. The **span** of the stock's price in one day is the maximum number of consecutive days (starting from that day and going backward) for which the stock price was less than or equal to ...
null
Array,Greedy,Sorting
Medium
null
1,832
hello everyone Aaron here and welcome back to leak code today we are doing the check if the sentence is pan gram problem is a sentence where every letter of the English alphabet appears at least once given a string sentence containing only lowercase English letters return true if sentence is a pan gram or false otherwi...
Check if the Sentence Is Pangram
minimum-operations-to-make-a-subsequence
A **pangram** is a sentence where every letter of the English alphabet appears at least once. Given a string `sentence` containing only lowercase English letters, return `true` _if_ `sentence` _is a **pangram**, or_ `false` _otherwise._ **Example 1:** **Input:** sentence = "thequickbrownfoxjumpsoverthelazydog " **O...
The problem can be reduced to computing Longest Common Subsequence between both arrays. Since one of the arrays has distinct elements, we can consider that these elements describe an arrangement of numbers, and we can replace each element in the other array with the index it appeared at in the first array. Then the pro...
Array,Hash Table,Binary Search,Greedy
Hard
null
1,629
hello everyone welcome to day 6 of september lead code challenge and today's question is slowest keys has it ever happened with you guys that from the description of it the question looks too big and overwhelming while when you actually understand these questions these are pretty straightforward and easy so today's que...
Slowest Key
minimum-possible-integer-after-at-most-k-adjacent-swaps-on-digits
A newly designed keypad was tested, where a tester pressed a sequence of `n` keys, one at a time. You are given a string `keysPressed` of length `n`, where `keysPressed[i]` was the `ith` key pressed in the testing sequence, and a sorted list `releaseTimes`, where `releaseTimes[i]` was the time the `ith` key was releas...
We want to make the smaller digits the most significant digits in the number. For each index i, check the smallest digit in a window of size k and append it to the answer. Update the indices of all digits in this range accordingly.
String,Greedy,Binary Indexed Tree,Segment Tree
Hard
null
124
hi everyone welcome back to the channel today we are going to solve a hard question but is very frequently asked in facebook and google interviews and the question is binary tree maximum past sum and before we start don't forget to subscribe to my channel i'll be constantly solving good and classic clinical questions w...
Binary Tree Maximum Path Sum
binary-tree-maximum-path-sum
A **path** in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence **at most once**. Note that the path does not need to pass through the root. The **path sum** of a path is the sum of the node's values in the path. ...
null
Dynamic Programming,Tree,Depth-First Search,Binary Tree
Hard
112,129,666,687,1492
3
Hello friends, welcome to the new video, question number three is List Code Longest Something without Repeating Characters, the name is medium level question, this question is of Springs category, it is a two point question and in this we will use sliding window technique, the question has been asked Amazon Microsoft L...
Longest Substring Without Repeating Characters
longest-substring-without-repeating-characters
Given a string `s`, find the length of the **longest** **substring** without repeating characters. **Example 1:** **Input:** s = "abcabcbb " **Output:** 3 **Explanation:** The answer is "abc ", with the length of 3. **Example 2:** **Input:** s = "bbbbb " **Output:** 1 **Explanation:** The answer is "b ", with t...
null
Hash Table,String,Sliding Window
Medium
159,340,1034,1813,2209
707
everyone so today we are looking at lead code number 707 it's a question called design a linked list okay and this question can seem a little intimidating because there's a lot going on here uh it's also somewhat frequently asked but i think it's a good data structure to be really familiar with because it is used a lot...
Design Linked List
design-linked-list
Design your implementation of the linked list. You can choose to use a singly or doubly linked list. A node in a singly linked list should have two attributes: `val` and `next`. `val` is the value of the current node, and `next` is a pointer/reference to the next node. If you want to use the doubly linked list, you...
null
null
Medium
null
147
hello everyone welcome to my channel let's sort the list using the insertion sort so what does it insert and sort say we know some partially sorted list we got and then we will keep growing it by adding new elements so let's say we have this list 1 5 3 and 2 and if you see till that point this list is already partially...
Insertion Sort List
insertion-sort-list
Given the `head` of a singly linked list, sort the list using **insertion sort**, and return _the sorted list's head_. The steps of the **insertion sort** algorithm: 1. Insertion sort iterates, consuming one input element each repetition and growing a sorted output list. 2. At each iteration, insertion sort removes...
null
Linked List,Sorting
Medium
148,850
199
hello everyone today we are going to see problem number 199 of lead code so let's first go through the problem statement so basically it says uh given the root of a binary tree imagine yourself standing on the right side of it and return the values of the node you can see ordered from top to bottom right so basically w...
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
617
all right think we're recording hey guys with a Nick white here I do tech in live coding stuff on twitch in YouTube so if you want to check that out just you know look we're in the description and I appreciate it if you could fall unsubscribe this is basically so this is basically the elite code series I'm doing I just...
Merge Two Binary Trees
merge-two-binary-trees
You are given two binary trees `root1` and `root2`. Imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge the two trees into a new binary tree. The merge rule is that if two nodes overlap, then sum node values up as the new valu...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
null
116
hello everyone this is ed today I'm gonna go through a LICO challenge problem with you called populating the next right pointers in each node so this question is pulled from the most common interview questions list on the code so it's a good one to know especially if you're struggling with trees and the different algor...
Populating Next Right Pointers in Each Node
populating-next-right-pointers-in-each-node
You are given a **perfect binary tree** where all leaves are on the same level, and every parent has two children. The binary tree has the following definition: struct Node { int val; Node \*left; Node \*right; Node \*next; } Populate each next pointer to point to its next right node. If there is no next righ...
null
Linked List,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
117,199
316
Hello gas I am Lalita Agarwal welcome tu jo owner on coding channel contention bio made on your so let start today this lead code problem aaj ki date good ki problem kya bol rahi hai achha before movie towards d problem na 1 minute mein a chuka hai jo Try it yourself. Look, this is a simple question. If you think, yes,...
Remove Duplicate Letters
remove-duplicate-letters
Given a string `s`, remove duplicate letters so that every letter appears once and only once. You must make sure your result is **the smallest in lexicographical order** among all possible results. **Example 1:** **Input:** s = "bcabc " **Output:** "abc " **Example 2:** **Input:** s = "cbacdcbc " **Output:** "a...
Greedily try to add one missing character. How to check if adding some character will not cause problems ? Use bit-masks to check whether you will be able to complete the sub-sequence if you add the character at some index i.
String,Stack,Greedy,Monotonic Stack
Medium
2157
38
this is the 38th Fleet Creek Challenge and it is called countency the count and say sequence is a sequence of Digit strings defined by the recursive formula count and say one equals one so count and say n is the way you would say the digit string from count and say n minus 1 which is then converted into a different dig...
Count and Say
count-and-say
The **count-and-say** sequence is a sequence of digit strings defined by the recursive formula: * `countAndSay(1) = "1 "` * `countAndSay(n)` is the way you would "say " the digit string from `countAndSay(n-1)`, which is then converted into a different digit string. To determine how you "say " a digit string, spli...
The following are the terms from n=1 to n=10 of the count-and-say sequence: 1. 1 2. 11 3. 21 4. 1211 5. 111221 6. 312211 7. 13112221 8. 1113213211 9. 31131211131221 10. 13211311123113112211 To generate the nth term, just count and say the n-1th term.
String
Medium
271,443
987
hey guys how your how's everything going this is Jay sir and in this video I'm going to take a look at nine eight seven vertical order of travel syllable binary tree we're given a binary tree we turn the vertical order of traversal of its node values for each node at position X Y its left and right children respect cli...
Vertical Order Traversal of a Binary Tree
reveal-cards-in-increasing-order
Given the `root` of a binary tree, calculate the **vertical order traversal** of the binary tree. For each node at position `(row, col)`, its left and right children will be at positions `(row + 1, col - 1)` and `(row + 1, col + 1)` respectively. The root of the tree is at `(0, 0)`. The **vertical order traversal** o...
null
Array,Queue,Sorting,Simulation
Medium
null
746
lead code problem number 746 mean cost climbing stairs so this problem gives us an integer array cost where cost I is the cost of the I step on a staircase so we have to pay the cost if we want to climb so after we pay the cost we can either climb one or two steps and we can also either start from index zero or index o...
Min Cost Climbing Stairs
prefix-and-suffix-search
You are given an integer array `cost` where `cost[i]` is the cost of `ith` step on a staircase. Once you pay the cost, you can either climb one or two steps. You can either start from the step with index `0`, or the step with index `1`. Return _the minimum cost to reach the top of the floor_. **Example 1:** **Input...
For a word like "test", consider "#test", "t#test", "st#test", "est#test", "test#test". Then if we have a query like prefix = "te", suffix = "t", we can find it by searching for something we've inserted starting with "t#te".
String,Design,Trie
Hard
211
657
hey everyone welcome back and today we will be doing another lead code problem 657 robot return to origin this is a very easy one and one of the most easiest problems in the easy ones there is a robot starting at position zero the origin on uh 2D plane given a subsequent this given a sequence of its move judge if the r...
Robot Return to Origin
robot-return-to-origin
There is a robot starting at the position `(0, 0)`, the origin, on a 2D plane. Given a sequence of its moves, judge if this robot **ends up at** `(0, 0)` after it completes its moves. You are given a string `moves` that represents the move sequence of the robot where `moves[i]` represents its `ith` move. Valid moves a...
null
String,Simulation
Easy
547,2239
825
the holodeck so today we requested a question 825 France of appropriate ages so we got a bunch of people they want to make friends requests almost themselves we know their ages in this array ages where the ice element is the age of the ice person somehow the sim to make a friend requests only based on their age differe...
Friends Of Appropriate Ages
max-increase-to-keep-city-skyline
There are `n` persons on a social media website. You are given an integer array `ages` where `ages[i]` is the age of the `ith` person. A Person `x` will not send a friend request to a person `y` (`x != y`) if any of the following conditions is true: * `age[y] <= 0.5 * age[x] + 7` * `age[y] > age[x]` * `age[y] >...
null
Array,Greedy,Matrix
Medium
null
1,798
hi guys so uh the problem first problem statement is maximum number of consecutive values that you can make you are given an integer array coins of length and which represents the end points that you have on so these are the coins they have given that we own the value of eighth coin is coins of i you can make some valu...
Maximum Number of Consecutive Values You Can Make
max-number-of-k-sum-pairs
You are given an integer array `coins` of length `n` which represents the `n` coins that you own. The value of the `ith` coin is `coins[i]`. You can **make** some value `x` if you can choose some of your `n` coins such that their values sum up to `x`. Return the _maximum number of consecutive integer values that you *...
The abstract problem asks to count the number of disjoint pairs with a given sum k. For each possible value x, it can be paired up with k - x. The number of such pairs equals to min(count(x), count(k-x)), unless that x = k / 2, where the number of such pairs will be floor(count(x) / 2).
Array,Hash Table,Two Pointers,Sorting
Medium
1,1830
1,441
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 there'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 eit...
Build an Array With Stack Operations
minimum-flips-to-make-a-or-b-equal-to-c
You are given an integer array `target` and an integer `n`. You have an empty stack with the two following operations: * **`"Push "`**: pushes an integer to the top of the stack. * **`"Pop "`**: removes the integer on the top of the stack. You also have a stream of the integers in the range `[1, n]`. Use the tw...
Check the bits one by one whether they need to be flipped.
Bit Manipulation
Medium
2323
969
welcome to august leco challenge today's problem is pancake sorting given array integers we need to sort the array performing pancake flips a pancake flip is where we select an integer k or an index and then reverse the sub array from zero to that index now they give you a couple examples here but honestly i think it's...
Pancake Sorting
number-of-recent-calls
Given an array of integers `arr`, sort the array by performing a series of **pancake flips**. In one pancake flip we do the following steps: * Choose an integer `k` where `1 <= k <= arr.length`. * Reverse the sub-array `arr[0...k-1]` (**0-indexed**). For example, if `arr = [3,2,1,4]` and we performed a pancake f...
null
Design,Queue,Data Stream
Easy
null
127
what's up coders what's good today we're gonna be doing word ladder so how about you climb on board ha get it like word ladder cuz you climb never again welcome back we're gonna be doing word ladder today and I'm filled with energy I'm doing this higher quality version of this video now cuz I want to try it out and see...
Word Ladder
word-ladder
A **transformation sequence** from word `beginWord` to word `endWord` using a dictionary `wordList` is a sequence of words `beginWord -> s1 -> s2 -> ... -> sk` such that: * Every adjacent pair of words differs by a single letter. * Every `si` for `1 <= i <= k` is in `wordList`. Note that `beginWord` does not need ...
null
Hash Table,String,Breadth-First Search
Hard
126,433
1,611
hey everybody this is larry this is me going over the recent q4 of the league code uh daily uh contest uh hit the like button hit the subscribe button join me in this card let me know what you think today's problem or the contest farm was minimum one bit operation to make a negative zero so this is a really hard proble...
Minimum One Bit Operations to Make Integers Zero
making-file-names-unique
Given an integer `n`, you must transform it into `0` using the following operations any number of times: * Change the rightmost (`0th`) bit in the binary representation of `n`. * Change the `ith` bit in the binary representation of `n` if the `(i-1)th` bit is set to `1` and the `(i-2)th` through `0th` bits are set...
Keep a map of each name and the smallest valid integer that can be appended as a suffix to it. If the name is not present in the map, you can use it without adding any suffixes. If the name is present in the map, append the smallest proper suffix, and add the new name to the map.
Array,Hash Table,String
Medium
null
1,200
hello everyone welcome to quartus camp we are at 20th day of december lead code challenge and the problem we are going to cover in this video is minimum absolute difference so the input given here is an integer array arr and we have to find all the pairs of elements with minimum absolute difference of any two elements ...
Minimum Absolute Difference
remove-interval
Given an array of **distinct** integers `arr`, find all pairs of elements with the minimum absolute difference of any two elements. Return a list of pairs in ascending order(with respect to pairs), each pair `[a, b]` follows * `a, b` are from `arr` * `a < b` * `b - a` equals to the minimum absolute difference o...
Solve the problem for every interval alone. Divide the problem into cases according to the position of the two intervals.
Array
Medium
null
1,460
guys how's everything going this is Jason who is not the good algorithms my interview won't be what happened on the day after tomorrow and this is Sunday I'm going to do a live contest but before that this is a about a bi-weekly before that this is a about a bi-weekly before that this is a about a bi-weekly contest one...
Make Two Arrays Equal by Reversing Subarrays
number-of-substrings-containing-all-three-characters
You are given two integer arrays of equal length `target` and `arr`. In one step, you can select any **non-empty subarray** of `arr` and reverse it. You are allowed to make any number of steps. Return `true` _if you can make_ `arr` _equal to_ `target` _or_ `false` _otherwise_. **Example 1:** **Input:** target = \[1,...
For each position we simply need to find the first occurrence of a/b/c on or after this position. So we can pre-compute three link-list of indices of each a, b, and c.
Hash Table,String,Sliding Window
Medium
2187
91
Hello guys welcome to hot sid subscribe indian more fuel video then subscribe to The Amazing subscribe to pimple give thursday don't forget to subscribe this Video plz subscribe Channel Please subscribe and subscribe the that this calling is less time when skin pimples appointed subscribe to A visible during can ensure...
Decode Ways
decode-ways
A message containing letters from `A-Z` can be **encoded** into numbers using the following mapping: 'A' -> "1 " 'B' -> "2 " ... 'Z' -> "26 " To **decode** an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For examp...
null
String,Dynamic Programming
Medium
639,2091
1,886
that's all Le code 1886 determine whether Matrix can be obtained by rotation so essentially what the question says is I'll take an example which is none of these are not good examples I'll take an example which will help us understand what the questions is so you will be given a matrix of size n byn okay so it's it was...
Determine Whether Matrix Can Be Obtained By Rotation
minimum-limit-of-balls-in-a-bag
Given two `n x n` binary matrices `mat` and `target`, return `true` _if it is possible to make_ `mat` _equal to_ `target` _by **rotating**_ `mat` _in **90-degree increments**, or_ `false` _otherwise._ **Example 1:** **Input:** mat = \[\[0,1\],\[1,0\]\], target = \[\[1,0\],\[0,1\]\] **Output:** true **Explanation:** W...
Let's change the question if we know the maximum size of a bag what is the minimum number of bags you can make note that as the maximum size increases the minimum number of bags decreases so we can binary search the maximum size
Array,Binary Search
Medium
1335,2188
881
That's it, friend, today we will do video number two of our credit balance, this question number two, the name of the question is that tissue paper, write number 82, elitism medium question and it's good that by Google, okay so the question is something like that, gave you a laptop interior. Which is the weight of the ...
Boats to Save People
loud-and-rich
You are given an array `people` where `people[i]` is the weight of the `ith` person, and an **infinite number of boats** where each boat can carry a maximum weight of `limit`. Each boat carries at most two people at the same time, provided the sum of the weight of those people is at most `limit`. Return _the minimum n...
null
Array,Depth-First Search,Graph,Topological Sort
Medium
null
94
hello and welcome today we are doing a question from li code called binary tree in order traversal it's a medium let's get started given a binary tree return the inorder traversal of its noses values example given the tree root one no left child 2 for its right child and then 3 and no we output 1 3 and then 2 and why d...
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
163
all right so this question is missing range so you're given an array and then you have lower and upper and then basically you just want to return the array which is uh exactly cover all of a missing number so what it does is actually in this so and the range is between 0 to 99 and then your number is zero one three um ...
Missing Ranges
missing-ranges
You are given an inclusive range `[lower, upper]` and a **sorted unique** integer array `nums`, where all elements are in the inclusive range. A number `x` is considered **missing** if `x` is in the range `[lower, upper]` and `x` is not in `nums`. Return _the **smallest sorted** list of ranges that **cover every miss...
null
Array
Easy
228
18
hello everyone let's do the code 18 today for sum the fourth sum is a very typical problem it's very similar to the code 15 threesome so if you haven't done the code 15 you can do the conflicting first since their solutions are exactly the same so this is a question given integer array they ask us to like find four num...
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,071
okay so let's solve another little question 1071 greatest common divis of a string so we have um other this question that say for two string s and t uh we say t divide s if and if only s = t Plus+ plus okay let's leave only s = t Plus+ plus okay let's leave only s = t Plus+ plus okay let's leave that as side that may n...
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
133
Loot hello hi maine mixed hui batao aaj today e will be shopping flipkart office number 133 likes is also called as clone graph in this problem will give in a connected crime * return more copy and worry of up to 100 * return more copy and worry of up to 100 * return more copy and worry of up to 100 graph is representa...
Clone Graph
clone-graph
Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph. Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph. Each node in the graph contains a value (`int`) and a list (`List[Node]`)...
null
Hash Table,Depth-First Search,Breadth-First Search,Graph
Medium
138,1624,1634
1,797
hey everybody this is larry this is me going with q2 of the bi-weekly contest 48 design of the bi-weekly contest 48 design of the bi-weekly contest 48 design authentication manager as you can see this was the problem that actually gave me the most trouble um i took i mean it only looked like i took one minute but actua...
Design Authentication Manager
goal-parser-interpretation
There is an authentication system that works with authentication tokens. For each session, the user will receive a new authentication token that will expire `timeToLive` seconds after the `currentTime`. If the token is renewed, the expiry time will be **extended** to expire `timeToLive` seconds after the (potentially d...
You need to check at most 2 characters to determine which character comes next.
String
Easy
null
11
good morning my name is vit I am currently pursuing a b from function of School Technology and I'm in my second semester and in my first semester I have done some programming languages like Java JavaScript HTML CSS to intermediate level and in this video I'm going to solve a med medium level lead code problem because w...
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,010
Hello Everyone Today Will Be Discussing Problem Par Songs Total Durations Divisible by Sixty Result Co Medium Problem Number 210 Vo Palt Aur Pahan Stunning Problem Statement Is To-Do List Songs Song Hi Yeh Time Ki And Jatin Tree In The Song Is Adhure So They can see and e want to talk to me to do subscribe to the Video...
Pairs of Songs With Total Durations Divisible by 60
powerful-integers
You are given a list of songs where the `ith` song has a duration of `time[i]` seconds. Return _the number of pairs of songs for which their total duration in seconds is divisible by_ `60`. Formally, we want the number of indices `i`, `j` such that `i < j` with `(time[i] + time[j]) % 60 == 0`. **Example 1:** **Input...
null
Hash Table,Math
Medium
null
870
hey what's up guys uh this is chung here so today uh let's take a look at daily challenge problem number 870 advantage shuffle so you're given like two arrays a and b of the same size and the advantage of a with respect to b is the number of indices i which that you know that the a i is greater than bi and we need to r...
Advantage Shuffle
magic-squares-in-grid
You are given two integer arrays `nums1` and `nums2` both of the same length. The **advantage** of `nums1` with respect to `nums2` is the number of indices `i` for which `nums1[i] > nums2[i]`. Return _any permutation of_ `nums1` _that maximizes its **advantage** with respect to_ `nums2`. **Example 1:** **Input:** nu...
null
Array,Math,Matrix
Medium
1311
752
hey everyone welcome back and let's write some more neat code today so today let's solve the problem open the lock we're given a lock that has four circular wheels and each of the wheels actually represents some digit and that digit could be from zero all the way up until nine so there's ten possibilities for each digi...
Open the Lock
ip-to-cidr
You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: `'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'`. The wheels can rotate freely and wrap around: for example we can turn `'9'` to be `'0'`, or `'0'` to be `'9'`. Each move consists of turning one wheel one slot. The lock initially starts...
Convert the ip addresses to and from (long) integers. You want to know what is the most addresses you can put in this block starting from the "start" ip, up to n. It is the smallest between the lowest bit of start and the highest bit of n. Then, repeat this process with a new start and n.
String,Bit Manipulation
Medium
93,468
435
everyone welcome back and let's write some more neat code today so today let's solve the problem non-overlapping solve the problem non-overlapping solve the problem non-overlapping intervals and this is actually a problem from the blind 75 list of questions that we've been working on and we've actually been tracking th...
Non-overlapping Intervals
non-overlapping-intervals
Given an array of intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping_. **Example 1:** **Input:** intervals = \[\[1,2\],\[2,3\],\[3,4\],\[1,3\]\] **Output:** 1 **Explanation:** \[1,3\] can be removed ...
null
Array,Dynamic Programming,Greedy,Sorting
Medium
452
1,928
hey what's up guys this is chung here again so this time lead code number uh 1928 minimum cost to reach destination in time okay so there is like a country of n cities numbered from zero to one minus one and all the cities are connected bi-directional bi-directional bi-directional right and then basically each road has...
Minimum Cost to Reach Destination in Time
number-of-orders-in-the-backlog
There is a country of `n` cities numbered from `0` to `n - 1` where **all the cities are connected** by bi-directional roads. The roads are represented as a 2D integer array `edges` where `edges[i] = [xi, yi, timei]` denotes a road between cities `xi` and `yi` that takes `timei` minutes to travel. There may be multiple...
Store the backlog buy and sell orders in two heaps, the buy orders in a max heap by price and the sell orders in a min heap by price. Store the orders in batches and update the fields according to new incoming orders. Each batch should only take 1 "slot" in the heap.
Array,Heap (Priority Queue),Simulation
Medium
null
5
in this video we will solve our longest palindromic substring problem and it has been asked many times in different uh programming interviews here you will be given a string and you have to find the longest palindrome that you can find within this and it should be a substring so in this string you can see that if you l...
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
821
hey everybody this is larry hit the like button hit the subscribe button let me know how you did on this problem i'm going to solve it live right about now check it out let me know uh show this distance to a character given a 821 shortest distance to a character given a string s and a count to c return an array of inte...
Shortest Distance to a Character
bricks-falling-when-hit
Given a string `s` and a character `c` that occurs in `s`, return _an array of integers_ `answer` _where_ `answer.length == s.length` _and_ `answer[i]` _is the **distance** from index_ `i` _to the **closest** occurrence of character_ `c` _in_ `s`. The **distance** between two indices `i` and `j` is `abs(i - j)`, where...
null
Array,Union Find,Matrix
Hard
2101,2322
341
hey folks welcome back to another video today we're looking at question 341 flat and nested list iterator the way we'll be approaching this problem is by actually flattening the list right here at the beginning so that we don't have to do any kind of computations uh when the next method or the next method is called so ...
Flatten Nested List Iterator
flatten-nested-list-iterator
You are given a nested list of integers `nestedList`. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an iterator to flatten it. Implement the `NestedIterator` class: * `NestedIterator(List nestedList)` Initializes the iterator with the nested list `nestedLi...
null
Stack,Tree,Depth-First Search,Design,Queue,Iterator
Medium
251,281,385,565