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 |
|---|---|---|---|---|---|---|---|---|
858 | Hello Guys Welcome Problems Middling Question Adhir Vo Subscribe Number 90 Subscribe Must Subscribe subscribe to subscribe and subscribe is surface it follows this path no extent of square into another attraction this result appointed Video subscribe hai e wish e left the room is too expensive that time Laddu Rupend su... | Mirror Reflection | masking-personal-information | There is a special square room with mirrors on each of the four walls. Except for the southwest corner, there are receptors on each of the remaining corners, numbered `0`, `1`, and `2`.
The square room has walls of length `p` and a laser ray from the southwest corner first meets the east wall at a distance `q` from th... | null | String | Medium | null |
729 | hey what's up guys chung here again so today uh let's take a look at this lead code problem here number 729 my calendar one so which means there will be my calendar two or three but today let's take a look at my calendar one first it's a medium problem i think i kind of like this problem okay so let's take a look at th... | My Calendar I | my-calendar-i | You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a **double booking**.
A **double booking** happens when two events have some non-empty intersection (i.e., some moment is common to both events.).
The event can be represented as a pair of integers `start... | Store the events as a sorted list of intervals. If none of the events conflict, then the new event can be added. | Design,Segment Tree,Ordered Set | Medium | 731,732 |
201 | hello and welcome to another video in this video we're going to be doing bitwise and of a numbers range and in the problem you're given a left and right that represent a range and you want to turn the bitwise and of all the numbers in that range inclusive so for example for five and seven you want to Output four becaus... | 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 |
368 | okay 368 largest his largest divisible was subset given a self distinct positive integers find the largest subset such that every parent s sub I and a sub J of elements in the subset satisfy as I mod a sub J 0 s sub j sy 0 if the multiple solutions returning return any subset is fine okay so 1 2 3 give you a 1/2 or 1/3... | Largest Divisible Subset | largest-divisible-subset | Given a set of **distinct** positive integers `nums`, return the largest subset `answer` such that every pair `(answer[i], answer[j])` of elements in this subset satisfies:
* `answer[i] % answer[j] == 0`, or
* `answer[j] % answer[i] == 0`
If there are multiple solutions, return any of them.
**Example 1:**
**Inp... | null | Array,Math,Dynamic Programming,Sorting | Medium | null |
707 | hey everyone welcome back and let's write some more neat code today so today let's solve designing a linked list as you may know a linked list is a pretty simple data structure where we have some nodes and typically every single node will have some type of value like one or two in this case the values are integers and ... | Design Linked List | design-linked-list | Design your implementation of the linked list. You can choose to use a singly or doubly linked list.
A node in a singly linked list should have two attributes: `val` and `next`. `val` is the value of the current node, and `next` is a pointer/reference to the next node.
If you want to use the doubly linked list, you... | null | null | Medium | null |
1,466 | hello guys let's look at this problem this is from leadcore sweetly challenge let's see how we can solve this problem so problem statement says that we are given in cities which are numbered from 0 to n minus 1 and there are roads between these cities and there exactly n minus 1 roads and the connections are representi... | Reorder Routes to Make All Paths Lead to the City Zero | jump-game-v | There are `n` cities numbered from `0` to `n - 1` and `n - 1` roads such that there is only one way to travel between two different cities (this network form a tree). Last year, The ministry of transport decided to orient the roads in one direction because they are too narrow.
Roads are represented by `connections` wh... | Use dynamic programming. dp[i] is max jumps you can do starting from index i. Answer is max(dp[i]). dp[i] = 1 + max (dp[j]) where j is all indices you can reach from i. | Array,Dynamic Programming,Sorting | Hard | 2001 |
1,673 | everyone welcome to day 24 january record challenge and today's question is find the most competitive subsequence in this question you are given an array and a positive integer k you need to identify the maximum the most competitive sub sequence of size k that is present in this input array and what are the rules for i... | 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 |
1,462 | hello friends welcome back to the channel hope you are doing great if you haven't subscribed to my channel yet please go ahead and subscribe i have created bunch of playlists to cover various categories of the problems such as trees graphs dynamic programming stacks queues linked list breadth first search depth first s... | Course Schedule IV | list-the-products-ordered-in-a-period | 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 `ai` first if you want to take course `bi`.
* For example, the pair `[0, 1]` indicates that you have to ... | null | Database | Easy | null |
218 | all right so this question is the skyline problem so uh if you have time just real quick but uh the problem is pretty much uh simple so you have building eye so uh building a ray right i mean the beauty and eye is going to represent left right and height okay so i'm going to start the drawing so this is about 2 represe... | 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,847 | hey everybody this is larry this is me golfing q4 of the bi-weekly contest me golfing q4 of the bi-weekly contest me golfing q4 of the bi-weekly contest 50 uh 51st closest room uh hit the like button in the subscribe button join me on discord let me know what you think about this farm and on this contest and so forth u... | Closest Room | largest-subarray-length-k | There is a hotel with `n` rooms. The rooms are represented by a 2D integer array `rooms` where `rooms[i] = [roomIdi, sizei]` denotes that there is a room with room number `roomIdi` and size equal to `sizei`. Each `roomIdi` is guaranteed to be **unique**.
You are also given `k` queries in a 2D array `queries` where `qu... | Search for the largest integer in the range [0, n - k] This integer is the first element in the subarray. You should take it with the k - 1 elements after it. | Array,Greedy | Easy | null |
977 | whenever you see any problem on arrays what do you think we can start traversing the array from the beginning or we start reversing the array from the backwards right but we often forget that we can traverse this array from both the starting and the end simultaneously right and sometimes this approach can give you an e... | 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 |
724 | Hai Tu ok hai, something special before this deception and if we want to talk, our channel is sponsored by Spots and Akhilesh Nice day, it does not come on its own, okay then you soon after getting a job, you have to pay YouTube 29337 jobs After salary, you must subscribe to these many benefits channel because Ling sen... | Find Pivot Index | find-pivot-index | Given an array of integers `nums`, calculate the **pivot index** of this array.
The **pivot index** is the index where the sum of all the numbers **strictly** to the left of the index is equal to the sum of all the numbers **strictly** to the index's right.
If the index is on the left edge of the array, then the left... | We can precompute prefix sums P[i] = nums[0] + nums[1] + ... + nums[i-1].
Then for each index, the left sum is P[i], and the right sum is P[P.length - 1] - P[i] - nums[i]. | Array,Prefix Sum | Easy | 560,2102,2369 |
3 | what solve leak code 3 longest substring without repeating characters or back to a classic leak code problem the third one so this one's pretty simple we're just given a string and we want to find the longest sub screen without any repeating characters right like how these three don't have any duplicate characters ABC ... | 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,372 | hey so welcome back in this another daily code problem so today it was called longest zigzag path in a binary tree and it's a medium level uh tree question where you're gonna do exactly that actually so you just want to find whatever zigzag path and that's just you have to alternate between going left right or starting... | Longest ZigZag Path in a Binary Tree | check-if-it-is-a-good-array | You are given the `root` of a binary tree.
A ZigZag path for a binary tree is defined as follow:
* Choose **any** node in the binary tree and a direction (right or left).
* If the current direction is right, move to the right child of the current node; otherwise, move to the left child.
* Change the direction f... | Eq. ax+by=1 has solution x, y if gcd(a,b) = 1. Can you generalize the formula?. Check Bézout's lemma. | Array,Math,Number Theory | Hard | null |
532 | hey guys welcome back in today's video we're going to look at Elite code problem and the problem's name is KD fairs in an array in this question we are given an array called nums we're also given an integer K we have to return the number of unique creative face in the array a creative fair is an integer pair consisting... | K-diff Pairs in an Array | k-diff-pairs-in-an-array | Given an array of integers `nums` and an integer `k`, return _the number of **unique** k-diff pairs in the array_.
A **k-diff** pair is an integer pair `(nums[i], nums[j])`, where the following are true:
* `0 <= i, j < nums.length`
* `i != j`
* `nums[i] - nums[j] == k`
**Notice** that `|val|` denotes the absol... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Medium | 530,2116,2150 |
930 | hello so today while doing this problem called binary sub-array with some it's a called binary sub-array with some it's a called binary sub-array with some it's a medium difficulty problem and it's we get an array of 0 and once only and want to count how many non-empty sub arrays to count how many non-empty sub arrays ... | Binary Subarrays With Sum | all-possible-full-binary-trees | Given a binary array `nums` and an integer `goal`, return _the number of non-empty **subarrays** with a sum_ `goal`.
A **subarray** is a contiguous part of the array.
**Example 1:**
**Input:** nums = \[1,0,1,0,1\], goal = 2
**Output:** 4
**Explanation:** The 4 subarrays are bolded and underlined below:
\[**1,0,1**,0... | null | Dynamic Programming,Tree,Recursion,Memoization,Binary Tree | Medium | null |
110 | Premature Ejaculation Sir, welcome back to the series Australia, today we will talk about the balance body, which is a very good question in itself. Those who have put the concept in deposit, then like every time I would please request you that If you are new on this channel and if you do not know the regulation of thi... | 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 |
392 | hello everyone welcome to day second of march heat code challenge and i hope all of you are having a great time the question that we have in today's is subsequence here in this question we are given two strings s and t we need to identify whether s happens to be a sub sequence of d or not for example here they have pro... | 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 |
48 | everyone so today we are looking at leak code number 48 it is a question called rotate image and so we are given an n by n 2d matrix representing an image and we want to rotate the image by 90 degrees clockwise we want to do this in place and we do not want to allocate another 2d matrix to do the rotation so here we ha... | Rotate Image | rotate-image | You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise).
You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati... | null | Array,Math,Matrix | Medium | 2015 |
473 | hi everyone welcome to lenovo in this video we will discuss about another liquid problem that is the matchsticks to square this is the middle level problem i don't see what this question is asking us to do and how we can think of finding a solution like for this type of questions so uh we'll look into the exact questio... | Matchsticks to Square | matchsticks-to-square | You are given an integer array `matchsticks` where `matchsticks[i]` is the length of the `ith` matchstick. You want to use **all the matchsticks** to make one square. You **should not break** any stick, but you can link them up, and each matchstick must be used **exactly one time**.
Return `true` if you can make this ... | Treat the matchsticks as an array. Can we split the array into 4 equal halves? Every matchstick can belong to either of the 4 sides. We don't know which one. Maybe try out all options! For every matchstick, we have to try out each of the 4 options i.e. which side it can belong to. We can make use of recursion for this.... | Array,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask | Medium | null |
958 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem check completeness of a binary tree we're given the root of a binary tree and we just want to check if it is a complete binary tree which by definition is a tree where every single level in the tree is completely full e... | Check Completeness of a Binary Tree | sort-array-by-parity-ii | Given the `root` of a binary tree, determine if it is a _complete binary tree_.
In a **[complete binary tree](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between ... | null | Array,Two Pointers,Sorting | Easy | 2271,2283,2327 |
1,335 | Hey gas, so today we are going to do dynamic programming playlist. Okay but friend, before I start, I want to clear one thing very clearly, the solution means I will tell the question, I will also tell the solution and also samjhaunga the solution very well, okay but. For those who are beginners, there will be a separa... | Minimum Difficulty of a Job Schedule | maximum-candies-allocated-to-k-children | You want to schedule a list of jobs in `d` days. Jobs are dependent (i.e To work on the `ith` job, you have to finish all the jobs `j` where `0 <= j < i`).
You have to finish **at least** one task every day. The difficulty of a job schedule is the sum of difficulties of each day of the `d` days. The difficulty of a da... | For a fixed number of candies c, how can you check if each child can get c candies? Use binary search to find the maximum c as the answer. | Array,Binary Search | Medium | 907,1886,2000,2027,2188,2294 |
1,913 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem maximum product difference between two pairs a pair is defined as two numbers and the product difference between two different pairs is defined as the product of the first pair a * B subtracted by the product of pair a ... | Maximum Product Difference Between Two Pairs | make-the-xor-of-all-segments-equal-to-zero | The **product difference** between two pairs `(a, b)` and `(c, d)` is defined as `(a * b) - (c * d)`.
* For example, the product difference between `(5, 6)` and `(2, 7)` is `(5 * 6) - (2 * 7) = 16`.
Given an integer array `nums`, choose four **distinct** indices `w`, `x`, `y`, and `z` such that the **product differ... | Let's note that for the XOR of all segments with size K to be equal to zeros, nums[i] has to be equal to nums[i+k] Basically, we need to make the first K elements have XOR = 0 and then modify them. | Array,Dynamic Programming,Bit Manipulation | Hard | null |
1,365 | and today we will be discussing the question how many numbers are smaller than the current number in this question we are given the array norms and for each value we need to find out how many numbers are in the array that are smaller than this particular number at the end we need to return the answer in an array so we ... | 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 |
274 | hey YouTube Welcome Back and today we have this problem it's called H index uh given that if integers called citations where citations of I is the number of citations a researcher received for their eyes paper return the research on each index okay and that there is the each index occurred a current humidity then is de... | 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,288 | hello everyone i hope all of you are having a great time and welcome to day 20th of february record challenge the question that we have in today is removed covered intervals here in this question we are given an array of intervals wherein each interval has two endpoints the starting index and the ending index what we c... | Remove Covered Intervals | maximum-subarray-sum-with-one-deletion | Given an array `intervals` where `intervals[i] = [li, ri]` represent the interval `[li, ri)`, remove all intervals that are covered by another interval in the list.
The interval `[a, b)` is covered by the interval `[c, d)` if and only if `c <= a` and `b <= d`.
Return _the number of remaining intervals_.
**Example 1:... | How to solve this problem if no deletions are allowed ? Try deleting each element and find the maximum subarray sum to both sides of that element. To do that efficiently, use the idea of Kadane's algorithm. | Array,Dynamic Programming | Medium | null |
956 | hello guys welcome to deep codes and in today's video we will discuss liquid question 956 that says tallest billboard so guys although this question is easy to understand as well as code but the complexity arises when you have to solve this question in a memory bound so yeah guys uh in today's video we will learn how w... | Tallest Billboard | number-of-music-playlists | You are installing a billboard and want it to have the largest height. The billboard will have two steel supports, one on each side. Each steel support must be an equal height.
You are given a collection of `rods` that can be welded together. For example, if you have rods of lengths `1`, `2`, and `3`, you can weld the... | null | Math,Dynamic Programming,Combinatorics | Hard | null |
72 | hey everyone welcome to Tech wired in this video we are going to solve problem number 72 edit distance 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 are given word one and word two we need to convert word one to word two by using these ... | 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 |
4 | Hey guys welcome back to my YouTube channel I am astrologer and in this video serial I am solving the problem of lead and today we are going to see the problem which is the media so let's see what is the problem of scientists we can see that This problem is given by the heart attack list in the problem statement that t... | 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 |
316 | hello everyone so today in this video we are going to solve a question of fleet code that is remove duplicate letters it is 316 question on lead code and it consider medium category all right so let's start with the problem statement given as string as remove duplicate letters so that every letter appears once and only... | 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 |
209 | everyone welcome back and let's write some more neat code today so today let's solve the problem minimum size subarray sum we're given an array of positive integers and that's actually going to be an important detail the fact that they're all positive and we're also given a target value and all we want to do is return ... | Minimum Size Subarray Sum | minimum-size-subarray-sum | Given an array of positive integers `nums` and a positive integer `target`, return _the **minimal length** of a_ _subarray_ _whose sum is greater than or equal to_ `target`. If there is no such subarray, return `0` instead.
**Example 1:**
**Input:** target = 7, nums = \[2,3,1,2,4,3\]
**Output:** 2
**Explanation:** Th... | null | Array,Binary Search,Sliding Window,Prefix Sum | Medium | 76,325,718,1776,2211,2329 |
274 | hey guys welcome back to another video and today we're going to be solving the leaka question h index so in this question we're given an array of citations and we need to write a function to compute the researchers h index so what exactly is the h index so over here we have the definition a scientist has index h if h o... | 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 |
746 | hey what's up guys it's Nick white here I do tech inchoate hey what's up guys think white here I did technically stuff on Twitch on youtube check the description I got all my stuff there I do these premium problems on leak code there on my patreon if you want to check that out and join the discord this is min-cost clim... | Min Cost Climbing Stairs | prefix-and-suffix-search | You are given an integer array `cost` where `cost[i]` is the cost of `ith` step on a staircase. Once you pay the cost, you can either climb one or two steps.
You can either start from the step with index `0`, or the step with index `1`.
Return _the minimum cost to reach the top of the floor_.
**Example 1:**
**Input... | For a word like "test", consider "#test", "t#test", "st#test", "est#test", "test#test". Then if we have a query like prefix = "te", suffix = "t", we can find it by searching for something we've inserted starting with "t#te". | String,Design,Trie | Hard | 211 |
563 | today we are going to solve a question called as binary tree tilt we are given with the root of a binary tree and we need to return the sum of every tree nodes tilt and your question could naturally be what is a tilt yeah so let us see the tilt of a tree node is the absolute difference between the sum of all left sub 3... | Binary Tree Tilt | binary-tree-tilt | Given the `root` of a binary tree, return _the sum of every tree node's **tilt**._
The **tilt** of a tree node is the **absolute difference** between the sum of all left subtree node **values** and all right subtree node **values**. If a node does not have a left child, then the sum of the left subtree node **values**... | Don't think too much, this is an easy problem. Take some small tree as an example. Can a parent node use the values of its child nodes? How will you implement it? May be recursion and tree traversal can help you in implementing. What about postorder traversal, using values of left and right childs? | Tree,Depth-First Search,Binary Tree | Easy | 1609 |
211 | welcome to august leeco challenge today's problem is add and search word data structure design is data structure that supports the following operations add word and search word can search for a literal word or a regular expression string containing letters a through z or period means it represents any one letter that's... | 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 |
1,833 | hello everyone welcome to coding chance in today's video we are going to be solving the problem maximum ice bars let's start by reading the problem statement it says sweltering summer day and a boy wants to buy some ice cream bars at this store there are n ice cream bars you are given an array of cost of length n where... | 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 |
1,880 | hey everybody this is larry this is me going over the lead code weekly contest 243 problem one check if word equals summation of two words so this one is actually pretty okay um probably the users of the bunch uh which is why it's q1 but uh hit the like button subscribe whatever hit the subscribe button join me on disc... | Check if Word Equals Summation of Two Words | largest-merge-of-two-strings | The **letter value** of a letter is its position in the alphabet **starting from 0** (i.e. `'a' -> 0`, `'b' -> 1`, `'c' -> 2`, etc.).
The **numerical value** of some string of lowercase English letters `s` is the **concatenation** of the **letter values** of each letter in `s`, which is then **converted** into an inte... | Build the result character by character. At each step, you choose a character from one of the two strings. If the next character of the first string is larger than that of the second string, or vice versa, it's optimal to use the larger one. If both are equal, think of a criteria that lets you decide which string to co... | Two Pointers,String,Greedy | Medium | null |
1,480 | hey everybody this is larry this is dave one of the june nico daddy challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's prom how you doing uh just to give a quick update i was at the yankee game day one so go yanks no more sports for until a little bit so w... | Running Sum of 1d Array | movie-rating | Given an array `nums`. We define a running sum of an array as `runningSum[i] = sum(nums[0]...nums[i])`.
Return the running sum of `nums`.
**Example 1:**
**Input:** nums = \[1,2,3,4\]
**Output:** \[1,3,6,10\]
**Explanation:** Running sum is obtained as follows: \[1, 1+2, 1+2+3, 1+2+3+4\].
**Example 2:**
**Input:** ... | null | Database | Medium | null |
473 | it could question 473 match sticks to square uh first thing i have never seen this question so it's gonna be like a real interview kind of a video so let's see you are given an integer array matchsticks where mastics of i is length of eighth matchstick you want to use all matchsticks to make a square you should not bre... | Matchsticks to Square | matchsticks-to-square | You are given an integer array `matchsticks` where `matchsticks[i]` is the length of the `ith` matchstick. You want to use **all the matchsticks** to make one square. You **should not break** any stick, but you can link them up, and each matchstick must be used **exactly one time**.
Return `true` if you can make this ... | Treat the matchsticks as an array. Can we split the array into 4 equal halves? Every matchstick can belong to either of the 4 sides. We don't know which one. Maybe try out all options! For every matchstick, we have to try out each of the 4 options i.e. which side it can belong to. We can make use of recursion for this.... | Array,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask | Medium | null |
328 | Hello everyone welcome, the question of my channel is lead code number 3 28 but pay attention to this thing, I will make it very easy, I will explain it so well, it is simple, there is not much to do, okay then look, I have asked the company Amazon and Microsoftness, ask the question. If you have kept it then look at t... | Odd Even Linked List | odd-even-linked-list | Given the `head` of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return _the reordered list_.
The **first** node is considered **odd**, and the **second** node is **even**, and so on.
Note that the relative order inside both the even and odd groups s... | null | Linked List | Medium | 725 |
316 | hello and welcome to another video in this video we're going to be working on our move duplicate letters so in this problem you're given a string s and you want to remove duplicate letters such that every letter appears once and only once and you want to make sure your result is the smallest and lexicographical Order a... | 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 |
1,648 | hey what's up guys this is chung here so let's talk about this week's weekly contest number 1648 self diminishing valued colored boss all right so i this is a interesting i would say it's a math more like a math problem okay so you have an inventory of different colored balls and there is like a customer that wants oth... | Sell Diminishing-Valued Colored Balls | minimum-insertions-to-balance-a-parentheses-string | You have an `inventory` of different colored balls, and there is a customer that wants `orders` balls of **any** color.
The customer weirdly values the colored balls. Each colored ball's value is the number of balls **of that color** you currently have in your `inventory`. For example, if you own `6` yellow balls, the... | Use a stack to keep opening brackets. If you face single closing ')' add 1 to the answer and consider it as '))'. If you have '))' with empty stack, add 1 to the answer, If after finishing you have x opening remaining in the stack, add 2x to the answer. | String,Stack,Greedy | Medium | 2095 |
754 | hello everyone welcome back to harlot called Channel today I'm going to talk about a new problem Richard number the this problem has medium complicity and first let's look at the problem is that you are standing at position 0 on an infinite number line there's a go at position target and on it you move you can either g... | Reach a Number | cracking-the-safe | You are standing at position `0` on an infinite number line. There is a destination at position `target`.
You can make some number of moves `numMoves` so that:
* On each move, you can either go left or right.
* During the `ith` move (starting from `i == 1` to `i == numMoves`), you take `i` steps in the chosen dir... | We can think of this problem as the problem of finding an Euler path (a path visiting every edge exactly once) on the following graph: there are $$k^{n-1}$$ nodes with each node having $$k$$ edges. It turns out this graph always has an Eulerian circuit (path starting where it ends.)
We should visit each node in "po... | Depth-First Search,Graph,Eulerian Circuit | Hard | null |
1,262 | solving the greatest sum divisible by 3 problem from lead code using dynamic programming is what we are going to do in this video of joey's tech welcome my friends i am joey and yes i will be telling you how to think of the approach to the dp solution of this problem this is one of the exciting problems i came across a... | Greatest Sum Divisible by Three | online-majority-element-in-subarray | Given an integer array `nums`, return _the **maximum possible sum** of elements of the array such that it is divisible by three_.
**Example 1:**
**Input:** nums = \[3,6,5,1,8\]
**Output:** 18
**Explanation:** Pick numbers 3, 6, 1 and 8 their sum is 18 (maximum sum divisible by 3).
**Example 2:**
**Input:** nums = \... | What's special about a majority element ? A majority element appears more than half the length of the array number of times. If we tried a random index of the array, what's the probability that this index has a majority element ? It's more than 50% if that array has a majority element. Try a random index for a proper n... | Array,Binary Search,Design,Binary Indexed Tree,Segment Tree | Hard | null |
1,684 | welcome ladies and gentlemen for another exercise on leapcoat today it's about the gold passer interpretation so i guess it's coming from like a football scenario so basically from this exercise if you're given a command and you see g in that command you interpret it as g if you see the open and closing parenthesis wit... | Count the Number of Consistent Strings | find-latest-group-of-size-m | You are given a string `allowed` consisting of **distinct** characters and an array of strings `words`. A string is **consistent** if all characters in the string appear in the string `allowed`.
Return _the number of **consistent** strings in the array_ `words`.
**Example 1:**
**Input:** allowed = "ab ", words = \[... | Since the problem asks for the latest step, can you start the searching from the end of arr? Use a map to store the current “1” groups. At each step (going backwards) you need to split one group and update the map. | Array,Binary Search,Simulation | Medium | null |
1,266 | Scientist Hi Guys How Are You I Hope For Doing Good So This Is The New Yorker Face Which Has Been Created Athlete Code And This Is The White Bun I Like It Record You Very Colorful And Share Feedback Option Dowry Want To The Receiver Want To Go To attend the festival is the president where we are used to a guy but that'... | Minimum Time Visiting All Points | minimum-time-visiting-all-points | On a 2D plane, there are `n` points with integer coordinates `points[i] = [xi, yi]`. Return _the **minimum time** in seconds to visit all the points in the order given by_ `points`.
You can move according to these rules:
* In `1` second, you can either:
* move vertically by one unit,
* move horizontally... | null | null | Easy | null |
787 | good evening everyone today we are going to do the daily record challenge of 26 January 2023 that is 787 question number cheapest flight within K stop so the question is saying that there are ncts which are connected by some number of flights and we are given an array of flights and there we are given the starting inde... | 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 |
48 | foreign problem which is to rotate an image here a two-dimensional array or a matrix is a two-dimensional array or a matrix is a two-dimensional array or a matrix is referred as a image from the problem we can see that the size of the Matrix is given as n by n which means it is a square Matrix and our task is to rotate... | Rotate Image | rotate-image | You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise).
You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati... | null | Array,Math,Matrix | Medium | 2015 |
917 | Hello whom I am Amrita welcome back to our channel technologies so this is lead code series in which will be solving lead code problems one by one if you also wish to solve it jump problems then you can join us and subscribe to our channel and also press D Bell Icon You Get The Notification So Nine Let's Move Ahead Wit... | Reverse Only Letters | boats-to-save-people | Given a string `s`, reverse the string according to the following rules:
* All the characters that are not English letters remain in the same position.
* All the English letters (lowercase or uppercase) should be reversed.
Return `s` _after reversing it_.
**Example 1:**
**Input:** s = "ab-cd"
**Output:** "dc-ba... | null | Array,Two Pointers,Greedy,Sorting | Medium | null |
452 | hello everyone welcome to clashing coder so in this video we will see the question 452 that is minimum number of arrows to burst balloons so it is a medium level question and it is also sometimes asked in interviews also so let's see the problem statement there are some spherical balloons spread in two dimensional spac... | 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 |
565 | hello friends so today in this video we're gonna discuss a problem from lead code problem name array nesting so i will first tell you the problem statement it's still like it's tell that you are given an integer array nums where this nums array is actually a permutation of different numbers from ranging from zero to n ... | Array Nesting | array-nesting | You are given an integer array `nums` of length `n` where `nums` is a permutation of the numbers in the range `[0, n - 1]`.
You should build a set `s[k] = {nums[k], nums[nums[k]], nums[nums[nums[k]]], ... }` subjected to the following rule:
* The first element in `s[k]` starts with the selection of the element `num... | null | Array,Depth-First Search | Medium | 339,341,364 |
969 | Everybody Gets All the Best Problem Bank Shopping for Giving Relief Victory Procession Half Are Performing in Wave Subscribe Like This Away from You for Example 814 Subscribe 1234 Turn on the Operation in To-Do List of the Content of This Problem To-Do List of the Content of This Problem To-Do List of the Content of Th... | 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 |
363 | Hello guys, once again welcome to all of you in the video of Tier-3 Daraz on your YouTube channel. The all of you in the video of Tier-3 Daraz on your YouTube channel. The all of you in the video of Tier-3 Daraz on your YouTube channel. The list has a very interesting question and the logic of the question is applicabl... | Max Sum of Rectangle No Larger Than K | max-sum-of-rectangle-no-larger-than-k | Given an `m x n` matrix `matrix` and an integer `k`, return _the max sum of a rectangle in the matrix such that its sum is no larger than_ `k`.
It is **guaranteed** that there will be a rectangle with a sum no larger than `k`.
**Example 1:**
**Input:** matrix = \[\[1,0,1\],\[0,-2,3\]\], k = 2
**Output:** 2
**Explana... | null | Array,Binary Search,Dynamic Programming,Matrix,Ordered Set | Hard | null |
415 | hello and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem 415 add strings let's read the question prompt given two non-negative integers num1 and given two non-negative integers num1 and given two non-negative integers num1 and num2 represented as strings return the s... | Add Strings | add-strings | Given two non-negative integers, `num1` and `num2` represented as string, return _the sum of_ `num1` _and_ `num2` _as a string_.
You must solve the problem without using any built-in library for handling large integers (such as `BigInteger`). You must also not convert the inputs to integers directly.
**Example 1:**
... | null | Math,String,Simulation | Easy | 2,43,1031 |
62 | Hello Hi Everybody Welcome To My Channel Today Is The Second Last Date Of Units Wedding Chalen Is Dahej Ki Problem Is Unique 500 Vs Laptop Left Most Corner Of M Cross And Great Hair This Start Points And Notes Can Only Move On The Dawn And Right At Any Point Of Time Android Trying To Reach At This Point For This Is And... | Unique Paths | unique-paths | There is a robot on an `m x n` grid. The robot is 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.
Given the two integers `m` and `n`, return _the nu... | null | Math,Dynamic Programming,Combinatorics | Medium | 63,64,174,2192 |
1,710 | let's solve the problem 1710 maximum units on a truck so the question goes like this so you'll be given a truck size is nothing but a capacity of the trucks okay so let's take an example so say the in this example you are given a truck size of 10 okay so my capacity is to store 10 boxes okay and then there is an array ... | Maximum Units on a Truck | find-servers-that-handled-most-number-of-requests | You are assigned to put some amount of boxes onto **one truck**. You are given a 2D array `boxTypes`, where `boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]`:
* `numberOfBoxesi` is the number of boxes of type `i`.
* `numberOfUnitsPerBoxi` is the number of units in each box of the type `i`.
You are also given... | To speed up the next available server search, keep track of the available servers in a sorted structure such as an ordered set. To determine if a server is available, keep track of the end times for each task in a heap and add the server to the available set once the soonest task ending time is less than or equal to th... | Array,Greedy,Heap (Priority Queue),Ordered Set | Hard | null |
217 | hey everyone welcome back and let's write some more neat code today so today let's solve contains duplicate this is another problem from the blind 75 list of questions we've been working on so i like this problem because it's a good problem for beginners but there's also multiple solutions to it that i'd like to go ove... | Contains Duplicate | contains-duplicate | Given an integer array `nums`, return `true` if any value appears **at least twice** in the array, and return `false` if every element is distinct.
**Example 1:**
**Input:** nums = \[1,2,3,1\]
**Output:** true
**Example 2:**
**Input:** nums = \[1,2,3,4\]
**Output:** false
**Example 3:**
**Input:** nums = \[1,1,1,... | null | Array,Hash Table,Sorting | Easy | 219,220 |
1,095 | me Brea me let me the lungs inside you and the black and eyes make my way into your mind just to know what you knew rest every time we start locking as all oh I lost control oh is Paradise with a nasty B wi the dead of the night let the darkness take control let the darkness take control Darkness take control May the d... | Find in Mountain Array | two-city-scheduling | _(This problem is an **interactive problem**.)_
You may recall that an array `arr` is a **mountain array** if and only if:
* `arr.length >= 3`
* There exists some `i` with `0 < i < arr.length - 1` such that:
* `arr[0] < arr[1] < ... < arr[i - 1] < arr[i]`
* `arr[i] > arr[i + 1] > ... > arr[arr.length ... | null | Array,Greedy,Sorting | Medium | null |
929 | it was a guy's nick wife here at attacking coding stuff on twitch in youtube and do all the solutions to all the hacker ink and lead code problems so just check my playlist it's on my channel I have them for both this one's called unique email addresses it's really easy every email consists of a local name and a domain... | Unique Email Addresses | groups-of-special-equivalent-strings | Every **valid email** consists of a **local name** and a **domain name**, separated by the `'@'` sign. Besides lowercase letters, the email may contain one or more `'.'` or `'+'`.
* For example, in `"alice@leetcode.com "`, `"alice "` is the **local name**, and `"leetcode.com "` is the **domain name**.
If you add pe... | null | Array,Hash Table,String | Medium | null |
22 | so yeah as an egg-white here I do so yeah as an egg-white here I do so yeah as an egg-white here I do technically stuff on twitch and YouTube check the description for all my information yeah we do all the Wako problems and I got a big playlist so we're gonna check them out we got generate parentheses for some reason w... | Generate Parentheses | generate-parentheses | Given `n` pairs of parentheses, write a function to _generate all combinations of well-formed parentheses_.
**Example 1:**
**Input:** n = 3
**Output:** \["((()))","(()())","(())()","()(())","()()()"\]
**Example 2:**
**Input:** n = 1
**Output:** \["()"\]
**Constraints:**
* `1 <= n <= 8` | null | String,Dynamic Programming,Backtracking | Medium | 17,20,2221 |
61 | hello guys welcome to another video in the series of coding let's do the problem which is called rotate list so given the head of a linked list you have to rotate the list to write by k places let's try to take an example to understand this suppose this is a linked list that you have so let's say k is equal to one what... | Rotate List | rotate-list | Given the `head` of a linked list, rotate the list to the right by `k` places.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], k = 2
**Output:** \[4,5,1,2,3\]
**Example 2:**
**Input:** head = \[0,1,2\], k = 4
**Output:** \[2,0,1\]
**Constraints:**
* The number of nodes in the list is in the range `[0, 500]`.
* ... | null | Linked List,Two Pointers | Medium | 189,725 |
1,402 | Hello guys morning zinc etc co dot problem nadu solution special in this problem difficult and date of all the is reception level officer and distress and what mintu time and essence of him and every day take bollywood talk time great prepare show is virat and you Can give divine one to three layer and M2 respectively ... | Reducing Dishes | count-square-submatrices-with-all-ones | A chef has collected data on the `satisfaction` level of his `n` dishes. Chef can cook any dish in 1 unit of time.
**Like-time coefficient** of a dish is defined as the time taken to cook that dish including previous dishes multiplied by its satisfaction level i.e. `time[i] * satisfaction[i]`.
Return _the maximum sum... | Create an additive table that counts the sum of elements of submatrix with the superior corner at (0,0). Loop over all subsquares in O(n^3) and check if the sum make the whole array to be ones, if it checks then add 1 to the answer. | Array,Dynamic Programming,Matrix | Medium | 2192,2193 |
44 | uh today we're gonna be working on need code question number 44 wild card matching given an input string s and a pattern p implement wildcard pattern matching with support of question mark and star so the question mark matches any single character whereas the star matches any sequence of characters including the empty ... | Wildcard Matching | wildcard-matching | Given an input string (`s`) and a pattern (`p`), implement wildcard pattern matching with support for `'?'` and `'*'` where:
* `'?'` Matches any single character.
* `'*'` Matches any sequence of characters (including the empty sequence).
The matching should cover the **entire** input string (not partial).
**Exam... | null | String,Dynamic Programming,Greedy,Recursion | Hard | 10 |
329 | Jhaal Ajay Ko Hello friends welcome to my YouTube channel Teaser CEA Today they are going to solid problem More than 300 problem name is the longest in increasing path in matrix the problem seems to be heart problems between the medium and heart bits note dry ginger 9 medium Bigg Boss Problem Statements Similar Dolata ... | Longest Increasing Path in a Matrix | longest-increasing-path-in-a-matrix | Given an `m x n` integers `matrix`, return _the length of the longest increasing path in_ `matrix`.
From each cell, you can either move in four directions: left, right, up, or down. You **may not** move **diagonally** or move **outside the boundary** (i.e., wrap-around is not allowed).
**Example 1:**
**Input:** matr... | null | Dynamic Programming,Depth-First Search,Breadth-First Search,Graph,Topological Sort,Memoization | Hard | null |
1,793 | Hello guys welcome to code fix otherwise so let's start now date code problem i maximum score of good all so let's get into this problem so today's problem is a little tricky to understand. That problem is very simple to solve, so if you listen a little carefully, in this question you must have given yourself an array ... | 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 |
54 | Hello friends, welcome to the new video, question number 54 Spiral Matrix is a very famous question, this question is a very famous question, this question is a very famous question, this question is a medium category question, Spiral Matrix Too, you will also get similar code in the late chord, do one question i... | 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 |
893 | Hello hello welcome to taste preparation requested post question is the patient has pieces in which we have the texture that kidney will go and the listing will be as much as it will be that whatever elements it will have all of it, we have a quarter inch of it that happened in special events in which we Out of that, l... | Groups of Special-Equivalent Strings | all-nodes-distance-k-in-binary-tree | You are given an array of strings of the same length `words`.
In one **move**, you can swap any two even indexed characters or any two odd indexed characters of a string `words[i]`.
Two strings `words[i]` and `words[j]` are **special-equivalent** if after any number of moves, `words[i] == words[j]`.
* For example,... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
60 | Hello hello everybody welcome to my channel today is the day 28th june recording challenge MB problem is per motivation cement members to and contains all the total length factory units per month in this listing and having all the per motivation in order to get the following sequence for any One to three lights 12313 2... | Permutation Sequence | permutation-sequence | The set `[1, 2, 3, ..., n]` contains a total of `n!` unique permutations.
By listing and labeling all of the permutations in order, we get the following sequence for `n = 3`:
1. `"123 "`
2. `"132 "`
3. `"213 "`
4. `"231 "`
5. `"312 "`
6. `"321 "`
Given `n` and `k`, return the `kth` permutation sequence.
**Exa... | null | Math,Recursion | Hard | 31,46 |
1,071 | hi everyone so today we're going to solve lead code daily challenge problem number 1071 greatest common division of strength so uh it's a very simple problem uh it is marked as easy as well so what we have to do is we have to find out the gcd of two strength and they have given a definition of gcd in strings as well uh... | Greatest Common Divisor of Strings | binary-prefix-divisible-by-5 | For two strings `s` and `t`, we say "`t` divides `s` " if and only if `s = t + ... + t` (i.e., `t` is concatenated with itself one or more times).
Given two strings `str1` and `str2`, return _the largest string_ `x` _such that_ `x` _divides both_ `str1` _and_ `str2`.
**Example 1:**
**Input:** str1 = "ABCABC ", str2... | If X is the first i digits of the array as a binary number, then 2X + A[i] is the first i+1 digits. | Array | Easy | null |
341 | and hello so today we are going to do this problem called flatten nested list iterator so what we have with this problem is a nested list of integers and each element is either an integer or a list okay um and the user list also can be listed so you can have something like this and then another list inside it and maybe... | Flatten Nested List Iterator | flatten-nested-list-iterator | You are given a nested list of integers `nestedList`. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an iterator to flatten it.
Implement the `NestedIterator` class:
* `NestedIterator(List nestedList)` Initializes the iterator with the nested list `nestedLi... | null | Stack,Tree,Depth-First Search,Design,Queue,Iterator | Medium | 251,281,385,565 |
1,442 | Hua Tha Hello Viewers Welcome Back to My Channel Hope You Are Doing Red Brahmin Subscribe My Channel This Please Do Subscribe My Favorite Several Places for Various Categories Such Problems Iss Defiant Programming subscribe this Video Please subscribe and subscribe the inform 2all Subscribe Give Winners Were Selected i... | Count Triplets That Can Form Two Arrays of Equal XOR | number-of-operations-to-make-network-connected | Given an array of integers `arr`.
We want to select three indices `i`, `j` and `k` where `(0 <= i < j <= k < arr.length)`.
Let's define `a` and `b` as follows:
* `a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]`
* `b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]`
Note that **^** denotes the **bitwise-xor** operation.
Return... | As long as there are at least (n - 1) connections, there is definitely a way to connect all computers. Use DFS to determine the number of isolated computer clusters. | Depth-First Search,Breadth-First Search,Union Find,Graph | Medium | null |
111 | welcome ladies and gentlemen boys and girls today we are going to school's problem which is minimum depth of binary so basically this is the binary problem and it's quite simple as well so what the question is saying let's just see the question saying like i hope like from the title only you understand what the questio... | Minimum Depth of Binary Tree | minimum-depth-of-binary-tree | Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
**Note:** A leaf is a node with no children.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 2
**Example 2:**
**Input:** root = \[2... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 102,104 |
258 | hey everybody this is larry this is day eight of the leeco daily february challenge hit the like button hit the subscribe and join me on this card let me know what you think about today's farm which is add digits i am still in the city of hopefully i'm seeing that a little bit closer uh any uh south american uh people ... | 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 |
20 | hello everyone and welcome to python programming practice in this episode we're going to be covering lead code number 20 valid parentheses this is marked as an easy problem we'll start by reading through the problem description and examples so given a string s containing just the characters these things the various ope... | Valid Parentheses | valid-parentheses | Given a string `s` containing just the characters `'('`, `')'`, `'{'`, `'}'`, `'['` and `']'`, determine if the input string is valid.
An input string is valid if:
1. Open brackets must be closed by the same type of brackets.
2. Open brackets must be closed in the correct order.
3. Every close bracket has a corres... | An interesting property about a valid parenthesis expression is that a sub-expression of a valid expression should also be a valid expression. (Not every sub-expression) e.g.
{ { } [ ] [ [ [ ] ] ] } is VALID expression
[ [ [ ] ] ] is VALID sub-expression
{ } [ ] is VALID sub-express... | String,Stack | Easy | 22,32,301,1045,2221 |
73 | foreign next problem is called set Matrix zeros and in this problem we are given an N times n integer Matrix called Matrix and if an element is zero we have to set the entire row and column to zeros and we have to do it in place so for the for example we have the central zero so we have to make the second row and the s... | 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 |
374 | Hello hello guys to Ajay, I asked on this occasion that Sachin himself will submit this question, it is a festival whose religion is on this number and people ask this question once, this question also for a little bit, after this see what problem has to be set here too, then you can understand this thing. Okay, and yo... | Guess Number Higher or Lower | guess-number-higher-or-lower | We are playing the Guess Game. The game is as follows:
I pick a number from `1` to `n`. You have to guess which number I picked.
Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess.
You call a pre-defined API `int guess(int num)`, which returns three possible re... | null | Binary Search,Interactive | Easy | 278,375,658 |
289 | hey everybody this is larry this is day 12 of the april eco daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's prom today's problem is game of life okay um i guess the game of life is pretty standard so let's take a while to see how everyone else is ... | Game of Life | game-of-life | According to [Wikipedia's article](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life): "The **Game of Life**, also known simply as **Life**, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. "
The board is made up of an `m x n` grid of cells, where each cell has an initial st... | null | Array,Matrix,Simulation | Medium | 73 |
1,697 | hey what's up guys this is john here again so this time let's take a look at 1697 checking the existence of edge length limited path so i mean this is another graph problem i think it's quite interesting and you're given like a graph of n nodes and in the form of an edge at list which is a uv and distance between this ... | 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 |
383 | Hello everyone, welcome to D channel, in today's video we are going to solve problem number 383, whose name is Rasom Knot, which is one of the problems in lead code. This problem is also featured in the list of Challenge for new users, so it is a good one for business. If it is a good exercise then let's solve this que... | Ransom Note | ransom-note | Given two strings `ransomNote` and `magazine`, return `true` _if_ `ransomNote` _can be constructed by using the letters from_ `magazine` _and_ `false` _otherwise_.
Each letter in `magazine` can only be used once in `ransomNote`.
**Example 1:**
**Input:** ransomNote = "a", magazine = "b"
**Output:** false
**Example ... | null | Hash Table,String,Counting | Easy | 691 |
1,452 | hey everybody this is Larry I'm doing this problem as part of a contest so you're gonna watch me live as I go through my darts I'm coding they've been explanation near the end and for more context they'll be a link below on this actual screencast of the contest how did you do let me know you do hit the like button eith... | People Whose List of Favorite Companies Is Not a Subset of Another List | restaurant-growth | Given the array `favoriteCompanies` where `favoriteCompanies[i]` is the list of favorites companies for the `ith` person (**indexed from 0**).
_Return the indices of people whose list of favorite companies is not a **subset** of any other list of favorites companies_. You must return the indices in increasing order.
... | null | Database | Medium | null |
174 | Hello Everyone Welcome to Difficult Channel Subscribe To A Situation Has Done Game Liquid 174 Is Hotspot Of Birth And Its Very Interesting Problem Subscribe Must Subscribe School Width Minimum Amount Power S Key Settings Operation Electronic Example Dheer Vo Grade - - - Electronic Example Dheer Vo Grade - - - Electroni... | Dungeon Game | dungeon-game | The demons had captured the princess and imprisoned her in **the bottom-right corner** of a `dungeon`. The `dungeon` consists of `m x n` rooms laid out in a 2D grid. Our valiant knight was initially positioned in **the top-left room** and must fight his way through `dungeon` to rescue the princess.
The knight has an i... | null | Array,Dynamic Programming,Matrix | Hard | 62,64,741,2354 |
7 | hi everyone once again welcome to my channel and today again we are solving another problem from lit code top interview question list and the problem is reverse integer so i always recommend everyone to solve the top interview question list first if you are preparing for interviews so that list has almost around 146 pr... | Reverse Integer | reverse-integer | Given a signed 32-bit integer `x`, return `x` _with its digits reversed_. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-231, 231 - 1]`, then return `0`.
**Assume the environment does not allow you to store 64-bit integers (signed or unsigned).**
**Example 1:**
**Input:** x = 123
... | null | Math | Medium | 8,190,2238 |
349 | Soon A Ho to A Ho to A Ho to Ajay, you all are doing great, my name is Yatha Batra and today we will clear the simple question and the name of this question is Intersection of Two Years so as you can see on my screen. Yes, this is a recent question of 359 intersection of toe that if this question is latest then it is o... | Intersection of Two Arrays | intersection-of-two-arrays | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must be **unique** and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2\]
**Example 2:**
**Input:** nums1 = \[4,9,5\], nums2 = \... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 350,1149,1392,2190,2282 |
537 | hey how are you doing guys it's hilah bella here i recording stuff on youtube chat description for all my information i do all liquor problems uh make sure you subscribe to the channel give me a big thumbs up to support it and this is called complex number multiplication um given two strings representing two complex nu... | Complex Number Multiplication | complex-number-multiplication | A [complex number](https://en.wikipedia.org/wiki/Complex_number) can be represented as a string on the form `"**real**+**imaginary**i "` where:
* `real` is the real part and is an integer in the range `[-100, 100]`.
* `imaginary` is the imaginary part and is an integer in the range `[-100, 100]`.
* `i2 == -1`.
... | null | Math,String,Simulation | Medium | null |
1,496 | hello hi guys good morning welcome back to a new video in this video Problem path Crossing and the special part in this video is how to optimize the complexity without changing anything but only changing the data structure we will see this kind of problem uh it has been asked by Amazon in the last one two years and it ... | Path Crossing | lucky-numbers-in-a-matrix | Given a string `path`, where `path[i] = 'N'`, `'S'`, `'E'` or `'W'`, each representing moving one unit north, south, east, or west, respectively. You start at the origin `(0, 0)` on a 2D plane and walk on the path specified by `path`.
Return `true` _if the path crosses itself at any point, that is, if at any time you ... | Find out and save the minimum of each row and maximum of each column in two lists. Then scan through the whole matrix to identify the elements that satisfy the criteria. | Array,Matrix | Easy | null |
1,232 | hey guys persistent programmer here and today we're gonna do another week cool question check if it is a straight line okay so let's look at this problem statement and understand what the question is asking you are given an array coordinates with coordinate I equals XY where X Y represents a coordinate of a point check... | Check If It Is a Straight Line | sum-of-mutated-array-closest-to-target | You are given an array `coordinates`, `coordinates[i] = [x, y]`, where `[x, y]` represents the coordinate of a point. Check if these points make a straight line in the XY plane.
**Example 1:**
**Input:** coordinates = \[\[1,2\],\[2,3\],\[3,4\],\[4,5\],\[5,6\],\[6,7\]\]
**Output:** true
**Example 2:**
**Input:** coo... | If you draw a graph with the value on one axis and the absolute difference between the target and the array sum, what will you get? That graph is uni-modal. Use ternary search on that graph to find the best value. | Array,Binary Search,Sorting | Medium | null |
82 | Hello Everyone, today we are going to discuss whose Pran Math problem is Remove Duplicates Transport Play List. There are two problems with this problem that we have been shortlisted and hence we are removing whatever duplicate number is there on it. Like here it is 12345 You can see it here See this and two more times... | Remove Duplicates from Sorted List II | remove-duplicates-from-sorted-list-ii | Given the `head` of a sorted linked list, _delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list_. Return _the linked list **sorted** as well_.
**Example 1:**
**Input:** head = \[1,2,3,3,4,4,5\]
**Output:** \[1,2,5\]
**Example 2:**
**Input:** head = \[1,1,1,2,3\]
**Outpu... | null | Linked List,Two Pointers | Medium | 83,1982 |
1,494 | hey everybody this is Larry this is when I'm going to prompt I sell for the PI weekly contest 29 I'm gonna put the explanation in the beginning and then I'm gonna do the live coding of it afterwards let me know what you think about this format I'm still playing with it and here we hey everybody so for this problem I ac... | Parallel Courses II | activity-participants | You are given an integer `n`, which indicates that there are `n` courses labeled from `1` to `n`. You are also given an array `relations` where `relations[i] = [prevCoursei, nextCoursei]`, representing a prerequisite relationship between course `prevCoursei` and course `nextCoursei`: course `prevCoursei` has to be take... | null | Database | Medium | null |
1,710 | hello all welcome to code hub today let us solve the july's required daily challenge and the question is maximum units on a truck you are assigned to put some amount of boxes onto one truck you are given a 2d array box types where box types of i is number of boxes and number of units per box number of boxes i is the nu... | Maximum Units on a Truck | find-servers-that-handled-most-number-of-requests | You are assigned to put some amount of boxes onto **one truck**. You are given a 2D array `boxTypes`, where `boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]`:
* `numberOfBoxesi` is the number of boxes of type `i`.
* `numberOfUnitsPerBoxi` is the number of units in each box of the type `i`.
You are also given... | To speed up the next available server search, keep track of the available servers in a sorted structure such as an ordered set. To determine if a server is available, keep track of the end times for each task in a heap and add the server to the available set once the soonest task ending time is less than or equal to th... | Array,Greedy,Heap (Priority Queue),Ordered Set | Hard | null |
1,340 | Jhaal Hello Guys Welcome To Our Bloody Mary Worth It Will Be Discussed Some Questions Page In This Question Adhir Van Adhikari In Addition To Agree With U Kar Diya Answer Isko Add Ronit 282 subscribe and subscribe the Video then subscribe to the Page and to the Writer Off the indicated rites were performed but because ... | Jump Game V | the-dining-philosophers | Given an array of integers `arr` and an integer `d`. In one step you can jump from index `i` to index:
* `i + x` where: `i + x < arr.length` and `0 < x <= d`.
* `i - x` where: `i - x >= 0` and `0 < x <= d`.
In addition, you can only jump from index `i` to index `j` if `arr[i] > arr[j]` and `arr[i] > arr[k]` for a... | null | Concurrency | Medium | null |
309 | hey guys today we will be solving lead for problem 3 0 9 when it's time to buy and sell stock with cool down its it's basically a variation of the normal stock problem stock price problem of buying and selling stocks where you're giving stock prices on different days and you're supposed to gain maximum profit by they'r... | Best Time to Buy and Sell Stock with Cooldown | best-time-to-buy-and-sell-stock-with-cooldown | You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the following restrictions:
* After you sell your stock, yo... | null | Array,Dynamic Programming | Medium | 121,122 |
47 | hey everyone this is hope you are doing good so let's start with the first question so the question is permutation two okay so what you have given a collection of numbers uh it's a num array that might contain duplicate what you have to do you have to return all possible unique permutation in any order okay so this que... | 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 |
100 | hello hi everyone welcome back to the channel so today in this video lecture we're going to be solving this problem same tree so this problem in this problem we're given two binary trees the roots of two binary trees p and Q these represent the root nodes of the binary trees we need to write a function to check if they... | Same Tree | same-tree | Given the roots of two binary trees `p` and `q`, write a function to check if they are the same or not.
Two binary trees are considered the same if they are structurally identical, and the nodes have the same value.
**Example 1:**
**Input:** p = \[1,2,3\], q = \[1,2,3\]
**Output:** true
**Example 2:**
**Input:** p... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
1,601 | this is a column called maximum number of achievable transfer requests that is you have and buildings number from 0 to n minus one okay each building has a number of employees yes transfer season Transformers want to change the building reside in you're given an array request the request type also from two representing... | Maximum Number of Achievable Transfer Requests | maximum-number-of-achievable-transfer-requests | We have `n` buildings numbered from `0` to `n - 1`. Each building has a number of employees. It's transfer season, and some employees want to change the building they reside in.
You are given an array `requests` where `requests[i] = [fromi, toi]` represents an employee's request to transfer from building `fromi` to bu... | null | null | Hard | null |
617 | hi guys hope you're doing great our today's question is much to binary trees given to binary trees and imagine that when you put one on top 100 of them to cover the other some nodes of the two trees are overlapped while the others are not you need to merge them into a new binary tree the merge rule is that if two nodes... | Merge Two Binary Trees | merge-two-binary-trees | You are given two binary trees `root1` and `root2`.
Imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge the two trees into a new binary tree. The merge rule is that if two nodes overlap, then sum node values up as the new valu... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
199 | Hello Hi Guys ready today video seven I in this we will see the second approach of binary tree right side view earlier in that we had decided which level ROI and in this approach in this video we will fold this question by preorder traversal i.e. David Okay, so input it, they have done the i.e. David Okay, so input it,... | 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,672 | hello friends welcome to coding host youtube channel in this video i will explain you a lead code problem recharged customer wealth so in this question we will get a m into an integer grade accounts where accounts i and j is the amount of money is customer has in the jth bank return the wealth that the just customer ha... | Richest Customer Wealth | find-the-index-of-the-large-integer | You are given an `m x n` integer grid `accounts` where `accounts[i][j]` is the amount of money the `ith` customer has in the `jth` bank. Return _the **wealth** that the richest customer has._
A customer's **wealth** is the amount of money they have in all their bank accounts. The richest ... | Do a binary search over the array, exclude the half of the array that doesn't contain the largest number. Keep shrinking the search space till it reaches the size of 2 where you can easily determine which one has the largest integer. | Array,Binary Search,Interactive | Medium | 786 |
1,091 | hi everyone today we are here with the new problem and the problem is shortest path in a binary matrix so it is a medium type of problem and uh yes it is between the easy and medium and first we see what is the problem and then we see how we can solve it right so basically in this problem we have a given n cross and bi... | Shortest Path in Binary Matrix | maximum-average-subtree | Given an `n x n` binary matrix `grid`, return _the length of the shortest **clear path** in the matrix_. If there is no clear path, return `-1`.
A **clear path** in a binary matrix is a path from the **top-left** cell (i.e., `(0, 0)`) to the **bottom-right** cell (i.e., `(n - 1, n - 1)`) such that:
* All the visite... | Can you find the sum of values and the number of nodes for every sub-tree ? Can you find the sum of values and the number of nodes for a sub-tree given the sum of values and the number of nodes of it's left and right sub-trees ? Use depth first search to recursively find the solution for the children of a node then use... | Tree,Depth-First Search,Binary Tree | Medium | 2126 |
981 | in this video we have to design a key Value Store so let's understand the problem it says that we have to implement this class Time map and here we have to define the Constructor the setter method where you pass the key value so in a typical key Value Store like any hash map or any other map you just need key and value... | Time Based Key-Value Store | delete-columns-to-make-sorted | Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key's value at a certain timestamp.
Implement the `TimeMap` class:
* `TimeMap()` Initializes the object of the data structure.
* `void set(String key, String value, int timestamp)... | null | Array,String | Easy | null |
767 | hey guys how's everything going this is jeiza who is not good algorithms in this video I'm going to take a look at seven six seven reorganized string we're giving us rain check if your letters can be rearranged so that two characters that are adjacent to each other and not the same okay if possible output any possible ... | Reorganize String | prime-number-of-set-bits-in-binary-representation | Given a string `s`, rearrange the characters of `s` so that any two adjacent characters are not the same.
Return _any possible rearrangement of_ `s` _or return_ `" "` _if not possible_.
**Example 1:**
**Input:** s = "aab"
**Output:** "aba"
**Example 2:**
**Input:** s = "aaab"
**Output:** ""
**Constraints:**
* ... | Write a helper function to count the number of set bits in a number, then check whether the number of set bits is 2, 3, 5, 7, 11, 13, 17 or 19. | Math,Bit Manipulation | Easy | 191 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.