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 |
|---|---|---|---|---|---|---|---|---|
797 | hey guys welcome back to another video and today we're going to be solving the lead code question all paths from source to target so before i get started with the question uh if there's any lead code question you want me to solve specifically just let me know down in the comments and i'll try to get it solved for you a... | All Paths From Source to Target | rabbits-in-forest | Given a directed acyclic graph (**DAG**) of `n` nodes labeled from `0` to `n - 1`, find all possible paths from node `0` to node `n - 1` and return them in **any order**.
The graph is given as follows: `graph[i]` is a list of all nodes you can visit from node `i` (i.e., there is a directed edge from node `i` to node `... | null | Array,Hash Table,Math,Greedy | Medium | null |
1,059 | hello friends now list of the Oh party from source to destination let's see a statement given the ages of a directed graph and the two North's source and the destination of this graph determining whether or not a party starting from souls eventually end at destination there is at least one person exists from the source... | All Paths from Source Lead to Destination | missing-element-in-sorted-array | Given the `edges` of a directed graph where `edges[i] = [ai, bi]` indicates there is an edge between nodes `ai` and `bi`, and two nodes `source` and `destination` of this graph, determine whether or not all paths starting from `source` eventually, end at `destination`, that is:
* At least one path exists from the `s... | First define a function f(x) that counts the number of missing elements until x. Then use binary search with the given function f(x) to find the kth missing element. | Array,Binary Search | Medium | null |
1,877 | Hello everyone welcome to my channel Quote Surrey with Mike So today you are going to do video number five of the playlist of Two Pointer Technique, okay and it is a very simple question but it is a very good question and is also famous, this is also a similar question to it. Now I will tell you that it is marked mediu... | Minimize Maximum Pair Sum in Array | find-followers-count | The **pair sum** of a pair `(a,b)` is equal to `a + b`. The **maximum pair sum** is the largest **pair sum** in a list of pairs.
* For example, if we have pairs `(1,5)`, `(2,3)`, and `(4,4)`, the **maximum pair sum** would be `max(1+5, 2+3, 4+4) = max(6, 5, 8) = 8`.
Given an array `nums` of **even** length `n`, pai... | null | Database | Easy | null |
1,486 | hey everybody there's a slurry you're watching me solve this problem live during a contest I'm gonna stop the explanation and then it's going to go into some code review some times and then just me working on a prom let me know what you think about this format hit like button to subscribe one join me on a discord link ... | XOR Operation in an Array | find-the-distance-value-between-two-arrays | You are given an integer `n` and an integer `start`.
Define an array `nums` where `nums[i] = start + 2 * i` (**0-indexed**) and `n == nums.length`.
Return _the bitwise XOR of all elements of_ `nums`.
**Example 1:**
**Input:** n = 5, start = 0
**Output:** 8
**Explanation:** Array nums is equal to \[0, 2, 4, 6, 8\] w... | Sort 'arr2' and use binary search to get the closest element for each 'arr1[i]', it gives a time complexity of O(nlogn). | Array,Two Pointers,Binary Search,Sorting | Easy | null |
25 | so let's continue with our playlist before that hey welcome back to the channel I hope you guys are doing extremely well so the problem that we will be solving today is reversing nodes in k group so what is the problem exactly stating it is stating that you will be given the head of the link list and you'll also be giv... | Reverse Nodes in k-Group | reverse-nodes-in-k-group | Given the `head` of a linked list, reverse the nodes of the list `k` at a time, and return _the modified list_.
`k` is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of `k` then left-out nodes, in the end, should remain as it is.
You may not alt... | null | Linked List,Recursion | Hard | 24,528,2196 |
845 | hey guys welcome back to another video and today we're going to be solving the lee code question longest mountain in area all right so in this question let's call any contiguous sub array b of a mountain if it has the following properties so the sub area b must have a length which is greater than or equal to three and ... | Longest Mountain in Array | longest-mountain-in-array | You may recall that an array `arr` is a **mountain array** if and only if:
* `arr.length >= 3`
* There exists some index `i` (**0-indexed**) 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 - 1]`
Given an integer arr... | null | null | Medium | null |
111 | all right so this leaker question is called minimum depth of binary tree it says given a binary tree find its minimum depth the minimum depth is the number of nodes along the shortest paths from the root node down to the nearest leaf node note a leaf is a node with no children all right so given this binary tree if we ... | 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 |
83 | everyone today we are looking at lead code number 83 remove duplicates from a sorted list okay so this question here is asking if we have a list of one two we want to remove any duplicates we want to remove this 1 here and return 1 2. here we have 1 2 3. we want to go ahead and remove this one over here and either one ... | 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 |
402 | Hello guys welcome back to tech division in this video also directly remove's digit problem wish to meet code 9th me challenge so let's not look at the problem statement the problems the giver unwanted birth represented as a string remove's deposits from the number is the Smallest Possible Number 9 Notes The Length of ... | Remove K Digits | remove-k-digits | Given string num representing a non-negative integer `num`, and an integer `k`, return _the smallest possible integer after removing_ `k` _digits from_ `num`.
**Example 1:**
**Input:** num = "1432219 ", k = 3
**Output:** "1219 "
**Explanation:** Remove the three digits 4, 3, and 2 to form the new number 1219 which ... | null | String,Stack,Greedy,Monotonic Stack | Medium | 321,738,1792,2305 |
426 | hey everybody this is Larry this is me trying to do an extra bonus premium Farm oh yeah I hit 1900 so maybe that's to celebrate uh let's do it let's do one they haven't done before hopefully how do I do this yeah uh medium let's just say and maybe we'll get an SQL question because I feel like that happens a lot okay no... | Convert Binary Search Tree to Sorted Doubly Linked List | convert-binary-search-tree-to-sorted-doubly-linked-list | Convert a **Binary Search Tree** to a sorted **Circular Doubly-Linked List** in place.
You can think of the left and right pointers as synonymous to the predecessor and successor pointers in a doubly-linked list. For a circular doubly linked list, the predecessor of the first element is the last element, and the succe... | null | null | Medium | null |
1,802 | welcome to Pomodoro Joe for Saturday June 10th 2023 today we're doing leaked code problem 1802 maximum value at a given index in a bounded array this is a medium problem you're given three positive integers n index and Max sum you want to construct an array nums which is zero indexed that satisfies the following condit... | Maximum Value at a Given Index in a Bounded Array | number-of-students-unable-to-eat-lunch | You are given three positive integers: `n`, `index`, and `maxSum`. You want to construct an array `nums` (**0-indexed**) that satisfies the following conditions:
* `nums.length == n`
* `nums[i]` is a **positive** integer where `0 <= i < n`.
* `abs(nums[i] - nums[i+1]) <= 1` where `0 <= i < n-1`.
* The sum of a... | Simulate the given in the statement Calculate those who will eat instead of those who will not. | Array,Stack,Queue,Simulation | Easy | 2195 |
674 | hey everyone welcome back and today we'll be doing another Elite code 674 longest continuous increasing subsequence this is an easy one given around saute sorted array of integers num return the length of the longest continuous increasing subsequence the subsequence must be strictly increasing so in this case we are go... | Longest Continuous Increasing Subsequence | longest-continuous-increasing-subsequence | Given an unsorted array of integers `nums`, return _the length of the longest **continuous increasing subsequence** (i.e. subarray)_. The subsequence must be **strictly** increasing.
A **continuous increasing subsequence** is defined by two indices `l` and `r` (`l < r`) such that it is `[nums[l], nums[l + 1], ..., num... | null | Array | Easy | 673,727 |
1,955 | come on easy question okay hard question all right given an array numbers consisting of only zero one and twos return the number of different subsequents that are special in special means if it consists of positive number of zeros positive followed by a positive number of ones positive number of twos since then says la... | Count Number of Special Subsequences | seat-reservation-manager | A sequence is **special** if it consists of a **positive** number of `0`s, followed by a **positive** number of `1`s, then a **positive** number of `2`s.
* For example, `[0,1,2]` and `[0,0,1,1,1,2]` are special.
* In contrast, `[2,1,0]`, `[1]`, and `[0,1,2,0]` are not special.
Given an array `nums` (consisting of... | You need a data structure that maintains the states of the seats. This data structure should also allow you to get the first available seat and flip the state of a seat in a reasonable time. You can let the data structure contain the available seats. Then you want to be able to get the lowest element and erase an eleme... | Design,Heap (Priority Queue) | Medium | 379 |
958 | hey what's up guys this is shown here and this time let's continue on this on our tree journey here so today we're gonna talk about this number 958 check completeness of a binary tree so for those who doesn't know what the complete binary tree is so complete a complete binary tree and then if it's not the last level al... | 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,371 | hello everyone so in this video let us talk about a medievable problem from lead code the problem name is find the longest substring containing vowels in even count let us talk about the problem statement first it states that you are given a string s you have to return the size of the longest substring containing each ... | Find the Longest Substring Containing Vowels in Even Counts | minimum-remove-to-make-valid-parentheses | Given the string `s`, return the size of the longest substring containing each vowel an even number of times. That is, 'a', 'e', 'i', 'o', and 'u' must appear an even number of times.
**Example 1:**
**Input:** s = "eleetminicoworoep "
**Output:** 13
**Explanation:** The longest substring is "leetminicowor " which c... | Each prefix of a balanced parentheses has a number of open parentheses greater or equal than closed parentheses, similar idea with each suffix. Check the array from left to right, remove characters that do not meet the property mentioned above, same idea in backward way. | String,Stack | Medium | 2095,2221 |
1,971 | hey everybody this is Larry this is Minicon do an extra bonus question um this is a little bit later in the day so I'm going to restrict the difficulty to medium and easy or okay so you can really choose both and I it's a little bit later today so let's just do an easy one then and then pick a random one that isn't an ... | Find if Path Exists in Graph | incremental-memory-leak | There is a **bi-directional** graph with `n` vertices, where each vertex is labeled from `0` to `n - 1` (**inclusive**). The edges in the graph are represented as a 2D integer array `edges`, where each `edges[i] = [ui, vi]` denotes a bi-directional edge between vertex `ui` and vertex `vi`. Every vertex pair is connecte... | What is the upper bound for the number of seconds? Simulate the process of allocating memory. | Simulation | Medium | null |
215 | so my folks today Les Deux little problem 2:15 the case largest element in problem 2:15 the case largest element in problem 2:15 the case largest element in the array so in this problem so we will use an algorithm called quick select it's very similar with quicksort except for quicksort is this time complexity is o n t... | Kth Largest Element in an Array | kth-largest-element-in-an-array | Given an integer array `nums` and an integer `k`, return _the_ `kth` _largest element in the array_.
Note that it is the `kth` largest element in the sorted order, not the `kth` distinct element.
You must solve it in `O(n)` time complexity.
**Example 1:**
**Input:** nums = \[3,2,1,5,6,4\], k = 2
**Output:** 5
**Ex... | null | Array,Divide and Conquer,Sorting,Heap (Priority Queue),Quickselect | Medium | 324,347,414,789,1014,2113,2204,2250 |
322 | hey guys it's all five one here and today we're going to be solving coin change in this problem we're given an array called coins and this represents coins of different denominations and that gives an integer amount that represent the total amount of money we want to get and in this problem they want us to return the f... | Coin Change | coin-change | You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money.
Return _the fewest number of coins that you need to make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `-1`.
You may a... | null | Array,Dynamic Programming,Breadth-First Search | Medium | 1025,1393,2345 |
88 | welcome to joey's tech friends in this video we are going to look into solving another interview question from lead code which is merge sorted array this is one of the most commonly asked questions that every fresher coder or experience coder must have in his or her pocket so without delaying any further let's look int... | Merge Sorted Array | merge-sorted-array | You are given two integer arrays `nums1` and `nums2`, sorted in **non-decreasing order**, and two integers `m` and `n`, representing the number of elements in `nums1` and `nums2` respectively.
**Merge** `nums1` and `nums2` into a single array sorted in **non-decreasing order**.
The final sorted array should not be re... | You can easily solve this problem if you simply think about two elements at a time rather than two arrays. We know that each of the individual arrays is sorted. What we don't know is how they will intertwine. Can we take a local decision and arrive at an optimal solution? If you simply consider one element each at a ti... | Array,Two Pointers,Sorting | Easy | 21,1019,1028 |
774 | hey what's up guys chung here this time let's continue our lead cold journey number 774 minimize max distance to gas stations all right okay let's take a look you're giving like stations of gas stations and the number K here and you need to return the minimum distance the minimum of the minimum distance between all the... | Minimize Max Distance to Gas Station | maximum-depth-of-n-ary-tree | You are given an integer array `stations` that represents the positions of the gas stations on the **x-axis**. You are also given an integer `k`.
You should add `k` new gas stations. You can add the stations anywhere on the **x-axis**, and not necessarily on an integer position.
Let `penalty()` be the maximum distanc... | null | Tree,Depth-First Search,Breadth-First Search | Easy | 104,2151 |
438 | hello everyone in this video we will be solving problem 438 find all animal grams in a string the problem statement is we are given two strings s and p we need to return an array of all the starting indices of peas analgram in s we can return the answer in any order if you don't know what analgram is it is a word or a ... | Find All Anagrams in a String | find-all-anagrams-in-a-string | Given two strings `s` and `p`, return _an array of all the start indices of_ `p`_'s anagrams in_ `s`. You may return the answer in **any order**.
An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
**Example 1:**
*... | null | Hash Table,String,Sliding Window | Medium | 242,567 |
39 | Videos related to this torch started and the name of your question and question from blind is this combination song AP's statement on force take you easily and question kahne kaise hain we have kept from the candidate that I represent the messages to the candidate and target Confirm that we have given, let's represent.... | Combination Sum | combination-sum | Given an array of **distinct** integers `candidates` and a target integer `target`, return _a list of all **unique combinations** of_ `candidates` _where the chosen numbers sum to_ `target`_._ You may return the combinations in **any order**.
The **same** number may be chosen from `candidates` an **unlimited number of... | null | Array,Backtracking | Medium | 17,40,77,216,254,377 |
645 | Hello everyone should stop this question of second match latest mismatch will happen again description changes question even your that I set of India is visually contain all the number from 128 digit point to time drops number is as defeated to the number wins and which Is the definition of one number and of the number... | Set Mismatch | set-mismatch | You have a set of integers `s`, which originally contains all the numbers from `1` to `n`. Unfortunately, due to some error, one of the numbers in `s` got duplicated to another number in the set, which results in **repetition of one** number and **loss of another** number.
You are given an integer array `nums` represe... | null | Array,Hash Table,Bit Manipulation,Sorting | Easy | 287 |
34 | Ajay Ko Jhali Hello brother Manish Mishra from Falling Swayam Sachin is important but I have to try that question whose name is Find First and Last Position of Element in Spotted. Okay, so you have got the basic question. What would you have got in this question? Found a target, you have to tell the first to last index... | Find First and Last Position of Element in Sorted Array | find-first-and-last-position-of-element-in-sorted-array | Given an array of integers `nums` sorted in non-decreasing order, find the starting and ending position of a given `target` value.
If `target` is not found in the array, return `[-1, -1]`.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[5,7,7,8,8,10\], target = 8
*... | null | Array,Binary Search | Medium | 278,2165,2210 |
1,079 | hey how you doing guys it's ilya bella here i recording stuff on youtube chat description for all my information i do all legal problems make sure you um subscribe to this channel give me a big thumbs up to support it and this is called leather tile possibilities you have a set of tiles where each style has one letter ... | Letter Tile Possibilities | sum-of-root-to-leaf-binary-numbers | You have `n` `tiles`, where each tile has one letter `tiles[i]` printed on it.
Return _the number of possible non-empty sequences of letters_ you can make using the letters printed on those `tiles`.
**Example 1:**
**Input:** tiles = "AAB "
**Output:** 8
**Explanation:** The possible sequences are "A ", "B ", "AA... | Find each path, then transform that path to an integer in base 10. | Tree,Depth-First Search,Binary Tree | Easy | null |
412 | hello everyone welcome back to Alico problem solving session today we're going to be doing probably the most infamous interview problem is dare I say extremely easy if you do know how to code if you don't know how to code then I could see it just understanding exactly how to write the code to do this would be a problem... | Fizz Buzz | fizz-buzz | Given an integer `n`, return _a string array_ `answer` _(**1-indexed**) where_:
* `answer[i] == "FizzBuzz "` if `i` is divisible by `3` and `5`.
* `answer[i] == "Fizz "` if `i` is divisible by `3`.
* `answer[i] == "Buzz "` if `i` is divisible by `5`.
* `answer[i] == i` (as a string) if none of the above condit... | null | Math,String,Simulation | Easy | 1316 |
1,657 | hey guys welcome to a new video in today's video we're going to look at a lead code problem and the problem's name is determine if two strings are Clos so in this question we given two strings and they're considered close if you can attain one string from the other using the following operations the first operation sta... | Determine if Two Strings Are Close | find-the-winner-of-an-array-game | Two strings are considered **close** if you can attain one from the other using the following operations:
* Operation 1: Swap any two **existing** characters.
* For example, `abcde -> aecdb`
* Operation 2: Transform **every** occurrence of one **existing** character into another **existing** character, and d... | If k ≥ arr.length return the max element of the array. If k < arr.length simulate the game until a number wins k consecutive games. | Array,Simulation | Medium | null |
890 | hello everyone welcome to day 21st of my lead code challenge and today's question is find and replace pattern so without much to do let's look at the question and the solution why the presentation that i've created for this and let me just start the slideshow let me just take a pen i hope all of you are enjoying these ... | Find and Replace Pattern | lemonade-change | Given a list of strings `words` and a string `pattern`, return _a list of_ `words[i]` _that match_ `pattern`. You may return the answer in **any order**.
A word matches the pattern if there exists a permutation of letters `p` so that after replacing every letter `x` in the pattern with `p(x)`, we get the desired word.... | null | Array,Greedy | Easy | null |
983 | welcome to august leco challenge today's problem is minimum cost for tickets in a country popular for train travel you have planned some train traveling one year in advance the days of the year you will travel is given as an array each day is an integer 1 to 365. all right so that's simple enough now we have three trai... | 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 |
38 | Hi gas welcome and welcome back to my channel so today our problem is count and say so what have you given us in this problem statement, here we have been given a wait number and according to that what we have to do is a sequence of digital distancing. If you have to find it, then how will you find it now, let us under... | Count and Say | count-and-say | The **count-and-say** sequence is a sequence of digit strings defined by the recursive formula:
* `countAndSay(1) = "1 "`
* `countAndSay(n)` is the way you would "say " the digit string from `countAndSay(n-1)`, which is then converted into a different digit string.
To determine how you "say " a digit string, spli... | The following are the terms from n=1 to n=10 of the count-and-say sequence:
1. 1
2. 11
3. 21
4. 1211
5. 111221
6. 312211
7. 13112221
8. 1113213211
9. 31131211131221
10. 13211311123113112211 To generate the nth term, just count and say the n-1th term. | String | Medium | 271,443 |
1,936 | hey everybody this is larry this is me going with q2 of the weekly contest 250 at minimum number of rungs so hit the like button to subscribe and join me in discord let me know what you think about this farm and so forth um so this one is just greedy um basically you're trying to get from zero to the last element and y... | Add Minimum Number of Rungs | maximize-number-of-nice-divisors | You are given a **strictly increasing** integer array `rungs` that represents the **height** of rungs on a ladder. You are currently on the **floor** at height `0`, and you want to reach the last rung.
You are also given an integer `dist`. You can only climb to the next highest rung if the distance between where you a... | The number of nice divisors is equal to the product of the count of each prime factor. Then the problem is reduced to: given n, find a sequence of numbers whose sum equals n and whose product is maximized. This sequence can have no numbers that are larger than 4. Proof: if it contains a number x that is larger than 4, ... | Math,Recursion | Hard | 343 |
974 | That in this problem where to find account of all the amazing maze special news like share subscribe button to subscribe this Video Please subscribe and subscribe the to know what will happen and effective way to return to all the black 06 that this wi-fi switch is simple Return Gift that this wi-fi switch is simple Re... | Subarray Sums Divisible by K | reorder-data-in-log-files | Given an integer array `nums` and an integer `k`, return _the number of non-empty **subarrays** that have a sum divisible by_ `k`.
A **subarray** is a **contiguous** part of an array.
**Example 1:**
**Input:** nums = \[4,5,0,-2,-3,1\], k = 5
**Output:** 7
**Explanation:** There are 7 subarrays with a sum divisible b... | null | Array,String,Sorting | Easy | null |
1,449 | hey everybody this is Larry I'm doing this problem as part of a contest so you're gonna watch me live as I go through my darts I'm coding they've been explanation near the end and for more context there'll be a link below on this actual screencast of the contest how did you do let me know you do hit the like button eit... | Form Largest Integer With Digits That Add up to Target | print-words-vertically | Given an array of integers `cost` and an integer `target`, return _the **maximum** integer you can paint under the following rules_:
* The cost of painting a digit `(i + 1)` is given by `cost[i]` (**0-indexed**).
* The total cost used must be equal to `target`.
* The integer does not have `0` digits.
Since the ... | Use the maximum length of words to determine the length of the returned answer. However, don't forget to remove trailing spaces. | Array,String,Simulation | Medium | null |
1,903 | hello guys my name is assalam welcome back to my channel and today we are going to solve a new lead code question that is largest odd number in a string so we will be solving this question with the help of Python and the question says you are given a string num representing a large integer written the largest varied od... | Largest Odd Number in String | design-most-recently-used-queue | You are given a string `num`, representing a large integer. Return _the **largest-valued odd** integer (as a string) that is a **non-empty substring** of_ `num`_, or an empty string_ `" "` _if no odd integer exists_.
A **substring** is a contiguous sequence of characters within a string.
**Example 1:**
**Input:** nu... | You can store the data in an array and apply each fetch by moving the ith element to the end of the array (i.e, O(n) per operation). A better way is to use the square root decomposition technique. You can build chunks of size sqrt(n). For each fetch operation, You can search for the chunk which has the ith element and ... | Array,Hash Table,Stack,Design,Binary Indexed Tree,Ordered Set | Medium | 146 |
1,291 | hey everybody this is larry this is me going over day 19 of the leeco dairy challenge uh hit the like button hit the subscribe button join me on uh discord let me know what you think uh got a haircut uh i don't know just feel like people are vlogging or something right anyway uh sequential digits let's get to it uh a n... | Sequential Digits | immediate-food-delivery-i | An integer has _sequential digits_ if and only if each digit in the number is one more than the previous digit.
Return a **sorted** list of all the integers in the range `[low, high]` inclusive that have sequential digits.
**Example 1:**
**Input:** low = 100, high = 300
**Output:** \[123,234\]
**Example 2:**
**Inp... | null | Database | Easy | null |
94 | um hello so today we are going to do this problem binary in order traversal which is part of this week's um this uh daily challenge litecoin daily challenge so we have a root of a binary tree and we want to return the inorder traversal in you know the traversal is just means the order from left to right so we have left... | 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 |
93 | hello guys my name is vishwas itan I hope you all are fine so let's solve today's lead code daily challenge restore IP address uh question says a valid IP address consists of attractive food integers subtited by a single Dot so each integer is between 0 and 255 okay and cannot have a leading zeros so it cannot have a l... | Restore IP Addresses | restore-ip-addresses | A **valid IP address** consists of exactly four integers separated by single dots. Each integer is between `0` and `255` (**inclusive**) and cannot have leading zeros.
* For example, `"0.1.2.201 "` and `"192.168.1.1 "` are **valid** IP addresses, but `"0.011.255.245 "`, `"192.168.1.312 "` and `"192.168@1.1 "` are **... | null | String,Backtracking | Medium | 752 |
46 | hello and welcome back to the cracking fan YouTube channel today we're going to be solving Elite code problem number 46 permutations given an array of nums of distinct integers return all the possible permutations you can return the answer in any order so let's now look at our example one two three and remember that pe... | Permutations | permutations | Given an array `nums` of distinct integers, return _all the possible permutations_. You can return the answer in **any order**.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,1\],\[3,1,2\],\[3,2,1\]\]
**Example 2:**
**Input:** nums = \[0,1\]
**Output:** \[\[0,1\],\[1,0\... | null | Array,Backtracking | Medium | 31,47,60,77 |
264 | hey everybody this is Larry this is the fourth day of the July litko daily challenge it's like button hit the subscribe button join a disco let me know what you think I'm gonna go into the explanation right now and then afterwards you could see me attack this farm life but they say I agree numbers - you're given three ... | Ugly Number II | ugly-number-ii | An **ugly number** is a positive integer whose prime factors are limited to `2`, `3`, and `5`.
Given an integer `n`, return _the_ `nth` _**ugly number**_.
**Example 1:**
**Input:** n = 10
**Output:** 12
**Explanation:** \[1, 2, 3, 4, 5, 6, 8, 9, 10, 12\] is the sequence of the first 10 ugly numbers.
**Example 2:**
... | The naive approach is to call isUgly for every number until you reach the nth one. Most numbers are not ugly. Try to focus your effort on generating only the ugly ones. An ugly number must be multiplied by either 2, 3, or 5 from a smaller ugly number. The key is how to maintain the order of the ugly numbers. Try a simi... | Hash Table,Math,Dynamic Programming,Heap (Priority Queue) | Medium | 23,204,263,279,313,1307 |
148 | Hi riven welcome back tu turn off in this video c r covering a problem statement from lead gold which is salt linked list un so in this question we have given the head node of our single digit list and we have to salt it linklies meaning sorting So we have to sort in kismelon. We have to sort in sending order. Okay, so... | Sort List | sort-list | Given the `head` of a linked list, return _the list after sorting it in **ascending order**_.
**Example 1:**
**Input:** head = \[4,2,1,3\]
**Output:** \[1,2,3,4\]
**Example 2:**
**Input:** head = \[-1,5,3,4,0\]
**Output:** \[-1,0,3,4,5\]
**Example 3:**
**Input:** head = \[\]
**Output:** \[\]
**Constraints:**
* ... | null | Linked List,Two Pointers,Divide and Conquer,Sorting,Merge Sort | Medium | 21,75,147,1992 |
1,814 | hey how's it going leite code 1814 count nice pairs in an array you're given an array nums that consists of non- array nums that consists of non- array nums that consists of non- negative integers let us Define rev X as the reverse of the non- negative integer the reverse of the non- negative integer the reverse of the... | Count Nice Pairs in an Array | jump-game-vi | You are given an array `nums` that consists of non-negative integers. Let us define `rev(x)` as the reverse of the non-negative integer `x`. For example, `rev(123) = 321`, and `rev(120) = 21`. A pair of indices `(i, j)` is **nice** if it satisfies all of the following conditions:
* `0 <= i < j < nums.length`
* `nu... | Let dp[i] be "the maximum score to reach the end starting at index i". The answer for dp[i] is nums[i] + max{dp[i+j]} for 1 <= j <= k. That gives an O(n*k) solution. Instead of checking every j for every i, keep track of the largest dp[i] values in a heap and calculate dp[i] from right to left. When the largest value i... | Array,Dynamic Programming,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue | Medium | 239,2001 |
474 | hello guys welcome to another video in the series of coding today we are going to do a problem which is called ones and zeros so you are given an area of binary strings strs and two integers m and n you have to return the size of the largest subset of strs such that there are at most m zeros and n once in the subset uh... | Ones and Zeroes | ones-and-zeroes | You are given an array of binary strings `strs` and two integers `m` and `n`.
Return _the size of the largest subset of `strs` such that there are **at most**_ `m` `0`_'s and_ `n` `1`_'s in the subset_.
A set `x` is a **subset** of a set `y` if all elements of `x` are also elements of `y`.
**Example 1:**
**Input:**... | null | Array,String,Dynamic Programming | Medium | 510,600,2261 |
884 | hi my name is david today we're going to do number 8 for uncommon words from two sentences this is an easy level problem on lead code and we're going to solve it in javascript so basically we have a function that takes an a and b they're both strings and you get those sentences and they're they want us to return an out... | Uncommon Words from Two Sentences | k-similar-strings | A **sentence** is a string of single-space separated words where each word consists only of lowercase letters.
A word is **uncommon** if it appears exactly once in one of the sentences, and **does not appear** in the other sentence.
Given two **sentences** `s1` and `s2`, return _a list of all the **uncommon words**_.... | null | String,Breadth-First Search | Hard | 770 |
1,790 | hey folks welcome back to another video today we're looking at question 1790 check if one string swap can make strings equal though we will be solving this problem is by keeping a track of all the indices that we need to change or possibly swap um and check if the number of indices are greater than two or not but befor... | Check if One String Swap Can Make Strings Equal | lowest-common-ancestor-of-a-binary-tree-iii | You are given two strings `s1` and `s2` of equal length. A **string swap** is an operation where you choose two indices in a string (not necessarily different) and swap the characters at these indices.
Return `true` _if it is possible to make both strings equal by performing **at most one string swap** on **exactly on... | Store the path from p to the root. Traverse the path from q to the root, the first common point of the two paths is the LCA. | Hash Table,Tree,Binary Tree | Medium | 235,236,1780,1816 |
239 | hey friends welcome to the new episode of code with Jess so today let's do leap code number 239 sliding window Maxima if you haven't done this question before please feel free to pause this video and try it yourself I'll put a link in the description box so this question is given an array of numbers and given the windo... | Sliding Window Maximum | sliding-window-maximum | You are given an array of integers `nums`, there is a sliding window of size `k` which is moving from the very left of the array to the very right. You can only see the `k` numbers in the window. Each time the sliding window moves right by one position.
Return _the max sliding window_.
**Example 1:**
**Input:** nums... | How about using a data structure such as deque (double-ended queue)? The queue size need not be the same as the window’s size. Remove redundant elements and the queue should store only elements that need to be considered. | Array,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue | Hard | 76,155,159,265,1814 |
1,254 | Hello gas welcome you me channel number one tu five four okay the name of the question is number of close okay Google asked this question and by looking at the input of the question and understand what is the question okay you must have given one you the great. Okay, if you pay attention in the 2D grid, whatever is for... | Number of Closed Islands | deepest-leaves-sum | Given a 2D `grid` consists of `0s` (land) and `1s` (water). An _island_ is a maximal 4-directionally connected group of `0s` and a _closed island_ is an island **totally** (all left, top, right, bottom) surrounded by `1s.`
Return the number of _closed islands_.
**Example 1:**
**Input:** grid = \[\[1,1,1,1,1,1,1,0\],... | Traverse the tree to find the max depth. Traverse the tree again to compute the sum required. | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
1,416 | Hello everyone welcome back to my channel once again here we are going to talk about the problem of lead code daily challenge which is today's problem okay and this lead code is one of the hard part which is where the question name you are seeing. This is one of the hard questions and here we are going to discuss it, s... | Restore The Array | check-if-an-array-is-consecutive | A program was supposed to print an array of integers. The program forgot to print whitespaces and the array is printed as a string of digits `s` and all we know is that all integers in the array were in the range `[1, k]` and there are no leading zeros in the array.
Given the string `s` and the integer `k`, return _th... | Try sorting nums. If nums is consecutive and sorted in ascending order, then nums[i] + 1 = nums[i + 1] for every i in the range 0 ≤ i < nums.length - 1. | Array | Easy | 298,549,1542 |
1,287 | yeahyeah Hi everyone, I'm a programmer. Today I'm going to introduce to you a problem titled as follows: you a problem titled as follows: you a problem titled as follows: elements appear more than 25 percent in an arranged piece. Arranging the detailed problem as follows gives us a table of integers arranged in ascendi... | Element Appearing More Than 25% In Sorted Array | distance-between-bus-stops | Given an integer array **sorted** in non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time, return that integer.
**Example 1:**
**Input:** arr = \[1,2,2,6,6,6,6,7,10\]
**Output:** 6
**Example 2:**
**Input:** arr = \[1,1\]
**Output:** 1
**Constraints:**
* `1 <= arr... | Find the distance between the two stops if the bus moved in clockwise or counterclockwise directions. | Array | Easy | null |
199 | hi everyone today we are going to talk with a little question binary tree right side view so you are given root of binary tree imagine your yourself standing on the right side of it Returns the values of the nodes you can see all that from top to bottom so let's see the example so you are given one two three five four ... | 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 |
941 | Hello Everyone, the first number of the code we are going to discuss today is the name of Nine Four One Problem: Lift and Carry. Problem: Lift and Carry. Problem: Lift and Carry. What is there in it is that we have been given an egg and I want to tell you that whether we set the mountain or not, how is this mountain? A... | Valid Mountain Array | sort-array-by-parity | Given an array of integers `arr`, return _`true` if and only if it is a valid mountain array_.
Recall that 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]... | null | Array,Two Pointers,Sorting | Easy | 2283,2327 |
1,359 | hello everyone welcome back here is Vanessa and today we are diving deep into lead code daily challenge count overall its pickup and delivery option and we are going to explore not one Note 2 but three different methods to solve it so let's dive in all right so the game is S4 uh it's say we have an order and each with ... | Count All Valid Pickup and Delivery Options | circular-permutation-in-binary-representation | Given `n` orders, each order consist in pickup and delivery services.
Count all valid pickup/delivery possible sequences such that delivery(i) is always after of pickup(i).
Since the answer may be too large, return it modulo 10^9 + 7.
**Example 1:**
**Input:** n = 1
**Output:** 1
**Explanation:** Unique order (P1, ... | Use gray code to generate a n-bit sequence. Rotate the sequence such that its first element is start. | Math,Backtracking,Bit Manipulation | Medium | null |
1,652 | Al so this question is fuse the bomb so you are given a circular array and integer K so K can be greater less than or equal so if K is greater you want to add some of the next K numbers if K is less than zero you want to add the previous K number if k equal zero return zero and then you want to return the new array oka... | Defuse the Bomb | minimum-suffix-flips | You have a bomb to defuse, and your time is running out! Your informer will provide you with a **circular** array `code` of length of `n` and a key `k`.
To decrypt the code, you must replace every number. All the numbers are replaced **simultaneously**.
* If `k > 0`, replace the `ith` number with the sum of the **n... | Consider a strategy where the choice of bulb with number i is increasing. In such a strategy, you no longer need to worry about bulbs that have been set to the left. | String,Greedy | Medium | null |
9 | okay this is leak code 9 in javascript palindrome number so palindrome as they say is something that's the same backwards as forwards so i'll show you a couple of ways to do this uh the way i solve this so first i'm going to start this by setting reversed to this input x and all i'm going to do here is i'm going to con... | Palindrome Number | palindrome-number | Given an integer `x`, return `true` _if_ `x` _is a_ _**palindrome**__, and_ `false` _otherwise_.
**Example 1:**
**Input:** x = 121
**Output:** true
**Explanation:** 121 reads as 121 from left to right and from right to left.
**Example 2:**
**Input:** x = -121
**Output:** false
**Explanation:** From left to right, i... | Beware of overflow when you reverse the integer. | Math | Easy | 234,1375 |
58 | Hello Everyone Welcome To My Channel It's All The Problem Length of Clans Words For This Is Very Easy Problem And Straightforward Suryavanshi Open Soft And Terrific Subscribe Length Of The Last Word Meaning Word In Root From Left To Right In Distic Last But Not Least 1000 maximum subscribe button the return of the solu... | Length of Last Word | length-of-last-word | Given a string `s` consisting of words and spaces, return _the length of the **last** word in the string._
A **word** is a maximal substring consisting of non-space characters only.
**Example 1:**
**Input:** s = "Hello World "
**Output:** 5
**Explanation:** The last word is "World " with length 5.
**Example 2:**
... | null | String | Easy | null |
162 | foreign problem and the problem's name is find Peak element in this question we are given an array called nums and we have to find a peak element and return its index and it says it might be possible that there are multiple Peaks inside the array written any one of the Peaks so how do you identify element is a peak and... | Find Peak Element | find-peak-element | A peak element is an element that is strictly greater than its neighbors.
Given a **0-indexed** integer array `nums`, find a peak element, and return its index. If the array contains multiple peaks, return the index to **any of the peaks**.
You may imagine that `nums[-1] = nums[n] = -∞`. In other words, an element is... | null | Array,Binary Search | Medium | 882,2047,2273,2316 |
1,534 | hi guys so we will do the question count good triplets so this is a easy level question and given an array of integers arr and three integers abc you need to find the number of plates so what is meant by voter plates per triplet a r of i a r of j a r of k is good if the following conditions hold true i and j i j and k ... | Count Good Triplets | minimum-number-of-frogs-croaking | Given an array of integers `arr`, and three integers `a`, `b` and `c`. You need to find the number of good triplets.
A triplet `(arr[i], arr[j], arr[k])` is **good** if the following conditions are true:
* `0 <= i < j < k < arr.length`
* `|arr[i] - arr[j]| <= a`
* `|arr[j] - arr[k]| <= b`
* `|arr[i] - arr[k]|... | keep the frequency of all characters from "croak" using a hashmap. For each character in the given string, greedily match it to a possible "croak". | String,Counting | Medium | null |
1,312 | hi guys good morning welcome back to the next video it's a pretty easy problem if you have done the last lectures of our DP or the programs of RDP I just recommend please try this problem by yourself it's actually an easy problem but let's quickly jump to the problem statement itself it says meme session steps to make ... | Minimum Insertion Steps to Make a String Palindrome | count-artifacts-that-can-be-extracted | Given a string `s`. In one step you can insert any character at any index of the string.
Return _the minimum number of steps_ to make `s` palindrome.
A **Palindrome String** is one that reads the same backward as well as forward.
**Example 1:**
**Input:** s = "zzazz "
**Output:** 0
**Explanation:** The string "zz... | Check if each coordinate of each artifact has been excavated. How can we do this quickly without iterating over the dig array every time? Consider marking all excavated cells in a 2D boolean array. | Array,Hash Table,Simulation | Medium | 221 |
797 | everyone in this video let's go to question 797 all paths from source to Target only code this is part of our blind 75 list of questions so let's begin in this question we're given a directed acyclic graph dag of endnodes labeled 0 to n minus 1 and you want to find all possible paths from node 0 to node n minus 1 and r... | All Paths From Source to Target | rabbits-in-forest | Given a directed acyclic graph (**DAG**) of `n` nodes labeled from `0` to `n - 1`, find all possible paths from node `0` to node `n - 1` and return them in **any order**.
The graph is given as follows: `graph[i]` is a list of all nodes you can visit from node `i` (i.e., there is a directed edge from node `i` to node `... | null | Array,Hash Table,Math,Greedy | Medium | null |
491 | to day 28th of Jan lead Cod Challenge I hope all of you are in a great spirit and by the way this painting is made by me so I'll be sh I have created a new wall I've got my paintings framed and there is a very good surprise for all of you so stay tuned I'll be showing you something really interesting now let's focus ba... | Non-decreasing Subsequences | increasing-subsequences | Given an integer array `nums`, return _all the different possible non-decreasing subsequences of the given array with at least two elements_. You may return the answer in **any order**.
**Example 1:**
**Input:** nums = \[4,6,7,7\]
**Output:** \[\[4,6\],\[4,6,7\],\[4,6,7,7\],\[4,7\],\[4,7,7\],\[6,7\],\[6,7,7\],\[7,7\]... | null | Array,Hash Table,Backtracking,Bit Manipulation | Medium | 646 |
1,993 | welcome back guys so now let's see the third question it's basically we have to design our data structures which supports the following operations like we can lock when a particular node is not already locked and then we can lock it for a given user and unlock we can only unlock when the given user tries to then the us... | Operations on Tree | sum-of-all-subset-xor-totals | You are given a tree with `n` nodes numbered from `0` to `n - 1` in the form of a parent array `parent` where `parent[i]` is the parent of the `ith` node. The root of the tree is node `0`, so `parent[0] = -1` since it has no parent. You want to design a data structure that allows users to lock, unlock, and upgrade node... | Is there a way to iterate through all the subsets of the array? Can we use recursion to efficiently iterate through all the subsets? | Array,Math,Backtracking,Bit Manipulation,Combinatorics | Easy | null |
389 | hello so these questions find the difference so you're giving too soon s and t and basically that sntr exactly almost the same so there's only one character difference so you just have to return a later levels add to the string T so uh and this is simple so here we go so here's it so you have ABCD right and then in the... | Find the Difference | find-the-difference | You are given two strings `s` and `t`.
String `t` is generated by random shuffling string `s` and then add one more letter at a random position.
Return the letter that was added to `t`.
**Example 1:**
**Input:** s = "abcd ", t = "abcde "
**Output:** "e "
**Explanation:** 'e' is the letter that was added.
**Exam... | null | Hash Table,String,Bit Manipulation,Sorting | Easy | 136 |
1,675 | hey everyone welcome to Tech quiet in this video we are going to solve problem number 1675 minimize deviation in Array first we will see the problem statement then the logic and finally the code now let's dive into the solution so here I've taken the first example from the leeco website so here we are given positive n ... | Minimize Deviation in Array | magnetic-force-between-two-balls | You are given an array `nums` of `n` positive integers.
You can perform two types of operations on any element of the array any number of times:
* If the element is **even**, **divide** it by `2`.
* For example, if the array is `[1,2,3,4]`, then you can do this operation on the last element, and the array wil... | If you can place balls such that the answer is x then you can do it for y where y < x. Similarly if you cannot place balls such that the answer is x then you can do it for y where y > x. Binary search on the answer and greedily see if it is possible. | Array,Binary Search,Sorting | Medium | 2188 |
70 | in this problem we have to count the number of ways of reaching from bottom of a stair to top of a stair and there are different steps in the stair and in each step you can either climb by one or two so you have to just return in how many ways you can do that so let's look at an example so this is a pretty simple probl... | Climbing Stairs | climbing-stairs | You are climbing a staircase. It takes `n` steps to reach the top.
Each time you can either climb `1` or `2` steps. In how many distinct ways can you climb to the top?
**Example 1:**
**Input:** n = 2
**Output:** 2
**Explanation:** There are two ways to climb to the top.
1. 1 step + 1 step
2. 2 steps
**Example 2:**
... | To reach nth step, what could have been your previous steps? (Think about the step sizes) | Math,Dynamic Programming,Memoization | Easy | 747,1013,1236 |
1,668 | welcome to my uh legal summit section or 1668 uh maximum repeated substring before i start uh please subscribe to my channel okay uh for string uh sequence uh string word case k a string word is k repeating if a word is containing k times the string of subsequence of sequence right otherwise maximum k between values hi... | Maximum Repeating Substring | find-longest-awesome-substring | For a string `sequence`, a string `word` is **`k`\-repeating** if `word` concatenated `k` times is a substring of `sequence`. The `word`'s **maximum `k`\-repeating value** is the highest value `k` where `word` is `k`\-repeating in `sequence`. If `word` is not a substring of `sequence`, `word`'s maximum `k`\-repeating v... | Given the character counts, under what conditions can a palindrome be formed ? From left to right, use bitwise xor-operation to compute for any prefix the number of times modulo 2 of each digit. (mask ^= (1<<(s[i]-'0')). Expected complexity is O(n*A) where A is the alphabet (10). | Hash Table,String,Bit Manipulation | Hard | null |
1,200 | hello everyone welcome or welcome back to my channel today we are going to discuss another problem is minimum absolute difference so in this problem we are given an area of distinct integers find all pair of elements with the minimum absolute difference of any two elements what does this mean that we need to return all... | Minimum Absolute Difference | remove-interval | Given an array of **distinct** integers `arr`, find all pairs of elements with the minimum absolute difference of any two elements.
Return a list of pairs in ascending order(with respect to pairs), each pair `[a, b]` follows
* `a, b` are from `arr`
* `a < b`
* `b - a` equals to the minimum absolute difference o... | Solve the problem for every interval alone. Divide the problem into cases according to the position of the two intervals. | Array | Medium | null |
83 | foreign problem and the problem's name is remove duplicates from sorted list so in this question we're given the head office Hotel linked list we need to delete all the duplicates such that each element appears only once and we need to return the linked list in sorted order as well so let's take a look at this example ... | 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 |
465 | hello friends today lists of optimum of a counterbalancing province we are given transactions and a transaction will be given as at a pole X Y Z that means X give Y Z dollars so for this example that means zero gave one $10 to get zero that means zero gave one $10 to get zero that means zero gave one $10 to get zero fi... | Optimal Account Balancing | optimal-account-balancing | You are given an array of transactions `transactions` where `transactions[i] = [fromi, toi, amounti]` indicates that the person with `ID = fromi` gave `amounti $` to the person with `ID = toi`.
Return _the minimum number of transactions required to settle the debt_.
**Example 1:**
**Input:** transactions = \[\[0,1,1... | null | Array,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask | Hard | null |
368 | hello everyone this is sham soari and I welcome you again in the next video of our YouTube channel in today's video we are discussing this problem which came on 9th of February so the problem is largest divisible subset so they have given a set of distinct positive integers nums and we need to return the largest subset... | 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 |
698 | hello everyone welcome to coderscamp we are at last day of september eco challenge and the problem we are going to cover in this video is partition to k equals some subsets so the input given here is an integer array num and an integer value k and we have to return true or false if it is possible to divide the given ar... | Partition to K Equal Sum Subsets | partition-to-k-equal-sum-subsets | Given an integer array `nums` and an integer `k`, return `true` if it is possible to divide this array into `k` non-empty subsets whose sums are all equal.
**Example 1:**
**Input:** nums = \[4,3,2,3,5,2,1\], k = 4
**Output:** true
**Explanation:** It is possible to divide it into 4 subsets (5), (1, 4), (2,3), (2,3) w... | We can figure out what target each subset must sum to. Then, let's recursively search, where at each call to our function, we choose which of k subsets the next value will join. | Array,Dynamic Programming,Backtracking,Bit Manipulation,Memoization,Bitmask | Medium | 416,2135 |
84 | so in the previous approach we implicated this formula in order to find out the rectangular area and we did this for every a of i for every a phi we did this and this was a two pass solution where we had to figure out the left smaller as well as the right smaller how to convert this to pass into a one pass solution now... | Largest Rectangle in Histogram | largest-rectangle-in-histogram | Given an array of integers `heights` representing the histogram's bar height where the width of each bar is `1`, return _the area of the largest rectangle in the histogram_.
**Example 1:**
**Input:** heights = \[2,1,5,6,2,3\]
**Output:** 10
**Explanation:** The above is a histogram where width of each bar is 1.
The l... | null | Array,Stack,Monotonic Stack | Hard | 85,1918 |
56 | in this problem we have a list of intervals and an interval is a tuple it has two points start of the time and end of the time so this is one interval and we have many such intervals and it's not sorted in any order so you have to merge these intervals so if we have intervals like this so you can represent intervals by... | 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 |
199 | hey everyone welcome back and let's write some more neat code today so today let's solve binary tree right side view the problem is pretty self-explanatory we're given a binary self-explanatory we're given a binary self-explanatory we're given a binary tree and basically imagine you're standing on the right side of 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 |
657 | Scientist Hi how are you I hope all doing good welcome to the land so english playlist wear completed a notification and update you are all right you all engineering display list of trains from bulk shiv watching this video please like subscribe and comment shravan ko messages robot Return to Origin Ten Little Bit Long... | Robot Return to Origin | robot-return-to-origin | There is a robot starting at the position `(0, 0)`, the origin, on a 2D plane. Given a sequence of its moves, judge if this robot **ends up at** `(0, 0)` after it completes its moves.
You are given a string `moves` that represents the move sequence of the robot where `moves[i]` represents its `ith` move. Valid moves a... | null | String,Simulation | Easy | 547,2239 |
173 | hey guys how's everything going this is Jay sir who's not good algorithms today let's get a look at one seven three binary search tree iterator we're implementing an interpreter over a binary search tree Ari reader must be utilized with the root node of a BST for what is BSD means smaller nodes so left and bigger nodes... | Binary Search Tree Iterator | binary-search-tree-iterator | Implement the `BSTIterator` class that represents an iterator over the **[in-order traversal](https://en.wikipedia.org/wiki/Tree_traversal#In-order_(LNR))** of a binary search tree (BST):
* `BSTIterator(TreeNode root)` Initializes an object of the `BSTIterator` class. The `root` of the BST is given as part of the co... | null | Stack,Tree,Design,Binary Search Tree,Binary Tree,Iterator | Medium | 94,251,281,284,285,1729 |
91 | And listen guys Mukesh and you're looking at tempered and as always we're going to go ahead our line is 7500 decode base that you question sample is medium type and saying that the decoding methods are actually our A to Z 1234 like this And the food is Sector-26, this is our dip, so I am Sector-26, this is our dip, so ... | Decode Ways | decode-ways | A message containing letters from `A-Z` can be **encoded** into numbers using the following mapping:
'A' -> "1 "
'B' -> "2 "
...
'Z' -> "26 "
To **decode** an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For examp... | null | String,Dynamic Programming | Medium | 639,2091 |
421 | Hello hello friends why are we going to discuss today liquid problem photo space maxims of two numbers is there a problem on these can you also use the channel subscribe button subscribe and share and subscribe their video like share and if you like this subscribe It's okay, what will you get after the shark office in ... | 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 |
137 | hello everyone let's talk about a new problem today that is single number two what does this problem exactly say is that you will be given an array of integers and in this particular array every element is going to appear thrice except for one element which is going to appear only once and your task is to find that par... | Single Number II | single-number-ii | Given an integer array `nums` where every element appears **three times** except for one, which appears **exactly once**. _Find the single element and return it_.
You must implement a solution with a linear runtime complexity and use only constant extra space.
**Example 1:**
**Input:** nums = \[2,2,3,2\]
**Output:**... | null | Array,Bit Manipulation | Medium | 136,260 |
210 | hey guys welcome back to another video and today we're going to be solving the lead code question course schedule 2. all right so let's just go over the question real quick all right so we have a total of n courses you have to take label from zero to n minus one so some of these courses have pre requisites so let's say... | 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,997 | Hello Everyone Means Sandeep And This Video Is Showing You How To Solve There Problem Zoom Is From 1974 Contest Came Out The Problems Like This Is The Android Platform 020 subscribe to the Page if you liked The Video then subscribe to Main Net Means The Number of Times They Do I Involved in Activities More Liquid Arun ... | First Day Where You Have Been in All the Rooms | next-palindrome-using-same-digits | There are `n` rooms you need to visit, labeled from `0` to `n - 1`. Each day is labeled, starting from `0`. You will go in and visit one room a day.
Initially on day `0`, you visit room `0`. The **order** you visit the rooms for the coming days is determined by the following **rules** and a given **0-indexed** array `... | Is it possible to swap one character in the first half of the palindrome to make the next one? Are there different cases for when the length is odd and even? | Two Pointers,String | Hard | 556,564 |
778 | Hello Hi Friends Welcome Back Today We Are Going To Solid Problem Se Valid Swim In Rising Water Before We Go Through The Problem Description And Examples And Solution Is Just Want To Mention That My Channel Is Dedicated To Help People Who Are Preparing For Java Coding Interviews And Job Interviews And All My Channel Mo... | Swim in Rising Water | reorganize-string | You are given an `n x n` integer matrix `grid` where each value `grid[i][j]` represents the elevation at that point `(i, j)`.
The rain starts to fall. At time `t`, the depth of the water everywhere is `t`. You can swim from a square to another 4-directionally adjacent square if and only if the elevation of both square... | Alternate placing the most common letters. | Hash Table,String,Greedy,Sorting,Heap (Priority Queue),Counting | Medium | 358,621,1304 |
295 | hello friends today that's so fine the medium from Telestream so the medium is a middle value in order to inter list if the size of the list is even there is no middle value so the medium is a mean of the two middle value so this question we are given a dear stream so we do not know the size of the data stream so for e... | 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 |
35 | Hello Gas Myself Amrita Welcome Back To Our Channel Technologies So This Is Read Code Series In Which See Are Solving Lead Code Problems One By One If You Also Wish You Join Us You Can Subscribe To Our Channel And I Mention Date Geet Tripulink End Description Box You Can Check Out Doors Which You Are Doing in This Seri... | 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 |
204 | so that means if the there is a number let's say six so what are the prime numbers which stick to less than six so it will be adding by 2 3 then 5 so you want to return the count of this numbers so you have to write a three as the answer so that is what the triangle is so usually what we can do is if they tell n equal ... | Count Primes | count-primes | Given an integer `n`, return _the number of prime numbers that are strictly less than_ `n`.
**Example 1:**
**Input:** n = 10
**Output:** 4
**Explanation:** There are 4 prime numbers less than 10, they are 2, 3, 5, 7.
**Example 2:**
**Input:** n = 0
**Output:** 0
**Example 3:**
**Input:** n = 1
**Output:** 0
**Co... | Let's start with a isPrime function. To determine if a number is prime, we need to check if it is not divisible by any number less than n. The runtime complexity of isPrime function would be O(n) and hence counting the total prime numbers up to n would be O(n2). Could we do better? As we know the number must not be div... | Array,Math,Enumeration,Number Theory | Medium | 263,264,279 |
41 | hey what's up guys this is sean here so uh so today uh let's take a look at today's daily challenge problem uh number 41 it's a very early problem so first missing positive okay so the description is pretty very straightforward basically you're given like unsorted integer array find the smallest missing in positive int... | First Missing Positive | first-missing-positive | Given an unsorted integer array `nums`, return the smallest missing positive integer.
You must implement an algorithm that runs in `O(n)` time and uses constant extra space.
**Example 1:**
**Input:** nums = \[1,2,0\]
**Output:** 3
**Explanation:** The numbers in the range \[1,2\] are all in the array.
**Example 2:*... | Think about how you would solve the problem in non-constant space. Can you apply that logic to the existing space? We don't care about duplicates or non-positive integers Remember that O(2n) = O(n) | Array,Hash Table | Hard | 268,287,448,770 |
1,572 | hello friends welcome again to my youtube channel today the problem that we are going to discuss is matrix diagonal sum problem number 1572 of lead code before starting if you are new to the channel or if you are watching this video first time please don't forget to subscribe and share among your friends also do watch ... | Matrix Diagonal Sum | subrectangle-queries | Given a square matrix `mat`, return the sum of the matrix diagonals.
Only include the sum of all the elements on the primary diagonal and all the elements on the secondary diagonal that are not part of the primary diagonal.
**Example 1:**
**Input:** mat = \[\[**1**,2,**3**\],
\[4,**5**,6\],
... | Use brute force to update a rectangle and, response to the queries in O(1). | Array,Design,Matrix | Medium | null |
215 | hey everybody this is larry this is day 22nd of june uh of deletecode daytime hit the like button hit the subscribe button join me on discord let me know what you think about today's problems a problem cave launches element in an array which is taking his time loading technology is hard how's everyone doing uh it's rai... | Kth Largest Element in an Array | kth-largest-element-in-an-array | Given an integer array `nums` and an integer `k`, return _the_ `kth` _largest element in the array_.
Note that it is the `kth` largest element in the sorted order, not the `kth` distinct element.
You must solve it in `O(n)` time complexity.
**Example 1:**
**Input:** nums = \[3,2,1,5,6,4\], k = 2
**Output:** 5
**Ex... | null | Array,Divide and Conquer,Sorting,Heap (Priority Queue),Quickselect | Medium | 324,347,414,789,1014,2113,2204,2250 |
1,021 | remove outer most parenthesis so basically what this question asks is for example i'm skipping this these statements i'm just going to the example so we are given this set of string okay this is a string okay in which we have open brackets and closed brackets and it is asking us to remove outer most parenthesis outermo... | Remove Outermost Parentheses | distribute-coins-in-binary-tree | A valid parentheses string is either empty `" "`, `"( " + A + ") "`, or `A + B`, where `A` and `B` are valid parentheses strings, and `+` represents string concatenation.
* For example, `" "`, `"() "`, `"(())() "`, and `"(()(())) "` are all valid parentheses strings.
A valid parentheses string `s` is primitive if i... | null | Tree,Depth-First Search,Binary Tree | Medium | 863,1008 |
1,235 | Loot Hello Welcome 28th August Liquid Challenge And This Question Has Maximum Profit In Jobs Scheduling In This Question In The Earth Give Energy Of Job Skin Profit Acid The Video then subscribe to the Page if you liked The Video then subscribe to the Page Maximum Profit in Job During List Code 12358 Problem Exists Don... | Maximum Profit in Job Scheduling | maximum-profit-in-job-scheduling | We have `n` jobs, where every job is scheduled to be done from `startTime[i]` to `endTime[i]`, obtaining a profit of `profit[i]`.
You're given the `startTime`, `endTime` and `profit` arrays, return the maximum profit you can take such that there are no two jobs in the subset with overlapping time range.
If you choose... | null | null | Hard | null |
1,358 | so hello everyone today we'll be solving this problem number of 15 containing all the three characters so in this question what is says that this is a string length is six and it has some characters like ABC ad we have to find the number of all possible substrings such that for in each substring there must be at least ... | Number of Substrings Containing All Three Characters | find-positive-integer-solution-for-a-given-equation | Given a string `s` consisting only of characters _a_, _b_ and _c_.
Return the number of substrings containing **at least** one occurrence of all these characters _a_, _b_ and _c_.
**Example 1:**
**Input:** s = "abcabc "
**Output:** 10
**Explanation:** The substrings containing at least one occurrence of the charact... | Loop over 1 ≤ x,y ≤ 1000 and check if f(x,y) == z. | Math,Two Pointers,Binary Search,Interactive | Medium | null |
168 | That I am also one, my name is Ayush Mishra and you have to dress for urination, we are going to talk about the excel sheet column title problem itself, it is a very good problem and very easy but time does not come quickly, let's see what is the question. Tell him that the column number given to you by the teacher is ... | Excel Sheet Column Title | excel-sheet-column-title | Given an integer `columnNumber`, return _its corresponding column title as it appears in an Excel sheet_.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
**Example 1:**
**Input:** columnNumber = 1
**Output:** "A "
**Example 2:**
**Input:** columnNumber = 28
**Output:** "AB "
**Example 3:**... | null | Math,String | Easy | 171,2304 |
3 | hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you have not liked the video please like it subscribe to my channel and hit the bell icon so that you get notified whenever i post a new video so without any further ado let's get started pr... | 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 |
976 | hey everybody this is Larry I hit the like button hit the subscribe button let me know how you're doing this farm I'm gonna stop alive right about now 976 largest parameter triangle given an array a of positive lengths we turned the largest parameter of a triangle of nonzero area from three of these lengths it was impo... | 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 |
105 | The Heavens Welcome back to the second series, the video is coming after a long time from the Australian officers, why now what has happened, he had fallen ill for one and a half years, now he said this, he should not, but it is going very wrong for me, but still the dimensions Director, I am right, so now let's start ... | Construct Binary Tree from Preorder and Inorder Traversal | construct-binary-tree-from-preorder-and-inorder-traversal | Given two integer arrays `preorder` and `inorder` where `preorder` is the preorder traversal of a binary tree and `inorder` is the inorder traversal of the same tree, construct and return _the binary tree_.
**Example 1:**
**Input:** preorder = \[3,9,20,15,7\], inorder = \[9,3,15,20,7\]
**Output:** \[3,9,20,null,null,... | null | Array,Hash Table,Divide and Conquer,Tree,Binary Tree | Medium | 106 |
73 | hello friends welcome to joy of life so today we are going to look at another medium level problem from lead code it's been a while i have done any problems from lead code so the problem number is 73 it's a set matrix zeros so given an m into n integer matrix if an element is zero set the entire row and column to zero ... | 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 |
739 | hello hi guys it has been asked by Amazon Facebook Tik Tok Microsoft Apple Visa sap Google Bloomberg service now phone pay tin of pyan Salesforce Co Adobe Yahoo Uber and so many companies so let's see this problem again Although seeing this you might see it's a traditional easy medium problem but I swear it is not it i... | Daily Temperatures | daily-temperatures | Given an array of integers `temperatures` represents the daily temperatures, return _an array_ `answer` _such that_ `answer[i]` _is the number of days you have to wait after the_ `ith` _day to get a warmer temperature_. If there is no future day for which this is possible, keep `answer[i] == 0` instead.
**Example 1:**... | If the temperature is say, 70 today, then in the future a warmer temperature must be either 71, 72, 73, ..., 99, or 100. We could remember when all of them occur next. | Array,Stack,Monotonic Stack | Medium | 496,937 |
1,011 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem capacity to ship packages within D days so we're given an array of weights for example something like this one two three four five starting at the beginning of the array we want to break it up into chunks such that carr... | Capacity To Ship Packages Within D Days | flip-binary-tree-to-match-preorder-traversal | A conveyor belt has packages that must be shipped from one port to another within `days` days.
The `ith` package on the conveyor belt has a weight of `weights[i]`. Each day, we load the ship with packages on the conveyor belt (in the order given by `weights`). We may not load more weight than the maximum weight capaci... | null | Tree,Depth-First Search,Binary Tree | Medium | null |
393 | this is little question number 393 etf a validation this is medium question let's get into it a character in youtube eight can be from one to four quite long subjected to the following rule first for one byte of character the first bit is zero followed by its unique code number two four and byte character the first and... | UTF-8 Validation | utf-8-validation | Given an integer array `data` representing the data, return whether it is a valid **UTF-8** encoding (i.e. it translates to a sequence of valid UTF-8 encoded characters).
A character in **UTF8** can be from **1 to 4 bytes** long, subjected to the following rules:
1. For a **1-byte** character, the first bit is a `0`... | All you have to do is follow the rules. For a given integer, obtain its binary representation in the string form and work with the rules given in the problem. An integer can either represent the start of a UTF-8 character, or a part of an existing UTF-8 character. There are two separate rules for these two scenarios in... | Array,Bit Manipulation | Medium | null |
347 | hi everyone let's delete code 347 top K frequent elements we're given an array of integers and an integer K we want to return the K most frequent elements to better understand this let's look into the example the output is 1 and 2 and K is equal to 2. it means that they wanted the two most frequent elements in this inp... | Top K Frequent Elements | top-k-frequent-elements | Given an integer array `nums` and an integer `k`, return _the_ `k` _most frequent elements_. You may return the answer in **any order**.
**Example 1:**
**Input:** nums = \[1,1,1,2,2,3\], k = 2
**Output:** \[1,2\]
**Example 2:**
**Input:** nums = \[1\], k = 1
**Output:** \[1\]
**Constraints:**
* `1 <= nums.lengt... | null | Array,Hash Table,Divide and Conquer,Sorting,Heap (Priority Queue),Bucket Sort,Counting,Quickselect | Medium | 192,215,451,659,692,1014,1919 |
145 | hey everyone welcome back in the last video we saw in order traversal of a binary tree in this video we'll see postorder traversal of a binary tree in post order traversal as you know we traverse the left subtree first then travels the right subtree and finally process the root node post order traversal is slightly tri... | Binary Tree Postorder Traversal | binary-tree-postorder-traversal | Given the `root` of a binary tree, return _the postorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[3,2,1\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of the n... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 94,776 |
57 | welcome back to algojs today's question is leak code 57 insert interval so you're given an array of non-overlapping you're given an array of non-overlapping you're given an array of non-overlapping intervals where interval i is equal to start i and i represent the start and the end of the if interval and intervals is s... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.