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
126
hello friends today I saw what that to profit like even true words begin world and in the world and the dictionaries or at least find Osho days transformation sequences from beginner to end the word such that only one letter can be changed at a time each transformed word must exist in the world least not there begin wo...
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
455
hi everyone so today for leak code we're gonna actually try to do a problem that's kind of interesting I was just looking through the website and I saw a posting here by someone that you know congratulations got an offer from Google at l5 position that's pretty impressive so I was reading through this position a little...
Assign Cookies
assign-cookies
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child `i` has a greed factor `g[i]`, which is the minimum size of a cookie that the child will be content with; and each cookie `j` has a size `s[j]`. If `s[j] >= g[i]`, we can assign ...
null
Array,Greedy,Sorting
Easy
null
452
hello everyone welcome back to coding Champs in today's video we are going to be solving the good problem minimum number of arrows to burst balloons I hope everybody has already gone through the problem statement if you haven't already do read the problem statement and come back here so to summarize the problem uh we h...
Minimum Number of Arrows to Burst Balloons
minimum-number-of-arrows-to-burst-balloons
There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array `points` where `points[i] = [xstart, xend]` denotes a balloon whose **horizontal diameter** stretches between `xstart` and `xend`. You do not know the exact y-coordinates of the ball...
null
Array,Greedy,Sorting
Medium
253,435
88
hey everyone in this video I'm going to show you my solution to the code at8 merge sorted array first I'm going to explain what the problem is and then I'm going to show you the code implementation all right so basically you have two arrays and you have to merge and sort them into one at the same time okay uh here's th...
Merge Sorted Array
merge-sorted-array
You are given two integer arrays `nums1` and `nums2`, sorted in **non-decreasing order**, and two integers `m` and `n`, representing the number of elements in `nums1` and `nums2` respectively. **Merge** `nums1` and `nums2` into a single array sorted in **non-decreasing order**. The final sorted array should not be re...
You can easily solve this problem if you simply think about two elements at a time rather than two arrays. We know that each of the individual arrays is sorted. What we don't know is how they will intertwine. Can we take a local decision and arrive at an optimal solution? If you simply consider one element each at a ti...
Array,Two Pointers,Sorting
Easy
21,1019,1028
234
hey what's up guys uh this is john here so today uh today's daily challenge problem number 234 palindrome length list you know even though this one's easy problem you know the reason i want to talk about this one is because you know this one has a few corner cases you know especially if you want to solve this one with ...
Palindrome Linked List
palindrome-linked-list
Given the `head` of a singly linked list, return `true` _if it is a_ _palindrome_ _or_ `false` _otherwise_. **Example 1:** **Input:** head = \[1,2,2,1\] **Output:** true **Example 2:** **Input:** head = \[1,2\] **Output:** false **Constraints:** * The number of nodes in the list is in the range `[1, 105]`. * ...
null
Linked List,Two Pointers,Stack,Recursion
Easy
9,125,206,2236
1,025
foreign welcome back to my channel and today we are going to solve a new lead code question that is divisor key the question says Elise and Bob take turns playing a game with Elise starting first initially there is a number n on the chalkboard on each player's turn that player makes a move consisting of choosing any x ...
Divisor Game
minimum-cost-for-tickets
Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a number `n` on the chalkboard. On each player's turn, that player makes a move consisting of: * Choosing any `x` with `0 < x < n` and `n % x == 0`. * Replacing the number `n` on the chalkboard with `n - x`. Also, if a player...
null
Array,Dynamic Programming
Medium
322
274
hi everyone welcome back for another video we are going to do another decode question the question is h index 2 given array of integers citations where citations i is the number of citations a researcher receive for their eye paper and citations is sorted in a ascending order return compute the researchers age index ac...
H-Index
h-index
Given an array of integers `citations` where `citations[i]` is the number of citations a researcher received for their `ith` paper, return _the researcher's h-index_. According to the [definition of h-index on Wikipedia](https://en.wikipedia.org/wiki/H-index): The h-index is defined as the maximum value of `h` such th...
An easy approach is to sort the array first. What are the possible values of h-index? A faster approach is to use extra space.
Array,Sorting,Counting Sort
Medium
275
1,578
welcome to my youtube channel so after a long time i am actually making a video on solving a lead code challenge so one of my friends had a doubt on how can we approach this problem and i gave it a thought and i had a approach in mind so i thought of making a video on it and also code it and see whether my logic works ...
Minimum Time to Make Rope Colorful
apples-oranges
Alice has `n` balloons arranged on a rope. You are given a **0-indexed** string `colors` where `colors[i]` is the color of the `ith` balloon. Alice wants the rope to be **colorful**. She does not want **two consecutive balloons** to be of the same color, so she asks Bob for help. Bob can remove some balloons from the ...
null
Database
Medium
null
103
in this problem we have to traverse a binary tree in level order but we have to do it in zigzag manner so it's a natural extension of the simple level order traversal so if you do level order traversal of this we will first print five then three and 6 are at the next level then we print 2 and 4 in this order left to ri...
Binary Tree Zigzag Level Order Traversal
binary-tree-zigzag-level-order-traversal
Given the `root` of a binary tree, return _the zigzag level order traversal of its nodes' values_. (i.e., from left to right, then right to left for the next level and alternate between). **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** \[\[3\],\[20,9\],\[15,7\]\] **Example 2:** **Input:** roo...
null
Tree,Breadth-First Search,Binary Tree
Medium
102
355
A Pappu Gas Welcome Back Vansh is immersed in the record Designer Data Success Problem Designer on Twitter This Problem Women Have Not Decided To Withdraw Its Current Lever's Problem Try To Understand The Problem That Did Not Appear From The Tarzan The Structure Will Have To Do The thing but will try to understand this...
Design Twitter
design-twitter
Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the `10` most recent tweets in the user's news feed. Implement the `Twitter` class: * `Twitter()` Initializes your twitter object. * `void postTweet(int userId, int tweetId)` Composes a new tweet w...
null
Hash Table,Linked List,Design,Heap (Priority Queue)
Medium
1640
919
hi everyone in this video we are going to solve the lead code problem complete binary tree inserter so uh in this problem we have to implement the CBT inserted class as you can see here uh CBT inserted renote uh this is these are the function description given here right here on the right side you can see these functio...
Complete Binary Tree Inserter
projection-area-of-3d-shapes
A **complete binary tree** is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible. Design an algorithm to insert a new node to a complete binary tree keeping it complete after the insertion. Implement the `CBTInserter` class: * `CBTInserter(...
null
Array,Math,Geometry,Matrix
Easy
null
210
hey folks welcome back to another video today we'll be looking at question 210 course schedule two the way we'll be solving this problem is by using two data structures um we'll use one of the data structures to keep a track of the number of courses uh that a course needs before they can take that course um and for a g...
Course Schedule II
course-schedule-ii
There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`. * For example, the pair `[0, 1]`, indicates that to take cou...
This problem is equivalent to finding the topological order in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topolo...
Depth-First Search,Breadth-First Search,Graph,Topological Sort
Medium
207,269,310,444,630,1101,2220
787
hello everyone my name is Eric today I want to talk about legal challenge and June 14th and the problem is ship is flies with in case top and if it is actually a very traditional shortest path problem with but with one concern we cannot have more length K start K intermediate not and for example 1 we can only have one ...
Cheapest Flights Within K Stops
sliding-puzzle
There are `n` cities connected by some number of flights. You are given an array `flights` where `flights[i] = [fromi, toi, pricei]` indicates that there is a flight from city `fromi` to city `toi` with cost `pricei`. You are also given three integers `src`, `dst`, and `k`, return _**the cheapest price** from_ `src` _...
Perform a breadth-first-search, where the nodes are the puzzle boards and edges are if two puzzle boards can be transformed into one another with one move.
Array,Breadth-First Search,Matrix
Hard
null
1,833
hi everyone so today we're going to solve lead code daily challenge problem number 1833 maximum ice cream bars so in this problem basically we'll have to find out the maximum numbers of ice cream we can buy with a given number of coins okay and we will be given an array of cost in which each uh individual ice like each...
Maximum Ice Cream Bars
find-the-highest-altitude
It is a sweltering summer day, and a boy wants to buy some ice cream bars. At the store, there are `n` ice cream bars. You are given an array `costs` of length `n`, where `costs[i]` is the price of the `ith` ice cream bar in coins. The boy initially has `coins` coins to spend, and he wants to buy as many ice cream bar...
Let's note that the altitude of an element is the sum of gains of all the elements behind it Getting the altitudes can be done by getting the prefix sum array of the given array
Array,Prefix Sum
Easy
null
799
hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you have not liked the video please like it subscribe to my channel and hit the bell icon so that you get notified whenever i post a new video so without any further due let's get started so...
Champagne Tower
minimum-distance-between-bst-nodes
We stack glasses in a pyramid, where the **first** row has `1` glass, the **second** row has `2` glasses, and so on until the 100th row. Each glass holds one cup of champagne. Then, some champagne is poured into the first glass at the top. When the topmost glass is full, any excess liquid poured will fall equally to t...
null
Tree,Depth-First Search,Breadth-First Search,Binary Search Tree,Binary Tree
Easy
94
648
6:48 replays words in English grammar 6:48 replays words in English grammar 6:48 replays words in English grammar concept core group which can be followed by some other words to form another longer work let's call this word successor for example the end followed by an ax far by other can form another word another now g...
Replace Words
replace-words
In English, we have a concept called **root**, which can be followed by some other word to form another longer word - let's call this word **successor**. For example, when the **root** `"an "` is followed by the **successor** word `"other "`, we can form a new word `"another "`. Given a `dictionary` consisting of many...
null
Array,Hash Table,String,Trie
Medium
208
4
Hello everyone welcome you for placement and in today's video lecture we will see medium you come offer you sorted are so return two are those two are we have to find the medium so basically we have two variables namas van and namas tu number van see can C D Length of D lms van is nothing but M And the length of D nams...
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
54
hey everyone in this video let's take a look at question 54 spiral Matrix only code this is part of our blind 75 list of questions so let's begin in this question we're given an M by n Matrix and want to return all of the elements of the Matrix in spiral order Extensions by our order you start off at the top left hand ...
Spiral Matrix
spiral-matrix
Given an `m x n` `matrix`, return _all elements of the_ `matrix` _in spiral order_. **Example 1:** **Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\] **Output:** \[1,2,3,6,9,8,7,4,5\] **Example 2:** **Input:** matrix = \[\[1,2,3,4\],\[5,6,7,8\],\[9,10,11,12\]\] **Output:** \[1,2,3,4,8,12,11,10,9,5,6,7\] **Const...
Well for some problems, the best way really is to come up with some algorithms for simulation. Basically, you need to simulate what the problem asks us to do. We go boundary by boundary and move inwards. That is the essential operation. First row, last column, last row, first column and then we move inwards by 1 and th...
Array,Matrix,Simulation
Medium
59,921
61
hi everyone before we solve this question today I'd like to thank you for watching finally more than 100 people are subscribed to my channel so for the first two months that was a tough Journey nobody subscribed my channel so but I keep uploading so now um I have a more than 100 subscribers so thank you for watching so...
Rotate List
rotate-list
Given the `head` of a linked list, rotate the list to the right by `k` places. **Example 1:** **Input:** head = \[1,2,3,4,5\], k = 2 **Output:** \[4,5,1,2,3\] **Example 2:** **Input:** head = \[0,1,2\], k = 4 **Output:** \[2,0,1\] **Constraints:** * The number of nodes in the list is in the range `[0, 500]`. * ...
null
Linked List,Two Pointers
Medium
189,725
437
hi guys hope you're doing great or today's question is pass some three so this is a new question that has been added on lead code and it's a really good idea to have a look at this question so you're given a binary tree in which each node contains an integer value find the number of parts that sum to a given value the ...
Path Sum III
path-sum-iii
Given the `root` of a binary tree and an integer `targetSum`, return _the number of paths where the sum of the values along the path equals_ `targetSum`. The path does not need to start or end at the root or a leaf, but it must go downwards (i.e., traveling only from parent nodes to child nodes). **Example 1:** **In...
null
Tree,Depth-First Search,Binary Tree
Medium
112,113,666,687
1,921
hello and welcome to another video in this video we're going to be working on eliminate maximum number of monsters and in this problem you're playing a video game where you're defending a city from a group of n monsters you're given a zero indexed array of distances and speeds and so the distance is a starting distance...
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
191
lead code problem number 191 number of one bits so this problem gives us a unsigned integer and the goal is to return the number of one bits it has in the integer right so for example we have this long integer so there's only three ones so the approach will be to iterate through the numbers here and then if it's a one ...
Number of 1 Bits
number-of-1-bits
Write a function that takes the binary representation of an unsigned integer and returns the number of '1' bits it has (also known as the [Hamming weight](http://en.wikipedia.org/wiki/Hamming_weight)). **Note:** * Note that in some languages, such as Java, there is no unsigned integer type. In this case, the input ...
null
Bit Manipulation
Easy
190,231,338,401,461,693,767
1,793
hello and welcome to another video this video we're going to be working on maximum score of a good subarray and this problem you're given an array of integers zero index and integer K and they tell you the score of subarray and this is a little weird the wording is defined as Min of num's I to J * Jus I + 1 and so a go...
Maximum Score of a Good Subarray
minimum-moves-to-make-array-complementary
You are given an array of integers `nums` **(0-indexed)** and an integer `k`. The **score** of a subarray `(i, j)` is defined as `min(nums[i], nums[i+1], ..., nums[j]) * (j - i + 1)`. A **good** subarray is a subarray where `i <= k <= j`. Return _the maximum possible **score** of a **good** subarray._ **Example 1:**...
Given a target sum x, each pair of nums[i] and nums[n-1-i] would either need 0, 1, or 2 modifications. Can you find the optimal target sum x value such that the sum of modifications is minimized? Create a difference array to efficiently sum all the modifications.
Array,Hash Table,Prefix Sum
Medium
null
1,239
everyone welcome back and let's write some more neat code today so today let's solve a problem from the daily challenge or whatever it's called we don't usually do that but maximum length of a concatenated string with unique characters we're given an array of strings and a string s uh aka a concatenation in this case i...
Maximum Length of a Concatenated String with Unique Characters
largest-1-bordered-square
You are given an array of strings `arr`. A string `s` is formed by the **concatenation** of a **subsequence** of `arr` that has **unique characters**. Return _the **maximum** possible length_ of `s`. A **subsequence** is an array that can be derived from another array by deleting some or no elements without changing ...
For each square, know how many ones are up, left, down, and right of this square. You can find it in O(N^2) using dynamic programming. Now for each square ( O(N^3) ), we can evaluate whether that square is 1-bordered in O(1).
Array,Dynamic Programming,Matrix
Medium
null
766
hey everybody this is Larry this is uh date 31st the Halloween episode of the Nico day challenge hit the like button hit the Subscribe button join me on Discord oh trick or treat 10 Bitcoins uh yeah hit the like button hit subscribe and join me on Discord let me know what you think about today's Vlog so today uh it is ...
Toeplitz Matrix
flatten-a-multilevel-doubly-linked-list
Given an `m x n` `matrix`, return _`true` if the matrix is Toeplitz. Otherwise, return `false`._ A matrix is **Toeplitz** if every diagonal from top-left to bottom-right has the same elements. **Example 1:** **Input:** matrix = \[\[1,2,3,4\],\[5,1,2,3\],\[9,5,1,2\]\] **Output:** true **Explanation:** In the above gr...
null
Linked List,Depth-First Search,Doubly-Linked List
Medium
114,1796
229
Jhaal Hello everyone in this video will see the question that is maturity element to end win T20 video bhi har saal tak hai that was similar toss maturity element 125 suggests you have cent soldier question so I will suggest you to solve this question objective question for husband Calls it is the best politician and a...
Majority Element II
majority-element-ii
Given an integer array of size `n`, find all elements that appear more than `⌊ n/3 ⌋` times. **Example 1:** **Input:** nums = \[3,2,3\] **Output:** \[3\] **Example 2:** **Input:** nums = \[1\] **Output:** \[1\] **Example 3:** **Input:** nums = \[1,2\] **Output:** \[1,2\] **Constraints:** * `1 <= nums.length <...
How many majority elements could it possibly have? Do you have a better hint? Suggest it!
Array,Hash Table,Sorting,Counting
Medium
169,1102
409
That in this problem when suffering and virat yudh characters of latest information rom subscribe button for using the giver subscribe related to which is the longest born subscribe our channel and subscribe this video plz subscribe kare the sweep series report times you can see a proof tense Switzerland This Is Ringto...
Longest Palindrome
longest-palindrome
Given a string `s` which consists of lowercase or uppercase letters, return _the length of the **longest palindrome**_ that can be built with those letters. Letters are **case sensitive**, for example, `"Aa "` is not considered a palindrome here. **Example 1:** **Input:** s = "abccccdd " **Output:** 7 **Explanation...
null
Hash Table,String,Greedy
Easy
266,2237
3
hi this is josh from late dev where our goal is to explain lethal problems as simple and concise as we can today we're going to answer the question longest of string without repeating characters in this video we'll learn another crucial algorithm that we'll be adding to our tool set that will come in handy in cracking ...
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,365
what's up guys i'm xavier elon your favorite future facebook amazon google software engineer today we're going over how many numbers are smaller than the current number it's an easy problem on link code and let's jump right into it so i just recorded this entire video and i realized my microphone was off so let's do it...
How Many Numbers Are Smaller Than the Current Number
how-many-numbers-are-smaller-than-the-current-number
Given the array `nums`, for each `nums[i]` find out how many numbers in the array are smaller than it. That is, for each `nums[i]` you have to count the number of valid `j's` such that `j != i` **and** `nums[j] < nums[i]`. Return the answer in an array. **Example 1:** **Input:** nums = \[8,1,2,2,3\] **Output:** \[4,...
null
null
Easy
null
382
hey everyone welcome to Tech quiet in this video we are going to solve problem number 382 link to list random node first we will see the explanation of the problem statement then the logic on the code now let's dive into the solution so here we have taken the first example from the liquor website so we need to select a...
Linked List Random Node
linked-list-random-node
Given a singly linked list, return a random node's value from the linked list. Each node must have the **same probability** of being chosen. Implement the `Solution` class: * `Solution(ListNode head)` Initializes the object with the head of the singly-linked list `head`. * `int getRandom()` Chooses a node randoml...
null
Linked List,Math,Reservoir Sampling,Randomized
Medium
398
55
another day another problem so let's Solve IT hello everyone I hope you are all having a good day today we are going to solve the jump game problem this problem can be solved using dynamic programming and also greedy algorithms so I will show you both Solutions first let's get started by reading the problem and try to ...
Jump Game
jump-game
You are given an integer array `nums`. You are initially positioned at the array's **first index**, and each element in the array represents your maximum jump length at that position. Return `true` _if you can reach the last index, or_ `false` _otherwise_. **Example 1:** **Input:** nums = \[2,3,1,1,4\] **Output:** t...
null
Array,Dynamic Programming,Greedy
Medium
45,1428,2001
93
good morning friends today we will solve a question of lead code that is restore IP addresses a valid IP addresses consists of four integers separated by a single Dot and each integer should be in the range of 0 to 55. and it cannot have any leading zeros let's see the example for better understanding like we see an ex...
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
165
Hello hello everybody welcome to my channel let's all the problem compare version numbers to compare version numbers version 1.2 compare version numbers version 1.2 compare version numbers version 1.2 from January this year grade to be happy return wave in this version 101 210 be happy and minus one drops return after ...
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
997
today's problem is lead code problem number 997 and it asks you to find the town judge and we will see what is the definition of town edge so this is a town where these five people are there can be more people so here this green person denotes the judge and these yellow people are the general public and this blue line ...
Find the Town Judge
find-the-town-judge
In a town, there are `n` people labeled from `1` to `n`. There is a rumor that one of these people is secretly the town judge. If the town judge exists, then: 1. The town judge trusts nobody. 2. Everybody (except for the town judge) trusts the town judge. 3. There is exactly one person that satisfies properties **...
null
null
Easy
null
1,727
hello everyone let's the today's lad Cod Challenge which is largest sum metric with rearrangement so here in this problem we are given a my binary Matrix of size M crn and we are allowed to rearrange the column of this Matrix in any order and what we have to return is the largest submatrix within this Matrix where ever...
Largest Submatrix With Rearrangements
cat-and-mouse-ii
You are given a binary matrix `matrix` of size `m x n`, and you are allowed to rearrange the **columns** of the `matrix` in any order. Return _the area of the largest submatrix within_ `matrix` _where **every** element of the submatrix is_ `1` _after reordering the columns optimally._ **Example 1:** **Input:** matri...
Try working backward: consider all trivial states you know to be winning or losing, and work backward to determine which other states can be labeled as winning or losing.
Math,Dynamic Programming,Breadth-First Search,Graph,Memoization,Game Theory
Hard
805,949
49
That we will solve the question in Haj Badi, if there is Gram thing in the group, then see the question, you have got the link, the reason is mixed like this is ABC that Tricolor's CBC A B C D E F C I is actually COD that DOEACC BBA BCA BBA ESC AIDS Patient, you will get all the grams today. Ghr So both of these are th...
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,850
Hello gas so today we will be discussing question number 1850 code minimum andersen swaps is the smallest number of reach you can understand the question what is it quite an interesting problem although it is medium but according to you it is a problem ok so let's see what is And first of all, there is nothing in this,...
Minimum Adjacent Swaps to Reach the Kth Smallest Number
minimum-length-of-string-after-deleting-similar-ends
You are given a string `num`, representing a large integer, and an integer `k`. We call some integer **wonderful** if it is a **permutation** of the digits in `num` and is **greater in value** than `num`. There can be many wonderful integers. However, we only care about the **smallest-valued** ones. * For example, ...
If both ends have distinct characters, no more operations can be made. Otherwise, the only operation is to remove all of the same characters from both ends. We will do this as many times as we can. Note that if the length is equal 1 the answer is 1
Two Pointers,String
Medium
null
1,642
welcome to april's lee code challenge today's problem is furthest building you can reach you are given an energy array heights representing the heights of buildings some bricks and some ladders so you start your journey from building zero and you move to the next building by possibly using bricks or ladders while movin...
Furthest Building You Can Reach
water-bottles
You are given an integer array `heights` representing the heights of buildings, some `bricks`, and some `ladders`. You start your journey from building `0` and move to the next building by possibly using bricks or ladders. While moving from building `i` to building `i+1` (**0-indexed**), * If the current building'...
Simulate the process until there are not enough empty bottles for even one full bottle of water.
Math,Simulation
Easy
null
461
hello everyone so in this video let us talk about a easy problem from lead code the problem name is hamming distance so let's start so the hamming distance between two integer is the number of positions at which the corresponding bits of both of the numbers are different so you are given two integers x and y and you ju...
Hamming Distance
hamming-distance
The [Hamming distance](https://en.wikipedia.org/wiki/Hamming_distance) between two integers is the number of positions at which the corresponding bits are different. Given two integers `x` and `y`, return _the **Hamming distance** between them_. **Example 1:** **Input:** x = 1, y = 4 **Output:** 2 **Explanation:** 1...
null
Bit Manipulation
Easy
191,477
299
hey guys welcome back to another video and today we're going to be solving the leakout question bulls and cows all right so in this question we're playing the game of bullets and cows with one of our friends so you write down a number and you ask your friend to guess what the number is each time your friend makes a gue...
Bulls and Cows
bulls-and-cows
You are playing the **[Bulls and Cows](https://en.wikipedia.org/wiki/Bulls_and_Cows)** game with your friend. You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint with the following info: * The number of "bulls ", which are digits in the ...
null
Hash Table,String,Counting
Medium
null
1,877
hello guys and welcome back to lead Logics this is the minimize maximum pair sum in an array it is a lead code medium and the number for this is 1877 and I'm sure that it will be a easy question for you if you watch the video till the end so in this question we are given with an array nums of even length and we have to...
Minimize Maximum Pair Sum in Array
find-followers-count
The **pair sum** of a pair `(a,b)` is equal to `a + b`. The **maximum pair sum** is the largest **pair sum** in a list of pairs. * For example, if we have pairs `(1,5)`, `(2,3)`, and `(4,4)`, the **maximum pair sum** would be `max(1+5, 2+3, 4+4) = max(6, 5, 8) = 8`. Given an array `nums` of **even** length `n`, pai...
null
Database
Easy
null
1,507
hey everybody this is Larry hit the like button to subscribe and join me in the discord let's go over today's problem which is reformat date so this one is the easy on the reason it called contest and ideal here is just this parsing it's making sure you get everything right and I don't think there anything really trick...
Reformat Date
check-if-there-is-a-valid-path-in-a-grid
Given a `date` string in the form `Day Month Year`, where: * `Day` is in the set `{ "1st ", "2nd ", "3rd ", "4th ", ..., "30th ", "31st "}`. * `Month` is in the set `{ "Jan ", "Feb ", "Mar ", "Apr ", "May ", "Jun ", "Jul ", "Aug ", "Sep ", "Oct ", "Nov ", "Dec "}`. * `Year` is in the range `[1900, 2100]`. Conve...
Start DFS from the node (0, 0) and follow the path till you stop. When you reach a cell and cannot move anymore check that this cell is (m - 1, n - 1) or not.
Array,Depth-First Search,Breadth-First Search,Union Find,Matrix
Medium
null
51
hello everyone welcome to my channel coding together my name is vikas oja today we will see another lead code problem that is n Queens so let's read the problem statement the end Queens puzzle is the problem of placing n Queens on an N into an chess board such that no 2 Queens attack each other given an integer n writt...
N-Queens
n-queens
The **n-queens** puzzle is the problem of placing `n` queens on an `n x n` chessboard such that no two queens attack each other. Given an integer `n`, return _all distinct solutions to the **n-queens puzzle**_. You may return the answer in **any order**. Each solution contains a distinct board configuration of the n-...
null
Array,Backtracking
Hard
52,1043
662
hey what's up guys this is Chung here today not today same day actually I just uploaded another video so but I still like would like to record another video regarde about this one to steal another tree problem here number 662 maximum with off binary tree it's a I would say the medium one I like it so I will give anothe...
Maximum Width of Binary Tree
maximum-width-of-binary-tree
Given the `root` of a binary tree, return _the **maximum width** of the given tree_. The **maximum width** of a tree is the maximum **width** among all levels. The **width** of one level is defined as the length between the end-nodes (the leftmost and rightmost non-null nodes), where the null nodes between the end-no...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
336
hey hello there today I'm talking about questions 336 panel John parish their question is as follows given a list of unique words we want to find all the pairs of distinct indices IJ such that the concatenation between word I and work J it's a palindrome so the these two words has to be contending than in this order th...
Palindrome Pairs
palindrome-pairs
You are given a **0-indexed** array of **unique** strings `words`. A **palindrome pair** is a pair of integers `(i, j)` such that: * `0 <= i, j < words.length`, * `i != j`, and * `words[i] + words[j]` (the concatenation of the two strings) is a palindrome. Return _an array of all the **palindrome pairs** of_ `...
null
Array,Hash Table,String,Trie
Hard
5,214,2237
1,750
hey everybody this is Larry this is day five of the Leo daily challenge in March hit the like button hit the Subscribe button join me on Discord let me know what you think about this PR uh yeah sometimes you see me click on contest because I remember but here today just happy lead coding so you quick you get 10 coins I...
Minimum Length of String After Deleting Similar Ends
check-if-two-expression-trees-are-equivalent
Given a string `s` consisting only of characters `'a'`, `'b'`, and `'c'`. You are asked to apply the following algorithm on the string any number of times: 1. Pick a **non-empty** prefix from the string `s` where all the characters in the prefix are equal. 2. Pick a **non-empty** suffix from the string `s` where all...
Count for each variable how many times it appeared in the first tree. Do the same for the second tree and check if the count is the same for both tree.
Tree,Depth-First Search,Binary Tree
Medium
1736
49
Jhaal Hello everyone welcome to this video and welcome to shoulder and this video will see the program the question that is mudda nx100 withdrawal question and 28 mins of web based companies like facebook and twitter pure questions media ne bloody kisi to in this question website hai that One and Offspring Address Grou...
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,304
That Aapke Ajay Ko Hua Hello Everyone and Welcome to New Video India Go Into Another Problem from Decoded Problem No. 130 Fuel Overload Problem Said loudly that the young man came and told us Zanana whose subscription and all elements If we swear, if our questions are answered, then we subscribe, we can add any number,...
Find N Unique Integers Sum up to Zero
longest-happy-string
Given an integer `n`, return **any** array containing `n` **unique** integers such that they add up to `0`. **Example 1:** **Input:** n = 5 **Output:** \[-7,-1,1,3,4\] **Explanation:** These arrays also are accepted \[-5,-1,1,2,3\] , \[-3,-1,2,-2,4\]. **Example 2:** **Input:** n = 3 **Output:** \[-1,0,1\] **Exampl...
Use a greedy approach. Use the letter with the maximum current limit that can be added without breaking the condition.
String,Greedy,Heap (Priority Queue)
Medium
778
168
hi everyone in this video we'll be solving another lead code problem excel sheet column title so the problem states that we are given with an integer column number and we have to return its corresponding column title as it appears in the excel sheet so we know that a is the first column b is the second c is the third a...
Excel Sheet Column Title
excel-sheet-column-title
Given an integer `columnNumber`, return _its corresponding column title as it appears in an Excel sheet_. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 ... **Example 1:** **Input:** columnNumber = 1 **Output:** "A " **Example 2:** **Input:** columnNumber = 28 **Output:** "AB " **Example 3:**...
null
Math,String
Easy
171,2304
1,502
hi guys good morning welcome back to the next video although uh usually you would see that the explanation of easy problem never comes on our Channel uh for the daily problems but this question oh God although to solve this question you can solve it in three lines in under one minute but the way to go from Brute Force ...
Can Make Arithmetic Progression From Sequence
construct-k-palindrome-strings
A sequence of numbers is called an **arithmetic progression** if the difference between any two consecutive elements is the same. Given an array of numbers `arr`, return `true` _if the array can be rearranged to form an **arithmetic progression**. Otherwise, return_ `false`. **Example 1:** **Input:** arr = \[3,5,1\]...
If the s.length < k we cannot construct k strings from s and answer is false. If the number of characters that have odd counts is > k then the minimum number of palindrome strings we can construct is > k and answer is false. Otherwise you can construct exactly k palindrome strings and answer is true (why ?).
Hash Table,String,Greedy,Counting
Medium
null
1,611
One welcome to my channel code sir with mike so today we are going to upload the video number of the playlist of our bet manipulation topic lead code number 1611 is hard marked it is a very good question after explaining it will not seem hard but to come up with The solution is very challenging, okay, we will understan...
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,615
Hello hello guy welcome back to my channel thunk code and my name is gaurav and today we will be solving maximum network rank so today need code challenge maximum network rank okay before getting into this question I want to announce one thing let's like You are doing a coding problem and you are stuck in some problem ...
Maximal Network Rank
range-sum-of-sorted-subarray-sums
There is an infrastructure of `n` cities with some number of `roads` connecting these cities. Each `roads[i] = [ai, bi]` indicates that there is a bidirectional road between cities `ai` and `bi`. The **network rank** of **two different cities** is defined as the total number of **directly** connected roads to **either...
Compute all sums and save it in array. Then just go from LEFT to RIGHT index and calculate answer modulo 1e9 + 7.
Array,Two Pointers,Binary Search,Sorting
Medium
null
1,345
Jo Hai Ribbon Welcome To My Channel It's All The Problem Jam Game For Sure Winner Of Tears Are You Are Initially Position And First Index Of The Are In One Step You Can Jump From Index Of To Index I Plus One Until It Also Includes Independence Of The Rare and women in this with 3D software and all true share life biome...
Jump Game IV
perform-string-shifts
Given an array of integers `arr`, you are initially positioned at the first index of the array. In one step you can jump from index `i` to index: * `i + 1` where: `i + 1 < arr.length`. * `i - 1` where: `i - 1 >= 0`. * `j` where: `arr[i] == arr[j]` and `i != j`. Return _the minimum number of steps_ to reach the...
Intuitively performing all shift operations is acceptable due to the constraints. You may notice that left shift cancels the right shift, so count the total left shift times (may be negative if the final result is right shift), and perform it once.
Array,Math,String
Easy
null
1,400
the 1400th criminal problem called account lynn france called count constructive week menstrual book this word is too easy this one unlike the other good is that it is good course 183 is not the ico and the test and yes it is much more complicated than This is my script, I don't understand it. In this one, what they te...
Construct K Palindrome Strings
find-winner-on-a-tic-tac-toe-game
Given a string `s` and an integer `k`, return `true` _if you can use all the characters in_ `s` _to construct_ `k` _palindrome strings or_ `false` _otherwise_. **Example 1:** **Input:** s = "annabelle ", k = 2 **Output:** true **Explanation:** You can construct two palindromes using all characters in s. Some possibl...
It's straightforward to check if A or B won or not, check for each row/column/diag if all the three are the same. Then if no one wins, the game is a draw iff the board is full, i.e. moves.length = 9 otherwise is pending.
Array,Hash Table,Matrix,Simulation
Easy
null
968
That hey guys welcome back to my channel suggestion or problem with jaggery in binary tree camera will sleep problem where given root of minority install camera on no where is camera attend can't monitor this parents little boys images children what is the mean that you have a Beautiful accessibility hai to interface m...
Binary Tree Cameras
beautiful-array
You are given the `root` of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor its parent, itself, and its immediate children. Return _the minimum number of cameras needed to monitor all nodes of the tree_. **Example 1:** **Input:** root = \[0,0,null,0,0\] **Output:** 1 **Exp...
null
Array,Math,Divide and Conquer
Medium
null
34
Hey guys welcome and welcome back to my youtube4 challenge so the problem is find first and last position of element in sorted array ok so what is the problem once let us understand the problem is that we are given an array of integers sorted in non Descending order non-decreasing in non Descending order non-decreasing...
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
1,727
So hello everyone good morning welcome back to my channel so today we are going to do the next PTD which is the largest sum matrix with rearrangement is 1727 so let's first see as usual what is the question saying what is given to us what is binary matrix binary The same is visible in zero and one, yes, all of size, a ...
Largest Submatrix With Rearrangements
cat-and-mouse-ii
You are given a binary matrix `matrix` of size `m x n`, and you are allowed to rearrange the **columns** of the `matrix` in any order. Return _the area of the largest submatrix within_ `matrix` _where **every** element of the submatrix is_ `1` _after reordering the columns optimally._ **Example 1:** **Input:** matri...
Try working backward: consider all trivial states you know to be winning or losing, and work backward to determine which other states can be labeled as winning or losing.
Math,Dynamic Programming,Breadth-First Search,Graph,Memoization,Game Theory
Hard
805,949
410
hello everyone welcome to last day of march lead code challenge and today's question that we have is split array largest sum it's a hard level question on lead code however i will rate this question in medium category and if you like today's solution and you if you feel coding decoded is adding value in your life pleas...
Split Array Largest Sum
split-array-largest-sum
Given an integer array `nums` and an integer `k`, split `nums` into `k` non-empty subarrays such that the largest sum of any subarray is **minimized**. Return _the minimized largest sum of the split_. A **subarray** is a contiguous part of the array. **Example 1:** **Input:** nums = \[7,2,5,10,8\], k = 2 **Output:*...
null
Array,Binary Search,Dynamic Programming,Greedy
Hard
1056,1192,2242,2330
1,520
20 crime that is called maximum number of berlin his swings the truth is this problem is a headache he also shares the last contest of 198 the agreement is the truth this cannot be resolved during the contest because the truth is that I did not have time to The last contest I served you 3 but this one I didn't even get...
Maximum Number of Non-Overlapping Substrings
number-of-steps-to-reduce-a-number-in-binary-representation-to-one
Given a string `s` of lowercase letters, you need to find the maximum number of **non-empty** substrings of `s` that meet the following conditions: 1. The substrings do not overlap, that is for any two substrings `s[i..j]` and `s[x..y]`, either `j < x` or `i > y` is true. 2. A substring that contains a certain chara...
Read the string from right to left, if the string ends in '0' then the number is even otherwise it is odd. Simulate the steps described in the binary string.
String,Bit Manipulation
Medium
1303
70
Hello hello and welcome to another interesting problem in a series of wedding this time it's called climbing stairs is amazing problem let's get you to climb stairs steps to reach the top is this time till one or two steps in which you can climb to the top Suryavansham Examples Which Will Tree To Understand Diagrams Fo...
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
236
hey everybody this is larry this is state dirty of the june eco daily challenge you've made it if you're here the last day of june hope you did the entire month uh hit the like button hit the subscribe button join me in discord let me know what you think about today's problem the lowest common ancestor of a binary tree...
Lowest Common Ancestor of a Binary Tree
lowest-common-ancestor-of-a-binary-tree
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the [definition of LCA on Wikipedia](https://en.wikipedia.org/wiki/Lowest_common_ancestor): "The lowest common ancestor is defined between two nodes `p` and `q` as the lowest node in `T` that has both `p` and `q` as...
null
Tree,Depth-First Search,Binary Tree
Medium
235,1190,1354,1780,1790,1816,2217
1,701
hello friends today we are going to solo elite code problem that is pro number 101701 average waiting time if you directly want to see the code then this is our code you can see it and if you want to uh if you want to know about the question and i haven't read the question till now then the question is that we have giv...
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
144
hello and welcome to the another series of coding today we will solve lead code problem binary tree pre-order traversal so binary tree pre-order traversal so binary tree pre-order traversal so insist of reading this description let me take into the demo board then you will get the further and the understanding okay so ...
Binary Tree Preorder Traversal
binary-tree-preorder-traversal
Given the `root` of a binary tree, return _the preorder traversal of its nodes' values_. **Example 1:** **Input:** root = \[1,null,2,3\] **Output:** \[1,2,3\] **Example 2:** **Input:** root = \[\] **Output:** \[\] **Example 3:** **Input:** root = \[1\] **Output:** \[1\] **Constraints:** * The number of nodes ...
null
Stack,Tree,Depth-First Search,Binary Tree
Easy
94,255,775
47
hello everyone welcome to day 12 of my leak code challenge and i hope all of you are having a great time my name is sanchez i am working a software developer for adobe and today i present day 681 of daily lead good problem the question that we have in today is permutation 2 it's a medium level question on lead code and...
Permutations II
permutations-ii
Given a collection of numbers, `nums`, that might contain duplicates, return _all possible unique permutations **in any order**._ **Example 1:** **Input:** nums = \[1,1,2\] **Output:** \[\[1,1,2\], \[1,2,1\], \[2,1,1\]\] **Example 2:** **Input:** nums = \[1,2,3\] **Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,...
null
Array,Backtracking
Medium
31,46,267,1038
502
hello everyone that's all for today's problem IPO we are given n project and profit array what we can earn from a project and the capital array is needed captured to start the project at first we have W capital so we can start the project which needs less than or equal to W capital our goal is to maximize final capture...
IPO
ipo
Suppose LeetCode will start its **IPO** soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before the **IPO**. Since it has limited resources, it can only finish at most `k` distinct projects before the **IPO**. Help LeetCode design...
null
Array,Greedy,Sorting,Heap (Priority Queue)
Hard
null
967
oh Jesus hey everybody this is Larry this is me in Turkey still in uh Antalya but I'm giving you some ice cream action hit the like button hit the Subscribe button join me on Discord let me know what you think about today's Farm um so yeah I this is still the morning I still just woke up so let me know what you think I...
Numbers With Same Consecutive Differences
minimum-falling-path-sum
Given two integers n and k, return _an array of all the integers of length_ `n` _where the difference between every two consecutive digits is_ `k`. You may return the answer in **any order**. Note that the integers should not have leading zeros. Integers as `02` and `043` are not allowed. **Example 1:** **Input:** n...
null
Array,Dynamic Programming,Matrix
Medium
1224
1,448
EPF big let's all the best quote problem 148 account good notes in binary tree union ministry approved and axis given industry made it tiffin apart from route 2X during notes with jewelery track number note seervi note's value with this rule for the first to ghaghare [ Sangeet] [ Sangeet] [ Sangeet] Subscribe 4 A Famin...
Count Good Nodes in Binary Tree
maximum-69-number
Given a binary tree `root`, a node _X_ in the tree is named **good** if in the path from root to _X_ there are no nodes with a value _greater than_ X. Return the number of **good** nodes in the binary tree. **Example 1:** **Input:** root = \[3,1,4,3,null,1,5\] **Output:** 4 **Explanation:** Nodes in blue are **good*...
Convert the number in an array of its digits. Brute force on every digit to get the maximum number.
Math,Greedy
Easy
null
1,670
hey there everyone welcome back to lead coding in this video we will be solving the question number three of lead code by weekly contest 40 name of the problem is designed front middle back queue the problem description is we have to design a queue that supports push and pop operations in the front middle and back so w...
Design Front Middle Back Queue
patients-with-a-condition
Design a queue that supports `push` and `pop` operations in the front, middle, and back. Implement the `FrontMiddleBack` class: * `FrontMiddleBack()` Initializes the queue. * `void pushFront(int val)` Adds `val` to the **front** of the queue. * `void pushMiddle(int val)` Adds `val` to the **middle** of the queu...
null
Database
Easy
null
1,007
welcome to october's leco challenge today's problem is minimum domino rotations for equal row in a row of dominoes a and b represent the top and bottom halves of the ith domino we may rotate the ice dominoes so that a i and bi swap values we turn the minimum number of rotations so that all the values in a are the same ...
Minimum Domino Rotations For Equal Row
numbers-with-same-consecutive-differences
In a row of dominoes, `tops[i]` and `bottoms[i]` represent the top and bottom halves of the `ith` domino. (A domino is a tile with two numbers from 1 to 6 - one on each half of the tile.) We may rotate the `ith` domino, so that `tops[i]` and `bottoms[i]` swap values. Return the minimum number of rotations so that all...
null
Backtracking,Breadth-First Search
Medium
null
110
hello and welcome back to app for you in this particular video we are going to discuss a new problem from balanced binary basically from trees so before we proceed with the problem let us understand what is actually a balanced binary tree so the definition that is given here is clearly states that uh given a binary tre...
Balanced Binary Tree
balanced-binary-tree
Given a binary tree, determine if it is **height-balanced**. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** true **Example 2:** **Input:** root = \[1,2,2,3,3,null,null,4,4\] **Output:** false **Example 3:** **Input:** root = \[\] **Output:** true **Constraints:** * The number of nodes ...
null
Tree,Depth-First Search,Binary Tree
Easy
104
201
Hello everyone, we continue with the resolution of lit code problems This is the video of the problem 201 bitwise End of numbers Range that we can translate as bitwise end of a range of numbers problem classified as medium already asking for your like if you like This type of video if you like the series and consider f...
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
1,675
hi everyone let's work today's daily challenge that is minimize deviation and array so in this question we are given an array Norms of n positive integers and we can perform two types of operations on any element of the array any number of times so if the element is even you divide it by two if the element is odd you m...
Minimize Deviation in Array
magnetic-force-between-two-balls
You are given an array `nums` of `n` positive integers. You can perform two types of operations on any element of the array any number of times: * If the element is **even**, **divide** it by `2`. * For example, if the array is `[1,2,3,4]`, then you can do this operation on the last element, and the array wil...
If you can place balls such that the answer is x then you can do it for y where y < x. Similarly if you cannot place balls such that the answer is x then you can do it for y where y > x. Binary search on the answer and greedily see if it is possible.
Array,Binary Search,Sorting
Medium
2188
1,094
Once Hello Everyone Welcome Back To My Channel Today Were Going To Solve The Problem Problems Car Pooling Early Morning Pyuda Video Please Like And Subscribe My Channel And Without Further Delay Started So In This Problem Delhi Government With Capacity To Be Given A Car With seating capacity and they still need rise it...
Car Pooling
matrix-cells-in-distance-order
There is a car with `capacity` empty seats. The vehicle only drives east (i.e., it cannot turn around and drive west). You are given the integer `capacity` and an array `trips` where `trips[i] = [numPassengersi, fromi, toi]` indicates that the `ith` trip has `numPassengersi` passengers and the locations to pick them u...
null
Array,Math,Geometry,Sorting,Matrix
Easy
2304
1,851
hi uh so for this video i will discuss problem number one eight five one minimum intervals to include each carry so it is marked as hard let's see uh you are given a 2d integer array in the in intervals where intervals will contain left and right describes the ith interval stands for left starting at left and ending it...
Minimum Interval to Include Each Query
maximum-number-of-events-that-can-be-attended-ii
You are given a 2D integer array `intervals`, where `intervals[i] = [lefti, righti]` describes the `ith` interval starting at `lefti` and ending at `righti` **(inclusive)**. The **size** of an interval is defined as the number of integers it contains, or more formally `righti - lefti + 1`. You are also given an intege...
Sort the events by its startTime. For every event, you can either choose it and consider the next event available, or you can ignore it. You can efficiently find the next event that is available using binary search.
Array,Binary Search,Dynamic Programming
Hard
1478,2118,2164
232
Hello friends, welcome to your Day 39 of Lead Code Challenge, so let's go straight to the screen and let's start. Today's question is okay, so today's question is opposite to yesterday's, it is completely opposite. Yesterday we did it, we implemented it. Tha stack using queue, today we have to create queue using stacks...
Implement Queue using Stacks
implement-queue-using-stacks
Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (`push`, `peek`, `pop`, and `empty`). Implement the `MyQueue` class: * `void push(int x)` Pushes element x to the back of the queue. * `int pop()` Removes the element from th...
null
Stack,Design,Queue
Easy
225
15
hello everyone welcome back to lead coding i am your host faraz and we are going to discuss another really interesting problem so we saw in the last problem that we were supposed to find two numbers the summation of which is equal to a given target now we extended the problem slightly now there are three numbers and th...
3Sum
3sum
Given an integer array nums, return all the triplets `[nums[i], nums[j], nums[k]]` such that `i != j`, `i != k`, and `j != k`, and `nums[i] + nums[j] + nums[k] == 0`. Notice that the solution set must not contain duplicate triplets. **Example 1:** **Input:** nums = \[-1,0,1,2,-1,-4\] **Output:** \[\[-1,-1,2\],\[-1,0...
So, we essentially need to find three numbers x, y, and z such that they add up to the given value. If we fix one of the numbers say x, we are left with the two-sum problem at hand! For the two-sum problem, if we fix one of the numbers, say x, we have to scan the entire array to find the next numbery which is value - x...
Array,Two Pointers,Sorting
Medium
1,16,18,259
316
hello friends now let's of the remove duplicate letters problem given a string which contains only lowercase letters remove duplicate letters so that each letter appear once and only once you must make sure your result is a smallest ink lexicographical order among all possible results until these two examples the first...
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
705
hey everyone welcome back and today we'll be doing another lead code problem 507 designer headset this is an easy one designer hashtag without using any built-in hash table libraries built-in hash table libraries built-in hash table libraries Implement headset class void at a function void add key that takes the keys o...
Design HashSet
design-hashset
Design a HashSet without using any built-in hash table libraries. Implement `MyHashSet` class: * `void add(key)` Inserts the value `key` into the HashSet. * `bool contains(key)` Returns whether the value `key` exists in the HashSet or not. * `void remove(key)` Removes the value `key` in the HashSet. If `key` do...
null
null
Easy
null
11
hey everyone in this video i'll be describing the solution to container with most water so in this video i'll be introducing the problem explaining the solution and how to implement it and then wrapping up with the runtime analysis so in this problem you're given an integer array which is essentially a height map so ea...
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
338
lead code problem number 338 counting bits so this problem gives us an integer and the goal is to return an array on of length n + one right such that for on of length n + one right such that for on of length n + one right such that for each integer inside uh from zero to n the basically each value of it is the number ...
Counting Bits
counting-bits
Given an integer `n`, return _an array_ `ans` _of length_ `n + 1` _such that for each_ `i` (`0 <= i <= n`)_,_ `ans[i]` _is the **number of**_ `1`_**'s** in the binary representation of_ `i`. **Example 1:** **Input:** n = 2 **Output:** \[0,1,1\] **Explanation:** 0 --> 0 1 --> 1 2 --> 10 **Example 2:** **Input:** n =...
You should make use of what you have produced already. Divide the numbers in ranges like [2-3], [4-7], [8-15] and so on. And try to generate new range from previous. Or does the odd/even status of the number help you in calculating the number of 1s?
Dynamic Programming,Bit Manipulation
Easy
191
316
hey what's up guys hi this is sean here so uh actually i want to talk about briefly talk about today's week uh daily challenge problem which is number 316. remove duplicate letters i think this is a very like interesting problem you know okay so you're given like a string uh you need to remove the duplicate letters so ...
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
73
Bluetooth Hi Everyone Welcome To The Channel Once Again Another Very Important Problem Set Matric Shyu Nimit This Problem Is Like Subscribe And Planning To For Company You Must For This Problem Long Time Back To You Should Not Remember You Can Solve This Problem Solve Problems He Gives rise to modify in place where 201...
Set Matrix Zeroes
set-matrix-zeroes
Given an `m x n` integer matrix `matrix`, if an element is `0`, set its entire row and column to `0`'s. You must do it [in place](https://en.wikipedia.org/wiki/In-place_algorithm). **Example 1:** **Input:** matrix = \[\[1,1,1\],\[1,0,1\],\[1,1,1\]\] **Output:** \[\[1,0,1\],\[0,0,0\],\[1,0,1\]\] **Example 2:** **In...
If any cell of the matrix has a zero we can record its row and column number using additional memory. But if you don't want to use extra memory then you can manipulate the array instead. i.e. simulating exactly what the question says. Setting cell values to zero on the fly while iterating might lead to discrepancies. ...
Array,Hash Table,Matrix
Medium
289,2244,2259,2314
107
And where did it happen Hello friends welcome to your depot software going to school problem list code 1073 2011 order traversal to cash withdrawal program so let's see what is this question so basically you will give one graph and how to return its bottom of living Product Reversal Pocket Means 16 This Is My Life Is M...
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,004
hello welcome back to my new video in today's video we are going to solve a lead code problem number one4 Max consecutive 13 so let's understand the problem statement we have given a binary array nums and an integer K return the maximum number of consecutive ones in the array if you can flip at most K Zer means let's s...
Max Consecutive Ones III
least-operators-to-express-number
Given a binary array `nums` and an integer `k`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most_ `k` `0`'s. **Example 1:** **Input:** nums = \[1,1,1,0,0,0,1,1,1,1,0\], k = 2 **Output:** 6 **Explanation:** \[1,1,1,0,0,**1**,1,1,1,1,**1**\] Bolded numbers were flipped from 0 to 1....
null
Math,Dynamic Programming
Hard
null
528
Hello friends welcome back if you are enjoying the content don't forget to hit that subscribe button below it really helps us out and you won't miss any future videos today we are solving random pick with weight this is an interesting probability based problem let's get into it we are given a zero indexed array of posi...
Random Pick with Weight
swapping-nodes-in-a-linked-list
You are given a **0-indexed** array of positive integers `w` where `w[i]` describes the **weight** of the `ith` index. You need to implement the function `pickIndex()`, which **randomly** picks an index in the range `[0, w.length - 1]` (**inclusive**) and returns it. The **probability** of picking an index `i` is `w[i...
We can transform the linked list to an array this should ease things up After transforming the linked list to an array it becomes as easy as swapping two integers in an array then rebuilding the linked list
Linked List,Two Pointers
Medium
19,24,25
258
hello guys my name is Arsenal and welcome back to my channel and today we will be solving a new lead code question that is ADD digits we will be solving this question with the help of JavaScript so let's read out the question what the question is asking from us so the question says given an integer number repeatedly ad...
Add Digits
add-digits
Given an integer `num`, repeatedly add all its digits until the result has only one digit, and return it. **Example 1:** **Input:** num = 38 **Output:** 2 **Explanation:** The process is 38 --> 3 + 8 --> 11 11 --> 1 + 1 --> 2 Since 2 has only one digit, return it. **Example 2:** **Input:** num = 0 **Output:** 0 *...
A naive implementation of the above process is trivial. Could you come up with other methods? What are all the possible results? How do they occur, periodically or randomly? You may find this Wikipedia article useful.
Math,Simulation,Number Theory
Easy
202,1082,2076,2264
200
okay think we're recording hey guys what's up Nick white here I do tech and coding stuff on twitch and YouTube so check the description and I'll have everything that you need to know right now I am doing leak code series where I just explain all the problems while I do them because I'm you know I'm doing myself studyin...
Number of Islands
number-of-islands
Given an `m x n` 2D binary grid `grid` which represents a map of `'1'`s (land) and `'0'`s (water), return _the number of islands_. An **island** is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. **Exampl...
null
Array,Depth-First Search,Breadth-First Search,Union Find,Matrix
Medium
130,286,305,323,694,695,2035,2103
83
hey what's up guys think white here are you Tecna coding stuff on twitching YouTube check the description I do the premium Lea codes on patreon and then join the discord I try and respond to everyone I just did a problem harder than this one I didn't even notice that this was a problem I didn't do remove duplicates fro...
Remove Duplicates from Sorted List
remove-duplicates-from-sorted-list
Given the `head` of a sorted linked list, _delete all duplicates such that each element appears only once_. Return _the linked list **sorted** as well_. **Example 1:** **Input:** head = \[1,1,2\] **Output:** \[1,2\] **Example 2:** **Input:** head = \[1,1,2,3,3\] **Output:** \[1,2,3\] **Constraints:** * The numb...
null
Linked List
Easy
82,1982
1,980
hey everybody this is larry this is me going over q2 of the weekly contest 255 find unique binary string hit the like button hit the subscribe button join me on discord let me know what you think about this problem whatever problems you like to do and if you're here after the contest then definitely check me out becaus...
Find Unique Binary String
faulty-sensor
Given an array of strings `nums` containing `n` **unique** binary strings each of length `n`, return _a binary string of length_ `n` _that **does not appear** in_ `nums`_. If there are multiple answers, you may return **any** of them_. **Example 1:** **Input:** nums = \[ "01 ", "10 "\] **Output:** "11 " **Explanatio...
Check for a common prefix of the two arrays. After this common prefix, there should be one array similar to the other but shifted by one. If both arrays can be shifted, return -1.
Array,Two Pointers
Easy
null
63
in this video we'll be going over the bottom up approach of unique paths 2. let's go over the dot process so we'll be converting the memorization approach to a bottom level approach now where do we start in the memorization approach we have cached the current row and column with the number of the unique paths this mean...
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
502
um hello so today we are going to do this problem which is part of lead code daily challenge IPO um so what this problem um says is basically suppose lead code is going to IPO soon and we want to sell a good price of its shares to VCS um essentially you can ignore all of that but basically we have some projects that th...
IPO
ipo
Suppose LeetCode will start its **IPO** soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before the **IPO**. Since it has limited resources, it can only finish at most `k` distinct projects before the **IPO**. Help LeetCode design...
null
Array,Greedy,Sorting,Heap (Priority Queue)
Hard
null
1,953
all right trying out this problem uh maximum number of Peaks for which you have to work that's our reader so there are amp projects and each project has certain number of milestones and there are two conditions every week we finish exactly one Milestone of one project and you cannot work on two miles from the same proj...
Maximum Number of Weeks for Which You Can Work
finding-mk-average
There are `n` projects numbered from `0` to `n - 1`. You are given an integer array `milestones` where each `milestones[i]` denotes the number of milestones the `ith` project has. You can work on the projects following these two rules: * Every week, you will finish **exactly one** milestone of **one** project. You ...
At each query, try to save and update the sum of the elements needed to calculate MKAverage. You can use BSTs for fast insertion and deletion of the elements.
Design,Queue,Heap (Priority Queue),Ordered Set
Hard
295,789,2207
927
hey what's up guys uh this is chung here so it's been a few days um yeah i had some back pain after overdoing um on the rowing machine so anyway so uh i think this one is today's daily challenge problem uh number 927 three equal parts um so this time you're given like an array which consists only consists of only zero ...
Three Equal Parts
sum-of-subsequence-widths
You are given an array `arr` which consists of only zeros and ones, divide the array into **three non-empty parts** such that all of these parts represent the same binary value. If it is possible, return any `[i, j]` with `i + 1 < j`, such that: * `arr[0], arr[1], ..., arr[i]` is the first part, * `arr[i + 1], ar...
null
Array,Math,Sorting
Hard
null
252
hey everyone how are you doing today let's check out a nice and easy lead code problem called meeting rooms given an array of meeting time intervals where each interval is basically a pair of start and end times we have to determine if a person could attend all the meetings i also want to mention that if you just start...
Meeting Rooms
meeting-rooms
Given an array of meeting time `intervals` where `intervals[i] = [starti, endi]`, determine if a person could attend all meetings. **Example 1:** **Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\] **Output:** false **Example 2:** **Input:** intervals = \[\[7,10\],\[2,4\]\] **Output:** true **Constraints:** * ...
null
Array,Sorting
Easy
56,253
525
Hello everyone and welcome back to another video of lead code daily challenge so today we are going to solve the problem here ah this is also a problem related to everything which we have already solved so it will be a short video company Talking about tax, it has been asked in facebook's question What is the question ...
Contiguous Array
contiguous-array
Given a binary array `nums`, return _the maximum length of a contiguous subarray with an equal number of_ `0` _and_ `1`. **Example 1:** **Input:** nums = \[0,1\] **Output:** 2 **Explanation:** \[0, 1\] is the longest contiguous subarray with an equal number of 0 and 1. **Example 2:** **Input:** nums = \[0,1,0\] **O...
null
Array,Hash Table,Prefix Sum
Medium
325
67
Hi gas welcome and welcome back tu my channel so today our problem is add binary so what have you given us in this problem statement here we have been given two binary A and B and we have to give the sum of this tu my dream Okay, so what we do is, let us understand through the example what we have been given in the pro...
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
207
hello welcome to my channel i'm here to do my 100 lego challenge and today we have nico 207 course schedule this is really famous uh legal questions and have been asked by a lot of companies and the question is there are a total of number courses you have to take label from zero to num courses minus one and some course...
Course Schedule
course-schedule
There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`. * For example, the pair `[0, 1]`, indicates that to take cou...
This problem is equivalent to finding if a cycle exists in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topologica...
Depth-First Search,Breadth-First Search,Graph,Topological Sort
Medium
210,261,310,630
392
That a guy welcome back to record in today's problem is sequence pure YouTube channel please do subscribe vishal slot to complete your problems and problems is given testing lab testing labs which TV sequence of strings in used in which is the form from the original sting By Tilting Some of the Characters Without Stopp...
Is Subsequence
is-subsequence
Given two strings `s` and `t`, return `true` _if_ `s` _is a **subsequence** of_ `t`_, or_ `false` _otherwise_. A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i...
null
Two Pointers,String,Dynamic Programming
Easy
808,1051
1,043
I have shown you all the check out statements here, you can simply cross check them, see how much I have taken out, what is my maximum element coming inside all the sub arrays and not how many. From one to three, if a sub-array of mine is being formed, three, if a sub-array of mine is being formed, three, if a sub-arra...
Partition Array for Maximum Sum
grid-illumination
Given an integer array `arr`, partition the array into (contiguous) subarrays of length **at most** `k`. After partitioning, each subarray has their values changed to become the maximum value of that subarray. Return _the largest sum of the given array after partitioning. Test cases are generated so that the answer fi...
null
Array,Hash Table
Hard
51
975
welcome back today we are going to start new uh video of this Google interview Series right so this and this time we are going to use uh problem we have selected odd even jumps right and uh this is very good questions and have been asked in the Google interview multiple times so I will recommend you to please watch the...
Odd Even Jump
range-sum-of-bst
You are given an integer array `arr`. From some starting index, you can make a series of jumps. The (1st, 3rd, 5th, ...) jumps in the series are called **odd-numbered jumps**, and the (2nd, 4th, 6th, ...) jumps in the series are called **even-numbered jumps**. Note that the **jumps** are numbered, not the indices. You...
null
Tree,Depth-First Search,Binary Search Tree,Binary Tree
Easy
null