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 |
|---|---|---|---|---|---|---|---|---|
115 | Hello everyone welcome to date on 19th September subscribe me to the number of units subscribe and subscribe this Video subscribe our is turmeric explaining the example of Baroda Sydney presentation under subscribe to that let's move on to understand the question and how they can build A Gautam subscribe and subscribe ... | Distinct Subsequences | distinct-subsequences | Given two strings `s` and `t`, return _the number of distinct_ **_subsequences_** _of_ `s` _which equals_ `t`.
The test cases are generated so that the answer fits on a 32-bit signed integer.
**Example 1:**
**Input:** s = "rabbbit ", t = "rabbit "
**Output:** 3
**Explanation:**
As shown below, there are 3 ways you... | null | String,Dynamic Programming | Hard | 2115 |
201 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem bitwise and of numbers range we're given two integers left and right will be greater than or equal to the left value and very simply we just want to return the bitwise and of all the numbers in this range what is a bitw... | 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 |
392 | Hey guys hello welcome to the channel I am doing 90 days ac prep this is question number 11 lead code is 75 overall question lead code is 392 the name of the question is all this subsequence before I tell you about the question I want to tell you About Scalar School of Technology, there is Scalar School of Technology w... | Is Subsequence | is-subsequence | Given two strings `s` and `t`, return `true` _if_ `s` _is a **subsequence** of_ `t`_, or_ `false` _otherwise_.
A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i... | null | Two Pointers,String,Dynamic Programming | Easy | 808,1051 |
1,170 | hi uh let us solve one lead code question today let me pick a random one sum of all subset xor so it's easy one and it is related to bit operations it looks like so let's see some medium level problem yeah compare the strings by frequency of the smallest character let the function be the frequency of lexicographically ... | Compare Strings by Frequency of the Smallest Character | shortest-common-supersequence | Let the function `f(s)` be the **frequency of the lexicographically smallest character** in a non-empty string `s`. For example, if `s = "dcce "` then `f(s) = 2` because the lexicographically smallest character is `'c'`, which has a frequency of 2.
You are given an array of strings `words` and another array of query s... | We can find the length of the longest common subsequence between str1[i:] and str2[j:] (for all (i, j)) by using dynamic programming. We can use this information to recover the longest common supersequence. | String,Dynamic Programming | Hard | 1250 |
392 | hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you not like 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 problem ... | 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 |
264 | Alright so hello, how are you doing? So in today's video, we all have asked this question. In the previous video, now we all will do the next question, date is the next number, you are ok, the next number was that, we all are People had seen that basically what we had to do inside it was 2 3 5. We have a given number. ... | 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 |
1,781 | hey everybody this is larry this is me gomer q3 of the buy weekly contest 47 summer beauty of all sub strings um this one's a little bit weird i thought uh i had some doubts about whether my code is fast enough and i think there's definitely a um slicker race to kind of keep track of the men for sure but the thing that... | Sum of Beauty of All Substrings | check-if-two-string-arrays-are-equivalent | The **beauty** of a string is the difference in frequencies between the most frequent and least frequent characters.
* For example, the beauty of `"abaacc "` is `3 - 1 = 2`.
Given a string `s`, return _the sum of **beauty** of all of its substrings._
**Example 1:**
**Input:** s = "aabcb "
**Output:** 5
**Explana... | Concatenate all strings in the first array into a single string in the given order, the same for the second array. Both arrays represent the same string if and only if the generated strings are the same. | Array,String | Easy | 2184 |
1,962 | hello so I'll be solving remove stones to minimize the total and it's my daily challenge though I'll do it but I don't think it's medium I think it's easy um basically we want to remove as much stones as possible from this array so we'll take the highest number in this array so nine because nine divided by 2 4 is great... | Remove Stones to Minimize the Total | single-threaded-cpu | You are given a **0-indexed** integer array `piles`, where `piles[i]` represents the number of stones in the `ith` pile, and an integer `k`. You should apply the following operation **exactly** `k` times:
* Choose any `piles[i]` and **remove** `floor(piles[i] / 2)` stones from it.
**Notice** that you can apply the ... | To simulate the problem we first need to note that if at any point in time there are no enqueued tasks we need to wait to the smallest enqueue time of a non-processed element We need a data structure like a min-heap to support choosing the task with the smallest processing time from all the enqueued tasks | Array,Sorting,Heap (Priority Queue) | Medium | 2176 |
238 | hello everyone welcome to netset os so today let's discuss a lead code question lead code number 238 and this is a medium based so let's try to solve it so the question is given an array numbers of n integers which return an array output such that it is equal to the product of all elements of input but except that numb... | Product of Array Except Self | product-of-array-except-self | Given an integer array `nums`, return _an array_ `answer` _such that_ `answer[i]` _is equal to the product of all the elements of_ `nums` _except_ `nums[i]`.
The product of any prefix or suffix of `nums` is **guaranteed** to fit in a **32-bit** integer.
You must write an algorithm that runs in `O(n)` time and without... | null | Array,Prefix Sum | Medium | 42,152,265,2267 |
134 | what's up coders good morning good afternoon and good evening today we're going to be doing an ugly code problem number 134 gas station so let's see what it is about there are n gas stations along a circular route where the amount of gas at the Ice Station is gas of I so if we look at example one's input we see a gas a... | Gas Station | gas-station | There are `n` gas stations along a circular route, where the amount of gas at the `ith` station is `gas[i]`.
You have a car with an unlimited gas tank and it costs `cost[i]` of gas to travel from the `ith` station to its next `(i + 1)th` station. You begin the journey with an empty tank at one of the gas stations.
Gi... | null | Array,Greedy | Medium | 1346 |
35 | today we're going to be going over the Java solution for leap code 35 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 was inserted in order you must write an algorithm at all of log n runtime comp... | 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 |
258 | hello everyone welcome to the 8th of february lead good challenge and i hope all of you are having a great time the question that we have in today is add digits here in this question we are given an integer number and we need to repeatedly add all the digits until the result has only one single digit that simply signif... | Add Digits | add-digits | Given an integer `num`, repeatedly add all its digits until the result has only one digit, and return it.
**Example 1:**
**Input:** num = 38
**Output:** 2
**Explanation:** The process is
38 --> 3 + 8 --> 11
11 --> 1 + 1 --> 2
Since 2 has only one digit, return it.
**Example 2:**
**Input:** num = 0
**Output:** 0
*... | A naive implementation of the above process is trivial. Could you come up with other methods? What are all the possible results? How do they occur, periodically or randomly? You may find this Wikipedia article useful. | Math,Simulation,Number Theory | Easy | 202,1082,2076,2264 |
2 | hello guys welcome to this episode in this particular episode we're gonna go over the leak code problem number two solution for that actually I hadn't made the video earlier but I realized that the orientation of the video like it was horizontal and I mean it was a disappointment because I thought it was an actual full... | Add Two Numbers | add-two-numbers | You are given two **non-empty** linked lists representing two non-negative integers. The digits are stored in **reverse order**, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 ... | null | Linked List,Math,Recursion | Medium | 43,67,371,415,445,1031,1774 |
279 | it has been asked by Apple Yahoo Amazon Bloomberg yendes essential Google Microsoft Adobe Uber dunzo and so many companies hi guys good morning welcome back to a new video I hope that you guys are doing good in this you going see problem perfect squares again rather than as in apart from other videos on YouTube in this... | Perfect Squares | perfect-squares | Given an integer `n`, return _the least number of perfect square numbers that sum to_ `n`.
A **perfect square** is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, `1`, `4`, `9`, and `16` are perfect squares while `3` and `11` are not.
**Example ... | null | Math,Dynamic Programming,Breadth-First Search | Medium | 204,264 |
1,007 | Hello Hi Everyone Welcome To My Channel Today In This Video Vihar Solving Bhi Problem Minimum Domino Rotations For Equal Road Show In Raw Milk From Top And Bottom Of Two Numbers From 1 To 6 After Speech Of Divide And Rule Number Of The Like Subscribe and Share Subscribe And This With Your Friends Will Have To Every Whe... | Minimum Domino Rotations For Equal Row | numbers-with-same-consecutive-differences | In a row of dominoes, `tops[i]` and `bottoms[i]` represent the top and bottom halves of the `ith` domino. (A domino is a tile with two numbers from 1 to 6 - one on each half of the tile.)
We may rotate the `ith` domino, so that `tops[i]` and `bottoms[i]` swap values.
Return the minimum number of rotations so that all... | null | Backtracking,Breadth-First Search | Medium | null |
41 | everyone welcome back to the channel I hope you guys are doing extremely well so we will be continuing with our binary search playlist now this is the part of the ongoing striversity and DSA course in case you haven't checked it out yet there's a link in the description make sure you check it out otherwise you're going... | 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,171 | Hello everyone, so today we will solve a new problem of daily challenge to the lead, remove zero sum error note from link list, so let us first understand the problem statement, then given the head of a link list, we are given the head of the link list. Have to repeatedly delete the sequence of notes that sums to zero.... | Remove Zero Sum Consecutive Nodes from Linked List | shortest-path-in-binary-matrix | Given the `head` of a linked list, we repeatedly delete consecutive sequences of nodes that sum to `0` until there are no such sequences.
After doing so, return the head of the final linked list. You may return any such answer.
(Note that in the examples below, all sequences are serializations of `ListNode` objects.)... | Do a breadth first search to find the shortest path. | Array,Breadth-First Search,Matrix | Medium | null |
1,030 | all right welcome back to pewaukee youtube channel in today's video we're going to be taking a look at uh question number 1030 on leak code and that is i just clicked away matrix sales and distance order so we're just going to take a look at the easy problem today and let's go ahead and start so if you enjoyed this vid... | Matrix Cells in Distance Order | smallest-string-starting-from-leaf | You are given four integers `row`, `cols`, `rCenter`, and `cCenter`. There is a `rows x cols` matrix and you are on the cell with the coordinates `(rCenter, cCenter)`.
Return _the coordinates of all cells in the matrix, sorted by their **distance** from_ `(rCenter, cCenter)` _from the smallest distance to the largest ... | null | String,Tree,Depth-First Search,Binary Tree | Medium | 129,257 |
146 | Hello everyone welcome to my channel cash kya hota hai but I am pretty show this will be very easy after you understand the explanation and yes we will make it in both ways first of all brat force which we should come after that we will make it in optimal way this How to optimize it, okay, we will see after submitting ... | LRU Cache | lru-cache | Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**.
Implement the `LRUCache` class:
* `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`.
* `int get(int key)` Return the valu... | null | Hash Table,Linked List,Design,Doubly-Linked List | Medium | 460,588,604,1903 |
67 | hello lead coders today I am going to solve liquid problem number 67 at binary in this problem we are given two binary strings A and B and we need to return the sum of the binary string so let's look at this example here so we are given a string A and B which has the value 11 and 1. so basically this is not 11 this val... | Add Binary | add-binary | Given two binary strings `a` and `b`, return _their sum as a binary string_.
**Example 1:**
**Input:** a = "11", b = "1"
**Output:** "100"
**Example 2:**
**Input:** a = "1010", b = "1011"
**Output:** "10101"
**Constraints:**
* `1 <= a.length, b.length <= 104`
* `a` and `b` consist only of `'0'` or `'1'` chara... | null | Math,String,Bit Manipulation,Simulation | Easy | 2,43,66,1031 |
43 | this is the 43rd Lego Challenge and it is called multiply strings given two non-negative integers num1 and num2 non-negative integers num1 and num2 non-negative integers num1 and num2 represented the strings return the product of num1 and num2 also represented as a string we must not use any built-in beak integer libra... | Multiply Strings | multiply-strings | Given two non-negative integers `num1` and `num2` represented as strings, return the product of `num1` and `num2`, also represented as a string.
**Note:** You must not use any built-in BigInteger library or convert the inputs to integer directly.
**Example 1:**
**Input:** num1 = "2", num2 = "3"
**Output:** "6"
**Ex... | null | Math,String,Simulation | Medium | 2,66,67,415 |
173 | Loot Phir Guys Welcome And Welcome Back To My Channel And This Video Wear Quintal Binary Search Tree Twitter Swiss Roll We are going to understand Mind Sastri Twitter Par, What is the problem, we will see the solution of the problem, first we will understand what is the problem, what is ok, then first what. Do this, re... | 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 |
496 | Whatever it is, grandma says, let's take it, use it if I have the meaning, I want it all, where it is taken, support, service for dental health, get it from you, crispy tv85 Hawaii Nestle Inna Steve Oley I'm also connected Forest of this is my child, it will go down very well porn Come on, it's cold, that's everything ... | Next Greater Element I | next-greater-element-i | The **next greater element** of some element `x` in an array is the **first greater** element that is **to the right** of `x` in the same array.
You are given two **distinct 0-indexed** integer arrays `nums1` and `nums2`, where `nums1` is a subset of `nums2`.
For each `0 <= i < nums1.length`, find the index `j` such ... | null | Array,Hash Table,Stack,Monotonic Stack | Easy | 503,556,739,2227 |
472 | hey what's up guys this is Chung here so today let's talk about take a look at another problem on lead code number 472 concatenated words its market as hard yeah I think yeah I'm gonna give my own like I keep both no sorry yeah so you're given a list of words without duplicates please write a program that return return... | Concatenated Words | concatenated-words | Given an array of strings `words` (**without duplicates**), return _all the **concatenated words** in the given list of_ `words`.
A **concatenated word** is defined as a string that is comprised entirely of at least two shorter words (not necesssarily distinct) in the given array.
**Example 1:**
**Input:** words = \... | null | Array,String,Dynamic Programming,Depth-First Search,Trie | Hard | 140 |
429 | Hey everyone welcome and welcome back to my channel so what is our problem today Andrew Tree level order traversal so in this problem statement we are given an entry trick and what we have to do is level audit towers and fine okay so if you have binary If you have solved it with levels and towers, then you can solve th... | N-ary Tree Level Order Traversal | n-ary-tree-level-order-traversal | Given an n-ary tree, return the _level order_ traversal of its nodes' values.
_Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples)._
**Example 1:**
**Input:** root = \[1,null,3,2,4,null,5,6\]
**Output:** \[\[1\],\[3,2,4\],\... | null | null | Medium | null |
79 | hello welcome to my channel today we have leeco 79 word search and this question is a good example for dfs solution so let's take a look at this given an m time and board in a word find if the word exists in the grip so the word can be constructed from letters of sequential adjacent cells where adjacent cells are horiz... | Word Search | word-search | Given an `m x n` grid of characters `board` and a string `word`, return `true` _if_ `word` _exists in the grid_.
The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.
**Example 1:**... | null | Array,Backtracking,Matrix | Medium | 212 |
1,991 | Hi everyone, I am Nishant and you have joined with the entry, we are the interviewers, we are the ones who are going to drive, that is lead code problem number 724 find pubic index, a duplicate problem of the same problem is available on lead code which is Problem No. 1991 Find D is the problem from the middle indexica... | Find the Middle Index in Array | league-statistics | Given a **0-indexed** integer array `nums`, find the **leftmost** `middleIndex` (i.e., the smallest amongst all the possible ones).
A `middleIndex` is an index where `nums[0] + nums[1] + ... + nums[middleIndex-1] == nums[middleIndex+1] + nums[middleIndex+2] + ... + nums[nums.length-1]`.
If `middleIndex == 0`, the lef... | null | Database | Medium | null |
1,053 | hey guys how's everything going let's take a look at number 105 three previous fermentation with one swap given an array of positive integers not necessary distinct this is a warning return the lexicographically largest permutation that is smaller than X that can be made with one swamp if it cannot be done then return ... | Previous Permutation With One Swap | minimize-rounding-error-to-meet-target | Given an array of positive integers `arr` (not necessarily distinct), return _the_ _lexicographically_ _largest permutation that is smaller than_ `arr`, that can be **made with exactly one swap**. If it cannot be done, then return the same array.
**Note** that a _swap_ exchanges the positions of two numbers `arr[i]` a... | If we have integer values in the array then we just need to subtract the target those integer values, so we reduced the problem. Similarly if we have non integer values we have two options to put them flor(value) or ceil(value) = floor(value) + 1, so the idea is to just subtract floor(value). Now the problem is differe... | Array,Math,String,Greedy | Medium | null |
1,046 | hey everyone well we're here for an easy problem here which I might as well put on video just because it would be a good idea to introduce this Heap which in C++ is a priority this Heap which in C++ is a priority this Heap which in C++ is a priority Cube so here's the problem we have a collection of stones each Stone h... | Last Stone Weight | max-consecutive-ones-iii | You are given an array of integers `stones` where `stones[i]` is the weight of the `ith` stone.
We are playing a game with the stones. On each turn, we choose the **heaviest two stones** and smash them together. Suppose the heaviest two stones have weights `x` and `y` with `x <= y`. The result of this smash is:
* I... | One thing's for sure, we will only flip a zero if it extends an existing window of 1s. Otherwise, there's no point in doing it, right? Think Sliding Window! Since we know this problem can be solved using the sliding window construct, we might as well focus in that direction for hints. Basically, in a given window, we c... | Array,Binary Search,Sliding Window,Prefix Sum | Medium | 340,424,485,487,2134 |
92 | hey everyone today we are going to solve the little question with us linked list two so you are given head of single reading to this and the two integers left and the right where left is less than or equal right reversal nodes of the list from position left to position right and the return the Reversed list so let's se... | Reverse Linked List II | reverse-linked-list-ii | Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], left = 2, right = 4
**Output:** \[1,4,3,2,5\]
**Example 2:**
**I... | null | Linked List | Medium | 206 |
1,351 | Hello Everyone More Than Profit Code Problem Yes-Yes More Than Profit Code Problem Yes-Yes More Than Profit Code Problem Yes-Yes Account Negative Numbers In Spotted Matric And Craft And Thread Which Supported In Unknown Decreasing Order Is The Summary Greater Than It's PM Candidate Delhi Blouse Midning Drafted In The R... | Count Negative Numbers in a Sorted Matrix | replace-the-substring-for-balanced-string | Given a `m x n` matrix `grid` which is sorted in non-increasing order both row-wise and column-wise, return _the number of **negative** numbers in_ `grid`.
**Example 1:**
**Input:** grid = \[\[4,3,2,-1\],\[3,2,1,-1\],\[1,1,-1,-2\],\[-1,-1,-2,-3\]\]
**Output:** 8
**Explanation:** There are 8 negatives number in the ma... | Use 2-pointers algorithm to make sure all amount of characters outside the 2 pointers are smaller or equal to n/4. That means you need to count the amount of each letter and make sure the amount is enough. | String,Sliding Window | Medium | null |
1,671 | Hello everyone so latest i zero thundex with zero less give zero greater than less give length true date 5 + 1 this is increasing and this is in 5 + 1 this is increasing and this is in 5 + 1 this is increasing and this is in decreasing in fashion so this is increasing till here how many are the remaining elements decre... | Minimum Number of Removals to Make Mountain Array | the-most-recent-three-orders | 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 | Database | Medium | 1688 |
110 | Hello's life was looted, some questions were looted at half a minute, the walking dead took the president of clan's card, it is side wise and seeing all the notes of shame, hi hotel is the valley, these files were spread of fruit juice, in the meantime, there is note due to which middle school Na Ghate Height Hawa Da R... | 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 |
136 | Hello Gas Myself Amrita Welcome Back Your Channel Technosis So In Today's Video Are You Going To Discuss Lead Code Problem Number 136 Date Is Single Number So Let's Get Started Let's First Understand The Problem Given A Non-M Tiara Of Problem Given A Non-M Tiara Of Problem Given A Non-M Tiara Of Inteasers Every Element... | Single Number | single-number | Given a **non-empty** array of integers `nums`, every element appears _twice_ except for one. Find that single one.
You must implement a solution with a linear runtime complexity and use only constant extra space.
**Example 1:**
**Input:** nums = \[2,2,1\]
**Output:** 1
**Example 2:**
**Input:** nums = \[4,1,2,1,2... | null | Array,Bit Manipulation | Easy | 137,260,268,287,389 |
594 | hey everyone welcome back and today we will be doing another lead code problem 594 longest harmonious subsequence and easy one we Define a harmonious array as an array where the difference between its maximum value and its minimum value is exactly one given the integer array nums return the length of its longest harmon... | Longest Harmonious Subsequence | longest-harmonious-subsequence | We define a harmonious array as an array where the difference between its maximum value and its minimum value is **exactly** `1`.
Given an integer array `nums`, return _the length of its longest harmonious subsequence among all its possible subsequences_.
A **subsequence** of array is a sequence that can be derived f... | null | Array,Hash Table,Sorting | Easy | null |
1,293 | I got an offer at bite this and I received for interview questions in three rounds of technical interviews of the four interview questions two of them are leaf code hard difficulty and another two are medium difficulty and I want to share all that my interview questions with you so in this video we're gonna talk about ... | Shortest Path in a Grid with Obstacles Elimination | three-consecutive-odds | You are given an `m x n` integer matrix `grid` where each cell is either `0` (empty) or `1` (obstacle). You can move up, down, left, or right from and to an empty cell in **one step**.
Return _the minimum number of **steps** to walk from the upper left corner_ `(0, 0)` _to the lower right corner_ `(m - 1, n - 1)` _giv... | Check every three consecutive numbers in the array for parity. | Array | Easy | null |
718 | hi friends welcome back today we are going to solve loot code problem 718 maximum length of repeated sub array so before we start looking into the problem description and some examples and solution fault for this problem i just want to mention that my channel is dedicated to help people who are preparing for coding int... | Maximum Length of Repeated Subarray | maximum-length-of-repeated-subarray | Given two integer arrays `nums1` and `nums2`, return _the maximum length of a subarray that appears in **both** arrays_.
**Example 1:**
**Input:** nums1 = \[1,2,3,2,1\], nums2 = \[3,2,1,4,7\]
**Output:** 3
**Explanation:** The repeated subarray with maximum length is \[3,2,1\].
**Example 2:**
**Input:** nums1 = \[0... | Use dynamic programming. dp[i][j] will be the answer for inputs A[i:], B[j:]. | Array,Binary Search,Dynamic Programming,Sliding Window,Rolling Hash,Hash Function | Medium | 209,2051 |
453 | Hello friends, if we look at the question today, what will we do in it, which is minimum, as soon as our one and you are minimum in both of them, then if we move both of them, then we will also become earth, then if we move you and three, then three and four. It will be done, if these two are minimum then three and thr... | Minimum Moves to Equal Array Elements | minimum-moves-to-equal-array-elements | Given an integer array `nums` of size `n`, return _the minimum number of moves required to make all array elements equal_.
In one move, you can increment `n - 1` elements of the array by `1`.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** 3
**Explanation:** Only three moves are needed (remember each move inc... | null | Array,Math | Medium | 462,2263,2273 |
71 | what's up guys today we're gonna talk about simple simplify path so the question says that uh given a path which is a string we have to simplify the path and return a simplified path for example the simplified path starts with a slash and then it will have a one folder name slash another folder name this is the linux s... | Simplify Path | simplify-path | Given a string `path`, which is an **absolute path** (starting with a slash `'/'`) to a file or directory in a Unix-style file system, convert it to the simplified **canonical path**.
In a Unix-style file system, a period `'.'` refers to the current directory, a double period `'..'` refers to the directory up a level,... | null | String,Stack | Medium | null |
482 | all right let's talk about the license key formatting so you can restore it and the idea is that you are given the string s and then the integral k so for every single group you should have a length of k on except the first group so the first group could be shorter so for every single group is uh two right and the firs... | License Key Formatting | license-key-formatting | You are given a license key represented as a string `s` that consists of only alphanumeric characters and dashes. The string is separated into `n + 1` groups by `n` dashes. You are also given an integer `k`.
We want to reformat the string `s` such that each group contains exactly `k` characters, except for the first g... | null | String | Easy | null |
315 | hello everyone welcome to our channel code with sunny and in this video we will be talking about uh heart problem the lead code count of smaller numbers after self and its index is 315 and it is a hard type problem but i like that so i will give it a like over here okay so and the basic prerequisite to solve this probl... | Count of Smaller Numbers After Self | count-of-smaller-numbers-after-self | Given an integer array `nums`, return _an integer array_ `counts` _where_ `counts[i]` _is the number of smaller elements to the right of_ `nums[i]`.
**Example 1:**
**Input:** nums = \[5,2,6,1\]
**Output:** \[2,1,1,0\]
**Explanation:**
To the right of 5 there are **2** smaller elements (2 and 1).
To the right of 2 the... | null | Array,Binary Search,Divide and Conquer,Binary Indexed Tree,Segment Tree,Merge Sort,Ordered Set | Hard | 327,406,493,1482,2280 |
948 | Hello Hi Guys so now we are going to do a new playlist Giridih will be approach questions and today we will do the first question of ready approach the name of our question is bag of toxins write number 9483 m dinner question ok and its configuration is by Google so This question is important first and then let's look ... | Bag of Tokens | sort-an-array | You have an initial **power** of `power`, an initial **score** of `0`, and a bag of `tokens` where `tokens[i]` is the value of the `ith` token (0-indexed).
Your goal is to maximize your total **score** by potentially playing each token in one of two ways:
* If your current **power** is at least `tokens[i]`, you may... | null | Array,Divide and Conquer,Sorting,Heap (Priority Queue),Merge Sort,Bucket Sort,Radix Sort,Counting Sort | Medium | null |
343 | EP L Ki I Don't Know In This Video Latest CD Internet Problem Gift Super Status Govt Appointment Hai Jhaal 200 Agency In Real Problem Solve This Problem Not Where Were Given In Teachers Students Were In Danger Is Found And Interior Stranded In Thing But Pimple No Water Into A Visit To Barricades Into Tears Into Another... | Integer Break | integer-break | Given an integer `n`, break it into the sum of `k` **positive integers**, where `k >= 2`, and maximize the product of those integers.
Return _the maximum product you can get_.
**Example 1:**
**Input:** n = 2
**Output:** 1
**Explanation:** 2 = 1 + 1, 1 \* 1 = 1.
**Example 2:**
**Input:** n = 10
**Output:** 36
**Exp... | There is a simple O(n) solution to this problem. You may check the breaking results of n ranging from 7 to 10 to discover the regularities. | Math,Dynamic Programming | Medium | 1936 |
1,004 | hmm hey what's up guys Nick white here at detecting coding stuff on twitch in YouTube check the description I do the leak code premium problems on my patreon and join my discord please this problem is called max consecutive ones number three and we already did number one number two is patreon so checking that out if yo... | Max Consecutive Ones III | least-operators-to-express-number | Given a binary array `nums` and an integer `k`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most_ `k` `0`'s.
**Example 1:**
**Input:** nums = \[1,1,1,0,0,0,1,1,1,1,0\], k = 2
**Output:** 6
**Explanation:** \[1,1,1,0,0,**1**,1,1,1,1,**1**\]
Bolded numbers were flipped from 0 to 1.... | null | Math,Dynamic Programming | Hard | null |
815 | Hello everyone welcome to my channel code sari with mike so today we are going to do video number 40 of our graphs playlist lead code number 815 is not at all hard it is a very simple BFS question it is ok it will become very easy just the name is routes R has asked this question, two questions, what does it say that y... | Bus Routes | champagne-tower | You are given an array `routes` representing bus routes where `routes[i]` is a bus route that the `ith` bus repeats forever.
* For example, if `routes[0] = [1, 5, 7]`, this means that the `0th` bus travels in the sequence `1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> ...` forever.
You will start at the bus stop `source` (You... | null | Dynamic Programming | Medium | 1385 |
1,952 | welcome guys so welcome to my little zombie section so this time that's someone is a 1952 uh called the three divisors so basically uh yeah i think everyone knows about divisor right if a device if a divides b then a is called a divisor so given integer array and generally an exactly three positive divisor so for examp... | Three Divisors | minimum-sideway-jumps | Given an integer `n`, return `true` _if_ `n` _has **exactly three positive divisors**. Otherwise, return_ `false`.
An integer `m` is a **divisor** of `n` if there exists an integer `k` such that `n = k * m`.
**Example 1:**
**Input:** n = 2
**Output:** false
**Explantion:** 2 has only two divisors: 1 and 2.
**Exampl... | At a given point, there are only 3 possible states for where the frog can be. Check all the ways to move from one point to the next and update the minimum side jumps for each lane. | Array,Dynamic Programming,Greedy | Medium | 403 |
93 | hi everyone so today we're going to solve lead code daily challenge problem number 93 restore IP addresses so in this problem we have to basically find out a valid IP address which can be formed from a given string so they have mentioned a few conditions which we need to satisfy uh to your to identify a valid headphone... | 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 |
1,019 | Hello friends welcome to your channel today is our day 73 of the challenge so let's go straight to the screen and let's start today's question so the number of today's question is 9 I feel like changing the color. Need 109 and the name of the queen is the next greater node in the link list. Okay, so this is a very inte... | Next Greater Node In Linked List | squares-of-a-sorted-array | You are given the `head` of a linked list with `n` nodes.
For each node in the list, find the value of the **next greater node**. That is, for each node, find the value of the first node that is next to it and has a **strictly larger** value than it.
Return an integer array `answer` where `answer[i]` is the value of ... | null | Array,Two Pointers,Sorting | Easy | 88,360 |
109 | hey everybody this is larry this is day six of the madeliko daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's problem uh convert sorted list to binary search tree convert it to a height balance binary search tree okay um this is i mean this is still... | Convert Sorted List to Binary Search Tree | convert-sorted-list-to-binary-search-tree | Given the `head` of a singly linked list where elements are sorted in **ascending order**, convert _it to a_ **_height-balanced_** _binary search tree_.
**Example 1:**
**Input:** head = \[-10,-3,0,5,9\]
**Output:** \[0,-3,9,-10,null,5\]
**Explanation:** One possible answer is \[0,-3,9,-10,null,5\], which represents t... | null | Linked List,Divide and Conquer,Tree,Binary Search Tree,Binary Tree | Medium | 108,2306 |
92 | Hello welcome back tu Abhijeet quotes so today's video is going to be in Hindi, today's problem is reverse link list tu so this problem is English left and right where you have to separate the notes from tu to k four, they have to be reversed back to the original list. So if we solve this then first we will take this c... | Reverse Linked List II | reverse-linked-list-ii | Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], left = 2, right = 4
**Output:** \[1,4,3,2,5\]
**Example 2:**
**I... | null | Linked List | Medium | 206 |
81 | 181 search in rotated sorted array number two there is an integer array nouns sorted in non-decreasing array nouns sorted in non-decreasing array nouns sorted in non-decreasing order and not necessarily with distinct values which means we might have duplicates before being passed to your function noms is rotated at an ... | Search in Rotated Sorted Array II | search-in-rotated-sorted-array-ii | There is an integer array `nums` sorted in non-decreasing order (not necessarily with **distinct** values).
Before being passed to your function, `nums` is **rotated** at an unknown pivot index `k` (`0 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nu... | null | Array,Binary Search | Medium | 33 |
876 | hello everybody and welcome back to my Channel today I'm going to be working on a fast slow uh pointer approach in order to solve the middle of the linked list lead code problem and without further Ado let's move to the board here we are we've got the number 876 which is called middle of the linked list and the questio... | Middle of the Linked List | hand-of-straights | Given the `head` of a singly linked list, return _the middle node of the linked list_.
If there are two middle nodes, return **the second middle** node.
**Example 1:**
**Input:** head = \[1,2,3,4,5\]
**Output:** \[3,4,5\]
**Explanation:** The middle node of the list is node 3.
**Example 2:**
**Input:** head = \[1,... | null | Array,Hash Table,Greedy,Sorting | Medium | null |
532 | hello everyone welcome to coders camp we are at ninth day of february lead code challenge and the problem we are going to cover in this video is k different pairs in an array so we are given an input array nums and variable k which is also an integer and we have to return the number of k difference unique pair in the a... | 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 |
134 | Hello everyone, today we discuss this court problem 130. There are four main names of gas stations, there are stations, if you decide this a little problem then call it petrol station, what is there in it that even our bus owners have given end petrol stations, okay? So this will tell the first station that how many li... | Gas Station | gas-station | There are `n` gas stations along a circular route, where the amount of gas at the `ith` station is `gas[i]`.
You have a car with an unlimited gas tank and it costs `cost[i]` of gas to travel from the `ith` station to its next `(i + 1)th` station. You begin the journey with an empty tank at one of the gas stations.
Gi... | null | Array,Greedy | Medium | 1346 |
130 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem surrounded regions this is a pretty interesting problem and i think you're going to be really surprised by the solution that we come up with today and i definitely think this problem is well worth your time but before w... | Surrounded Regions | surrounded-regions | Given an `m x n` matrix `board` containing `'X'` and `'O'`, _capture all regions that are 4-directionally surrounded by_ `'X'`.
A region is **captured** by flipping all `'O'`s into `'X'`s in that surrounded region.
**Example 1:**
**Input:** board = \[\[ "X ", "X ", "X ", "X "\],\[ "X ", "O ", "O ", "X "\],\[ "X ", "... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | 200,286 |
203 | hello and welcome everyone let's continue tackling edition plus at least by solving the removed linked list element problem if you're new here to subscribe and if at the end of the video you like the video please be sure to give it a thumbs up as it helps to support the channel we are currently solving the sean plaza d... | Remove Linked List Elements | remove-linked-list-elements | Given the `head` of a linked list and an integer `val`, remove all the nodes of the linked list that has `Node.val == val`, and return _the new head_.
**Example 1:**
**Input:** head = \[1,2,6,3,4,5,6\], val = 6
**Output:** \[1,2,3,4,5\]
**Example 2:**
**Input:** head = \[\], val = 1
**Output:** \[\]
**Example 3:**... | null | Linked List,Recursion | Easy | 27,237,2216 |
1,985 | hey everybody this is larry this is me going to q2 of the weekly contest 256. find the cave largest integer underway so yeah hit the like button in the subscribe button join me in discord let me know what you think about this problem and especially if you are interested in contest problems come hang out so we could tal... | Find the Kth Largest Integer in the Array | maximum-subarray-min-product | You are given an array of strings `nums` and an integer `k`. Each string in `nums` represents an integer without leading zeros.
Return _the string that represents the_ `kth` _**largest integer** in_ `nums`.
**Note**: Duplicate numbers should be counted distinctly. For example, if `nums` is `[ "1 ", "2 ", "2 "]`, `"2 ... | Is there a way we can sort the elements to simplify the problem? Can we find the maximum min-product for every value in the array? | Array,Stack,Monotonic Stack,Prefix Sum | Medium | null |
1,706 | um hello everyone today we are going to see the solution of the problem where will the ball fall so in this problem we are given a two day grid of size M Crossing representing a box and we have N Balls so uh the Box is open at top and the bottom sides so um suppose this is the Box and the box has opened at the top and ... | Where Will the Ball Fall | min-cost-to-connect-all-points | You have a 2-D `grid` of size `m x n` representing a box, and you have `n` balls. The box is open on the top and bottom sides.
Each cell in the box has a diagonal board spanning two corners of the cell that can redirect a ball to the right or to the left.
* A board that redirects the ball to the right spans the top... | Connect each pair of points with a weighted edge, the weight being the manhattan distance between those points. The problem is now the cost of minimum spanning tree in graph with above edges. | Array,Union Find,Minimum Spanning Tree | Medium | 2287 |
1,636 | Hello Everyone Notorious Solving Questions From Number to Zip Code The Name of the Missions and Tabs at Liberation Positive Ones Can You Give R Tears for the Fast and the Types of Basics Subscribe Now to the White Quote Logic Million To Solve This Question Planet Which White Part To Solve Example Minute To Follow Basic... | Sort Array by Increasing Frequency | number-of-substrings-with-only-1s | Given an array of integers `nums`, sort the array in **increasing** order based on the frequency of the values. If multiple values have the same frequency, sort them in **decreasing** order.
Return the _sorted array_.
**Example 1:**
**Input:** nums = \[1,1,2,2,2,3\]
**Output:** \[3,1,1,2,2,2\]
**Explanation:** '3' h... | Count number of 1s in each consecutive-1 group. For a group with n consecutive 1s, the total contribution of it to the final answer is (n + 1) * n // 2. | Math,String | Medium | 1885,2186 |
31 | almostallplanswill go aheadthisyear, butthecouncilcanleadpv thedeathwasfound to have been aroundthedebate which wereadded whatajellyfishnokiapitythezero althoughit has to be workedelsewhere Noordhoekafootnotemustgo thousands ofdeadfeet hedoeshisjobmustpay the rates for theyear before, Ialso do that on the phone, Ihavea... | Next Permutation | next-permutation | A **permutation** of an array of integers is an arrangement of its members into a sequence or linear order.
* For example, for `arr = [1,2,3]`, the following are all the permutations of `arr`: `[1,2,3], [1,3,2], [2, 1, 3], [2, 3, 1], [3,1,2], [3,2,1]`.
The **next permutation** of an array of integers is the next le... | null | Array,Two Pointers | Medium | 46,47,60,267,1978 |
435 | hello everyone welcome back here is vanamsen and today we are working with JavaScript to solve at the interesting problem from lead code problem 435 attached non-overlapping interval uh 435 attached non-overlapping interval uh 435 attached non-overlapping interval uh JavaScript has some powerful features that make it a... | Non-overlapping Intervals | non-overlapping-intervals | Given an array of intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping_.
**Example 1:**
**Input:** intervals = \[\[1,2\],\[2,3\],\[3,4\],\[1,3\]\]
**Output:** 1
**Explanation:** \[1,3\] can be removed ... | null | Array,Dynamic Programming,Greedy,Sorting | Medium | 452 |
523 | Hello everyone so today we will be discussing question number 523 complete code which is continuous sub arrest sam so let us see what is given to us and what is to be removed from it we are given by a name na and we are given care we find What we have to do is whether this name exists or not. If it exists then we have ... | Continuous Subarray Sum | continuous-subarray-sum | Given an integer array nums and an integer k, return `true` _if_ `nums` _has a **good subarray** or_ `false` _otherwise_.
A **good subarray** is a subarray where:
* its length is **at least two**, and
* the sum of the elements of the subarray is a multiple of `k`.
**Note** that:
* A **subarray** is a contiguo... | null | Array,Hash Table,Math,Prefix Sum | Medium | 560,2119,2240 |
1,054 | hello friends today less of the distinct barcodes problem ever see the statement in a way house there is a roll of barcodes where the eyes barcode it sparkles I rearranged the barcode so that no two agents turnbuckles re Co you may return ending answer and it is guaranteeing the answer exists so because we do not need ... | Distant Barcodes | complement-of-base-10-integer | In a warehouse, there is a row of barcodes, where the `ith` barcode is `barcodes[i]`.
Rearrange the barcodes so that no two adjacent barcodes are equal. You may return any answer, and it is guaranteed an answer exists.
**Example 1:**
**Input:** barcodes = \[1,1,1,2,2,2\]
**Output:** \[2,1,2,1,2,1\]
**Example 2:**
... | A binary number plus its complement will equal 111....111 in binary. Also, N = 0 is a corner case. | Bit Manipulation | Easy | null |
103 | so uh lead code practice question uh in this video there are two things the first thing is to see how to solve this problem so we are going to find the solution and then we are going to do some coding work and the second goal is to see how we should behave in a real interview so let's get started so remember the first ... | Binary Tree Zigzag Level Order Traversal | binary-tree-zigzag-level-order-traversal | Given the `root` of a binary tree, return _the zigzag level order traversal of its nodes' values_. (i.e., from left to right, then right to left for the next level and alternate between).
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[3\],\[20,9\],\[15,7\]\]
**Example 2:**
**Input:** roo... | null | Tree,Breadth-First Search,Binary Tree | Medium | 102 |
630 | That's what guys welcome back to my channel and you are going to solve course k doom3 morning problem statement what is life in the problem statement here now I have given the course address which e is representing depression let's blast divide urination that your here Now when you take any course, what will you do til... | Course Schedule III | course-schedule-iii | There are `n` different online courses numbered from `1` to `n`. You are given an array `courses` where `courses[i] = [durationi, lastDayi]` indicate that the `ith` course should be taken **continuously** for `durationi` days and must be finished before or on `lastDayi`.
You will start on the `1st` day and you cannot ... | During iteration, say I want to add the current course, currentTotalTime being total time of all courses taken till now, but adding the current course might exceed my deadline or it doesn’t.
1. If it doesn’t, then I have added one new course. Increment the currentTotalTime with duration of current course. 2. If it e... | Array,Greedy,Heap (Priority Queue) | Hard | 207,210,2176 |
235 | welcome ladies and gentlemen boys and girls today we are going to solve one of the coolest problem which is lowest common ancestor of a binary substrate so this is one of the coolest and easy problem so we are going to do this let me just open my open board over here so first of all let me explain in the what the probl... | Lowest Common Ancestor of a Binary Search Tree | lowest-common-ancestor-of-a-binary-search-tree | Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST.
According to the [definition of LCA on Wikipedia](https://en.wikipedia.org/wiki/Lowest_common_ancestor): "The lowest common ancestor is defined between two nodes `p` and `q` as the lowest node in `T` that has bo... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | 236,1190,1780,1790,1816 |
1,734 | hey there everyone welcome back to lead coding in this video we are solving the biweekly contest 44 and this is the problem number three of the contest this was a tricky problem so first i will upload the solution to this and then i will upload the solution to the second problem which was comparatively easier than this... | Decode XORed Permutation | bank-account-summary-ii | There is an integer array `perm` that is a permutation of the first `n` positive integers, where `n` is always **odd**.
It was encoded into another integer array `encoded` of length `n - 1`, such that `encoded[i] = perm[i] XOR perm[i + 1]`. For example, if `perm = [1,3,2]`, then `encoded = [2,1]`.
Given the `encoded`... | null | Database | Easy | null |
1,575 | hey what's up guys john here again so let's take a look at another bi-weekly contest problem this time bi-weekly contest problem this time bi-weekly contest problem this time uh it's number 1575. uh count all possible roots okay so and you're given like an array of distinct positive integers locations okay where locati... | Count All Possible Routes | maximum-area-of-a-piece-of-cake-after-horizontal-and-vertical-cuts | You are given an array of **distinct** positive integers locations where `locations[i]` represents the position of city `i`. You are also given integers `start`, `finish` and `fuel` representing the starting city, ending city, and the initial amount of fuel you have, respectively.
At each step, if you are at city `i`,... | Sort the arrays, then compute the maximum difference between two consecutive elements for horizontal cuts and vertical cuts. The answer is the product of these maximum values in horizontal cuts and vertical cuts. | Array,Greedy,Sorting | Medium | null |
1,717 | hi everyone this is steve today let's go through another legal problem 1717 maximus call from removing sub streams um this is kind of pretty new problem i think from yesterday's uh contest i don't recall maybe from last week's contest okay let's go through the problem first you're given a string s and two integers x an... | Maximum Score From Removing Substrings | minimum-cost-to-connect-two-groups-of-points | You are given a string `s` and two integers `x` and `y`. You can perform two types of operations any number of times.
* Remove substring `"ab "` and gain `x` points.
* For example, when removing `"ab "` from `"cabxbae "` it becomes `"cxbae "`.
* Remove substring `"ba "` and gain `y` points.
* For examp... | Each point on the left would either be connected to exactly point already connected to some left node, or a subset of the nodes on the right which are not connected to any node Use dynamic programming with bitmasking, where the state will be (number of points assigned in first group, bitmask of points assigned in secon... | Array,Dynamic Programming,Bit Manipulation,Matrix,Bitmask | Hard | null |
1,711 | talkative Hi, this is not necessarily a question. Swag Lex chats countermeasures except for the problems with many different colors so its not so Let's get some and there are However the always for defense softwind is make up Kwee Tuh right every time from different Anton since David cerny tank and check if the song of... | Count Good Meals | find-valid-matrix-given-row-and-column-sums | A **good meal** is a meal that contains **exactly two different food items** with a sum of deliciousness equal to a power of two.
You can pick **any** two different foods to make a good meal.
Given an array of integers `deliciousness` where `deliciousness[i]` is the deliciousness of the `ith` item of fo... | Find the smallest rowSum or colSum, and let it be x. Place that number in the grid, and subtract x from rowSum and colSum. Continue until all the sums are satisfied. | Array,Greedy,Matrix | Medium | 1379 |
645 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem set mismatch this is a pretty interesting one for an easy it definitely qualifies as that because there is a pretty trivial solution which is O of n time and O of n space but we can actually optimize this in a few diffe... | 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 |
68 | friends today let's of text justification problem we are given array of words in the width max width format to the text such that each line has exactly max width characters and is fully justified I think this problem is just you translate these rules to the code and let's first to see the rules I figure out first it sh... | Text Justification | text-justification | Given an array of strings `words` and a width `maxWidth`, format the text such that each line has exactly `maxWidth` characters and is fully (left and right) justified.
You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces `' '` when necessary so that ea... | null | Array,String,Simulation | Hard | 1714,2260 |
997 | Hello everyone, today we will discuss about a new beat problem, lift problem number is 9717, problem is white till town judge, what is there in this problem, you have one leg and nutritious chillies are total and live and there is someone fixed at that end. What is your point in pointing out that judge, then it is as i... | Find the Town Judge | find-the-town-judge | In a town, there are `n` people labeled from `1` to `n`. There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
1. The town judge trusts nobody.
2. Everybody (except for the town judge) trusts the town judge.
3. There is exactly one person that satisfies properties **... | null | null | Easy | null |
1,996 | hello everyone this is september the 8th all right let's get to it the number of weak characters in the game you're playing a game that contains multiple characters and each of the character has two main properties attack and defense you're given a 2d integer array represents the properties of the eighth character is s... | The Number of Weak Characters in the Game | number-of-ways-to-rearrange-sticks-with-k-sticks-visible | You are playing a game that contains multiple characters, and each of the characters has **two** main properties: **attack** and **defense**. You are given a 2D integer array `properties` where `properties[i] = [attacki, defensei]` represents the properties of the `ith` character in the game.
A character is said to be... | Is there a way to build the solution from a base case? How many ways are there if we fix the position of one stick? | Math,Dynamic Programming,Combinatorics | Hard | null |
1,901 | okay so let's continue with our binary search playlist for before that heavy and welcome back to the channel I hope you guys are doing extremely well so the problem that you're going to solve today is finding a peak element the second now before watching this video please go back in the playlist and watch the part one ... | Find a Peak Element II | equal-sum-arrays-with-minimum-number-of-operations | A **peak** element in a 2D grid is an element that is **strictly greater** than all of its **adjacent** neighbors to the left, right, top, and bottom.
Given a **0-indexed** `m x n` matrix `mat` where **no two adjacent cells are equal**, find **any** peak element `mat[i][j]` and return _the length 2 array_ `[i,j]`.
Yo... | Let's note that we want to either decrease the sum of the array with a larger sum or increase the array's sum with the smaller sum. You can maintain the largest increase or decrease you can make in a binary search tree and each time get the maximum one. | Array,Hash Table,Greedy,Counting | Medium | 1263 |
1,802 | foreign this is Larry this is day 10 of the leeco daily challenge hit the like button hit the Subscribe and join me in Discord let me know what you think about today's Forum so yeah so the Drone video is still in Armenia but uh but I am here in tashken in Uzbekistan just chilling so let me know what you think uh about ... | 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 |
8 | hello friends welcome to this video this is a good hacker in this video I'm going to show you how to solve difficult coding publi string to integer all so long as a toy cutting table a toy is a C++ building function a toy stands for a C++ building function a toy stands for a C++ building function a toy stands for a ski... | String to Integer (atoi) | string-to-integer-atoi | Implement the `myAtoi(string s)` function, which converts a string to a 32-bit signed integer (similar to C/C++'s `atoi` function).
The algorithm for `myAtoi(string s)` is as follows:
1. Read in and ignore any leading whitespace.
2. Check if the next character (if not already at the end of the string) is `'-'` or `... | null | String | Medium | 7,65,2168 |
216 | Jhaal Ajay Ko Loot Hello Friends Welcome to My YouTube Channel Tier-3 Article Yagnik's Solid Channel Tier-3 Article Yagnik's Solid Channel Tier-3 Article Yagnik's Solid Problem 206 Problems Combination Hum Three Liter Problem Job Medium Category Let's Do Problem Statement Find All Valid Combinations of Numbers December... | Combination Sum III | combination-sum-iii | Find all valid combinations of `k` numbers that sum up to `n` such that the following conditions are true:
* Only numbers `1` through `9` are used.
* Each number is used **at most once**.
Return _a list of all possible valid combinations_. The list must not contain the same combination twice, and the combinations... | null | Array,Backtracking | Medium | 39 |
989 | um hello so today we are going to do this problem which is part of lead code daily challenge add to array form of integer so the problem says we get a number in the form of an array so for example one three two one in this format so each digit separately in a list and we get an integer K and we want to sum the two toge... | Add to Array-Form of Integer | largest-component-size-by-common-factor | The **array-form** of an integer `num` is an array representing its digits in left to right order.
* For example, for `num = 1321`, the array form is `[1,3,2,1]`.
Given `num`, the **array-form** of an integer, and an integer `k`, return _the **array-form** of the integer_ `num + k`.
**Example 1:**
**Input:** num ... | null | Array,Math,Union Find | Hard | 2276 |
1,494 | Hi Everyone, today we will discuss the question of Lead Code and Parallel Courses. This question was asked to me in the interviews of one of the main companies and the question asked in the interview had three parts, so I have discussed the first two parts in the previous video. Whose link I have also added in my descr... | 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 |
124 | hello and welcome back to another Elite code problem so today we're doing binary tree maximum path sum and the question is a path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them and no one can only appear in the sequence at most once note that the pa... | Binary Tree Maximum Path Sum | binary-tree-maximum-path-sum | A **path** in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence **at most once**. Note that the path does not need to pass through the root.
The **path sum** of a path is the sum of the node's values in the path.
... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Hard | 112,129,666,687,1492 |
67 | hey guys welcome back to another video and today we're going to be solving the lead code question add binary so this is a pretty simple question and all we need to do is we're given two binary strings and we need to return their sum as a binary string so the input strings are both non empty and they only contain the ch... | Add Binary | add-binary | Given two binary strings `a` and `b`, return _their sum as a binary string_.
**Example 1:**
**Input:** a = "11", b = "1"
**Output:** "100"
**Example 2:**
**Input:** a = "1010", b = "1011"
**Output:** "10101"
**Constraints:**
* `1 <= a.length, b.length <= 104`
* `a` and `b` consist only of `'0'` or `'1'` chara... | null | Math,String,Bit Manipulation,Simulation | Easy | 2,43,66,1031 |
37 | hey what's up guys this is jung so today um this one number 37 sudoku sober so i'm pretty sure everyone knows a sudoku game right so but this time so we need to solve it by writing a program so for those who are who don't know the sudoku game basically we have like 9x9 boards and on the boards our goal is to fill in th... | Sudoku Solver | sudoku-solver | Write a program to solve a Sudoku puzzle by filling the empty cells.
A sudoku solution must satisfy **all of the following rules**:
1. Each of the digits `1-9` must occur exactly once in each row.
2. Each of the digits `1-9` must occur exactly once in each column.
3. Each of the digits `1-9` must occur exactly onc... | null | Array,Backtracking,Matrix | Hard | 36,1022 |
126 | what's going to be body welcome to pass analytical solution to Turin number 126 and Henry 27 what ladder if a new here welcome I'm sure visiting the Annie blog nanny block on there are products and articles here doing absolutely enjoying this website so let's take a look to this classroom so it says um so yeah it actua... | Word Ladder II | word-ladder-ii | A **transformation sequence** from word `beginWord` to word `endWord` using a dictionary `wordList` is a sequence of words `beginWord -> s1 -> s2 -> ... -> sk` such that:
* Every adjacent pair of words differs by a single letter.
* Every `si` for `1 <= i <= k` is in `wordList`. Note that `beginWord` does not need ... | null | Hash Table,String,Backtracking,Breadth-First Search | Hard | 127,2276 |
24 | hello guys welcome to another video in the series of coding today we are going to do the problem which is called swap notes and paths so given a linked list you have to swap every two adjacent notes and return its head so let's try to take an example to understand this suppose you have a linked list which is one two th... | Swap Nodes in Pairs | swap-nodes-in-pairs | Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.)
**Example 1:**
**Input:** head = \[1,2,3,4\]
**Output:** \[2,1,4,3\]
**Example 2:**
**Input:** head = \[\]
**Output:** \[\... | null | Linked List,Recursion | Medium | 25,528 |
975 | hello welcome to algorithms simplified today we are going over number 975 odd even jump this is a hard level lee code question most notably used in a past online google assessment today i will be doing a detailed walkthrough explanation and coding out the solution to this problem i will be coding in the end with python... | Odd Even Jump | range-sum-of-bst | You are given an integer array `arr`. From some starting index, you can make a series of jumps. The (1st, 3rd, 5th, ...) jumps in the series are called **odd-numbered jumps**, and the (2nd, 4th, 6th, ...) jumps in the series are called **even-numbered jumps**. Note that the **jumps** are numbered, not the indices.
You... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | null |
492 | Sadhu Shrine in the ribbon month of You are looking at that moment dress, today we are going to talk about the constructing alarm clock on the list, it is a very good problem, we will see it, I have to call, the question is tell you that brother, it is on a withdrawal. We know how we design the size of the page, so her... | Construct the Rectangle | construct-the-rectangle | A web developer needs to know how to design a web page's size. So, given a specific rectangular web page's area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements:
1. The area of the rectangular web page you designed must equal to the given target area.... | The W is always less than or equal to the square root of the area, so we start searching at sqrt(area) till we find the result. | Math | Easy | null |
3 | hey guys Greg here and let's solve Le code number three the third question on Le code longest substring without repeating characters it is the most classic question for teaching the sliding window algorithm a really fundamental and Universal technique for data structures and algorithms it very commonly comes up in codi... | 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 |
258 | hi everyone i'm bihan chakravarti and today i'll be discussing late course problem number 258 that is add digits so here we have been given a number and we need to add all its digits until the result has only one digit and we need to return that single number that number with single digit okay so suppose i have 38 so s... | 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 |
1,239 | Hello everyone, today we will do question number of our dynamic programming playlist and as I told you in this note, first of all the basic fundamental concepts of DP will be in a separate playlist, here we will only explain the questions. We will understand and solve the question. Okay, so today's question is Lead Cod... | Maximum Length of a Concatenated String with Unique Characters | largest-1-bordered-square | You are given an array of strings `arr`. A string `s` is formed by the **concatenation** of a **subsequence** of `arr` that has **unique characters**.
Return _the **maximum** possible length_ of `s`.
A **subsequence** is an array that can be derived from another array by deleting some or no elements without changing ... | For each square, know how many ones are up, left, down, and right of this square. You can find it in O(N^2) using dynamic programming. Now for each square ( O(N^3) ), we can evaluate whether that square is 1-bordered in O(1). | Array,Dynamic Programming,Matrix | Medium | null |
191 | hello and welcome today we're doing a question from leak code called number of one bits it's an easy we're going to jump right into it write a function that takes the binary representation of an unsigned integer and Returns the number of one bits it has this is also known as the hemming weight and we have some notes He... | Number of 1 Bits | number-of-1-bits | Write a function that takes the binary representation of an unsigned integer and returns the number of '1' bits it has (also known as the [Hamming weight](http://en.wikipedia.org/wiki/Hamming_weight)).
**Note:**
* Note that in some languages, such as Java, there is no unsigned integer type. In this case, the input ... | null | Bit Manipulation | Easy | 190,231,338,401,461,693,767 |
458 | Hello and welcome to code ideas so in today's video we are going to solve today's problem is very poor so we will first understand the problem and then discuss the approach and intuition behind it and at the end we will be writing the code. For the solution so without any further delay let's get started so today's prob... | Poor Pigs | poor-pigs | There are `buckets` buckets of liquid, where **exactly one** of the buckets is poisonous. To figure out which one is poisonous, you feed some number of (poor) pigs the liquid to see whether they will die or not. Unfortunately, you only have `minutesToTest` minutes to determine which bucket is poisonous.
You can feed t... | What if you only have one shot? Eg. 4 buckets, 15 mins to die, and 15 mins to test. How many states can we generate with x pigs and T tests? Find minimum x such that (T+1)^x >= N | Math,Dynamic Programming,Combinatorics | Hard | null |
104 | in this video we'll go over leak code question number 104 maximum depth of a binary tree given the root of a binary tree we must return its maximum depth where the maximum depth is the number of nodes along the longest path from the root node down to the farthest Leaf node for example in this tree this is the longest p... | Maximum Depth of Binary Tree | maximum-depth-of-binary-tree | Given the `root` of a binary tree, return _its maximum depth_.
A binary tree's **maximum depth** is the number of nodes along the longest path from the root node down to the farthest leaf node.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 3
**Example 2:**
**Input:** root = \[1,null,2\]
**... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 110,111,774,1492 |
1,962 | Hello friends welcome to my channel let's have a look at today's daily challenge problem 1962 remove stones to minimize the total in this video we are going to give a solution based on the simulation with the help of a hip so first I'm going to read through the problem statement to digest the requirement and then we do... | Remove Stones to Minimize the Total | single-threaded-cpu | You are given a **0-indexed** integer array `piles`, where `piles[i]` represents the number of stones in the `ith` pile, and an integer `k`. You should apply the following operation **exactly** `k` times:
* Choose any `piles[i]` and **remove** `floor(piles[i] / 2)` stones from it.
**Notice** that you can apply the ... | To simulate the problem we first need to note that if at any point in time there are no enqueued tasks we need to wait to the smallest enqueue time of a non-processed element We need a data structure like a min-heap to support choosing the task with the smallest processing time from all the enqueued tasks | Array,Sorting,Heap (Priority Queue) | Medium | 2176 |
437 | 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 okay for 37 pass some Tory you're given a binary tree which each know contains an integer value find a number of paths that semester given right the path does not need t... | Path Sum III | path-sum-iii | Given the `root` of a binary tree and an integer `targetSum`, return _the number of paths where the sum of the values along the path equals_ `targetSum`.
The path does not need to start or end at the root or a leaf, but it must go downwards (i.e., traveling only from parent nodes to child nodes).
**Example 1:**
**In... | null | Tree,Depth-First Search,Binary Tree | Medium | 112,113,666,687 |
314 | well hello everyone come join me for a little coffee here and another elite code problem okay let's all sip now wasn't that the greatest sip you've ever had isn't this the best part of your day you know it is you know that's why you came for it okay so now we're gonna do binary tree vertical order traversal i have to a... | Binary Tree Vertical Order Traversal | binary-tree-vertical-order-traversal | Given the `root` of a binary tree, return _**the vertical order traversal** of its nodes' values_. (i.e., from top to bottom, column by column).
If two nodes are in the same row and column, the order should be from **left to right**.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[9\],\[3,... | null | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 102 |
1,187 | hey everyone today we are going to solve the little question maker is strictly increasing so you are given two integer arrays array1 and ra2 and returns a new minimum number of operations possibly zero needed to make array 1 switch 3 increasing in one operation you can choose two indices I and J and they do the assignm... | Make Array Strictly Increasing | print-foobar-alternately | Given two integer arrays `arr1` and `arr2`, return the minimum number of operations (possibly zero) needed to make `arr1` strictly increasing.
In one operation, you can choose two indices `0 <= i < arr1.length` and `0 <= j < arr2.length` and do the assignment `arr1[i] = arr2[j]`.
If there is no way to make `arr1` str... | null | Concurrency | Medium | 1203,1216 |
18 | hello everyone I welcome you all in our another DS where we will be solving a new DSA problem in C++ if you haven't new DSA problem in C++ if you haven't new DSA problem in C++ if you haven't checked our playlist the playlist is ready I will be uploading all the DSC questions here so you can check out so let's start ou... | 4Sum | 4sum | Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that:
* `0 <= a, b, c, d < n`
* `a`, `b`, `c`, and `d` are **distinct**.
* `nums[a] + nums[b] + nums[c] + nums[d] == target`
You may return the answer in **any order**.
**Examp... | null | Array,Two Pointers,Sorting | Medium | 1,15,454,2122 |
653 | in this video we will be solving a two sum problem for a binary search tree so we have a few numbers that are stored in a binary search tree and we are given access to the root node of this binary search tree and we have to check whether a pair of numbers exists in this binary tree binary search tree such that their su... | Two Sum IV - Input is a BST | two-sum-iv-input-is-a-bst | Given the `root` of a binary search tree and an integer `k`, return `true` _if there exist two elements in the BST such that their sum is equal to_ `k`, _or_ `false` _otherwise_.
**Example 1:**
**Input:** root = \[5,3,6,2,4,null,7\], k = 9
**Output:** true
**Example 2:**
**Input:** root = \[5,3,6,2,4,null,7\], k = ... | null | Hash Table,Two Pointers,Tree,Depth-First Search,Breadth-First Search,Binary Search Tree,Binary Tree | Easy | 1,167,170,1150 |
1,266 | with code number 1266 minimum time visiting all the points we are giving given a sequence of points and we have to visit them in the given order we cannot change the order we have to visit one after another and we have to visit by making a shortest move possible shortest number of moves and the shortest number of moves... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.