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,897
welcome back for another video we are going to do analytical question the question is we distribute characters to make own strings equal you are given an array of strings words geo indexed in one operation pick two distinct indices i and j where words i is a now empty string and move any character from words i to any p...
Redistribute Characters to Make All Strings Equal
maximize-palindrome-length-from-subsequences
You are given an array of strings `words` (**0-indexed**). In one operation, pick two **distinct** indices `i` and `j`, where `words[i]` is a non-empty string, and move **any** character from `words[i]` to **any** position in `words[j]`. Return `true` _if you can make **every** string in_ `words` _**equal** using **a...
Let's ignore the non-empty subsequence constraint. We can concatenate the two strings and find the largest palindromic subsequence with dynamic programming. Iterate through every pair of characters word1[i] and word2[j], and see if some palindrome begins with word1[i] and ends with word2[j]. This ensures that the subse...
String,Dynamic Programming
Hard
516
141
all right in today's video we're going to be doing link list cycle 141 okay given ahead the head of the link 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 pause or po...
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
253
how's it going everybody today we're gonna do a question number 253 meeting rooms number two last week we actually did meeting rooms number one and for those who haven't seen that just check the playlist or check a link down below for meeting room number one the reason I chose to do number two is because this is a good...
Meeting Rooms II
meeting-rooms-ii
Given an array of meeting time intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of conference rooms required_. **Example 1:** **Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\] **Output:** 2 **Example 2:** **Input:** intervals = \[\[7,10\],\[2,4\]\] **Output:** 1 **Constr...
Think about how we would approach this problem in a very simplistic way. We will allocate rooms to meetings that occur earlier in the day v/s the ones that occur later on, right? If you've figured out that we have to sort the meetings by their start time, the next thing to think about is how do we do the allocation? Th...
Array,Two Pointers,Greedy,Sorting,Heap (Priority Queue)
Medium
56,252,452,1184
328
Hey gas welcome and welcome back, what have you given us in my channel, here we have kept a single link. Okay, what do we have to do, here we have to group all the notes of all the different indias together and which and There will be notes of indiasis, we have to group them together, it is okay and who will follow the...
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
3
hey guys welcome to yet another session by scala in this session we'll be looking into longest substring without repeating characters and we're going to solve this particular problem so before we move on please make sure to subscribe to scala's youtube channel so that you don't miss our upcoming videos and also leave a...
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
80
hey everyone welcome back to the channel i hope you guys are doing extremely well so today we'll be solving the problem remove duplicates from the sorted array before moving on to the problem if you guys are new to our channel please do consider subscribing to our channel so the problem states that you're given a sorte...
Remove Duplicates from Sorted Array II
remove-duplicates-from-sorted-array-ii
Given an integer array `nums` sorted in **non-decreasing order**, remove some duplicates [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm) such that each unique element appears **at most twice**. The **relative order** of the elements should be kept the **same**. Since it is impossible to change the len...
null
Array,Two Pointers
Medium
26
394
okay we're going to use this example to expand the dfs algorithm here so initially uh in the dfl level one we have the parameter variable with result and then the current number what's the mean of that okay let's go further um so we have a little global pointer from here uh so when we find is a letter and then we assig...
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
89
all right let's do this question gray code if you want to make a sequence of two to the power of n integers where n is the input given into your function and every integer has to be within the range zero to the power of n minus one if earth's integer is zero every integer is unique in the sequence and every adjacent in...
Gray Code
gray-code
An **n-bit gray code sequence** is a sequence of `2n` integers where: * Every integer is in the **inclusive** range `[0, 2n - 1]`, * The first integer is `0`, * An integer appears **no more than once** in the sequence, * The binary representation of every pair of **adjacent** integers differs by **exactly one ...
null
Math,Backtracking,Bit Manipulation
Medium
717
1,837
okay let's talk about the sum of digits in base k so you so the base is no longer 10 is it could be six it could be anything else and you're going to return the sum of the digits so three and four if the base is ten then it's three plus four right so uh what you need in your answer and then basically it's normal it's p...
Sum of Digits in Base K
daily-leads-and-partners
Given an integer `n` (in base `10`) and a base `k`, return _the **sum** of the digits of_ `n` _**after** converting_ `n` _from base_ `10` _to base_ `k`. After converting, each digit should be interpreted as a base `10` number, and the sum should be returned in base `10`. **Example 1:** **Input:** n = 34, k = 6 **Out...
null
Database
Easy
null
65
hi there so today i want to talk about this question uh 65 value number so it's um the question statement is quite simple uh given a string we want to determine whether the string can be interpreted as a decimal number uh here are a whole bunch of lists of examples about uh what counts as a decimal point what's not uh ...
Valid Number
valid-number
A **valid number** can be split up into these components (in order): 1. A **decimal number** or an **integer**. 2. (Optional) An `'e'` or `'E'`, followed by an **integer**. A **decimal number** can be split up into these components (in order): 1. (Optional) A sign character (either `'+'` or `'-'`). 2. One of the...
null
String
Hard
8
367
all right today's question is valid perfect square and this question I'm going to go over two solutions the first one will be binary search that's probably something that I would implement in an interview the second one is using a Babylonian method so if you knew about it and you could implement it I would definitely i...
Valid Perfect Square
valid-perfect-square
Given a positive integer num, return `true` _if_ `num` _is a perfect square or_ `false` _otherwise_. A **perfect square** is an integer that is the square of an integer. In other words, it is the product of some integer with itself. You must not use any built-in library function, such as `sqrt`. **Example 1:** **In...
null
Math,Binary Search
Easy
69,633
1,643
hello everybody today on yeet code we'll be solving leaked code hard difficulty question number 1643 cape's smallest instructions we'll be doing this in the python programming language in this video i will go through the steps that i took to get to an acceptable solution throughout the video if you feel like my patient...
Kth Smallest Instructions
number-of-nodes-in-the-sub-tree-with-the-same-label
Bob is standing at cell `(0, 0)`, and he wants to reach `destination`: `(row, column)`. He can only travel **right** and **down**. You are going to help Bob by providing **instructions** for him to reach `destination`. The **instructions** are represented as a string, where each character is either: * `'H'`, meanin...
Start traversing the tree and each node should return a vector to its parent node. The vector should be of length 26 and have the count of all the labels in the sub-tree of this node.
Hash Table,Tree,Depth-First Search,Breadth-First Search,Counting
Medium
null
227
Hello hello everyone welcome to days gone back to the family channel live wallpaper have a great time today even before starting video lemon juice compound juice I hope you will have a great time today and join with friends family also want to believe world subscribe More Like Subscribe Now Subscribe subscribe to subsc...
Basic Calculator II
basic-calculator-ii
Given a string `s` which represents an expression, _evaluate this expression and return its value_. The integer division should truncate toward zero. You may assume that the given expression is always valid. All intermediate results will be in the range of `[-231, 231 - 1]`. **Note:** You are not allowed to use any ...
null
Math,String,Stack
Medium
224,282,785
307
hey what's up guys uh this is chung here again so this time again today's daily challenge problem number 307 range some query mutable so this one is very classic a range query problem right as you guys can see from the title so i mean i want to use this problem as an opportunity to revisit the segment tree all right ok...
Range Sum Query - Mutable
range-sum-query-mutable
Given an integer array `nums`, handle multiple queries of the following types: 1. **Update** the value of an element in `nums`. 2. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`. Implement the `NumArray` class: * `NumArray(int[] nums)` Initi...
null
Array,Design,Binary Indexed Tree,Segment Tree
Medium
303,308
1,525
hey everyone welcome to my channel in this video i'm going to try to solve this problem at the same time i'm going to follow the general interview steps while trying to solve this problem so first of all let's have a good understanding about this question so number of good ways to split the string so you're given a str...
Number of Good Ways to Split a String
queries-on-a-permutation-with-key
You are given a string `s`. A split is called **good** if you can split `s` into two non-empty strings `sleft` and `sright` where their concatenation is equal to `s` (i.e., `sleft + sright = s`) and the number of distinct letters in `sleft` and `sright` is the same. Return _the number of **good splits** you can make ...
Create the permutation P=[1,2,...,m], it could be a list for example. For each i, find the position of queries[i] with a simple scan over P and then move this to the beginning.
Array,Binary Indexed Tree,Simulation
Medium
null
190
hey folks today we are going to solve a lead code problem which is reverse bits so the problem statement states that uh we will be given an integer uh an unsigned 32-bit integer so what we are unsigned 32-bit integer so what we are unsigned 32-bit integer so what we are supposed to do we are supposed to reverse all the...
Reverse Bits
reverse-bits
Reverse bits of a given 32 bits unsigned integer. **Note:** * Note that in some languages, such as Java, there is no unsigned integer type. In this case, both input and output will be given as a signed integer type. They should not affect your implementation, as the integer's internal binary representation is the s...
null
Divide and Conquer,Bit Manipulation
Easy
7,191,2238
91
hello everyone so today we are going to see another interesting problem decode base and we are given a string yes which consists of digits and we have to convert the digits to alphabets in order like a starts with 1 till z ends with 26 and how many ways we can convert the string to characters or alphabets is the output...
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
509
hello everyone so today I will uh show you how to find the uh nth number of the given Fibonacci series so uh to start with what Fibonacci series is ah it is the sum of the N minus 1 and the N minus 2 number so the first number of the sequence will be zero the second number will be 1 and the third number will be zero pl...
Fibonacci Number
inorder-successor-in-bst-ii
The **Fibonacci numbers**, commonly denoted `F(n)` form a sequence, called the **Fibonacci sequence**, such that each number is the sum of the two preceding ones, starting from `0` and `1`. That is, F(0) = 0, F(1) = 1 F(n) = F(n - 1) + F(n - 2), for n > 1. Given `n`, calculate `F(n)`. **Example 1:** **Input:** n = ...
null
Tree,Binary Search Tree,Binary Tree
Medium
285
472
hey everyone welcome back and let's write some more neat code today so today let's solve concatenated words while this is a hard problem I don't think it's crazy hard so maybe by the end of this video you will have boosted your confidence or maybe even shattered it who knows we're given an array of strings without dupl...
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
70
hi all welcome back to tracking the fang interviews today i'm going to be talking about lead code number 17 which is climbing stairs and this question is very popular at facebook salesforce amazon and also microsoft i have seen this getting asked for regular software engineering and also data science slash aiml intervi...
Climbing Stairs
climbing-stairs
You are climbing a staircase. It takes `n` steps to reach the top. Each time you can either climb `1` or `2` steps. In how many distinct ways can you climb to the top? **Example 1:** **Input:** n = 2 **Output:** 2 **Explanation:** There are two ways to climb to the top. 1. 1 step + 1 step 2. 2 steps **Example 2:** ...
To reach nth step, what could have been your previous steps? (Think about the step sizes)
Math,Dynamic Programming,Memoization
Easy
747,1013,1236
1,992
1992 find all groups of farmland so the problem statement is uh you are given a zero index m by n binary matrix land where a zero represents the forest and let and one represents the hector farmland to keep the land organized there are designated rectangular areas of hectares that consist entirely of farmland so there ...
Find All Groups of Farmland
sort-linked-list-already-sorted-using-absolute-values
You are given a **0-indexed** `m x n` binary matrix `land` where a `0` represents a hectare of forested land and a `1` represents a hectare of farmland. To keep the land organized, there are designated rectangular areas of hectares that consist **entirely** of farmland. These rectangular areas are called **groups**. N...
The nodes with positive values are already in the correct order. Nodes with negative values need to be moved to the front. Nodes with negative values are in reversed order.
Linked List,Two Pointers,Sorting
Medium
148
1,652
Hello friends welcome to my channel let's have a look at problem 1552 they viewed the bomb in this video we are going to share Solutions based on sliding window and we are going to share two formats of solutions first I will read through the problem statement to digest the requirements then we do the analysis and share...
Defuse the Bomb
minimum-suffix-flips
You have a bomb to defuse, and your time is running out! Your informer will provide you with a **circular** array `code` of length of `n` and a key `k`. To decrypt the code, you must replace every number. All the numbers are replaced **simultaneously**. * If `k > 0`, replace the `ith` number with the sum of the **n...
Consider a strategy where the choice of bulb with number i is increasing. In such a strategy, you no longer need to worry about bulbs that have been set to the left.
String,Greedy
Medium
null
328
hello everyone welcome back so today we are going to continue with the problems related to linked list so the problem name is uh or even linked list so given the head of the sinclair linked list group all the nodes with odd indices together followed by nodes with even indices and return the reordered list the first nod...
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
120
some problems can really help you understand how dynamic programming actually works one such example is the problem triangle on lead code and trust me once you are done with this video you will be really happy how you were able to solve this problem hello friends welcome back to my channel first i will explain you the ...
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
881
hey everybody this is larry this is day 24 of the march ooh this quick let go daily challenge hit the like button to subscribe or enjoy my discord let me know what you think about today's farm boats to save people i hope this farm is boat boatloads of fun so yeah join me on discord to let me know what you think about t...
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
1,095
so lead code problem of the day and here we bring solution for today's lead code problem that is called as find in a mountain array this is the most interesting question and I'm going to solve this question in three important steps so I highly recommend you to stay in the end of my video just in case if you're new to o...
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
844
in this video we will see second solution of backspace string compare and it's lead code problem number 844 and it's also part of day 9 question of 30 days lead coding challenge in my previous video i had given a solution where we used two stacks one for each of the strings and uh here we will avoid the stacks and we w...
Backspace String Compare
backspace-string-compare
Given two strings `s` and `t`, return `true` _if they are equal when both are typed into empty text editors_. `'#'` means a backspace character. Note that after backspacing an empty text, the text will continue empty. **Example 1:** **Input:** s = "ab#c ", t = "ad#c " **Output:** true **Explanation:** Both s and t...
null
null
Easy
null
500
hey what's going on guys it's illa bell here i recording stuff on youtube chat description for all my information i do all liquid problems uh make sure you subscribe to this channel give me a big thumbs up to support it and this is called keyboard raw you know list of words return the words that can be typed using lett...
Keyboard Row
keyboard-row
Given an array of strings `words`, return _the words that can be typed using letters of the alphabet on only one row of American keyboard like the image below_. In the **American keyboard**: * the first row consists of the characters `"qwertyuiop "`, * the second row consists of the characters `"asdfghjkl "`, and...
null
Array,Hash Table,String
Easy
null
903
hey everybody this is larry this is me doing the bonus question a little bit early to be honest on august 13 2022 uh before my daily prom the reason is mostly just because of logistics and i want i today i do want to mix it up by still trying to do it one i haven't done before but i wouldn't do a difficult one that i h...
Valid Permutations for DI Sequence
implement-rand10-using-rand7
You are given a string `s` of length `n` where `s[i]` is either: * `'D'` means decreasing, or * `'I'` means increasing. A permutation `perm` of `n + 1` integers of all the integers in the range `[0, n]` is called a **valid permutation** if for all valid `i`: * If `s[i] == 'D'`, then `perm[i] > perm[i + 1]`, an...
null
Math,Rejection Sampling,Randomized,Probability and Statistics
Medium
null
1,425
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 screen cats of the contest how did you do let me know you do hit the like button eit...
Constrained Subsequence Sum
weather-type-in-each-country
Given an integer array `nums` and an integer `k`, return the maximum sum of a **non-empty** subsequence of that array such that for every two **consecutive** integers in the subsequence, `nums[i]` and `nums[j]`, where `i < j`, the condition `j - i <= k` is satisfied. A _subsequence_ of an array is obtained by deleting...
null
Database
Easy
null
1,701
hello everyone let's look at lead code question 17001 average weight time so in this question we're given a two-dimensional array called customers two-dimensional array called customers two-dimensional array called customers and the individual values of customers at I is the arrival and time the arrival time of the I c...
Average Waiting Time
remove-max-number-of-edges-to-keep-graph-fully-traversable
There is a restaurant with a single chef. You are given an array `customers`, where `customers[i] = [arrivali, timei]:` * `arrivali` is the arrival time of the `ith` customer. The arrival times are sorted in **non-decreasing** order. * `timei` is the time needed to prepare the order of the `ith` customer. When a ...
Build the network instead of removing extra edges. Suppose you have the final graph (after removing extra edges). Consider the subgraph with only the edges that Alice can traverse. What structure does this subgraph have? How many edges are there? Use disjoint set union data structure for both Alice and Bob. Always use ...
Union Find,Graph
Hard
null
13
hey everyone welcome back and let's write some more neat code today so today let's solve the problem roman 2 integer this is an easy problem but i would say the difficult part about this problem is really trying to understand the problem itself and the requirements that they want even though it's easy i think it's a pr...
Roman to Integer
roman-to-integer
Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`. **Symbol** **Value** I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, `2` is written as `II` in Roman numeral, just two ones added...
Problem is simpler to solve by working the string from back to front and using a map.
Hash Table,Math,String
Easy
12
342
hey guys welcome to code circle and today we'll be covering the lead code problem number 342 power of four it is marked as an easy and it is quite a light problem okay so first of all i'll read out the problem statement here which says that given an integer of a sign 32 bits write a function to check whether it is a po...
Power of Four
power-of-four
Given an integer `n`, return _`true` if it is a power of four. Otherwise, return `false`_. An integer `n` is a power of four, if there exists an integer `x` such that `n == 4x`. **Example 1:** **Input:** n = 16 **Output:** true **Example 2:** **Input:** n = 5 **Output:** false **Example 3:** **Input:** n = 1 **O...
null
Math,Bit Manipulation,Recursion
Easy
231,326
5
hey what's up guys in this video we're going to solve this coding interview problem longest palindromic substring given a string is written the longest palindromic substring in s what is a palindrome a string is a palindrome when it reads the same backward as forward for this string aba these strings read the same back...
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
145
hello friends welcome to joy of life so today we are going to look at another medium level problem from lead code the problem number is 145 it says binary tree post order traversal so previously we have done videos on pre-order in order and level order as pre-order in order and level order as pre-order in order and lev...
Binary Tree Postorder Traversal
binary-tree-postorder-traversal
Given the `root` of a binary tree, return _the postorder traversal of its nodes' values_. **Example 1:** **Input:** root = \[1,null,2,3\] **Output:** \[3,2,1\] **Example 2:** **Input:** root = \[\] **Output:** \[\] **Example 3:** **Input:** root = \[1\] **Output:** \[1\] **Constraints:** * The number of the n...
null
Stack,Tree,Depth-First Search,Binary Tree
Easy
94,776
1,650
hello and welcome to the cracking fang youtube channel today we're going to be solving lead code problem 1650 lowest common ancestor of a binary tree 3. let's read the question prompt given two nodes of a binary tree p and q return their lowest common ancestor according to the definition of an lca on wikipedia the lowe...
Lowest Common Ancestor of a Binary Tree III
find-root-of-n-ary-tree
Given two nodes of a binary tree `p` and `q`, return _their lowest common ancestor (LCA)_. Each node will have a reference to its parent node. The definition for `Node` is below: class Node { public int val; public Node left; public Node right; public Node parent; } According to the **[definition of ...
Node with indegree 0 is the root
Hash Table,Bit Manipulation,Tree,Depth-First Search
Medium
1655
126
hey everybody this is larry this is me going with the july decode challenge um word ladder too i'm not gonna lie i a little bit lower in time today i didn't i mean i didn't solve this i saw this previously so you can actually find my video from before but i'm just going to do a quick going over the solution there are a...
Word Ladder II
word-ladder-ii
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,Backtracking,Breadth-First Search
Hard
127,2276
653
Hello guys welcome to my video report to dhigri school administration subscribe our Channel and Share Thank you number ke liye aapko return rules are subject to market ok so lets you want to know the limits for example 99690 subscribe and placid in the problems and 252 Those Who Are Very Selfish Tablet Se Bigg Boss Are...
Two Sum IV - Input is a BST
two-sum-iv-input-is-a-bst
Given the `root` of a binary search tree and an integer `k`, return `true` _if there exist two elements in the BST such that their sum is equal to_ `k`, _or_ `false` _otherwise_. **Example 1:** **Input:** root = \[5,3,6,2,4,null,7\], k = 9 **Output:** true **Example 2:** **Input:** root = \[5,3,6,2,4,null,7\], k = ...
null
Hash Table,Two Pointers,Tree,Depth-First Search,Breadth-First Search,Binary Search Tree,Binary Tree
Easy
1,167,170,1150
242
hi guys welcome to algorithms made easy in this video we will see the question valid anagram given two strings s and t write a function to determine if t is an anagram of s in the example one we have two inputs string s and string t and the output is true now why is the output true you can see that the set of character...
Valid Anagram
valid-anagram
Given two strings `s` and `t`, return `true` _if_ `t` _is an anagram of_ `s`_, and_ `false` _otherwise_. An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. **Example 1:** **Input:** s = "anagram", t = "nagaram" **...
null
Hash Table,String,Sorting
Easy
49,266,438
1,531
hey everybody this is Larry this is day 15 of the October Lego day challenge hit the like button and the Subscribe button join me on Discord let me know what you think about today's form 1531 strain compression two rle is a string compression method that we place okay one length obviously uh I know how to do this thoug...
String Compression II
number-of-ways-to-wear-different-hats-to-each-other
[Run-length encoding](http://en.wikipedia.org/wiki/Run-length_encoding) is a string compression method that works by replacing consecutive identical characters (repeated 2 or more times) with the concatenation of the character and the number marking the count of the characters (length of the run). For example, to compr...
Dynamic programming + bitmask. dp(peopleMask, idHat) number of ways to wear different hats given a bitmask (people visited) and used hats from 1 to idHat-1.
Array,Dynamic Programming,Bit Manipulation,Bitmask
Hard
2105
901
Hi gas welcome and welcome back to my channel so today our problem is online stock span so what have you given us in this problem statement here you have given us a class okay from stock spanner in this you have one constructor and the other one is your next The function is, in the next function you have an argument na...
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
95
hello everybody and welcome today we're going to discuss the solution to the problem unique binary search trees you're given an integer n which signifies the number of nodes available to you and you have to create from all these collection of modes binary search trees and you have to create all structurally unique bina...
Unique Binary Search Trees II
unique-binary-search-trees-ii
Given an integer `n`, return _all the structurally unique **BST'**s (binary search trees), which has exactly_ `n` _nodes of unique values from_ `1` _to_ `n`. Return the answer in **any order**. **Example 1:** **Input:** n = 3 **Output:** \[\[1,null,2,null,3\],\[1,null,3,2\],\[2,1,3\],\[3,1,null,null,2\],\[3,2,null,1\...
null
Dynamic Programming,Backtracking,Tree,Binary Search Tree,Binary Tree
Medium
96,241
1,046
easy level question of Welcome Tu De Stylish Co. Inside this question, we will have a waiting area filled with stones, inside which we will have a stone telling us the weight of the stone. Okay, so this is all about our input. What we will be doing in this question is that we will be playing a game in this question in ...
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
335
okay this is a this is an interesting problem okay so the thing is you start going arts then you take left run then you take left round then you take left and you continue taking left turns and you have to tell whether you have crossed the path or not so and this two means like you are going like you know two units tow...
Self Crossing
self-crossing
You are given an array of integers `distance`. You start at the point `(0, 0)` on an **X-Y plane,** and you move `distance[0]` meters to the north, then `distance[1]` meters to the west, `distance[2]` meters to the south, `distance[3]` meters to the east, and so on. In other words, after each move, your direction chan...
null
Array,Math,Geometry
Hard
null
1,539
hey everyone welcome to Tech quiet in this video we are going to solve problem number 1539 Keith missing positive number first we will see the explanation of the problem statement then the logic and the code now let's dive into the solution so here I've taken the first example from the lead code website so we are given...
Kth Missing Positive Number
diagonal-traverse-ii
Given an array `arr` of positive integers sorted in a **strictly increasing order**, and an integer `k`. Return _the_ `kth` _**positive** integer that is **missing** from this array._ **Example 1:** **Input:** arr = \[2,3,4,7,11\], k = 5 **Output:** 9 **Explanation:** The missing positive integers are \[1,5,6,8,9,10...
Notice that numbers with equal sums of row and column indexes belong to the same diagonal. Store them in tuples (sum, row, val), sort them, and then regroup the answer.
Array,Sorting,Heap (Priority Queue)
Medium
null
438
Peace be upon you, my dear friend. How are you doing? Oh God, you will be fine and in the best condition. God willing, today we will be together. Instagram. Anna Grams is telling you that your hand is supposed to return to him all of his Instagram messages that are Anna Grams, and return them to him in any normal order...
Find All Anagrams in a String
find-all-anagrams-in-a-string
Given two strings `s` and `p`, return _an array of all the start indices of_ `p`_'s anagrams in_ `s`. You may return the answer in **any order**. An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. **Example 1:** *...
null
Hash Table,String,Sliding Window
Medium
242,567
1,663
Hello Everyone Chaturvedi Arvind Small Electronic Product Must Subscribe Till 2030 Vriddhi Misal Issi Ke Sikud Se Zameen Isse Idli 476 subscribe The Channel Please subscribe and subscribe Amit Ko WhatsApp Madding Dos Clear Loot Certificate Subscribe To Turn Off Side This big ass may stringers are going to be of science...
Smallest String With A Given Numeric Value
detect-cycles-in-2d-grid
The **numeric value** of a **lowercase character** is defined as its position `(1-indexed)` in the alphabet, so the numeric value of `a` is `1`, the numeric value of `b` is `2`, the numeric value of `c` is `3`, and so on. The **numeric value** of a **string** consisting of lowercase characters is defined as the sum of...
Keep track of the parent (previous position) to avoid considering an invalid path. Use DFS or BFS and keep track of visited cells to see if there is a cycle.
Array,Depth-First Search,Breadth-First Search,Union Find,Matrix
Medium
null
1,071
hi guys and welcome back to the series um so we're going to be looking at um this question which is uh greatest common divisor of strings um let me just expand this first so for two strings s and t we say t divides s if and only if s = to t + t divides s if and only if s = to t + t divides s if and only if s = to t + t...
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
261
hey everyone in this video let's take a look at question 261 graph valid Tree on Lee code this is part of our blind 75 list of questions so let's begin so this question is actually a premium question and that's why we're doing it on the lint code website and why the number here is different but otherwise the question t...
Graph Valid Tree
graph-valid-tree
You have a graph of `n` nodes labeled from `0` to `n - 1`. You are given an integer n and a list of `edges` where `edges[i] = [ai, bi]` indicates that there is an undirected edge between nodes `ai` and `bi` in the graph. Return `true` _if the edges of the given graph make up a valid tree, and_ `false` _otherwise_. **...
Given n = 5 and edges = [[0, 1], [1, 2], [3, 4]], what should your return? Is this case a valid tree? According to the definition of tree on Wikipedia: “a tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles is a tree.”
Depth-First Search,Breadth-First Search,Union Find,Graph
Medium
207,323,871
1,189
hey what's up guys think white here the second coding stuff on twitching YouTube check the description for all of my information I do I'm putting a lot of stuff on my patreon if you want to check that out pulling a new stuff every day and if you want to reach out to me patreon or discord those are good places I try and...
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
2
hi everybody welcome back and thank you so much for all the support that you have shown on my previous videos i am very thankful for that but if you're new here my name is patricia vacrolla i make videos about lead code solution and system design concepts if you are interested in that sort of things make sure to subscr...
Add Two Numbers
add-two-numbers
You are given two **non-empty** linked lists representing two non-negative integers. The digits are stored in **reverse order**, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 ...
null
Linked List,Math,Recursion
Medium
43,67,371,415,445,1031,1774
1,311
hello everyone so in this video we'll go over one more problem from lead code the problem name is get watched videos by your friends fine so let us move down to the problem statement it says that there are n people each person has a unique id between 0 to n minus 1 fine given the array watched videos and friends so now...
Get Watched Videos by Your Friends
largest-magic-square
There are `n` people, each person has a unique _id_ between `0` and `n-1`. Given the arrays `watchedVideos` and `friends`, where `watchedVideos[i]` and `friends[i]` contain the list of watched videos and the list of friends respectively for the person with `id = i`. Level **1** of videos are all watched videos by your...
Check all squares in the matrix and find the largest one.
Array,Matrix,Prefix Sum
Medium
870
1,987
hey everybody this is larry this is me going with q4 of the weekly contest 256 number of unique good subsequences so this one was very hard uh hit the like button in the subscribe button join me on discord let me know what you think about this problem i end up spending about an hour more than an hour on this one um and...
Number of Unique Good Subsequences
substrings-of-size-three-with-distinct-characters
You are given a binary string `binary`. A **subsequence** of `binary` is considered **good** if it is **not empty** and has **no leading zeros** (with the exception of `"0 "`). Find the number of **unique good subsequences** of `binary`. * For example, if `binary = "001 "`, then all the **good** subsequences are `[...
Try using a set to find out the number of distinct characters in a substring.
Hash Table,String,Sliding Window,Counting
Easy
null
152
hello so today we are doing with this problem called maximum product subarray and the problem says we get an array NIMS and we want to find the contiguous sub array within an array that contains at least one number which has the largest product so we can have something like 2 3 - 2 4 here and the largest like 2 3 - 2 4...
Maximum Product Subarray
maximum-product-subarray
Given an integer array `nums`, find a subarray that has the largest product, and return _the product_. The test cases are generated so that the answer will fit in a **32-bit** integer. **Example 1:** **Input:** nums = \[2,3,-2,4\] **Output:** 6 **Explanation:** \[2,3\] has the largest product 6. **Example 2:** **I...
null
Array,Dynamic Programming
Medium
53,198,238,628,713
146
lead code problem 146 lru cash so this problem gives a wants us to implement a class called lru cache and here they have some different things they want us to do so in the Constructor you will call the contractor like this where it will use a the capacity which in this case will be the total size the capacity of the ca...
LRU Cache
lru-cache
Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**. Implement the `LRUCache` class: * `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`. * `int get(int key)` Return the valu...
null
Hash Table,Linked List,Design,Doubly-Linked List
Medium
460,588,604,1903
165
welcome back guys today we're going to solve this lead code question compare version numbers in this question we'll be given two strings version one and version two as an input and we need to check if version one is greater than version two or not and the output will be like if version one is less than version two then...
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,689
hello everyone welcome to learn overflow in this video we will discuss another liftboard problem partitioning into minimum number of dc binary numbers okay so that's the question we have over here this is an uh medium level question let's see what's the question it's all about so before starting this make sure to subsc...
Partitioning Into Minimum Number Of Deci-Binary Numbers
detect-pattern-of-length-m-repeated-k-or-more-times
A decimal number is called **deci-binary** if each of its digits is either `0` or `1` without any leading zeros. For example, `101` and `1100` are **deci-binary**, while `112` and `3001` are not. Given a string `n` that represents a positive decimal integer, return _the **minimum** number of positive **deci-binary** n...
Use a three-layer loop to check all possible patterns by iterating through all possible starting positions, all indexes less than m, and if the character at the index is repeated k times.
Array,Enumeration
Easy
1764
4
hello friends welcome to geeks for geeks today we are going to learn how we can find the median of two sorted areas of same size problem statement there are two sorted arrays a and B of size n each write an algorithm to find the median of the area obtained after merging the above two areas that is array of length 2 n s...
Median of Two Sorted Arrays
median-of-two-sorted-arrays
Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays. The overall run time complexity should be `O(log (m+n))`. **Example 1:** **Input:** nums1 = \[1,3\], nums2 = \[2\] **Output:** 2.00000 **Explanation:** merged array = \[1,2,3\] and median is ...
null
Array,Binary Search,Divide and Conquer
Hard
null
934
hi guys good morning good evening welcome back to the next lecture of our series it is the last video of our BFS and DFS traversal which we have been doing so far it is the mix of both BFS and BFS for your uh like in this video we're gonna see the power shortest bridge but if you want to try on you can also try minimum...
Shortest Bridge
bitwise-ors-of-subarrays
You are given an `n x n` binary matrix `grid` where `1` represents land and `0` represents water. An **island** is a 4-directionally connected group of `1`'s not connected to any other `1`'s. There are **exactly two islands** in `grid`. You may change `0`'s to `1`'s to connect the two islands to form **one island**. ...
null
Array,Dynamic Programming,Bit Manipulation
Medium
null
929
hello friends so today we're going to discuss a interesting problem asked in google interview and this will help you to understand how to pass a string given some constraints i will tell you two examples but the question statement first like read down this question statement the question name is unique email addresses ...
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
167
in this video we're going to take a look at a legal problem called two cell number two input array sorted so given a integer array and a target sum we're given we're asked to find two elements in the array that has a sum that is equal to target so in this case we cannot use the same element twice um and there must be a...
Two Sum II - Input Array Is Sorted
two-sum-ii-input-array-is-sorted
Given a **1-indexed** array of integers `numbers` that is already **_sorted in non-decreasing order_**, find two numbers such that they add up to a specific `target` number. Let these two numbers be `numbers[index1]` and `numbers[index2]` where `1 <= index1 < index2 <= numbers.length`. Return _the indices of the two n...
null
Array,Two Pointers,Binary Search
Medium
1,653,1083
59
hey what's up guys it's Nick white I do tech encoding stuff on Twitch in YouTube and I do all the leaker and a current solution so if you want those explained up playlists I do like all of them so just check those out on my channel I guess everything else in the description I just did one called spiral matrix on leak c...
Spiral Matrix II
spiral-matrix-ii
Given a positive integer `n`, generate an `n x n` `matrix` filled with elements from `1` to `n2` in spiral order. **Example 1:** **Input:** n = 3 **Output:** \[\[1,2,3\],\[8,9,4\],\[7,6,5\]\] **Example 2:** **Input:** n = 1 **Output:** \[\[1\]\] **Constraints:** * `1 <= n <= 20`
null
Array,Matrix,Simulation
Medium
54,921
378
Hello everyone welcome to my channel, today we will give challenge question of number two. Let's see the question. A question is that smallest element is sufficient water meters given in process meter is illicit liquor collection shifted in ascending order return's smallest element inter. metric notification smallest e...
Kth Smallest Element in a Sorted Matrix
kth-smallest-element-in-a-sorted-matrix
Given an `n x n` `matrix` where each of the rows and columns is sorted in ascending order, return _the_ `kth` _smallest element in the matrix_. Note that it is the `kth` smallest element **in the sorted order**, not the `kth` **distinct** element. You must find a solution with a memory complexity better than `O(n2)`....
null
Array,Binary Search,Sorting,Heap (Priority Queue),Matrix
Medium
373,668,719,802
80
hello everyone let's welcome back let's solve today's problem today we'll solve the problem remove duplicates from sorted array 2. so here we are given our non-decreasing array in which we'll non-decreasing array in which we'll non-decreasing array in which we'll have to remove uh some duplicates in place such that at ...
Remove Duplicates from Sorted Array II
remove-duplicates-from-sorted-array-ii
Given an integer array `nums` sorted in **non-decreasing order**, remove some duplicates [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm) such that each unique element appears **at most twice**. The **relative order** of the elements should be kept the **same**. Since it is impossible to change the len...
null
Array,Two Pointers
Medium
26
969
That one shot of your pan was started, in this we will get one Hey, this ray will be found 3241 So we have to cost it, using pan cake clips of one of the tips is that like this, you can give a point here to your fans here. From here to here, you can just click on this, you can click on my from here to here, you can wri...
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
3
alright hey what's up guys they're quite here to tech encoding stuff on twitch and YouTube and yeah that's cool right yep very cool right this is the longest substring without repeating characters so this is given a string find the length of the longest substring meaning part of the string that doesn't have repeating c...
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
1,861
hey everybody this is larry this is me going with q3 of the buy weekly contest 52 uh rotating the box so this one is also simulation it's just very tricky um there are probably a couple of ways to do it but the thing that i noticed is that n is 500 so as long as you do it reasonably it'll be okay and basically i just s...
Rotating the Box
building-boxes
You are given an `m x n` matrix of characters `box` representing a side-view of a box. Each cell of the box is one of the following: * A stone `'#'` * A stationary obstacle `'*'` * Empty `'.'` The box is rotated **90 degrees clockwise**, causing some of the stones to fall due to gravity. Each stone falls down u...
Suppose We can put m boxes on the floor, within all the ways to put the boxes, what’s the maximum number of boxes we can put in? The first box should always start in the corner
Math,Binary Search,Greedy
Hard
null
63
Hello friends welcome to the new video question number 63 unique part 2 name is follow medium rice question is DP question you will find this question on the internet and this was asked on Facebook let's start give this gram and said The robot went to the top left corner, the finish line is the last one and if your rob...
Unique Paths II
unique-paths-ii
You are given an `m x n` integer array `grid`. There is a robot initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time. An obstacle and space are marked as ...
The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be if obstacleGrid[i][j] is not an obstacle ...
Array,Dynamic Programming,Matrix
Medium
62,1022
1,660
okay so here's the code and solution let's run through it so as you can see we create a set which will keep track of the nodes that have already been visited and we start with our first Noe okay let's start at node one if root equals none that's not the case if root. WR exists and the root. right value is in the self. ...
Correct a Binary Tree
thousand-separator
You have a binary tree with a small defect. There is **exactly one** invalid node where its right child incorrectly points to another node at the **same depth** but to the **invalid node's right**. Given the root of the binary tree with this defect, `root`, return _the root of the binary tree after **removing** this i...
Scan from the back of the integer and use dots to connect blocks with length 3 except the last block.
String
Easy
null
1,921
hey everyone welcome back and let's write some more neat code today so today let's solve the problem eliminate maximum number of monsters this is from today's elite code contest so we're given two arrays an array of distance an array of speed as well both of these are going to be the same size and each position of thes...
Eliminate Maximum Number of Monsters
eliminate-maximum-number-of-monsters
You are playing a video game where you are defending your city from a group of `n` monsters. You are given a **0-indexed** integer array `dist` of size `n`, where `dist[i]` is the **initial distance** in kilometers of the `ith` monster from the city. The monsters walk toward the city at a **constant** speed. The speed...
null
null
Medium
null
1,663
Hello Everyone Welcome Back to My Channel Short Viewers Name Problems Molesting the Giver Numerical Value So Problems in the Married Life of Lower Case Character is Defined a Position in the Alphabet So Value of a Given May for Your Gift To and Leave a Reply On 16th's first citizen go be first a subjective of lower cas...
Smallest String With A Given Numeric Value
detect-cycles-in-2d-grid
The **numeric value** of a **lowercase character** is defined as its position `(1-indexed)` in the alphabet, so the numeric value of `a` is `1`, the numeric value of `b` is `2`, the numeric value of `c` is `3`, and so on. The **numeric value** of a **string** consisting of lowercase characters is defined as the sum of...
Keep track of the parent (previous position) to avoid considering an invalid path. Use DFS or BFS and keep track of visited cells to see if there is a cycle.
Array,Depth-First Search,Breadth-First Search,Union Find,Matrix
Medium
null
965
cool 965 you know why you'd binary tree a binary trees you know valued if every node in the tree has the same right we turn true if and only if the given tree is unified all right seems straightforward ish okay unless we didn't time to do it this way what motive concrete is new but return true okay otherwise have no cl...
Univalued Binary Tree
unique-email-addresses
A binary tree is **uni-valued** if every node in the tree has the same value. Given the `root` of a binary tree, return `true` _if the given tree is **uni-valued**, or_ `false` _otherwise._ **Example 1:** **Input:** root = \[1,1,1,1,1,null,1\] **Output:** true **Example 2:** **Input:** root = \[2,2,2,5,2\] **Outpu...
null
Array,Hash Table,String
Easy
null
1,029
hello everyone welcome to the channel today's question is to cities in Tivoli if you are new to the channel please consider subscribing we sold a lot of into a question on this channel and that can definitely help you with your interview the question says there are 2n people a company is planning to interview the cost ...
Two City Scheduling
vertical-order-traversal-of-a-binary-tree
A company is planning to interview `2n` people. Given the array `costs` where `costs[i] = [aCosti, bCosti]`, the cost of flying the `ith` person to city `a` is `aCosti`, and the cost of flying the `ith` person to city `b` is `bCosti`. Return _the minimum cost to fly every person to a city_ such that exactly `n` people...
null
Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Hard
null
67
this function takes the binary string representation of two integers and we have to add them up and return the answer as a binary string so what I'm doing here is grabbing both values A and B converting them to their integer equivalent in base 10 notice that I'm using here this second argument to say that the original ...
Add Binary
add-binary
Given two binary strings `a` and `b`, return _their sum as a binary string_. **Example 1:** **Input:** a = "11", b = "1" **Output:** "100" **Example 2:** **Input:** a = "1010", b = "1011" **Output:** "10101" **Constraints:** * `1 <= a.length, b.length <= 104` * `a` and `b` consist only of `'0'` or `'1'` chara...
null
Math,String,Bit Manipulation,Simulation
Easy
2,43,66,1031
1,547
Hello everyone welcome, we are going to do video number 36 of my channel and before starting I want you to repeat my playlist of DP concepts and questions. You can start that question has started coming in ok and there you can start DP from scratch. Can you understand ok so nowadays lead code number is 1547 is hard mar...
Minimum Cost to Cut a Stick
destination-city
Given a wooden stick of length `n` units. The stick is labelled from `0` to `n`. For example, a stick of length **6** is labelled as follows: Given an integer array `cuts` where `cuts[i]` denotes a position you should perform a cut at. You should perform the cuts in order, you can change the order of the cuts as you ...
Start in any city and use the path to move to the next city. Eventually, you will reach a city with no path outgoing, this is the destination city.
Hash Table,String
Easy
null
69
hi my name is david today we're going to do number 69 on the code square root x we're giving a non-negative integer x we're giving a non-negative integer x we're giving a non-negative integer x compute and return the square root of x so in this example the input of x is 4 so the square root of 4 is 2. and there's anoth...
Sqrt(x)
sqrtx
Given a non-negative integer `x`, return _the square root of_ `x` _rounded down to the nearest integer_. The returned integer should be **non-negative** as well. You **must not use** any built-in exponent function or operator. * For example, do not use `pow(x, 0.5)` in c++ or `x ** 0.5` in python. **Example 1:** ...
Try exploring all integers. (Credits: @annujoshi) Use the sorted property of integers to reduced the search space. (Credits: @annujoshi)
Math,Binary Search
Easy
50,367
645
hello guys welcome to algorithms made easy today we will be discussing the question set mismatch in this question we are given a set of integer s which originally contains all the number from 1 to n unfortunately due to some error one of the numbers in as got duplicated to another number in the set which results in rep...
Set Mismatch
set-mismatch
You have a set of integers `s`, which originally contains all the numbers from `1` to `n`. Unfortunately, due to some error, one of the numbers in `s` got duplicated to another number in the set, which results in **repetition of one** number and **loss of another** number. You are given an integer array `nums` represe...
null
Array,Hash Table,Bit Manipulation,Sorting
Easy
287
1,463
hey everyone welcome back and let's write some more neat code today so today let's solve the problem Cherry pickup 2 this is definitely a hard one but it's not crazy hard at least in my opinion it's not as hard as the first one which is why I'm not going to recommend that you solve the first one before this one in my o...
Cherry Pickup II
the-k-weakest-rows-in-a-matrix
You are given a `rows x cols` matrix `grid` representing a field of cherries where `grid[i][j]` represents the number of cherries that you can collect from the `(i, j)` cell. You have two robots that can collect cherries for you: * **Robot #1** is located at the **top-left corner** `(0, 0)`, and * **Robot #2** is...
Sort the matrix row indexes by the number of soldiers and then row indexes.
Array,Binary Search,Sorting,Heap (Priority Queue),Matrix
Easy
null
463
hey guys welcome back to my channel and i'm back again with another really interesting coding interview question video this time guys again we are going to solve a graph question called as island parameter which is question number 463 before i start with the video guys just want to request you that if you have not yet ...
Island Perimeter
island-perimeter
You are given `row x col` `grid` representing a map where `grid[i][j] = 1` represents land and `grid[i][j] = 0` represents water. Grid cells are connected **horizontally/vertically** (not diagonally). The `grid` is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells)...
null
Array,Depth-First Search,Breadth-First Search,Matrix
Easy
695,733,1104
49
A high-rise is ready today, we will do the playlist's A high-rise is ready today, we will do the playlist's A high-rise is ready today, we will do the playlist's question number at 11:00. The question number at 11:00. The question number at 11:00. The question is kept medium. The name of the animal is Liquid 149. The n...
Group Anagrams
group-anagrams
Given an array of strings `strs`, group **the anagrams** together. You can return the answer in **any order**. An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. **Example 1:** **Input:** strs = \["eat","tea","tan...
null
Hash Table,String,Sorting
Medium
242,249
1,970
Hello friends welcome to code Sutra in this video we'll be solving lead code 1970 last day where you can still cross in this problem actually this is not a very difficult level problem this problem has two concepts or topics that is combined with it if you understand the problem step by step it is actually very easy to...
Last Day Where You Can Still Cross
sorting-the-sentence
There is a **1-based** binary matrix where `0` represents land and `1` represents water. You are given integers `row` and `col` representing the number of rows and columns in the matrix, respectively. Initially on day `0`, the **entire** matrix is **land**. However, each day a new cell becomes flooded with **water**. ...
Divide the string into the words as an array of strings Sort the words by removing the last character from each word and sorting according to it
String,Sorting
Easy
2168
35
hi today we'll talk about another binary search problem search insert position let's say what this question is all about all right so they will provide us a sorted distinct integer array and a target value and they're asking we have to find this target in the particular array if it is found then we have to return the i...
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,684
all right so let's talk about content number of consistent strings so you are giving the string a lot of consistency of the same character and an array of string word so string is consistent if all the character in the string appears in the string alone so you just have to return the number of consistent string in the ...
Count the Number of Consistent Strings
find-latest-group-of-size-m
You are given a string `allowed` consisting of **distinct** characters and an array of strings `words`. A string is **consistent** if all characters in the string appear in the string `allowed`. Return _the number of **consistent** strings in the array_ `words`. **Example 1:** **Input:** allowed = "ab ", words = \[...
Since the problem asks for the latest step, can you start the searching from the end of arr? Use a map to store the current “1” groups. At each step (going backwards) you need to split one group and update the map.
Array,Binary Search,Simulation
Medium
null
139
legal questions 139 word break basically this question want to check if a given string can be break into multiple valid words so the intuition is pretty simple we iterate through the strings at each point such as first number givens a little code so we start from l followed by e t until you find a valid word then we sp...
Word Break
word-break
Given a string `s` and a dictionary of strings `wordDict`, return `true` if `s` can be segmented into a space-separated sequence of one or more dictionary words. **Note** that the same word in the dictionary may be reused multiple times in the segmentation. **Example 1:** **Input:** s = "leetcode ", wordDict = \[ "...
null
Hash Table,String,Dynamic Programming,Trie,Memoization
Medium
140
34
okay let's go Challenge number 34 finding personalized positions of Target in uh number list that was passing a parameter so we're going to find the Target in our numbers list now we're going to use binary search and we will Define concur our list okay so we're going to need first we put your first search we will be so...
Find First and Last Position of Element in Sorted Array
find-first-and-last-position-of-element-in-sorted-array
Given an array of integers `nums` sorted in non-decreasing order, find the starting and ending position of a given `target` value. If `target` is not found in the array, return `[-1, -1]`. You must write an algorithm with `O(log n)` runtime complexity. **Example 1:** **Input:** nums = \[5,7,7,8,8,10\], target = 8 *...
null
Array,Binary Search
Medium
278,2165,2210
332
hey what's up guys this is John here so this time let's talk about some a graph problem here so it's called I turn number 310 30 and 32 reconstruct a ternary so you're given any input for the I turn rate with each element in the array gonna be the flight from airport and to airport so this one from Munich right I am yo...
Reconstruct Itinerary
reconstruct-itinerary
You are given a list of airline `tickets` where `tickets[i] = [fromi, toi]` represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it. All of the tickets belong to a man who departs from `"JFK "`, thus, the itinerary must begin with `"JFK "`. If there are multiple...
null
Depth-First Search,Graph,Eulerian Circuit
Hard
2051,2201
1,041
hey guys welcome back to another video and today we're going to be solving the lee code question robot bounded in circle all right so in this question we have an infinite plane and a robot originally stands at 0 and faces north so the robot can receive one of the three commands so g is going to say go straight by one u...
Robot Bounded In Circle
available-captures-for-rook
On an infinite plane, a robot initially stands at `(0, 0)` and faces north. Note that: * The **north direction** is the positive direction of the y-axis. * The **south direction** is the negative direction of the y-axis. * The **east direction** is the positive direction of the x-axis. * The **west direction**...
null
Array,Matrix,Simulation
Easy
null
1,292
all the training lead coder solution if you want the best mock interview experience in North America feel free to check us out at depository in the Lord we're here to help you lend your next big offer today we're going to talk about well lead coach solution 1292 I cannot believe right now it has like more than one thou...
Maximum Side Length of a Square with Sum Less than or Equal to Threshold
immediate-food-delivery-ii
Given a `m x n` matrix `mat` and an integer `threshold`, return _the maximum side-length of a square with a sum less than or equal to_ `threshold` _or return_ `0` _if there is no such square_. **Example 1:** **Input:** mat = \[\[1,1,3,2,4,3,2\],\[1,1,3,2,4,3,2\],\[1,1,3,2,4,3,2\]\], threshold = 4 **Output:** 2 **Expl...
null
Database
Medium
null
1,797
Show More Hello Everyone Today We Are Discussing Questions Many Questions Off List Ko Title Add Designer Partition Manager By Name Do You Understand Some Questions Related To World Design System Design In The System Will Receive New Updates Time To Day Do Subscribe Thank You Will Now Be Able To Edit And The Current Tim...
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
729
hi guys welcome to technique so today we are back with the daily link for challenge problem that's my calendar one uh that's unique good medium question lead code medium 729 uh basically this question belongs to uh fan questions if you have seen uh kind of uh merge interval questions uh it's similar to that so white as...
My Calendar I
my-calendar-i
You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a **double booking**. A **double booking** happens when two events have some non-empty intersection (i.e., some moment is common to both events.). The event can be represented as a pair of integers `start...
Store the events as a sorted list of intervals. If none of the events conflict, then the new event can be added.
Design,Segment Tree,Ordered Set
Medium
731,732
714
hello everyone our today's problem is a deep problem so the problem is uh is a famous one so this is a this is similar to best time to buy and sell stocks too so if you have solved that it is well and good if you have not uh we will see uh we will understand this problem in this video so let me tell you how we will uh ...
Best Time to Buy and Sell Stock with Transaction Fee
best-time-to-buy-and-sell-stock-with-transaction-fee
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day, and an integer `fee` representing a transaction fee. Find the maximum profit you can achieve. You may complete as many transactions as you like, but you need to pay the transaction fee for each transaction. **Note:** You...
Consider the first K stock prices. At the end, the only legal states are that you don't own a share of stock, or that you do. Calculate the most profit you could have under each of these two cases.
Array,Dynamic Programming,Greedy
Medium
122
403
Ajay told that if in this video we will see the solution to the problem, a question says that we will get it in ascending order, friends, it is nourished, that means there is a receiver, there are some stones kept in it at some places and let us assume that those stones If there is a table, then the positions of those ...
Frog Jump
frog-jump
A frog is crossing a river. The river is divided into some number of units, and at each unit, there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water. Given a list of `stones`' positions (in units) in sorted **ascending order**, determine if the frog can cross the river by...
null
Array,Dynamic Programming
Hard
1952,2262
573
hello hi guys welcome back to the new problem squel simulation firstly sub chazi I hope that you guys are doing good uh so basically it has been asked by square and not pretty much but it's actually a good problem like it can give you Devolution of something else but it's something else let's see uh what it is saying t...
Squirrel Simulation
squirrel-simulation
You are given two integers `height` and `width` representing a garden of size `height x width`. You are also given: * an array `tree` where `tree = [treer, treec]` is the position of the tree in the garden, * an array `squirrel` where `squirrel = [squirrelr, squirrelc]` is the position of the squirrel in the garde...
Will Brute force solution works here? What will be its complexity? Brute force definitely won't work here. Think of some simple solution. Take some example and make some observations. Will order of nuts traversed by squirrel is important or only first nut traversed by squirrel is important? Are there some paths which s...
Array,Math
Medium
null
122
hey guys today we're going to be solving a code question 122 but it's time to buy and sell stock - this is the second and sell stock - this is the second and sell stock - this is the second question in the stock prices problem series the first problem was the same except the only difference between this question and th...
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,608
hi everyone um welcome back to jk work well actually this is first video i'm trying to making it as kind of nervous uh today we are gonna solve the problem the liquid 16 8 special array with x elements greater than or equal x let's look into the problem is very simple so um you are given an array numbers of non-negativ...
Special Array With X Elements Greater Than or Equal X
calculate-salaries
You are given an array `nums` of non-negative integers. `nums` is considered **special** if there exists a number `x` such that there are **exactly** `x` numbers in `nums` that are **greater than or equal to** `x`. Notice that `x` **does not** have to be an element in `nums`. Return `x` _if the array is **special**, ...
null
Database
Medium
null
808
Hello gas welcome back to my channel and today's hit and challenge soup servings so what to do in this question basically I have given you two words A and B ok and I have given you N M L of soup in both and what you You can basically do one by one operation from A, if you keep giving operations then what can you do one...
Soup Servings
number-of-matching-subsequences
There are two types of soup: **type A** and **type B**. Initially, we have `n` ml of each type of soup. There are four kinds of operations: 1. Serve `100` ml of **soup A** and `0` ml of **soup B**, 2. Serve `75` ml of **soup A** and `25` ml of **soup B**, 3. Serve `50` ml of **soup A** and `50` ml of **soup B**, an...
null
Hash Table,String,Trie,Sorting
Medium
392,1051,2186
1,816
uh let's talk about truncate sentence the trunk sentence is a list of words that are separated by a single space with no leading or trading space and each of the words consists of only upper and lower english data so there's a constraint you can only have k words so the first k words you are going to return the first k...
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
102
leak code question 102 binary tree level order traversal given the root of a binary tree return the level order traversal of its node's values from the left to right level by level so in the example here we have a binary tree so our output needs to include the node's values level by level so we've got three here which ...
Binary Tree Level Order Traversal
binary-tree-level-order-traversal
Given the `root` of a binary tree, return _the level order traversal of its nodes' values_. (i.e., from left to right, level by level). **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** \[\[3\],\[9,20\],\[15,7\]\] **Example 2:** **Input:** root = \[1\] **Output:** \[\[1\]\] **Example 3:** **I...
null
Tree,Breadth-First Search,Binary Tree
Medium
103,107,111,314,637,764,1035
63
okay lead code number 63 and unique paths two so this is the brother of the previous task right here unique paths one in this test it's the same description the guys on the left corner on the top left the destination is on the bottom right and there are only ways to move down or right and the question is how many diffe...
Unique Paths II
unique-paths-ii
You are given an `m x n` integer array `grid`. There is a robot initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time. An obstacle and space are marked as ...
The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be if obstacleGrid[i][j] is not an obstacle ...
Array,Dynamic Programming,Matrix
Medium
62,1022
1,846
hello and welcome to another video in this problem we're going to be working on maximum element after decreasing and rearranging and in here you're given an array of positive numbers and you want to perform some operations possibly none on the array such that it follows the following conditions the value of the first e...
Maximum Element After Decreasing and Rearranging
maximum-element-after-decreasing-and-rearranging
You are given an array of positive integers `arr`. Perform some operations (possibly none) on `arr` so that it satisfies these conditions: * The value of the **first** element in `arr` must be `1`. * The absolute difference between any 2 adjacent elements must be **less than or equal to** `1`. In other words, `abs...
null
null
Medium
null