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,734 | hello guys welcome back to Tech dose and in this video we will see the decode Zod permutation problem which is from lead code number 1734 and this is from math algorithms the prerequisite for watching this video is to watch my video on finding zor in a range of numbers so the link for this video will be present in the ... | Decode XORed Permutation | bank-account-summary-ii | There is an integer array `perm` that is a permutation of the first `n` positive integers, where `n` is always **odd**.
It was encoded into another integer array `encoded` of length `n - 1`, such that `encoded[i] = perm[i] XOR perm[i + 1]`. For example, if `perm = [1,3,2]`, then `encoded = [2,1]`.
Given the `encoded`... | null | Database | Easy | null |
77 | hi everyone welcome to the episode number 11. now before we move ahead i just want to give you a quick advice i have been looking at a lot of comments sometimes you find a problem to be difficult okay that doesn't mean that you are not going to learn it just watch the video if you are not able to watch it in 1.5 x slow... | Combinations | combinations | Given two integers `n` and `k`, return _all possible combinations of_ `k` _numbers chosen from the range_ `[1, n]`.
You may return the answer in **any order**.
**Example 1:**
**Input:** n = 4, k = 2
**Output:** \[\[1,2\],\[1,3\],\[1,4\],\[2,3\],\[2,4\],\[3,4\]\]
**Explanation:** There are 4 choose 2 = 6 total combin... | null | Backtracking | Medium | 39,46 |
56 | hey there welcome back to this video now we're going to solve according to the problem mars intervals we're given an area of intervals where intervals i equals to start i and end i our job is to merge all overlapping intervals and we have to return an array of the non-overlapping intervals that cover non-overlapping in... | Merge Intervals | merge-intervals | Given an array of `intervals` where `intervals[i] = [starti, endi]`, merge all overlapping intervals, and return _an array of the non-overlapping intervals that cover all the intervals in the input_.
**Example 1:**
**Input:** intervals = \[\[1,3\],\[2,6\],\[8,10\],\[15,18\]\]
**Output:** \[\[1,6\],\[8,10\],\[15,18\]\... | null | Array,Sorting | Medium | 57,252,253,495,616,715,761,768,1028,2297,2319 |
310 | hey everybody this is larry this is day 16 of the sim december lego day challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's prom i've been a little bit or a lot tired the last couple of days just dealing with uh a giant mice or a giant mouse or a small rat ... | Minimum Height Trees | minimum-height-trees | 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.
Given a tree of `n` nodes labelled from `0` to `n - 1`, and an array of `n - 1` `edges` where `edges[i] = [ai, bi]` indicates that there is an undirected edg... | How many MHTs can a graph have at most? | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 207,210 |
843 | this problem is called guess the word and let's understand so we have a string array of strings or words so word one word two and these are unique words so same word will not be repeated so these are all unique and all the words each of these words is six letters long so this is true for all the words in this words arr... | Guess the Word | binary-trees-with-factors | You are given an array of unique strings `words` where `words[i]` is six letters long. One word of `words` was chosen as a secret word.
You are also given the helper object `Master`. You may call `Master.guess(word)` where `word` is a six-letter-long string, and it must be from `words`. `Master.guess(word)` returns:
... | null | Array,Hash Table,Dynamic Programming | Medium | null |
1,579 | hello guys welcome to deep codes and in today's video we will discuss liquid question 1579 that says remove max number of edges to keep graph fully traversable so guys this question is somewhat of a medium level where if you get the intuition right then it is an easier for you to write the code and approach to the solu... | Remove Max Number of Edges to Keep Graph Fully Traversable | active-users | Alice and Bob have an undirected graph of `n` nodes and three types of edges:
* Type 1: Can be traversed by Alice only.
* Type 2: Can be traversed by Bob only.
* Type 3: Can be traversed by both Alice and Bob.
Given an array `edges` where `edges[i] = [typei, ui, vi]` represents a bidirectional edge of type `typ... | null | Database | Medium | null |
654 | That Welcome Back Friends Today We Are Going To Solve Liquid Problem 1106 Maximum Binary Tree Beach Problem Shuru Skin Pass Microsoft Interview Schedule And Senior So Let's You Quickly Rudra Description Agravan Interior With Notification Maximum Trick Building On This Is Defined S Polo Root Is The Maximum Number Indra ... | Maximum Binary Tree | maximum-binary-tree | You are given an integer array `nums` with no duplicates. A **maximum binary tree** can be built recursively from `nums` using the following algorithm:
1. Create a root node whose value is the maximum value in `nums`.
2. Recursively build the left subtree on the **subarray prefix** to the **left** of the maximum val... | null | Array,Divide and Conquer,Stack,Tree,Monotonic Stack,Binary Tree | Medium | 1040 |
72 | foreign so this question has been asked tons of times in so many interviews Amazon Google Microsoft Flipkart so many companies it's good to know about this question so the question says that we have been given two words when and word two then I think there's just two strings of different sizes now what we want to do is... | Edit Distance | edit-distance | Given two strings `word1` and `word2`, return _the minimum number of operations required to convert `word1` to `word2`_.
You have the following three operations permitted on a word:
* Insert a character
* Delete a character
* Replace a character
**Example 1:**
**Input:** word1 = "horse ", word2 = "ros "
**O... | null | String,Dynamic Programming | Hard | 161,583,712,1105,2311 |
1,711 | hey there everyone welcome back to lead coding in this video we are solving the second question of lead code weekly contest 222. so you can go through the problem statement uh in simple terms the problem is asking us to find the pairs such that the summation of both those numbers is a power of 2. so let us see this exa... | Count Good Meals | find-valid-matrix-given-row-and-column-sums | A **good meal** is a meal that contains **exactly two different food items** with a sum of deliciousness equal to a power of two.
You can pick **any** two different foods to make a good meal.
Given an array of integers `deliciousness` where `deliciousness[i]` is the deliciousness of the `ith` item of fo... | Find the smallest rowSum or colSum, and let it be x. Place that number in the grid, and subtract x from rowSum and colSum. Continue until all the sums are satisfied. | Array,Greedy,Matrix | Medium | 1379 |
1,277 | Hello Guys Welcome Back Door And This Video Will See Given A Matrix How To Decorate The Number Of War Sub Matrices With All Once Soldiers From List To Twenty One Of The Match Challenge So Let's Not Look At The Problem Statement Letters Udayveer Vriksha And Want To Count number of matrices with this app you can see the ... | Count Square Submatrices with All Ones | largest-multiple-of-three | Given a `m * n` matrix of ones and zeros, return how many **square** submatrices have all ones.
**Example 1:**
**Input:** matrix =
\[
\[0,1,1,1\],
\[1,1,1,1\],
\[0,1,1,1\]
\]
**Output:** 15
**Explanation:**
There are **10** squares of side 1.
There are **4** squares of side 2.
There is **1** square of side 3.... | A number is a multiple of three if and only if its sum of digits is a multiple of three. Use dynamic programming. To find the maximum number, try to maximize the number of digits of the number. Sort the digits in descending order to find the maximum number. | Array,Dynamic Programming,Greedy | Hard | null |
76 | hey everyone welcome back and let's write some more neat code today so today let's solve minimum window substring we're given two strings s and t and we want to return the minimum window in the string s which contains every single character present in string t and it's possible that might not even exist in which case w... | Minimum Window Substring | minimum-window-substring | Given two strings `s` and `t` of lengths `m` and `n` respectively, return _the **minimum window**_ **_substring_** _of_ `s` _such that every character in_ `t` _(**including duplicates**) is included in the window_. If there is no such substring, return _the empty string_ `" "`.
The testcases will be generated such tha... | Use two pointers to create a window of letters in S, which would have all the characters from T. Since you have to find the minimum window in S which has all the characters from T, you need to expand and contract the window using the two pointers and keep checking the window for all the characters. This approach is als... | Hash Table,String,Sliding Window | Hard | 30,209,239,567,632,727 |
1,815 | hello everyone let's take a look at this liquid problem it's the last problem in the bi-weekly it's the last problem in the bi-weekly it's the last problem in the bi-weekly context and it's a hard problem although it's a hard problem but after we analyze this problem it may be not that hard okay let's take a look at it... | Maximum Number of Groups Getting Fresh Donuts | checking-existence-of-edge-length-limited-paths | There is a donuts shop that bakes donuts in batches of `batchSize`. They have a rule where they must serve **all** of the donuts of a batch before serving any donuts of the next batch. You are given an integer `batchSize` and an integer array `groups`, where `groups[i]` denotes that there is a group of `groups[i]` cust... | All the queries are given in advance. Is there a way you can reorder the queries to avoid repeated computations? | Array,Union Find,Graph,Sorting | Hard | 1865 |
478 | hi today i'm talking about leak code problem 478 generating random point in a circle what this problem asks you to do is write a solution object such that the constructor or initialization method takes a radius an x and y center point and the solution object should provide this function rand point which when called wil... | Generate Random Point in a Circle | generate-random-point-in-a-circle | Given the radius and the position of the center of a circle, implement the function `randPoint` which generates a uniform random point inside the circle.
Implement the `Solution` class:
* `Solution(double radius, double x_center, double y_center)` initializes the object with the radius of the circle `radius` and th... | null | null | Medium | null |
386 | uh let's go through the liquor 386 lexical graphical numbers and this question uh it gives us an integer and let's return the lexical graphical order um from one two and for example to give an a equals 13. so the one is the smallest and one zero that is from lexicographical order that is the second one because it start... | Lexicographical Numbers | lexicographical-numbers | Given an integer `n`, return all the numbers in the range `[1, n]` sorted in lexicographical order.
You must write an algorithm that runs in `O(n)` time and uses `O(1)` extra space.
**Example 1:**
**Input:** n = 13
**Output:** \[1,10,11,12,13,2,3,4,5,6,7,8,9\]
**Example 2:**
**Input:** n = 2
**Output:** \[1,2\]
*... | null | Depth-First Search,Trie | Medium | null |
1,760 | So in this problem, basically I will do a dry run to show whether it is possible or not, which means the explanation of the thing I am doing a dry run, I have already given the background in the first video, so the next video will basically take a small example. So what you can see in this is given which means by break... | Minimum Limit of Balls in a Bag | check-array-formation-through-concatenation | You are given an integer array `nums` where the `ith` bag contains `nums[i]` balls. You are also given an integer `maxOperations`.
You can perform the following operation at most `maxOperations` times:
* Take any bag of balls and divide it into two new bags with a **positive** number of balls.
* For example, ... | Note that the distinct part means that every position in the array belongs to only one piece Note that you can get the piece every position belongs to naively | Array,Hash Table | Easy | null |
57 | you would open fine questions around array in DSA rounds if you are appearing for fronting interview don't worry I am here to help you crack your dream job my name is vedant and you are watching array in JavaScript on GS Cafe so without wasting any time let's get started so today we are going to solve the question inse... | Insert Interval | insert-interval | You are given an array of non-overlapping intervals `intervals` where `intervals[i] = [starti, endi]` represent the start and the end of the `ith` interval and `intervals` is sorted in ascending order by `starti`. You are also given an interval `newInterval = [start, end]` that represents the start and end of another i... | null | Array | Medium | 56,715 |
16 | in this video we'll delve into a concise and Powerful C++ implementation of the and Powerful C++ implementation of the and Powerful C++ implementation of the TM problem the code utilizes the standard C++ Library including vectors standard C++ Library including vectors standard C++ Library including vectors for array re... | 3Sum Closest | 3sum-closest | Given an integer array `nums` of length `n` and an integer `target`, find three integers in `nums` such that the sum is closest to `target`.
Return _the sum of the three integers_.
You may assume that each input would have exactly one solution.
**Example 1:**
**Input:** nums = \[-1,2,1,-4\], target = 1
**Output:** ... | null | Array,Two Pointers,Sorting | Medium | 15,259 |
70 | given a staircase it takes n steps to reach the top each time you can take either one step or two steps in how many distinct ways can you reach the top that's today's video let's get into it hi everyone my name is Steve today we are going through an eco problem seventy climbing stairs this is a very classic dynamic pro... | 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 |
421 | Hello hi guys welcome to question today's question is this maxims of two numbers in there in this question be aware of it has been up to find now pair yield and this maxim for example where given importance of 310 phase to final year of elements which is- Who wish you perform all pressure is- Who wish you perform all p... | Maximum XOR of Two Numbers in an Array | maximum-xor-of-two-numbers-in-an-array | Given an integer array `nums`, return _the maximum result of_ `nums[i] XOR nums[j]`, where `0 <= i <= j < n`.
**Example 1:**
**Input:** nums = \[3,10,5,25,2,8\]
**Output:** 28
**Explanation:** The maximum result is 5 XOR 25 = 28.
**Example 2:**
**Input:** nums = \[14,70,53,83,49,91,36,80,92,51,66,70\]
**Output:** 1... | null | Array,Hash Table,Bit Manipulation,Trie | Medium | 1826 |
1,869 | lead code 1869 longer continuous segments of ones than zeros so the question explained is that you'll be given a string something like this and you need to see what is the longest continuous string for one so in this case the this out of this is a continuous string of one and this one is the longest what's the size of ... | Longer Contiguous Segments of Ones than Zeros | longer-contiguous-segments-of-ones-than-zeros | Given a binary string `s`, return `true` _if the **longest** contiguous segment of_ `1`'_s is **strictly longer** than the **longest** contiguous segment of_ `0`'_s in_ `s`, or return `false` _otherwise_.
* For example, in `s = "110100010 "` the longest continuous segment of `1`s has length `2`, and the longest cont... | null | null | Easy | null |
147 | hey everybody this is laurie this is day two of the league code daily challenge for november hit the like button hit the subscribe button join me on this card let me know what you think about today's farm uh which is insert it's insertion swordless so apparently this has been out for a little bit because of daylight sa... | Insertion Sort List | insertion-sort-list | Given the `head` of a singly linked list, sort the list using **insertion sort**, and return _the sorted list's head_.
The steps of the **insertion sort** algorithm:
1. Insertion sort iterates, consuming one input element each repetition and growing a sorted output list.
2. At each iteration, insertion sort removes... | null | Linked List,Sorting | Medium | 148,850 |
210 | all right so let's talk about the course schedule too so if you didn't watch this course schedule one then you just go back to watch it so once you're finished you'll be able to understand uh what additional code you need to add so basically in this one you are going to return the order of course you need to take for i... | 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 |
1,326 | Hello everyone, welcome to you, we are going to do video number 61 of my channel. Before starting, let me tell you the playlist of DP concession questions. If you want to see, then you can see there. I started understanding BP from the very basic. In that, we solve each and every problem through recognition memorizatio... | Minimum Number of Taps to Open to Water a Garden | sum-of-floored-pairs | There is a one-dimensional garden on the x-axis. The garden starts at the point `0` and ends at the point `n`. (i.e The length of the garden is `n`).
There are `n + 1` taps located at points `[0, 1, ..., n]` in the garden.
Given an integer `n` and an integer array `ranges` of length `n + 1` where `ranges[i]` (0-index... | Find the frequency (number of occurrences) of all elements in the array. For each element, iterate through its multiples and multiply frequencies to find the answer. | Array,Math,Binary Search,Prefix Sum | Hard | null |
1,636 | okay so let's try the next coding Excel file so open the and go to the file so open the and go to the file so open the and go to the problems tab and in the search question number 1636 and you will find this question sort array and increasing on it is also under the HD category so click on it okay so let's see the opti... | Sort Array by Increasing Frequency | number-of-substrings-with-only-1s | Given an array of integers `nums`, sort the array in **increasing** order based on the frequency of the values. If multiple values have the same frequency, sort them in **decreasing** order.
Return the _sorted array_.
**Example 1:**
**Input:** nums = \[1,1,2,2,2,3\]
**Output:** \[3,1,1,2,2,2\]
**Explanation:** '3' h... | Count number of 1s in each consecutive-1 group. For a group with n consecutive 1s, the total contribution of it to the final answer is (n + 1) * n // 2. | Math,String | Medium | 1885,2186 |
77 | Hello friends welcome to code Sutra in this video we'll be solving lead code program number 77 combinations and we solve similar problems in one of our recently concluded workshops and if you are someone who is interested in search workshops please do consider joining our telegram Channel and I have mentioned the link ... | Combinations | combinations | Given two integers `n` and `k`, return _all possible combinations of_ `k` _numbers chosen from the range_ `[1, n]`.
You may return the answer in **any order**.
**Example 1:**
**Input:** n = 4, k = 2
**Output:** \[\[1,2\],\[1,3\],\[1,4\],\[2,3\],\[2,4\],\[3,4\]\]
**Explanation:** There are 4 choose 2 = 6 total combin... | null | Backtracking | Medium | 39,46 |
416 | Everyone welcome to my channel but missing discussion problem list dot this 416 partition equal subsidy even perfume increase problem I will highly recommend you to watch this video you submit committee's after disaster 232 jag milk solution of this point pure account statement give in Theory Names Containing Only Posi... | Partition Equal Subset Sum | partition-equal-subset-sum | Given an integer array `nums`, return `true` _if you can partition the array into two subsets such that the sum of the elements in both subsets is equal or_ `false` _otherwise_.
**Example 1:**
**Input:** nums = \[1,5,11,5\]
**Output:** true
**Explanation:** The array can be partitioned as \[1, 5, 5\] and \[11\].
**E... | null | Array,Dynamic Programming | Medium | 698,2108,2135,2162 |
977 | hey guys welcome to a new video in today's video we're going to look at the lead code problem and the problem's name is square software sorted array in this question we're given our integer already num sorted in ascending order and return the array of the squares in the ascending order so this is the input nums given t... | Squares of a Sorted Array | distinct-subsequences-ii | Given an integer array `nums` sorted in **non-decreasing** order, return _an array of **the squares of each number** sorted in non-decreasing order_.
**Example 1:**
**Input:** nums = \[-4,-1,0,3,10\]
**Output:** \[0,1,9,16,100\]
**Explanation:** After squaring, the array becomes \[16,1,0,9,100\].
After sorting, it be... | null | String,Dynamic Programming | Hard | 2115 |
68 | Hello everyone, welcome to my channel, so today we are going to do question number 68 of Let's Code, whose name is text justification. This question has been asked in Uber and Google. Okay, this question implementation is the best. There is no need to put any intion in it as it is said in the mains. In the question, we... | Text Justification | text-justification | Given an array of strings `words` and a width `maxWidth`, format the text such that each line has exactly `maxWidth` characters and is fully (left and right) justified.
You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces `' '` when necessary so that ea... | null | Array,String,Simulation | Hard | 1714,2260 |
906 | So WhatsApp Web Big Ajit Mahajan End Welcome Back To Do YouTube Video Withdrawal Solving Till Now Number Nine Just Inserted Chords Super Palan Recent Visit Of Minutes And Shouldn't A I Late Say Possibilities Are Pig Palan Roo Acid Romantic Songs Play Open Loop Positivity End Represented in Tears Left and Right That The... | Super Palindromes | walking-robot-simulation | Let's say a positive integer is a **super-palindrome** if it is a palindrome, and it is also the square of a palindrome.
Given two positive integers `left` and `right` represented as strings, return _the number of **super-palindromes** integers in the inclusive range_ `[left, right]`.
**Example 1:**
**Input:** left ... | null | Array,Simulation | Medium | 2178 |
1,379 | hello friends so today in this video we're gonna discuss another problem from lead hood problem name find a corresponding node of a binary tree in a clone of that tree so what you are given in this problem is you are given two binary trees a original and a clone so both the binary trees are exactly the same but the pro... | Find a Corresponding Node of a Binary Tree in a Clone of That Tree | reconstruct-a-2-row-binary-matrix | Given two binary trees `original` and `cloned` and given a reference to a node `target` in the original tree.
The `cloned` tree is a **copy of** the `original` tree.
Return _a reference to the same node_ in the `cloned` tree.
**Note** that you are **not allowed** to change any of the two trees or the `target` node a... | You cannot do anything about colsum[i] = 2 case or colsum[i] = 0 case. Then you put colsum[i] = 1 case to the upper row until upper has reached. Then put the rest into lower row. Fill 0 and 2 first, then fill 1 in the upper row or lower row in turn but be careful about exhausting permitted 1s in each row. | Array,Greedy,Matrix | Medium | 1711 |
35 | hello everyone my name is daryl i work as a software developer and in this video you'll see how i naturally work through elite code challenge this is a problem that i'm seeing for the first time and i'll explain myself as i work through it my solution won't likely be the best or most efficient it'll be the one that i c... | 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 |
946 | hi guys good morning so this video is your problem valid stack sequences although it's a pretty easy problem if you have watched are the problems of Stack which you have did in the last two three lectures then it will be very easy for you to solve it but in this video I'm going to show you as we saw okay to solve the p... | Validate Stack Sequences | smallest-range-ii | Given two integer arrays `pushed` and `popped` each with distinct values, return `true` _if this could have been the result of a sequence of push and pop operations on an initially empty stack, or_ `false` _otherwise._
**Example 1:**
**Input:** pushed = \[1,2,3,4,5\], popped = \[4,5,3,2,1\]
**Output:** true
**Explana... | null | Array,Math,Greedy,Sorting | Medium | null |
169 | everyone welcome back and let's write some more neat code today so today let's solve the problem majority element i probably should have solved this problem earlier but don't let the tag fool you it's easy because the simple solution is actually easy to implement but there is a follow-up that's not very easy to come a ... | Majority Element | majority-element | Given an array `nums` of size `n`, return _the majority element_.
The majority element is the element that appears more than `⌊n / 2⌋` times. You may assume that the majority element always exists in the array.
**Example 1:**
**Input:** nums = \[3,2,3\]
**Output:** 3
**Example 2:**
**Input:** nums = \[2,2,1,1,1,2,... | null | Array,Hash Table,Divide and Conquer,Sorting,Counting | Easy | 229,1102 |
989 | That Aapke Ajay Ko Hua Hai Hello Everyone Welcome to New Video in This Video By Going to Discuss the Problem 518 Form of the Problem Statement Problem Sahrdaya Just Right for Example Agar Na Dhan Na Refined Via Electricity Rates Subscribe in dark form is 20202 and we have how many thirty-four of one person so what do t... | Add to Array-Form of Integer | largest-component-size-by-common-factor | The **array-form** of an integer `num` is an array representing its digits in left to right order.
* For example, for `num = 1321`, the array form is `[1,3,2,1]`.
Given `num`, the **array-form** of an integer, and an integer `k`, return _the **array-form** of the integer_ `num + k`.
**Example 1:**
**Input:** num ... | null | Array,Math,Union Find | Hard | 2276 |
1,717 | hey everybody this is larry this is me going with q2 of the bi-weekly contest for 3's maximum score bi-weekly contest for 3's maximum score bi-weekly contest for 3's maximum score from removing substring so this one to be honest um during the contest when i solved it and you know you could watch me to stop it during th... | Maximum Score From Removing Substrings | minimum-cost-to-connect-two-groups-of-points | You are given a string `s` and two integers `x` and `y`. You can perform two types of operations any number of times.
* Remove substring `"ab "` and gain `x` points.
* For example, when removing `"ab "` from `"cabxbae "` it becomes `"cxbae "`.
* Remove substring `"ba "` and gain `y` points.
* For examp... | Each point on the left would either be connected to exactly point already connected to some left node, or a subset of the nodes on the right which are not connected to any node Use dynamic programming with bitmasking, where the state will be (number of points assigned in first group, bitmask of points assigned in secon... | Array,Dynamic Programming,Bit Manipulation,Matrix,Bitmask | Hard | null |
295 | welcome to july's leeco challenge today's problem is find median from data stream the median is the middle value of an ordered integer list if the size of the list is even there's no middle value and the median is the mean of two middle values for instance if we had an array of 2 3 4 the median is going to be 3 and if ... | Find Median from Data Stream | find-median-from-data-stream | The **median** is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two middle values.
* For example, for `arr = [2,3,4]`, the median is `3`.
* For example, for `arr = [2,3]`, the median is `(2 + 3) / 2 = 2.5`.
Implement the M... | null | Two Pointers,Design,Sorting,Heap (Priority Queue),Data Stream | Hard | 480,1953,2207 |
342 | Hello ga today starting with the question power of given an entry we have to return power of it we have to return false soir n e 16 we have given power of a solution question with help of Ratio so in ratio if we get n e 16 and any of the numbers f then power of f then if dividing the number with fo then getting one at ... | 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 |
279 | hey everyone today we'll be solving lead C problem number 279 perfect sares as for the problem statement we will be given an integer n and we have to return the least number of perfect square numbers that sum to n okay so let's firstly try to understand what is the perfect square here so any integer let's say any integ... | Perfect Squares | perfect-squares | Given an integer `n`, return _the least number of perfect square numbers that sum to_ `n`.
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. For example, `1`, `4`, `9`, and `16` are perfect squares while `3` and `11` are not.
**Example ... | null | Math,Dynamic Programming,Breadth-First Search | Medium | 204,264 |
199 | hi everyone welcome to my channel let's solve the problem binary tree right side view so given a binary imagine yourself standing on the right side of it and return the values of the nodes you can see order from top to bottom so this is our binary and you are standing over here and you are looking the tree from here so... | Binary Tree Right Side View | binary-tree-right-side-view | Given the `root` of a binary tree, imagine yourself standing on the **right side** of it, return _the values of the nodes you can see ordered from top to bottom_.
**Example 1:**
**Input:** root = \[1,2,3,null,5,null,4\]
**Output:** \[1,3,4\]
**Example 2:**
**Input:** root = \[1,null,3\]
**Output:** \[1,3\]
**Examp... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 116,545 |
1,846 | Hello and welcome again so today's question is maximum element after decreasing and rearranging so before proceeding further in the video if you are new on this channel then please subscribe and if you like this video then please like this video then let's problem statement. You are given an array of positive integers ... | 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 |
10 | hello friends today that solve the regular expression matching problem given an input string as and a pattern P implement a regular expression matching with support for octet and the asterisk the dot matches any single character the asterisk matter is zero or more of the preceding element and the matching should cover ... | Regular Expression Matching | regular-expression-matching | Given an input string `s` and a pattern `p`, implement regular expression matching with support for `'.'` and `'*'` where:
* `'.'` Matches any single character.
* `'*'` Matches zero or more of the preceding element.
The matching should cover the **entire** input string (not partial).
**Example 1:**
**Input:... | null | String,Dynamic Programming,Recursion | Hard | 44 |
211 | hey guys how's everything going this is Jay sir who is not be good at algorithms I'm making the Beast making these videos to prepare my interview in this video I'm going to take a look at two one ad and a search word data structure design we are required to design data structure that sports the following interpretation... | Design Add and Search Words Data Structure | design-add-and-search-words-data-structure | Design a data structure that supports adding new words and finding if a string matches any previously added string.
Implement the `WordDictionary` class:
* `WordDictionary()` Initializes the object.
* `void addWord(word)` Adds `word` to the data structure, it can be matched later.
* `bool search(word)` Returns ... | You should be familiar with how a Trie works. If not, please work on this problem: Implement Trie (Prefix Tree) first. | String,Depth-First Search,Design,Trie | Medium | 208,746 |
221 | foreign Matrix filled with zeros and months find the largest Square containing only ones and within its area so what is same the given question is they are given a 2d Matrix uh it's a binary Matrix that means it contains only those and once and we have to return the maximum square that is present maximum Square form is... | Maximal Square | maximal-square | Given an `m x n` binary `matrix` filled with `0`'s and `1`'s, _find the largest square containing only_ `1`'s _and return its area_.
**Example 1:**
**Input:** matrix = \[\[ "1 ", "0 ", "1 ", "0 ", "0 "\],\[ "1 ", "0 ", "1 ", "1 ", "1 "\],\[ "1 ", "1 ", "1 ", "1 ", "1 "\],\[ "1 ", "0 ", "0 ", "1 ", "0 "\]\]
**Output:*... | null | Array,Dynamic Programming,Matrix | Medium | 85,769,1312,2200 |
83 | hey guys welcome back to our series on cracking the coding interview today we're going to be solving a problem called remove duplicates but keep a few things in mind versus this problem also happens to be a lead code problem feel free to pause this just to read them and make sure the only difference is lead code asks u... | 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,362 | Uh service barbell page can change the hands of that trouser hanger hey this is where it on tv nas tweety nang to file such as sms dst in law ah 2 sub there o in touch esd find a shovel star diver yes In sc Seongshin Girl Tao's Basic Aria Oh Jesus 5 Squalo Last time, lv-d was taken out, but I left it as it was. 5655 Is... | Closest Divisors | airplane-seat-assignment-probability | Given an integer `num`, find the closest two integers in absolute difference whose product equals `num + 1` or `num + 2`.
Return the two integers in any order.
**Example 1:**
**Input:** num = 8
**Output:** \[3,3\]
**Explanation:** For num + 1 = 9, the closest divisors are 3 & 3, for num + 2 = 10, the closest divisor... | Let f(n) denote the probability of the n-th person getting correct seat in n-person case, then:
f(1) = 1 (base case, trivial)
f(2) = 1/2 (also trivial) Try to calculate f(3), f(4), and f(5) using the base cases. What if the value of them?
f(i) for i >= 2 will also be 1/2. Try to proof why f(i) = 1/2 for i >= 2. | Math,Dynamic Programming,Brainteaser,Probability and Statistics | Medium | null |
344 | hey everyone nitissa's side hope you are doing well so let's start with the new challenge so let's see the question so the question is reverse string okay so you have given a string array and you have to convert basically reverse that string and you have to do it in place basically you can't take any extra space so you... | Reverse String | reverse-string | Write a function that reverses a string. The input string is given as an array of characters `s`.
You must do this by modifying the input array [in-place](https://en.wikipedia.org/wiki/In-place_algorithm) with `O(1)` extra memory.
**Example 1:**
**Input:** s = \["h","e","l","l","o"\]
**Output:** \["o","l","l","e","h... | The entire logic for reversing a string is based on using the opposite directional two-pointer approach! | Two Pointers,String,Recursion | Easy | 345,541 |
85 | Hello friends, I am Vishal and I am going to question the state primary tractor, largest area sub matrix with all once. Okay, have you heard of this meter, I am just going to tell you which is the matrix which has the largest area and one of them is coming out. Okay, so look here, these are many verses of the matrix an... | Maximal Rectangle | maximal-rectangle | Given a `rows x cols` binary `matrix` filled with `0`'s and `1`'s, find the largest rectangle containing only `1`'s and return _its area_.
**Example 1:**
**Input:** matrix = \[\[ "1 ", "0 ", "1 ", "0 ", "0 "\],\[ "1 ", "0 ", "1 ", "1 ", "1 "\],\[ "1 ", "1 ", "1 ", "1 ", "1 "\],\[ "1 ", "0 ", "0 ", "1 ", "0 "\]\]
**Ou... | null | Array,Dynamic Programming,Stack,Matrix,Monotonic Stack | Hard | 84,221 |
293 | how's it going guys today I want to go over another leak code question and say we're gonna go over a question called flip game and this is a question that's currently being asked by Google all right guys today our problem is called flip game again it's a questions being asked by Google and our problem ascription says y... | Flip Game | flip-game | You are playing a Flip Game with your friend.
You are given a string `currentState` that contains only `'+'` and `'-'`. You and your friend take turns to flip **two consecutive** `"++ "` into `"-- "`. The game ends when a person can no longer make a move, and therefore the other person will be the winner.
Return all ... | null | String | Easy | 294 |
1,704 | hey everybody this is larry this is me going over to one of the code contest victory 221. uh hit the like button to subscribe and join me on discord let me know what you think about today's problem uh determine if string halves are alike so during the contest i got this very quickly but i still got an wrong answer the ... | Determine if String Halves Are Alike | special-positions-in-a-binary-matrix | You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half.
Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppe... | Keep track of 1s in each row and in each column. Then while iterating over matrix, if the current position is 1 and current row as well as current column contains exactly one occurrence of 1. | Array,Matrix | Easy | null |
969 | Very short tour when the viewers are watching it is very interesting we are Pandey shopping What is What is What is this question then most of the time you will get a disgusting where dry ginger once click on the perform subscribe button and choose it. Revising forces me every morning, so this is our whole, it is okay ... | 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 |
218 | yeah under there today I want to talk about question 218 the skyline problem so the question is super law let me try to give a summarization about the problem so basically we're taking a picture of the city from are far away and there are a bunch of buildings on the picture each building can be sort of roughly represen... | The Skyline Problem | the-skyline-problem | A city's **skyline** is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of all the buildings, return _the **skyline** formed by these buildings collectively_.
The geometric information of each building is given in the array `buil... | null | Array,Divide and Conquer,Binary Indexed Tree,Segment Tree,Line Sweep,Heap (Priority Queue),Ordered Set | Hard | 699 |
1,721 | look uh today we will be solving liquid problem 1721 swapping those in a linked list uh you are given the head of a linked list and an integer K return the head of the linked list after swapping the values of the kth node from the beginning and the kth node from the end so they give us this example here uh we have an a... | Swapping Nodes in a Linked List | maximum-profit-of-operating-a-centennial-wheel | You are given the `head` of a linked list, and an integer `k`.
Return _the head of the linked list after **swapping** the values of the_ `kth` _node from the beginning and the_ `kth` _node from the end (the list is **1-indexed**)._
**Example 1:**
**Input:** head = \[1,2,3,4,5\], k = 2
**Output:** \[1,4,3,2,5\]
**Ex... | Think simulation Note that the number of turns will never be more than 50 / 4 * n | Array,Simulation | Medium | null |
1,603 | hey guys today we're going to solve lethal number 1603 design parking system so this is a beginner friendly problem where maybe you can use this to teach somebody how to use a hash map or a dictionary so we need to implement the two functions the constructor of our parking system and we're given the capacities for big ... | Design Parking System | running-sum-of-1d-array | Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size.
Implement the `ParkingSystem` class:
* `ParkingSystem(int big, int medium, int small)` Initializes object of the `ParkingSystem` class. The number of slot... | Think about how we can calculate the i-th number in the running sum from the (i-1)-th number. | Array,Prefix Sum | Easy | null |
976 | um hello so today we are going to do this problem which is part of Fleet code um October daily challenge uh largest perimeter of a triangle so the problem basically is that we have a an array of numbers and we want to return the largest perimeter um of a triangle with a non-zero area um of a triangle with a non-zero ar... | Largest Perimeter Triangle | minimum-area-rectangle | Given an integer array `nums`, return _the largest perimeter of a triangle with a non-zero area, formed from three of these lengths_. If it is impossible to form any triangle of a non-zero area, return `0`.
**Example 1:**
**Input:** nums = \[2,1,2\]
**Output:** 5
**Explanation:** You can form a triangle with three si... | null | Array,Hash Table,Math,Geometry,Sorting | Medium | null |
35 | hi everyone yeah so earlier we have solved this problem to some problem today we will try to solve the search insert position problem so let's open the um question now we have given a sorted array of District integer and the target value return the index if the target is wrong if not return the index where it should be... | 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 |
142 | so hello everyone i am straight i am a software development engineer so we are starting with this lead code premium top interview problem series we will be discussing each and every problem which are mentioned on the lead code top interviews and also this will help you to crack your next coding interview in the top not... | Linked List Cycle II | linked-list-cycle-ii | Given the `head` of a linked list, return _the node where the cycle begins. If there is no cycle, return_ `null`.
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 ta... | null | Hash Table,Linked List,Two Pointers | Medium | 141,287 |
1,456 | See, we are going to do questions in this video, the difficulty level of Late Ko is medium, Aaj U Know Lead Code has its own playlist, the link of which you will get the description and in that I am focusing on arrange only, there are basically three types of questions on Arrest. Sliding window 2.0 Sliding window 2.0 S... | Maximum Number of Vowels in a Substring of Given Length | find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance | Given a string `s` and an integer `k`, return _the maximum number of vowel letters in any substring of_ `s` _with length_ `k`.
**Vowel letters** in English are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`.
**Example 1:**
**Input:** s = "abciiidef ", k = 3
**Output:** 3
**Explanation:** The substring "iii " contains 3 vow... | Use Floyd-Warshall's algorithm to compute any-point to any-point distances. (Or can also do Dijkstra from every node due to the weights are non-negative). For each city calculate the number of reachable cities within the threshold, then search for the optimal city. | Dynamic Programming,Graph,Shortest Path | Medium | 2171 |
493 | Friends, welcome to my YouTube channel Kamlesh, today we are going to discuss so let's start and let's see what is there, satisfy the connection, okay, this condition has to be satisfied, we will give it to the one who satisfies this condition. Here we see that 5 is greater than 2 * 1. Here it will become 3. We will 5 ... | Reverse Pairs | reverse-pairs | Given an integer array `nums`, return _the number of **reverse pairs** in the array_.
A **reverse pair** is a pair `(i, j)` where:
* `0 <= i < j < nums.length` and
* `nums[i] > 2 * nums[j]`.
**Example 1:**
**Input:** nums = \[1,3,2,3,1\]
**Output:** 2
**Explanation:** The reverse pairs are:
(1, 4) --> nums\[1\]... | null | Array,Binary Search,Divide and Conquer,Binary Indexed Tree,Segment Tree,Merge Sort,Ordered Set | Hard | 315,327 |
944 | um hello so today we are going to solve this problem which is part of lead code daily challenge um delete columns to make sorted so basically we get a set of strings and we arrange them one on top of the other like this so we get ABC for example BCE cea and what we want to do is delete the columns that are not sorted s... | Delete Columns to Make Sorted | smallest-range-i | You are given an array of `n` strings `strs`, all of the same length.
The strings can be arranged such that there is one on each line, making a grid.
* For example, `strs = [ "abc ", "bce ", "cae "]` can be arranged as follows:
abc
bce
cae
You want to **delete** the columns that are **not sorted lexicographically... | null | Array,Math | Easy | null |
278 | we are going to solve the question called first bad person so in this question we are given a scenario let us first get to know what the scenario is so we have versions of all these projects so we are doing a project and we have versions of all these projects if let's say there are 10 versions of these projects if some... | First Bad Version | first-bad-version | You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.
Suppose you have `n` versions `[1, 2, ..., n]` an... | null | Binary Search,Interactive | Easy | 34,35,374 |
344 | welcome back to the coding interview question reverse string write a function that reverse a string the input string is given as an array of characters chart the constraint to this problem is that you have to solve this problem in constant space complexity if you are given this particular array that represents these st... | Reverse String | reverse-string | Write a function that reverses a string. The input string is given as an array of characters `s`.
You must do this by modifying the input array [in-place](https://en.wikipedia.org/wiki/In-place_algorithm) with `O(1)` extra memory.
**Example 1:**
**Input:** s = \["h","e","l","l","o"\]
**Output:** \["o","l","l","e","h... | The entire logic for reversing a string is based on using the opposite directional two-pointer approach! | Two Pointers,String,Recursion | Easy | 345,541 |
330 | Loot Hello Everyone Welcome To Design To Liquid Channel Subscribe Toe 's Cutting Are Liquid 330 Blind Hard 's Cutting Are Liquid 330 Blind Hard 's Cutting Are Liquid 330 Blind Hard Questions Read And Oils Page Subscribe The Questions Were Giving Sorted In Treasury This Point To Hydride And Uninterrupted Element Subscri... | Patching Array | patching-array | Given a sorted integer array `nums` and an integer `n`, add/patch elements to the array such that any number in the range `[1, n]` inclusive can be formed by the sum of some elements in the array.
Return _the minimum number of patches required_.
**Example 1:**
**Input:** nums = \[1,3\], n = 6
**Output:** 1
Explanati... | null | Array,Greedy | Hard | 1930 |
1,898 | hey everyone welcome back and let's write some more neat code today so today let's solve another leak code contest problem maximum number of removable characters and if you find this video helpful don't forget to like it supports the channel a lot and this is related to subsequences so we are given two strings s and p ... | Maximum Number of Removable Characters | leetflex-banned-accounts | You are given two strings `s` and `p` where `p` is a **subsequence** of `s`. You are also given a **distinct 0-indexed** integer array `removable` containing a subset of indices of `s` (`s` is also **0-indexed**).
You want to choose an integer `k` (`0 <= k <= removable.length`) such that, after removing `k` characters... | null | Database | Medium | null |
875 | hey what's up guys this is John here so today I want to talk about another at least call the problem number 875 Coco eating bananas okay so Coco loves to eat bananas I'm assuming Coco is like a monkey yeah and there are powers of bananas the numbers the ice-pile has like pile ice banana the ice-pile has like pile ice b... | Koko Eating Bananas | longest-mountain-in-array | Koko loves to eat bananas. There are `n` piles of bananas, the `ith` pile has `piles[i]` bananas. The guards have gone and will come back in `h` hours.
Koko can decide her bananas-per-hour eating speed of `k`. Each hour, she chooses some pile of bananas and eats `k` bananas from that pile. If the pile has less than `k... | null | Array,Two Pointers,Dynamic Programming,Enumeration | Medium | 1766,2205 |
1,676 | hello and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem 1676 lowest common ancestor of a binary tree 4. let's read the question prompt given the root of a binary tree an array of tree node objects nodes return the lowest common ancestor lca of all the nodes in nodes... | Lowest Common Ancestor of a Binary Tree IV | minimum-number-of-days-to-eat-n-oranges | Given the `root` of a binary tree and an array of `TreeNode` objects `nodes`, return _the lowest common ancestor (LCA) of **all the nodes** in_ `nodes`. All the nodes will exist in the tree, and all values of the tree's nodes are **unique**.
Extending the **[definition of LCA on Wikipedia](https://en.wikipedia.org/wik... | In each step, choose between 2 options:
minOranges = 1 + min( (n%2) + f(n/2), (n%3) + f(n/3) )
where f(n) is the minimum number of days to eat n oranges. | Dynamic Programming,Memoization | Hard | null |
387 | foreign hey this is Topher with the lonely Dash and today we're going over lead code question 387 first unique character in a string given a string called s find the first non-repeating character in it and first non-repeating character in it and first non-repeating character in it and return its index if it does not ex... | First Unique Character in a String | first-unique-character-in-a-string | Given a string `s`, _find the first non-repeating character in it and return its index_. If it does not exist, return `-1`.
**Example 1:**
**Input:** s = "leetcode"
**Output:** 0
**Example 2:**
**Input:** s = "loveleetcode"
**Output:** 2
**Example 3:**
**Input:** s = "aabb"
**Output:** -1
**Constraints:**
* `... | null | Hash Table,String,Queue,Counting | Easy | 451 |
95 | hello everyone welcome to my YouTube Club today we will be solving another daily lead code challenge and the challenge name is unique binary search twist part two so the challenge statement goes like this given an integer and return all the structurally unique binary search trees which has exactly nodes and you have to... | 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,673 | Jhal Hello Guys Welcome Gautam Seduction Subscribe Must Subscribe More Competitive Exams Page Subscribe Tips to Torch of Clans to all in the subscribe Video Channel and subscribe the Video then subscribe to The Amazing subscribe The Video then subscribe to The Amazing Length of Beer And Play List On The Value Subscribe... | Find the Most Competitive Subsequence | find-the-most-competitive-subsequence | Given an integer array `nums` and a positive integer `k`, return _the most **competitive** subsequence of_ `nums` _of size_ `k`.
An array's subsequence is a resulting sequence obtained by erasing some (possibly zero) elements from the array.
We define that a subsequence `a` is more **competitive** than a subsequence ... | null | null | Medium | null |
416 | hey what's up guys chung here again and this time let's take a look at another medium level lead called problem here um it's called it's number 460 partition equal subset sum okay and you're given like a none negative only positive integers okay and it asks you to partition these two subsets uh this partition this arra... | Partition Equal Subset Sum | partition-equal-subset-sum | Given an integer array `nums`, return `true` _if you can partition the array into two subsets such that the sum of the elements in both subsets is equal or_ `false` _otherwise_.
**Example 1:**
**Input:** nums = \[1,5,11,5\]
**Output:** true
**Explanation:** The array can be partitioned as \[1, 5, 5\] and \[11\].
**E... | null | Array,Dynamic Programming | Medium | 698,2108,2135,2162 |
79 | hey what's up guys Nick white here I do tech encoding stuff on twitch and YouTube and this problem I've had my eye on a little bit lately just because I've been doing all these other problems and I haven't had time to make a video on it but it's very similar to number of islands I made that video so please go check tha... | Word Search | word-search | Given an `m x n` grid of characters `board` and a string `word`, return `true` _if_ `word` _exists in the grid_.
The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.
**Example 1:**... | null | Array,Backtracking,Matrix | Medium | 212 |
94 | every one today we're gonna do question number 94 binary tree in order traversal we're first gonna go understand the problem and then I'm gonna show you three possible solutions but I'm actually gonna code the most optimal solution this question may seem relatively simple at first but I wanted to reiterate and talk abo... | Binary Tree Inorder Traversal | binary-tree-inorder-traversal | Given the `root` of a binary tree, return _the inorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[1,3,2\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of nodes i... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 98,144,145,173,230,272,285,758,799 |
133 | hey guys thanks for joining in today's video we're going to go over problem 133 on leak code clone graph so first we'll go over the problem description and we'll have a discussion on different types of approaches we can take to make the solution we'll talk about any edge cases which could get us into trouble we'll disc... | Clone Graph | clone-graph | Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph.
Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph.
Each node in the graph contains a value (`int`) and a list (`List[Node]`)... | null | Hash Table,Depth-First Search,Breadth-First Search,Graph | Medium | 138,1624,1634 |
598 | hello so these questions range rotation.2 so you're giving an rotation.2 so you're giving an rotation.2 so you're giving an environmentary and then also the operation array so you have to count and return the number of Maximum so maximum integer in the measure after performing all the operation so uh this is uh quickly... | Range Addition II | range-addition-ii | You are given an `m x n` matrix `M` initialized with all `0`'s and an array of operations `ops`, where `ops[i] = [ai, bi]` means `M[x][y]` should be incremented by one for all `0 <= x < ai` and `0 <= y < bi`.
Count and return _the number of maximum integers in the matrix after performing all the operations_.
**Exampl... | null | Array,Math | Easy | 370 |
792 | Hello guys welcome to another interesting videos refilling suggestion problem number of the thing subscribe The Channel Please subscribe and Share and subscirbe BCD Na Dheer Wa Next Seervi Subscribe Our ACP RCC CCCE Apni Petrol And This All Sequence Pet So S Subsidies For Distinct Mothers At That Time BCD And BC Someth... | Number of Matching Subsequences | binary-search | Given a string `s` and an array of strings `words`, return _the number of_ `words[i]` _that is a subsequence of_ `s`.
A **subsequence** of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.
* For exa... | null | Array,Binary Search | Easy | 786 |
367 | Ajay Ko Hello viewers welcome back to my channel and doing great prevent subscribe To My Channel Please Share subscribe Hafte Take Some Places For Various Categories All Problems Bread 10th Programming Binary Search Tree Is Graph And Take Off Please Like This Problem To The Page Want To bring the description of this vi... | 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 |
476 | today's problem is lead code problem number 476 and it's called number complement and by number complement we mean that uh the number that we obtain by changing the flipping the bits of original number for example here you see it's the bit representation of 5 it's 1 0 1 2 raised to the power 0 which is 1 plus this is a... | Number Complement | number-complement | The **complement** of an integer is the integer you get when you flip all the `0`'s to `1`'s and all the `1`'s to `0`'s in its binary representation.
* For example, The integer `5` is `"101 "` in binary and its **complement** is `"010 "` which is the integer `2`.
Given an integer `num`, return _its complement_.
**... | null | Bit Manipulation | Easy | null |
377 | okay so lead code question combination sum four so in this video i'm going to go over the solution how to solve this problem and uh let's get started so let's resolve this problem combination sum four given an integer array with all the positive numbers and no duplicates so find the number of possible combinations that... | Combination Sum IV | combination-sum-iv | Given an array of **distinct** integers `nums` and a target integer `target`, return _the number of possible combinations that add up to_ `target`.
The test cases are generated so that the answer can fit in a **32-bit** integer.
**Example 1:**
**Input:** nums = \[1,2,3\], target = 4
**Output:** 7
**Explanation:**
Th... | null | Array,Dynamic Programming | Medium | 39 |
258 | hey guys welcome back to another video and today we're going to be solving the lead code question add digits so in this question we're given a non-negative integer number given a non-negative integer number given a non-negative integer number and when you repeatedly add all of its digits until the result has only one d... | 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 |
2 | hello guys welcome back to my channel so in this video we're going to continue with leet code and we're going to solve the second problem in Python it will be this one add two numbers so we are given two a non-empty linked lists two a non-empty linked lists two a non-empty linked lists representing non-negative integer... | 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 |
87 | uh today we're gonna working on uh lead code question number 87 uh scramble strength okay so in this question we can scramble the string s i want to get uh to get a string t using the following algorithm okay basically the length of the string is one we need to stop right there if the length of the string is greater th... | Scramble String | scramble-string | We can scramble a string s to get a string t using the following algorithm:
1. If the length of the string is 1, stop.
2. If the length of the string is > 1, do the following:
* Split the string into two non-empty substrings at a random index, i.e., if the string is `s`, divide it to `x` and `y` where `s = x +... | null | String,Dynamic Programming | Hard | null |
1,697 | welcome to Pomodoro job for Saturday April 29th 2023 today we're doing lead code problem 1697. checking existence of edge length limit 1697 checking existence of edge length limited paths this is a hard problem this one really hard problem all right an undirected graph of end nodes is defined by Edge list where Edge li... | Checking Existence of Edge Length Limited Paths | strings-differ-by-one-character | An undirected graph of `n` nodes is defined by `edgeList`, where `edgeList[i] = [ui, vi, disi]` denotes an edge between nodes `ui` and `vi` with distance `disi`. Note that there may be **multiple** edges between two nodes.
Given an array `queries`, where `queries[j] = [pj, qj, limitj]`, your task is to determine for e... | BruteForce, check all pairs and verify if they differ in one character. O(n^2 * m) where n is the number of words and m is the length of each string. O(m^2 * n), Use hashset, to insert all possible combinations adding a character "*". For example: If dict[i] = "abc", insert ("*bc", "a*c" and "ab*"). | Hash Table,String,Rolling Hash,Hash Function | Medium | 2256 |
141 | hello hi everyone welcome back to the channel so this is your randip Singh today we'll be solving this problem link list cycle so in this problem we are given the head of a linked list and we have to determine if the linked list has a cycle in it right so what is a cycle in a link list so here we have our link list the... | Linked List Cycle | linked-list-cycle | Given `head`, the head of a linked list, determine if the linked list has a cycle in it.
There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that tail's `next` pointer is co... | null | Hash Table,Linked List,Two Pointers | Easy | 142,202 |
1,740 | Hai gas welcome to today's video and today we are going to do lead code problem 1740 whose name is find distance in a binary tree so basically here we have two nodes or the values of two notes are P and K or the values of two notes are P and K or the values of two notes are P and K and we have one root. Of a bina... | Find Distance in a Binary Tree | count-subtrees-with-max-distance-between-cities | Given the root of a binary tree and two integers `p` and `q`, return _the **distance** between the nodes of value_ `p` _and value_ `q` _in the tree_.
The **distance** between two nodes is the number of edges on the path from one to the other.
**Example 1:**
**Input:** root = \[3,5,1,6,2,0,8,null,null,7,4\], p = 5, q... | Iterate through every possible subtree by doing a bitmask on which vertices to include. How can you determine if a subtree is valid (all vertices are connected)? To determine connectivity, count the number of reachable vertices starting from any included vertex and only traveling on edges connecting 2 vertices in the s... | Dynamic Programming,Bit Manipulation,Tree,Enumeration,Bitmask | Hard | 1177 |
198 | Hello Hi Everyone Welcome To My Channel It's All The Problem How So You Are Professional Work Planning To Rock House On The Streets Of Us Have Certain Amount Of Money Only Can Stop You From Each Of The Independence Connected And Will Automatically In To-Do List Of negativity of money In To-Do List Of negativity of mone... | House Robber | house-robber | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and **it will automatically contact the police if two adjacent houses were broken into... | null | Array,Dynamic Programming | Medium | 152,213,256,276,337,600,656,740,2262 |
237 | what's up guys this is lead code 237 deleted node in a linked list write a function to delete a node except the tail in a single link of the list giving only access to that node given link at least head four five one nine which looks like the following we need to delete what we need to delete here so node five into the... | Delete Node in a Linked List | delete-node-in-a-linked-list | There is a singly-linked list `head` and we want to delete a node `node` in it.
You are given the node to be deleted `node`. You will **not be given access** to the first node of `head`.
All the values of the linked list are **unique**, and it is guaranteed that the given node `node` is not the last node in the linke... | null | Linked List | Easy | 203 |
67 | hello guys I hope you are all doing well in this video I will show you how to solve the problem lead code add binary so let's get started the problem is that they give us a two binary strings and they ask us to return their sum as a binary string so as we know decimal number are from 0 to 9 and for binary numbers are n... | 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,239 | I'm taking a very big risk on making this video because I have seen that if you discuss many approaches the video goes long and people don't like the long videos people just want the answers so I know okay I'm taking the risk for sure the video will be long because I'll discuss every approach recursion backtracking bit... | 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 |
1,926 | Hi gas welcome and welcome back to my channel so today's our problem is so what is given to us in this problem statement here we have M * N a here we have M * N a here we have M * N a matrix has been provided the table is fine in which what is yours is empty cells and The wall is here, the dot is representing your impr... | Nearest Exit from Entrance in Maze | products-price-for-each-store | You are given an `m x n` matrix `maze` (**0-indexed**) with empty cells (represented as `'.'`) and walls (represented as `'+'`). You are also given the `entrance` of the maze, where `entrance = [entrancerow, entrancecol]` denotes the row and column of the cell you are initially standing at.
In one step, you can move o... | null | Database | Easy | 1948 |
733 | welcome back to uncle Jess today's question is leak code 733 flood fill so an image is represented by an M by n integer grid image where image RJ represents the pixel value of the image you're also given three integers srsc and color you should perform a flood fill on the image starting from the pixel image srsc to per... | Flood Fill | flood-fill | An image is represented by an `m x n` integer grid `image` where `image[i][j]` represents the pixel value of the image.
You are also given three integers `sr`, `sc`, and `color`. You should perform a **flood fill** on the image starting from the pixel `image[sr][sc]`.
To perform a **flood fill**, consider the startin... | Write a recursive function that paints the pixel if it's the correct color, then recurses on neighboring pixels. | Array,Depth-First Search,Breadth-First Search,Matrix | Easy | 463 |
83 | hello everyone welcome back to everything swift today we'll be tackling a little question 83 titled remove duplicates from sorted list we are given a linked list type list node here and we are supposed to return one as well whereby the return version is basically non-duplicated uh notes within the non-duplicated uh not... | 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,551 | hello everyone and welcome back to another lead code video solution so today we're going to be taking a look at the lead code question minimum operations to make an area equal all right so for solving this question there's actually a really simple pattern and what i'm going to do is i'll try to show you how we can come... | Minimum Operations to Make Array Equal | npv-queries | You have an array `arr` of length `n` where `arr[i] = (2 * i) + 1` for all valid values of `i` (i.e., `0 <= i < n`).
In one operation, you can select two indices `x` and `y` where `0 <= x, y < n` and subtract `1` from `arr[x]` and add `1` to `arr[y]` (i.e., perform `arr[x] -=1` and `arr[y] += 1`). The goal is to make ... | null | Database | Easy | null |
983 | everyone welcome back and let's write some more neat code today so today let's solve the problem minimum cost for tickets and before we even get into the problem when you see a keyword like minimum or maximum or number of ways or you know anything like that you kind of have a hint that the problem is going to be dp rel... | Minimum Cost For Tickets | validate-stack-sequences | You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array `days`. Each day is an integer from `1` to `365`.
Train tickets are sold in **three different ways**:
* a **1-day** pass is sold for `costs[0]` dollars,
* a **7-day** pass is sold... | null | Array,Stack,Simulation | Medium | null |
384 | in this video we're going to be looking at this problem shuffle and array we're asked to design an algorithm that randomly shuffles the array and what it means by random shuffle is that all permutations of the array should be equally likely as a result of the shuffling alright let's break this question down so let's se... | Shuffle an Array | shuffle-an-array | Given an integer array `nums`, design an algorithm to randomly shuffle the array. All permutations of the array should be **equally likely** as a result of the shuffling.
Implement the `Solution` class:
* `Solution(int[] nums)` Initializes the object with the integer array `nums`.
* `int[] reset()` Resets the arr... | The solution expects that we always use the original array to shuffle() else some of the test cases fail. (Credits; @snehasingh31) | Array,Math,Randomized | Medium | null |
732 | hey what's up guys john here again and today let's take a look at this uh let's call the problem here number 732 my calendar number three it's a i would say to like a medium between medium and heart problem you know and i think it's a very interesting problem comparing to the regular or normal like or interval or meeti... | My Calendar III | my-calendar-iii | A `k`\-booking happens when `k` events have some non-empty intersection (i.e., there is some time that is common to all `k` events.)
You are given some events `[startTime, endTime)`, after each given event, return an integer `k` representing the maximum `k`\-booking between all the previous events.
Implement the `MyC... | Treat each interval [start, end) as two events "start" and "end", and process them in sorted order. | Design,Segment Tree,Ordered Set | Hard | 729,731 |
463 | hey everybody this is larry this is day four of the october eco daily challenge hit the like button to subscribe and join me in discord let me know what you think about today's problem so one question i've gotten recently is try to figure out how to do it how to you know there's a new interface trying to figure out how... | 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 |
1,578 | hey everybody this is Larry this is day 27 of the Leo day December challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's Farm it's going to be uh what is it three more four more one five or six more until the end of the year I cannot count clearly but uh mayb... | 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 |
387 | hi let's Sol today's daily challenge that is first unique character in a string so in this question we are given a string s and we need to find the first non- repeating character in it and non- repeating character in it and non- repeating character in it and return its index and if that character doesn't exist we have ... | First Unique Character in a String | first-unique-character-in-a-string | Given a string `s`, _find the first non-repeating character in it and return its index_. If it does not exist, return `-1`.
**Example 1:**
**Input:** s = "leetcode"
**Output:** 0
**Example 2:**
**Input:** s = "loveleetcode"
**Output:** 2
**Example 3:**
**Input:** s = "aabb"
**Output:** -1
**Constraints:**
* `... | null | Hash Table,String,Queue,Counting | Easy | 451 |
121 | hi guys hope you're doing great our today's question is best time to buy and sell stock this is a very common question with interviews because it's a question which is quite complex to think about and listen to but has a relatively easier solution so let's get started say you have an array for which the ayat element is... | Best Time to Buy and Sell Stock | best-time-to-buy-and-sell-stock | You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
You want to maximize your profit by choosing a **single day** to buy one stock and choosing a **different day in the future** to sell that stock.
Return _the maximum profit you can achieve from this transaction_. If you ... | null | Array,Dynamic Programming | Easy | 53,122,123,188,309,2138,2144 |
222 | Hello guys welcome back record in today's problem which account complete re notes and this problem will be of ascendant problem and will not explain different problems solutions for the end died and will see the time complexity and scorpio s11 life even if you own youtube channel please do Subscribe Vishal Sharma To Co... | Count Complete Tree Nodes | count-complete-tree-nodes | Given the `root` of a **complete** binary tree, return the number of the nodes in the tree.
According to **[Wikipedia](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled in a complete binary tree, and all nodes in the last level are as far lef... | null | Binary Search,Tree,Depth-First Search,Binary Tree | Medium | 270 |
1,909 | Hello Guys Suggest Solve Another Letter Problem Which Name Just Remove One Element To Make The Are Strictly Increasing Listen Versus Prostitutes Is That The Young Men Or This Darkness Viscometer No. 9 This To Return True Facts Can Be Strictly Increasing After Removing And Return For Subscribing To Solve this problem su... | Remove One Element to Make the Array Strictly Increasing | buildings-with-an-ocean-view | Given a **0-indexed** integer array `nums`, return `true` _if it can be made **strictly increasing** after removing **exactly one** element, or_ `false` _otherwise. If the array is already strictly increasing, return_ `true`.
The array `nums` is **strictly increasing** if `nums[i - 1] < nums[i]` for each index `(1 <= ... | You can traverse the buildings from the nearest to the ocean to the furthest. Keep with you the maximum to the right while traversing to determine if you can see the ocean or not. | Array,Stack,Monotonic Stack | Medium | 1305 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.