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 |
|---|---|---|---|---|---|---|---|---|
160 | hi folks welcome to one more linked list problem so in this problem we need to find a intersecting point between two linked lists so we have two linked lists going there and then at one point of time they intersect each other and then they become single linked list so our job is to find that node where both the lists i... | Intersection of Two Linked Lists | intersection-of-two-linked-lists | Given the heads of two singly linked-lists `headA` and `headB`, return _the node at which the two lists intersect_. If the two linked lists have no intersection at all, return `null`.
For example, the following two linked lists begin to intersect at node `c1`:
The test cases are generated such that there are no cycle... | null | Hash Table,Linked List,Two Pointers | Easy | 599 |
419 | Have saunf bandh today they want to discuss this list to medium problem people forces after various board this problem has been previously in verse in sea interviews of Microsoft amazon attractive and selected for the gullible like and subscribe the channel for celebration remind me to the place But you discus superint... | Battleships in a Board | battleships-in-a-board | Given an `m x n` matrix `board` where each cell is a battleship `'X'` or empty `'.'`, return _the number of the **battleships** on_ `board`.
**Battleships** can only be placed horizontally or vertically on `board`. In other words, they can only be made of the shape `1 x k` (`1` row, `k` columns) or `k x 1` (`k` rows, ... | null | Array,Depth-First Search,Matrix | Medium | null |
462 | Hello guys welcome to the video according to the series yes viewers problem school minimum mode to equal are elements of two souls were given a teacher in that size or Twitter minimum number of votes equal to make all elements equal annual increment and decrement elements by Subscribe Now to The Worst Thing You Can Giv... | Minimum Moves to Equal Array Elements II | minimum-moves-to-equal-array-elements-ii | 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 or decrement an element of the array by `1`.
Test cases are designed so that the answer will fit in a **32-bit** integer.
**Example 1:**
**Input:** nums = \[1,2,3... | null | Array,Math,Sorting | Medium | 296,453,2160,2290 |
49 | hello and welcome to another video in this video we're going to be working on group anagrams and in this problem you're given an array of strings and you want to group The anagrams together you can return the answer in any order anagram is a word or phrase rearranged or formed by rearranging letters of a different word... | Group Anagrams | group-anagrams | Given an array of strings `strs`, group **the anagrams** together. You can return the answer in **any order**.
An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
**Example 1:**
**Input:** strs = \["eat","tea","tan... | null | Hash Table,String,Sorting | Medium | 242,249 |
1,267 | Hello Hi Friends Welcome Back To Yaar Go Into Solitude Problem 1267 Contrasts Date Communicate Now Four Wheel Gotras Description Of The Problem And Some Example Is Just Want To Mention Date My Channel Process Of Helping People While Preparing For Coding And Java Interviews And All My Channel Draw More Than 80 Solved Pr... | Count Servers that Communicate | remove-zero-sum-consecutive-nodes-from-linked-list | You are given a map of a server center, represented as a `m * n` integer matrix `grid`, where 1 means that on that cell there is a server and 0 means that it is no server. Two servers are said to communicate if they are on the same row or on the same column.
Return the number of servers that communicate with any o... | Convert the linked list into an array. While you can find a non-empty subarray with sum = 0, erase it. Convert the array into a linked list. | Hash Table,Linked List | Medium | 1618 |
1,704 | hello and welcome to today's daily lead code challenge let's solve question 1704 determine if string halves are alike so I've solved this already before but you're given a string s of even length split the string into two halves of equal length let a be the first half B be the second half two strings are alike if they ... | Determine if String Halves Are Alike | special-positions-in-a-binary-matrix | You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half.
Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppe... | Keep track of 1s in each row and in each column. Then while iterating over matrix, if the current position is 1 and current row as well as current column contains exactly one occurrence of 1. | Array,Matrix | Easy | null |
1,722 | hey there everyone welcome back to lead coding in this video we will be solving the question number three of lead code weekly contest 223 name of the problem is minimize having distance after swipe operations now in this problem we are given two arrays the source array and the target array and we are given another arra... | Minimize Hamming Distance After Swap Operations | throne-inheritance | You are given two integer arrays, `source` and `target`, both of length `n`. You are also given an array `allowedSwaps` where each `allowedSwaps[i] = [ai, bi]` indicates that you are allowed to swap the elements at index `ai` and index `bi` **(0-indexed)** of array `source`. Note that you can swap elements at a specifi... | Create a tree structure of the family. Without deaths, the order of inheritance is simply a pre-order traversal of the tree. Mark the dead family members tree nodes and don't include them in the final order. | Hash Table,Tree,Depth-First Search,Design | Medium | 2104 |
373 | today we're gonna be working on nude code question number 373 find K pairs with smallest sums you are given to integer arrays nums 1 and nums two sorted in ascending order and an integer K Define a pair UV which consists of one element from the first array and one element from the second array return the K appears so w... | Find K Pairs with Smallest Sums | find-k-pairs-with-smallest-sums | You are given two integer arrays `nums1` and `nums2` sorted in **ascending order** and an integer `k`.
Define a pair `(u, v)` which consists of one element from the first array and one element from the second array.
Return _the_ `k` _pairs_ `(u1, v1), (u2, v2), ..., (uk, vk)` _with the smallest sums_.
**Example 1:**... | null | Array,Heap (Priority Queue) | Medium | 378,719,2150 |
1,640 | Is Then A Today They Are Going To 7 The Fast Follow Benefits Replay Mixture's Deformation True Contact Nation Should Strive To Easily Understand Statement Password Or Singh Hair You Will Be Given Twenty One Is The Schezwan When Scam Id Quantum Mode List Advocate Morning Nickel Unit Fluid Modifying sequence of the small... | Check Array Formation Through Concatenation | design-a-file-sharing-system | You are given an array of **distinct** integers `arr` and an array of integer arrays `pieces`, where the integers in `pieces` are **distinct**. Your goal is to form `arr` by concatenating the arrays in `pieces` **in any order**. However, you are **not** allowed to reorder the integers in each array `pieces[i]`.
Return... | Try to solve it by keeping for each file chunk, the users who have this chunk. Try to solve it by keeping all the users in the system with their owned chunks, and when you request a chunk, check all users for it. | Hash Table,Design,Heap (Priority Queue),Data Stream | Medium | 355 |
90 | Hello Hi Everyone Welcome To My Channel And We Are Going To Solve A Classical Problem Sabse To Me Already Sold Very Long Back Sabse Problem Seven So Let's Problem Aaye Delhi Suggest First Solve The Problem Because This Problem Can Beat Vishal Net Problem Solve This Problem Solve Basically Giver Numbers And Need To Gene... | Subsets II | subsets-ii | Given an integer array `nums` that may contain duplicates, return _all possible_ _subsets_ _(the power set)_.
The solution set **must not** contain duplicate subsets. Return the solution in **any order**.
**Example 1:**
**Input:** nums = \[1,2,2\]
**Output:** \[\[\],\[1\],\[1,2\],\[1,2,2\],\[2\],\[2,2\]\]
**Example... | null | Array,Backtracking,Bit Manipulation | Medium | 78,2109 |
144 | hello everyone welcome back to my channel this is jess so today in this video we're going to go over the implementation of pre-order over the implementation of pre-order over the implementation of pre-order traversal on binary tree if you want a quick recap on how pre-order pre-order pre-order traversal works on a bina... | Binary Tree Preorder Traversal | binary-tree-preorder-traversal | Given the `root` of a binary tree, return _the preorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[1,2,3\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of nodes ... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 94,255,775 |
72 | hi everyone welcome back to the channel called daily challenge problem number 72 headed distance so it's a really short problem but it's a really interesting problem to solve as well so we will be given two strings Ward one and board two and we have to basically return the minimum number of operations we would require ... | Edit Distance | edit-distance | Given two strings `word1` and `word2`, return _the minimum number of operations required to convert `word1` to `word2`_.
You have the following three operations permitted on a word:
* Insert a character
* Delete a character
* Replace a character
**Example 1:**
**Input:** word1 = "horse ", word2 = "ros "
**O... | null | String,Dynamic Programming | Hard | 161,583,712,1105,2311 |
1,658 | hey what's up guys this is chung here again so this time let's take a look at one of the weekly contest problem number 1658 minimum operations to reduce x to zero yeah i think this is a pretty good problem media level problem okay so you're given like an integer array nums and an integer x in one operations you can eit... | Minimum Operations to Reduce X to Zero | minimum-swaps-to-arrange-a-binary-grid | You are given an integer array `nums` and an integer `x`. In one operation, you can either remove the leftmost or the rightmost element from the array `nums` and subtract its value from `x`. Note that this **modifies** the array for future operations.
Return _the **minimum number** of operations to reduce_ `x` _to **e... | For each row of the grid calculate the most right 1 in the grid in the array maxRight. To check if there exist answer, sort maxRight and check if maxRight[i] ≤ i for all possible i's. If there exist an answer, simulate the swaps. | Array,Greedy,Matrix | Medium | null |
136 | hello everyone welcome back and today we are looking at question 136 which is single number so we are given a non empty array of integers it's called nums and every element in this array appears twice except for one and we want to return that single number in other words our array contains one unique value and all othe... | 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 |
363 | hi everyone my name is coaching and today i'm trying to solve the uh august challenge problem the problem is maximum sum of uh rectangle no larger than k so the basically the problem is that given an m cross n matrix uh an integer is k and written the maximum sum of uh rectangle in this matrix such that its sum is no l... | Max Sum of Rectangle No Larger Than K | max-sum-of-rectangle-no-larger-than-k | Given an `m x n` matrix `matrix` and an integer `k`, return _the max sum of a rectangle in the matrix such that its sum is no larger than_ `k`.
It is **guaranteed** that there will be a rectangle with a sum no larger than `k`.
**Example 1:**
**Input:** matrix = \[\[1,0,1\],\[0,-2,3\]\], k = 2
**Output:** 2
**Explana... | null | Array,Binary Search,Dynamic Programming,Matrix,Ordered Set | Hard | null |
888 | okay so welcome guys so let's solve this uh fair candy swap so alice and bob have candy spare uh different sizes no added size eyes the size of ice bears uh candy but i been can at his house and bear above side stage the size of jay's parliament so basically uh alice have some candies and bubbles on candies since they ... | Fair Candy Swap | mirror-reflection | Alice and Bob have a different total number of candies. You are given two integer arrays `aliceSizes` and `bobSizes` where `aliceSizes[i]` is the number of candies of the `ith` box of candy that Alice has and `bobSizes[j]` is the number of candies of the `jth` box of candy that Bob has.
Since they are friends, they wo... | null | Math,Geometry | Medium | null |
377 | Hello friends to Jhal Ajay, once again welcome all of you to my YouTube channel Tier-3. There are two more all of you to my YouTube channel Tier-3. There are two more interesting questions to be asked in today's video whose name is Combination Suff and these questions must have been already asked by those people who Ma... | Combination Sum IV | combination-sum-iv | Given an array of **distinct** integers `nums` and a target integer `target`, return _the number of possible combinations that add up to_ `target`.
The test cases are generated so that the answer can fit in a **32-bit** integer.
**Example 1:**
**Input:** nums = \[1,2,3\], target = 4
**Output:** 7
**Explanation:**
Th... | null | Array,Dynamic Programming | Medium | 39 |
1,694 | all right welcome to my second um Leo video where I choose a random problem and you join me as I encounter it for the first time and watch me do my best to solve it and then afterwards we look at the um optimal solution and if I had didn't reach that we'll explore the optimal solution and how we could have reached that... | Reformat Phone Number | make-sum-divisible-by-p | You are given a phone number as a string `number`. `number` consists of digits, spaces `' '`, and/or dashes `'-'`.
You would like to reformat the phone number in a certain manner. Firstly, **remove** all spaces and dashes. Then, **group** the digits from left to right into blocks of length 3 **until** there are 4 or f... | Use prefix sums to calculate the subarray sums. Suppose you know the remainder for the sum of the entire array. How does removing a subarray affect that remainder? What remainder does the subarray need to have in order to make the rest of the array sum up to be divisible by k? Use a map to keep track of the rightmost i... | Array,Hash Table,Prefix Sum | Medium | 1016 |
1,822 | hello guys welcome back to my channel and today we will be solving a new lead code question that is sign of the product of an array before starting this question guys please do subscribe to the channel hit the like button press the Bell icon button so that you can get the recent updates from the channel so let's read o... | Sign of the Product of an Array | longest-palindromic-subsequence-ii | There is a function `signFunc(x)` that returns:
* `1` if `x` is positive.
* `-1` if `x` is negative.
* `0` if `x` is equal to `0`.
You are given an integer array `nums`. Let `product` be the product of all values in the array `nums`.
Return `signFunc(product)`.
**Example 1:**
**Input:** nums = \[-1,-2,-3,-4,... | As with any good dp problem that uses palindromes, try building the palindrome from the edges The prime point is to check that no two adjacent characters are equal, so save the past character while building the palindrome. | String,Dynamic Programming | Medium | 516 |
332 | hello everyone welcome back here it's Vanessa and today we have a really exciting problem uh called find a itinerary so this is a political daily challenge and this is a classic graph problem that can be solved using that first search or DFS so if you are a fan of graph Theory or you want to learn more about DFS this i... | Reconstruct Itinerary | reconstruct-itinerary | You are given a list of airline `tickets` where `tickets[i] = [fromi, toi]` represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it.
All of the tickets belong to a man who departs from `"JFK "`, thus, the itinerary must begin with `"JFK "`. If there are multiple... | null | Depth-First Search,Graph,Eulerian Circuit | Hard | 2051,2201 |
1,762 | hello today we'll be doing leeco number 1762 buildings with an ocean view now for this problem we are being given an array of integers which represents heights of buildings in a line and to the right of all these buildings there is an ocean and what we want to do is find all the buildings that have an ocean view which ... | Buildings With an Ocean View | furthest-building-you-can-reach | There are `n` buildings in a line. You are given an integer array `heights` of size `n` that represents the heights of the buildings in the line.
The ocean is to the right of the buildings. A building has an ocean view if the building can see the ocean without obstructions. Formally, a building has an ocean view if al... | Assume the problem is to check whether you can reach the last building or not. You'll have to do a set of jumps, and choose for each one whether to do it using a ladder or bricks. It's always optimal to use ladders in the largest jumps. Iterate on the buildings, maintaining the largest r jumps and the sum of the remain... | Array,Greedy,Heap (Priority Queue) | Medium | null |
1,796 | let's solve problem 1796 second largest digit in a string so given an alpha numeric string is return the second largest numerical digit that appears in s or minus1 if it does not exist an alpha numeric string is a string consisting of lowercase English letters and digits so they are saying they're giving a string of le... | Second Largest Digit in a String | correct-a-binary-tree | Given an alphanumeric string `s`, return _the **second largest** numerical digit that appears in_ `s`_, or_ `-1` _if it does not exist_.
An **alphanumeric** string is a string consisting of lowercase English letters and digits.
**Example 1:**
**Input:** s = "dfa12321afd "
**Output:** 2
**Explanation:** The digits t... | If you traverse the tree from right to left, the invalid node will point to a node that has already been visited. | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 114,766 |
1,091 | Everyone welcome back to my YouTube channel, so today we are going to do the shortest lesson in a boundary matrix, it is a very medium level question but the meaning is something very special. No, if you know how to do fast first search concept then no in the question. Not going to tell anything quickly, it is a very e... | Shortest Path in Binary Matrix | maximum-average-subtree | Given an `n x n` binary matrix `grid`, return _the length of the shortest **clear path** in the matrix_. If there is no clear path, return `-1`.
A **clear path** in a binary matrix is a path from the **top-left** cell (i.e., `(0, 0)`) to the **bottom-right** cell (i.e., `(n - 1, n - 1)`) such that:
* All the visite... | Can you find the sum of values and the number of nodes for every sub-tree ? Can you find the sum of values and the number of nodes for a sub-tree given the sum of values and the number of nodes of it's left and right sub-trees ? Use depth first search to recursively find the solution for the children of a node then use... | Tree,Depth-First Search,Binary Tree | Medium | 2126 |
119 | hey guys welcome back to another video and today we're going to be solving the lead code question pascal's triangle 2. so in this question we're going to be given a non-negative we're going to be given a non-negative we're going to be given a non-negative index so let's say we're given the index 0. so we need to return... | Pascal's Triangle II | pascals-triangle-ii | Given an integer `rowIndex`, return the `rowIndexth` (**0-indexed**) row of the **Pascal's triangle**.
In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown:
**Example 1:**
**Input:** rowIndex = 3
**Output:** \[1,3,3,1\]
**Example 2:**
**Input:** rowIndex = 0
**Output:** \[... | null | Array,Dynamic Programming | Easy | 118,2324 |
905 | hey guys welcome back to another video and today we're going to be solving the lika question sort array by parity all right so we're given an area a of non-negative integers and we area a of non-negative integers and we area a of non-negative integers and we return an area consisting of all the even elements of a follo... | Sort Array By Parity | length-of-longest-fibonacci-subsequence | Given an integer array `nums`, move all the even integers at the beginning of the array followed by all the odd integers.
Return _**any array** that satisfies this condition_.
**Example 1:**
**Input:** nums = \[3,1,2,4\]
**Output:** \[2,4,3,1\]
**Explanation:** The outputs \[4,2,3,1\], \[2,4,1,3\], and \[4,2,1,3\] w... | null | Array,Hash Table,Dynamic Programming | Medium | 1013 |
198 | what's up everyone today we're going to go over house rubber first we'll go over the input and the output then we'll look at the approach and finally we'll go over the code and complexity oh the input is going to be an integer array and the output is going to be an integer what we have to do is pick numbers such that w... | House Robber | house-robber | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and **it will automatically contact the police if two adjacent houses were broken into... | null | Array,Dynamic Programming | Medium | 152,213,256,276,337,600,656,740,2262 |
413 | hi guys welcome to algorithms made easy in this video we will see the question arithmetic slices a sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive element is the same so here the examples given in these are arithmetic sequences because ... | Arithmetic Slices | arithmetic-slices | An integer array is called arithmetic if it consists of **at least three elements** and if the difference between any two consecutive elements is the same.
* For example, `[1,3,5,7,9]`, `[7,7,7,7]`, and `[3,-1,-5,-9]` are arithmetic sequences.
Given an integer array `nums`, return _the number of arithmetic **subarr... | null | Array,Dynamic Programming | Medium | 446,1752 |
153 | hey guys Greg here let's solve 153 which is find minimum in rotated sorted array so suppose an array of length n is sorted in ascending order so the numbers are going up but then it's been rotated between one and N times so for example the array of originally nums as just the numbers 0 to 7 if you rotated it four times... | Find Minimum in Rotated Sorted Array | find-minimum-in-rotated-sorted-array | Suppose an array of length `n` sorted in ascending order is **rotated** between `1` and `n` times. For example, the array `nums = [0,1,2,4,5,6,7]` might become:
* `[4,5,6,7,0,1,2]` if it was rotated `4` times.
* `[0,1,2,4,5,6,7]` if it was rotated `7` times.
Notice that **rotating** an array `[a[0], a[1], a[2], .... | Array was originally in ascending order. Now that the array is rotated, there would be a point in the array where there is a small deflection from the increasing sequence. eg. The array would be something like [4, 5, 6, 7, 0, 1, 2]. You can divide the search space into two and see which direction to go.
Can you think ... | Array,Binary Search | Medium | 33,154 |
915 | hey everybody this is larry this is day 22 of the july league daily challenge hit the like button to subscribe and join me on discord let me know what you think about today's problem and today's problem is partition the way into this disjoint intervals okay so i usually stop this live so if it's a bit slow fast forward... | Partition Array into Disjoint Intervals | generate-random-point-in-a-circle | Given an integer array `nums`, partition it into two (contiguous) subarrays `left` and `right` so that:
* Every element in `left` is less than or equal to every element in `right`.
* `left` and `right` are non-empty.
* `left` has the smallest possible size.
Return _the length of_ `left` _after such a partitioni... | null | Math,Geometry,Rejection Sampling,Randomized | Medium | 914 |
832 | hey everybody this is larry this is day 10 of the november league code daily challenge hit the like button to subscribe and join me on discord uh and today's forum is flipping an image binary matrix x you want to fit horizontally inward and then return the image okay which way is horizontally uh like left goes to the r... | Flipping an Image | binary-tree-pruning | Given an `n x n` binary matrix `image`, flip the image **horizontally**, then invert it, and return _the resulting image_.
To flip an image horizontally means that each row of the image is reversed.
* For example, flipping `[1,1,0]` horizontally results in `[0,1,1]`.
To invert an image means that each `0` is repla... | null | Tree,Depth-First Search,Binary Tree | Medium | null |
867 | question 867 transpose matrix so what the question is asking for is to return the new transposed matrix where it is flipped over its main diagonal switching the row matrix row and column indices so we can see over here that the main diagonal value is unchanged before and after and what's changed are the other values so... | Transpose Matrix | new-21-game | Given a 2D integer array `matrix`, return _the **transpose** of_ `matrix`.
The **transpose** of a matrix is the matrix flipped over its main diagonal, switching the matrix's row and column indices.
**Example 1:**
**Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[\[1,4,7\],\[2,5,8\],\[3,6,9\]\]
**E... | null | Math,Dynamic Programming,Sliding Window,Probability and Statistics | Medium | null |
456 | hello everyone welcome to day seventh of may lead code challenge and i hope all if you're having a great time my name is sanchez i'm working a software developer for adobe and today i present day 676 of daily record problem the question that we have in today's 132 pattern here in this question we are given an array of ... | 132 Pattern | 132-pattern | Given an array of `n` integers `nums`, a **132 pattern** is a subsequence of three integers `nums[i]`, `nums[j]` and `nums[k]` such that `i < j < k` and `nums[i] < nums[k] < nums[j]`.
Return `true` _if there is a **132 pattern** in_ `nums`_, otherwise, return_ `false`_._
**Example 1:**
**Input:** nums = \[1,2,3,4\]
... | null | Array,Binary Search,Stack,Monotonic Stack,Ordered Set | Medium | null |
1,696 | To Share Subscribe button and welcome back to my YouTube channel Today we are doing Ninth Question Objective Question Lens for Nico and the question is Champions Trophy Vitamin C The question it will ask and Share and Subscribe Hamare mann hoga to hume ghum kaun tak kar sakte Can subscribe and give us not at all voice ... | Jump Game VI | strange-printer-ii | You are given a **0-indexed** integer array `nums` and an integer `k`.
You are initially standing at index `0`. In one move, you can jump at most `k` steps forward without going outside the boundaries of the array. That is, you can jump from index `i` to any index in the range `[i + 1, min(n - 1, i + k)]` **inclusive*... | Try thinking in reverse. Given the grid, how can you tell if a colour was painted last? | Array,Graph,Topological Sort,Matrix | Hard | 664 |
354 | okay let's talk about russian door envelope so you're given 2d array and embedded i represent w i and h i represent height and width and whenever one envelope can fit into an order if only the width and height of both greater than the other so return the maximum number of the envelope you can um right so in this case u... | Russian Doll Envelopes | russian-doll-envelopes | You are given a 2D array of integers `envelopes` where `envelopes[i] = [wi, hi]` represents the width and the height of an envelope.
One envelope can fit into another if and only if both the width and height of one envelope are greater than the other envelope's width and height.
Return _the maximum number of envelope... | null | Array,Binary Search,Dynamic Programming,Sorting | Hard | 300,2123 |
234 | welcome to this video now we have a coding interview question palindrome linked list you're given a singly linked list to determine if it is a palindrome for example if you are given this particular linked list then you have to return true because this linked list is a palindrome if we reverse this linked list then it ... | Palindrome Linked List | palindrome-linked-list | Given the `head` of a singly linked list, return `true` _if it is a_ _palindrome_ _or_ `false` _otherwise_.
**Example 1:**
**Input:** head = \[1,2,2,1\]
**Output:** true
**Example 2:**
**Input:** head = \[1,2\]
**Output:** false
**Constraints:**
* The number of nodes in the list is in the range `[1, 105]`.
* ... | null | Linked List,Two Pointers,Stack,Recursion | Easy | 9,125,206,2236 |
398 | Hello hello friends welcome to codeinator love this channel doing great difficult my channel and please share subscribe my favorite become playlist cricketer and various categories of problems which made for research difficult for your research dynamic programming real mother and son porn you will find play list Aware ... | Random Pick Index | random-pick-index | Given an integer array `nums` with possible **duplicates**, randomly output the index of a given `target` number. You can assume that the given target number must exist in the array.
Implement the `Solution` class:
* `Solution(int[] nums)` Initializes the object with the array `nums`.
* `int pick(int target)` Pic... | null | Hash Table,Math,Reservoir Sampling,Randomized | Medium | 382,894,912 |
573 | hey everybody this is Larry this is day uh week two of the Leo daddy weekly premium challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's prom squirel simulation B I haven't done before uh yeah I'm still in Hiroshima uh today um if you watch my daily video yo... | Squirrel Simulation | squirrel-simulation | You are given two integers `height` and `width` representing a garden of size `height x width`. You are also given:
* an array `tree` where `tree = [treer, treec]` is the position of the tree in the garden,
* an array `squirrel` where `squirrel = [squirrelr, squirrelc]` is the position of the squirrel in the garde... | Will Brute force solution works here? What will be its complexity? Brute force definitely won't work here. Think of some simple solution. Take some example and make some observations. Will order of nuts traversed by squirrel is important or only first nut traversed by squirrel is important? Are there some paths which s... | Array,Math | Medium | null |
36 | let's take a look at number 36 that is Sudoku the problem solving algorithm problem is not just you we should be able to solve the problems by writing a code but we're also required to explain our thoughts so I find that it fine creating this YouTube channel and recording these videos is a it's very helpful to me to ex... | Valid Sudoku | valid-sudoku | Determine if a `9 x 9` Sudoku board is valid. Only the filled cells need to be validated **according to the following rules**:
1. Each row must contain the digits `1-9` without repetition.
2. Each column must contain the digits `1-9` without repetition.
3. Each of the nine `3 x 3` sub-boxes of the grid must contain... | null | Array,Hash Table,Matrix | Medium | 37,2254 |
1,403 | yeahyeah Hello everyone, I'm a programmer. Today I will introduce to you a problem titled minimum substring in sorting. This is descending sorting, right? Don't say that it's not ascending, it means sorting in descending order. Okay, the detailed problem is as follows, giving us an array of integers, a string called th... | Minimum Subsequence in Non-Increasing Order | palindrome-partitioning-iii | Given the array `nums`, obtain a subsequence of the array whose sum of elements is **strictly greater** than the sum of the non included elements in such subsequence.
If there are multiple solutions, return the subsequence with **minimum size** and if there still exist multiple solutions, return the subsequence with t... | For each substring calculate the minimum number of steps to make it palindrome and store it in a table. Create a dp(pos, cnt) which means the minimum number of characters changed for the suffix of s starting on pos splitting the suffix on cnt chunks. | String,Dynamic Programming | Hard | 1871 |
844 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem backspace string compare we're given two strings SNT and we want to return true if they are the same string but there's a catch here we can't just do a basic string compare because there is a special character the pound... | Backspace String Compare | backspace-string-compare | Given two strings `s` and `t`, return `true` _if they are equal when both are typed into empty text editors_. `'#'` means a backspace character.
Note that after backspacing an empty text, the text will continue empty.
**Example 1:**
**Input:** s = "ab#c ", t = "ad#c "
**Output:** true
**Explanation:** Both s and t... | null | null | Easy | null |
1,865 | hello guys welcome back to the channel today we are solving another lead code problem that is 1865 finding pair with certain some I would highly recommend before jumping into the solution you should read the problem statement on your own and give at least 15 to 30 minutes to this problem let's get right into it what pr... | Finding Pairs With a Certain Sum | checking-existence-of-edge-length-limited-paths-ii | You are given two integer arrays `nums1` and `nums2`. You are tasked to implement a data structure that supports queries of two types:
1. **Add** a positive integer to an element of a given index in the array `nums2`.
2. **Count** the number of pairs `(i, j)` such that `nums1[i] + nums2[j]` equals a given value (`0 ... | Find the minimum spanning tree of the given graph. Root the tree in an arbitrary node and calculate the maximum weight of the edge from each node to the chosen root. To answer a query, find the lca between the two nodes, and find the maximum weight from each of the query nodes to their lca and compare it to the given l... | Union Find,Graph,Minimum Spanning Tree | Hard | 1815 |
91 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem decode ways so we're basically given a string of integers and we want to know with that string of integers how many different ways can we take that string of integers and decode it into a string of characters and we're ... | 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 |
1,961 | foreign welcome back to my channel and today we guys are going to solve a new lead code question that is check if string is a prefix of array so guys just before starting to solve this question let's read out the question given a string as and an array of words determine whether s is a prefix of a string of words a str... | Check If String Is a Prefix of Array | maximum-ice-cream-bars | Given a string `s` and an array of strings `words`, determine whether `s` is a **prefix string** of `words`.
A string `s` is a **prefix string** of `words` if `s` can be made by concatenating the first `k` strings in `words` for some **positive** `k` no larger than `words.length`.
Return `true` _if_ `s` _is a **prefi... | It is always optimal to buy the least expensive ice cream bar first. Sort the prices so that the cheapest ice cream bar comes first. | Array,Greedy,Sorting | Medium | null |
1,675 | hello everyone welcome to day 19 the february lead code challenge i hope all of you are having a great time after a very long time i am seeing a hard question in the daily challenge which is minimize deviation in an array and to your surprise for all those who have been associated with a channel must know that we have ... | 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 |
33 | Hello Gas Myself Amrita Welcome Back To Our Channel Technosis So In Today's Video Are Going To Discuss Lead Code Problem Number 33 Date Is Search In Rotate Sorted Are So Let's Get Started Let's First Understand The Problem So Are The Problem Status Date There Is An Wait Errors Sorted in Ascending Order with Distinct Va... | Search in Rotated Sorted Array | search-in-rotated-sorted-array | There is an integer array `nums` sorted in ascending order (with **distinct** values).
Prior to being passed to your function, `nums` is **possibly rotated** at an unknown pivot index `k` (`1 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]]` ... | null | Array,Binary Search | Medium | 81,153,2273 |
1,557 | Hai gas welcome me welcome back to me channel so today our problem is minimum number of vertices tu rich jo notes so what have you given us in this problem statement here we have been given a one director a cyclic graph which has total n vertices. The numbering has been done from zero to -1 numbering has been done from... | Minimum Number of Vertices to Reach All Nodes | check-if-a-string-contains-all-binary-codes-of-size-k | Given a **directed acyclic graph**, with `n` vertices numbered from `0` to `n-1`, and an array `edges` where `edges[i] = [fromi, toi]` represents a directed edge from node `fromi` to node `toi`.
Find _the smallest set of vertices from which all nodes in the graph are reachable_. It's guaranteed that a unique solution ... | We need only to check all sub-strings of length k. The number of distinct sub-strings should be exactly 2^k. | Hash Table,String,Bit Manipulation,Rolling Hash,Hash Function | Medium | null |
1,959 | hey what's up guys uh this is sean here so this time it's called number 1959 minimum total space waste database k resizing operations uh this is an interesting problem okay so you're currently designing a dynamic array right and we give we're given like zero index integer array nums where the element is the number of e... | Minimum Total Space Wasted With K Resizing Operations | minimum-path-cost-in-a-hidden-grid | You are currently designing a dynamic array. You are given a **0-indexed** integer array `nums`, where `nums[i]` is the number of elements that will be in the array at time `i`. In addition, you are given an integer `k`, the **maximum** number of times you can **resize** the array (to **any** size).
The size of the ar... | The grid is at a maximum 100 x 100, so it is clever to assume that the robot's initial cell is grid[101][101] Run a DFS from the robot's position to make sure that you can reach the target, otherwise you should return -1. Now that you are sure you can reach the target and that you know the grid, run Dijkstra to find th... | Depth-First Search,Breadth-First Search,Graph,Heap (Priority Queue),Interactive | Medium | 865,1931 |
438 | um hello so today we are going to do this problem which is part of um lead code daily uh challenge of January so the problem says find all anagrams in a string basically we get two strings SNP and we want to return an array of all the start indices of P's anagrams in s right so basically by anagram here they mean just ... | 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 |
65 | hello my friends welcome back in today's video we want to solve one of the problems from the lead code website initially I thought that I would probably want to solve the problem of the day but today is the December 17th but like they've already posted as you can see the problem of the day for the next day and uh as we... | Valid Number | valid-number | A **valid number** can be split up into these components (in order):
1. A **decimal number** or an **integer**.
2. (Optional) An `'e'` or `'E'`, followed by an **integer**.
A **decimal number** can be split up into these components (in order):
1. (Optional) A sign character (either `'+'` or `'-'`).
2. One of the... | null | String | Hard | 8 |
29 | lead code 29 divide two integers Solution by Michael Elliott this is an easy solution given two integers dividend and divisor divide divisor into dividend the result must be a 32-bit signed int the result must be a 32-bit signed int the result must be a 32-bit signed int it means we truncate the decimal so 10 divided b... | Divide Two Integers | divide-two-integers | Given two integers `dividend` and `divisor`, divide two integers **without** using multiplication, division, and mod operator.
The integer division should truncate toward zero, which means losing its fractional part. For example, `8.345` would be truncated to `8`, and `-2.7335` would be truncated to `-2`.
Return _the... | null | Math,Bit Manipulation | Medium | null |
1,689 | Ajay Ko Hello Hi Guys Previous Links Problem Call Partition Which Minimum Number Of Tehsil Binary Numbers Seervi And The Students Are Number Withdraw From This Contest 120 Minimum Number Will Give Number 231 I One And Again In This Version 100 New Latest Free Numbers In Total Which Give Three Do The Number Denge Number... | Partitioning Into Minimum Number Of Deci-Binary Numbers | detect-pattern-of-length-m-repeated-k-or-more-times | A decimal number is called **deci-binary** if each of its digits is either `0` or `1` without any leading zeros. For example, `101` and `1100` are **deci-binary**, while `112` and `3001` are not.
Given a string `n` that represents a positive decimal integer, return _the **minimum** number of positive **deci-binary** n... | Use a three-layer loop to check all possible patterns by iterating through all possible starting positions, all indexes less than m, and if the character at the index is repeated k times. | Array,Enumeration | Easy | 1764 |
1,560 | let's look at problem 1560 most visited sector in a circular track given an integer n and an integer array rounds we have a circular track which conver consists of n sectors labeled from 1 to n a marathon will be held on this track the marathon consists of M rounds the ith round starts at sector down rounds i - one and... | Most Visited Sector in a Circular Track | number-of-students-doing-homework-at-a-given-time | Given an integer `n` and an integer array `rounds`. We have a circular track which consists of `n` sectors labeled from `1` to `n`. A marathon will be held on this track, the marathon consists of `m` rounds. The `ith` round starts at sector `rounds[i - 1]` and ends at sector `rounds[i]`. For example, round 1 starts at ... | Imagine that startTime[i] and endTime[i] form an interval (i.e. [startTime[i], endTime[i]]). The answer is how many times the queryTime laid in those mentioned intervals. | Array | Easy | null |
29 | this is the 29th Fleet crew Challenge and it is called divide two integers given to integers dividend and divisible divided two integers without using multiplication division and mod operator the integer division should truncate towards zero which means losing its fractional part for example 8.345 would fractional part... | Divide Two Integers | divide-two-integers | Given two integers `dividend` and `divisor`, divide two integers **without** using multiplication, division, and mod operator.
The integer division should truncate toward zero, which means losing its fractional part. For example, `8.345` would be truncated to `8`, and `-2.7335` would be truncated to `-2`.
Return _the... | null | Math,Bit Manipulation | Medium | null |
1,687 | hey everybody this is larry this is me going over q4 of the recently code uh bi-weekly of the recently code uh bi-weekly of the recently code uh bi-weekly contest delivering boxes from storage to ports hit the like button hit the subscribe button join me on discord let me know what you think about this problem it was r... | Delivering Boxes from Storage to Ports | the-most-similar-path-in-a-graph | You have the task of delivering some boxes from storage to their ports using only one ship. However, this ship has a **limit** on the **number of boxes** and the **total weight** that it can carry.
You are given an array `boxes`, where `boxes[i] = [portsi, weighti]`, and three integers `portsCount`, `maxBoxes`, and... | Create an array dp where dp[i][j] is the min edit distance for the path starting at node i and compared to index j of the targetPath. Traverse the dp array to obtain a valid answer. | Dynamic Programming,Graph | Hard | null |
838 | Hey gas welcome and welcome back to my channel so today's our problem is us domino so in this problem statement what have we given here we have got and domino given right in one line and this is your standing vertically what do we need What has to be done is to simultaneously push some dominoes either in the left direc... | Push Dominoes | design-linked-list | There are `n` dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to the left or to the right.
After each second, each domino that is falling to the left pushes the adjacent domino on the left. Similarly, the dominoes falling to the righ... | null | Linked List,Design | Medium | 1337 |
129 | Hello One Today Going to Record Delhi Bailey Samjhu To-Do List Number Delhi Bailey Samjhu To-Do List Number Delhi Bailey Samjhu To-Do List Number Questions Page Give Them Through 2000 Rupees Two Phone Numbers In Need To Return Friend intercourse play the giver 11123 subscribe route number 323 452 323 number two’s long ... | Sum Root to Leaf Numbers | sum-root-to-leaf-numbers | You are given the `root` of a binary tree containing digits from `0` to `9` only.
Each root-to-leaf path in the tree represents a number.
* For example, the root-to-leaf path `1 -> 2 -> 3` represents the number `123`.
Return _the total sum of all root-to-leaf numbers_. Test cases are generated so that the answer w... | null | Tree,Depth-First Search,Binary Tree | Medium | 112,124,1030 |
691 | hello and welcome back to the cracking Fang YouTube channel today we're solving lead code 691 stickers to spell word we are given n different types of stickers each sticker has a lowercase English word on it you would like to spell out the given string Target by cutting individual letters from your collection of sticke... | Stickers to Spell Word | stickers-to-spell-word | We are given `n` different types of `stickers`. Each sticker has a lowercase English word on it.
You would like to spell out the given string `target` by cutting individual letters from your collection of stickers and rearranging them. You can use each sticker more than once if you want, and you have infinite quantiti... | We want to perform an exhaustive search, but we need to speed it up based on the input data being random.
For all stickers, we can ignore any letters that are not in the target word.
When our candidate answer won't be smaller than an answer we have already found, we can stop searching this path.
When a s... | Dynamic Programming,Backtracking,Bit Manipulation,Bitmask | Hard | 383 |
35 | Hello Welcome back to Anonymous Data Scientist Channel Today we will solve Lead Code Problem 35 Search Insert Position What we have in this is a sorted array is given and we are given a target value. If our target value is inside the array then we have to return its index. If it is not there then we have to return the ... | 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 |
1,689 | Hello Guys Welcome to Video Series According Suggestions or Drop by Drop Problem School Partitioning * Minimum Number School Partitioning * Minimum Number School Partitioning * Minimum Number of Tasty Minor in Numbers What is the President Number It is the number which consists of its 0ur number 90 has not had any livi... | Partitioning Into Minimum Number Of Deci-Binary Numbers | detect-pattern-of-length-m-repeated-k-or-more-times | A decimal number is called **deci-binary** if each of its digits is either `0` or `1` without any leading zeros. For example, `101` and `1100` are **deci-binary**, while `112` and `3001` are not.
Given a string `n` that represents a positive decimal integer, return _the **minimum** number of positive **deci-binary** n... | Use a three-layer loop to check all possible patterns by iterating through all possible starting positions, all indexes less than m, and if the character at the index is repeated k times. | Array,Enumeration | Easy | 1764 |
1,982 | hey what's up guys this is chung here uh so this time it's called number 1982 find array given subset sums uh so this one is a very interesting yet very hard problem and so the description says you're given an integer n representing the length of an unknown array that you are trying to recover right and then you're als... | Find Array Given Subset Sums | remove-duplicates-from-an-unsorted-linked-list | You are given an integer `n` representing the length of an unknown array that you are trying to recover. You are also given an array `sums` containing the values of all `2n` **subset sums** of the unknown array (in no particular order).
Return _the array_ `ans` _of length_ `n` _representing the unknown array. If **mul... | Is there a way we can know beforehand which nodes to delete? Count the number of appearances for each number. | Hash Table,Linked List | Medium | 82,83 |
1,455 | Hello hello brother this welcome to another interesting problem not only from coding school forward do specific of any word in a sentence and easy problem sunil grover two examples for example I love eating burger is the sentence k 122 search category a certificate of duties words morning forward I love eating and burg... | Check If a Word Occurs As a Prefix of Any Word in a Sentence | filter-restaurants-by-vegan-friendly-price-and-distance | Given a `sentence` that consists of some words separated by a **single space**, and a `searchWord`, check if `searchWord` is a prefix of any word in `sentence`.
Return _the index of the word in_ `sentence` _(**1-indexed**) where_ `searchWord` _is a prefix of this word_. If `searchWord` is a prefix of more than one wor... | Do the filtering and sort as said. Note that the id may not be the index in the array. | Array,Sorting | Medium | null |
942 | welcome back everyone we're going to be solving leak code 942 di string match so we're given a permutation of n plus 1 integers of all the integers in the range from 0 to n which can be represented as a string of length n where the ith position inside of that string is equal to I if the ith position in our permutation ... | DI String Match | super-palindromes | A permutation `perm` of `n + 1` integers of all the integers in the range `[0, n]` can be represented as a string `s` of length `n` where:
* `s[i] == 'I'` if `perm[i] < perm[i + 1]`, and
* `s[i] == 'D'` if `perm[i] > perm[i + 1]`.
Given a string `s`, reconstruct the permutation `perm` and return it. If there are ... | null | Math,Enumeration | Hard | null |
953 | hey everyone welcome back and let's write some more neat code today so today let's solve facebook's most asked question of 2021 verifying an alien dictionary and the funny thing is i think this was also facebook's most asked question of 2020 so i guess they really like to reuse questions but let's get into the problem ... | Verifying an Alien Dictionary | reverse-only-letters | In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different `order`. The `order` of the alphabet is some permutation of lowercase letters.
Given a sequence of `words` written in the alien language, and the `order` of the alphabet, return `true` if and only if the given `wor... | This problem is exactly like reversing a normal string except that there are certain characters that we have to simply skip. That should be easy enough to do if you know how to reverse a string using the two-pointer approach. | Two Pointers,String | Easy | null |
1,189 | hey everybody this is larry this is day 13 for the september leco daily challenge hit the like button hit the subscribe button join me in discord let me know what you think about today's for our maximum number of balloons why are these in weird funky fonts uh okay so yeah i usually start this live um yeah so if it's a ... | Maximum Number of Balloons | encode-number | Given a string `text`, you want to use the characters of `text` to form as many instances of the word **"balloon "** as possible.
You can use each character in `text` **at most once**. Return the maximum number of instances that can be formed.
**Example 1:**
**Input:** text = "nlaebolko "
**Output:** 1
**Example 2... | Try to find the number of binary digits returned by the function. The pattern is to start counting from zero after determining the number of binary digits. | Math,String,Bit Manipulation | Medium | 1070 |
1,701 | hey everybody this is larry this is me going over q2 of the bi-weekly contest 42 average wait of the bi-weekly contest 42 average wait of the bi-weekly contest 42 average wait time so this one um so most of the uh time i spent on this problem was basically making sure the constraints are what i thought it was uh if not... | Average Waiting Time | remove-max-number-of-edges-to-keep-graph-fully-traversable | There is a restaurant with a single chef. You are given an array `customers`, where `customers[i] = [arrivali, timei]:`
* `arrivali` is the arrival time of the `ith` customer. The arrival times are sorted in **non-decreasing** order.
* `timei` is the time needed to prepare the order of the `ith` customer.
When a ... | Build the network instead of removing extra edges. Suppose you have the final graph (after removing extra edges). Consider the subgraph with only the edges that Alice can traverse. What structure does this subgraph have? How many edges are there? Use disjoint set union data structure for both Alice and Bob. Always use ... | Union Find,Graph | Hard | null |
11 | hi guys it's been a while since we did a problem on lead code and as you know being too far away from lead code for a long time can be injurious to one's health or at least injurious to one's um one's coding health so we are back to doing late court and i'm really excited to do this problem this is right now container ... | Container With Most Water | container-with-most-water | You are given an integer array `height` of length `n`. There are `n` vertical lines drawn such that the two endpoints of the `ith` line are `(i, 0)` and `(i, height[i])`.
Find two lines that together with the x-axis form a container, such that the container contains the most water.
Return _the maximum amount of water... | The aim is to maximize the area formed between the vertical lines. The area of any container is calculated using the shorter line as length and the distance between the lines as the width of the rectangle.
Area = length of shorter vertical line * distance between lines
We can definitely get the maximum width ... | Array,Two Pointers,Greedy | Medium | 42 |
1,578 | to daily contest day third of October lead Cod Challenge the problem that we have in today is minimum time to make rope colorful here in this question you given an array of colorful balloons arranged on a rope what do you need to identify the minimum time needed to make the Rope colorful and what is a constraint specif... | Minimum Time to Make Rope Colorful | apples-oranges | Alice has `n` balloons arranged on a rope. You are given a **0-indexed** string `colors` where `colors[i]` is the color of the `ith` balloon.
Alice wants the rope to be **colorful**. She does not want **two consecutive balloons** to be of the same color, so she asks Bob for help. Bob can remove some balloons from the ... | null | Database | Medium | null |
795 | hi guys today I'm going to talk about mythical questions and 9fem the number of summaries with the bombing maximum the in question scene that we now have every and our houses day lower bound and others for opponent the aim is to find the men of the suburbs that meet the requirement is that the maximum of given suddenly... | Number of Subarrays with Bounded Maximum | k-th-symbol-in-grammar | Given an integer array `nums` and two integers `left` and `right`, return _the number of contiguous non-empty **subarrays** such that the value of the maximum array element in that subarray is in the range_ `[left, right]`.
The test cases are generated so that the answer will fit in a **32-bit** integer.
**Example 1:... | Try to represent the current (N, K) in terms of some (N-1, prevK). What is prevK ? | Math,Bit Manipulation,Recursion | Medium | null |
6 | That a hello hi guys hope you are doing fine welcome back to the video today's question is a conversation question status due paper is higher in his written in superintendent pattern will be one number of crops like this a ko an indian red line by line is a prayer ko Date with the latest in this convention giver number... | Zigzag Conversion | zigzag-conversion | The string `"PAYPALISHIRING "` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S I I G
Y I R
And then read line by line: `"PAHNAPLSIIGYIR "`
Write the code that will take a string and make this co... | null | String | Medium | null |
22 | looking at lead code number 22. it's a question called generate parentheses i really like this question i think it's a great question as you start getting deeper and deeper into it really clears up a lot of confusion around backtracking recursion it touches on a lot of concepts so i think it's a good one to be very fam... | Generate Parentheses | generate-parentheses | Given `n` pairs of parentheses, write a function to _generate all combinations of well-formed parentheses_.
**Example 1:**
**Input:** n = 3
**Output:** \["((()))","(()())","(())()","()(())","()()()"\]
**Example 2:**
**Input:** n = 1
**Output:** \["()"\]
**Constraints:**
* `1 <= n <= 8` | null | String,Dynamic Programming,Backtracking | Medium | 17,20,2221 |
237 | welcome ladies and gentlemen boys and girls today we are going to solve not a coolest question because if you see the like and dislike the show i think this is one of the worst question on the lead code i don't know like i've never seen two this one dislikes till now in any questions okay so like i've seen the disclaim... | Delete Node in a Linked List | delete-node-in-a-linked-list | There is a singly-linked list `head` and we want to delete a node `node` in it.
You are given the node to be deleted `node`. You will **not be given access** to the first node of `head`.
All the values of the linked list are **unique**, and it is guaranteed that the given node `node` is not the last node in the linke... | null | Linked List | Easy | 203 |
881 | today we will solve a problem called boats to save people so here we have a number of people each person has different weights and we have a number of boards so we have to safely uh move all the people from one side of the river to other so let's take an example so there are some conditions so one condition is that max... | Boats to Save People | loud-and-rich | You are given an array `people` where `people[i]` is the weight of the `ith` person, and an **infinite number of boats** where each boat can carry a maximum weight of `limit`. Each boat carries at most two people at the same time, provided the sum of the weight of those people is at most `limit`.
Return _the minimum n... | null | Array,Depth-First Search,Graph,Topological Sort | Medium | null |
987 | Everybody Welcome to My Channel Today Have Any Problems Vertical Reversal of Boy's Tree to Give It Return More That Point Note Position Access Oil Left and Right Channels Pet Position - 151 - Running Vertical Line Pet Position - 151 - Running Vertical Line Pet Position - 151 - Running Vertical Line From - Infinitive Ve... | Vertical Order Traversal of a Binary Tree | reveal-cards-in-increasing-order | Given the `root` of a binary tree, calculate the **vertical order traversal** of the binary tree.
For each node at position `(row, col)`, its left and right children will be at positions `(row + 1, col - 1)` and `(row + 1, col + 1)` respectively. The root of the tree is at `(0, 0)`.
The **vertical order traversal** o... | null | Array,Queue,Sorting,Simulation | Medium | null |
146 | so let me first read through the question then we will move on to the solution designing an implementary data structure for least recent use cache it should support the following operations get and put so lru is basically eviction policy like many other fifo and lifo vision policy like gives us the maximum capacity our... | 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 |
427 | hello guys welcome to deep codes and in today's video we will discuss Network question 427 such as construct quieter so this question is a bit difficult to understand at First Sight but after watching this video I will make sure that you understand each bit each line of this question and also the solution so yeah witho... | Construct Quad Tree | construct-quad-tree | Given a `n * n` matrix `grid` of `0's` and `1's` only. We want to represent `grid` with a Quad-Tree.
Return _the root of the Quad-Tree representing_ `grid`.
A Quad-Tree is a tree data structure in which each internal node has exactly four children. Besides, each node has two attributes:
* `val`: True if the node r... | null | null | Medium | null |
1,493 | hi everyone my name is Steve today we're gonna go through one classic approach one classic algorithm to solve a series of problems we can almost use the identical code to solve it at least four problems on my code so this is a very classical and typical algorithm that we could apply to a lot of problems and of course y... | Longest Subarray of 1's After Deleting One Element | frog-position-after-t-seconds | Given a binary array `nums`, you should delete one element from it.
Return _the size of the longest non-empty subarray containing only_ `1`_'s in the resulting array_. Return `0` if there is no such subarray.
**Example 1:**
**Input:** nums = \[1,1,0,1\]
**Output:** 3
**Explanation:** After deleting the number in pos... | Use a variation of DFS with parameters 'curent_vertex' and 'current_time'. Update the probability considering to jump to one of the children vertices. | Tree,Depth-First Search,Breadth-First Search,Graph | Hard | null |
514 | all right let's talk about the freedom trail so this question is pretty long and i'm going to use my own definition to translate and try to explain so whatever you uh what whatever you get right you should return the minimum number of steps to spell the location in a keyword so uh in the example like you have two strin... | Freedom Trail | freedom-trail | In the video game Fallout 4, the quest **"Road to Freedom "** requires players to reach a metal dial called the **"Freedom Trail Ring "** and use the dial to spell a specific keyword to open the door.
Given a string `ring` that represents the code engraved on the outer ring and another string `key` that represents the... | null | String,Dynamic Programming,Depth-First Search,Breadth-First Search | Hard | null |
1,526 | Key side suggestion in between a question improve my mobile number and all the toof target tried to give positive subscribe now to receive so let's get started tell explanation remember on Monday that is Monday answer that Papa special loot kaise ho that you are dry Lucerne 61234 time, 100 deal-points from this point, ... | Minimum Number of Increments on Subarrays to Form a Target Array | html-entity-parser | You are given an integer array `target`. You have an integer array `initial` of the same size as `target` with all elements initially zeros.
In one operation you can choose **any** subarray from `initial` and increment each value by one.
Return _the minimum number of operations to form a_ `target` _array from_ `initi... | Search the string for all the occurrences of the character '&'. For every '&' check if it matches an HTML entity by checking the ';' character and if entity found replace it in the answer. | Hash Table,String | Medium | null |
609 | hello everyone so in this video we will solve problem number 609 here we have uh one problem in that we have given some file name with content and we have to print the output if there is duplicate files for a particular content uh if like in this example we can see for abcd we have file one dot txt three dot txt and ye... | Find Duplicate File in System | find-duplicate-file-in-system | Given a list `paths` of directory info, including the directory path, and all the files with contents in this directory, return _all the duplicate files in the file system in terms of their paths_. You may return the answer in **any order**.
A group of duplicate files consists of at least two files that have the same ... | null | Array,Hash Table,String | Medium | 2079 |
100 | hello guys I hope you are all doing well and this video will be solving the problem leads called same tree so let's get started so the problem is that they give you two binary tree and they ask you to check if they are the same or not to solve this problem we're going to use the recursion techniques or the Deep first s... | Same Tree | same-tree | Given the roots of two binary trees `p` and `q`, write a function to check if they are the same or not.
Two binary trees are considered the same if they are structurally identical, and the nodes have the same value.
**Example 1:**
**Input:** p = \[1,2,3\], q = \[1,2,3\]
**Output:** true
**Example 2:**
**Input:** p... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
1,046 | foreign and welcome back to another video So today we're going to be solving the lead code question Loft stone weight all right so in this question we're going to be given an area of integers called Stones where Stone's eye is the weight of the eye stone so we're going to be playing a game and we take the two heaviest ... | 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 |
312 | hey everybody this is larry this is day 13 lucky 13 of the december league daily challenge hit the like button to subscribe on drummond discord uh let me know what you think about today's problem burst balloons so usually i solve these live and i do the explanation live so you see me as i think for the prom as i go thr... | Burst Balloons | burst-balloons | You are given `n` balloons, indexed from `0` to `n - 1`. Each balloon is painted with a number on it represented by an array `nums`. You are asked to burst all the balloons.
If you burst the `ith` balloon, you will get `nums[i - 1] * nums[i] * nums[i + 1]` coins. If `i - 1` or `i + 1` goes out of bounds of the array, ... | null | Array,Dynamic Programming | Hard | 1042 |
1,603 | Hello everyone welcome to my channel with mike so today we are going to do video number six of your playlist of data structure design today's question is quite easy 1603 easy level mark is also there the name of the question is design parking system so phone sometimes if good If it happens, either call or ask in the sc... | Design Parking System | running-sum-of-1d-array | Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size.
Implement the `ParkingSystem` class:
* `ParkingSystem(int big, int medium, int small)` Initializes object of the `ParkingSystem` class. The number of slot... | Think about how we can calculate the i-th number in the running sum from the (i-1)-th number. | Array,Prefix Sum | Easy | null |
1,997 | hey what's up guys john here again so bitcoin number 1997 first day where you have been in all the rooms okay so this time we have n rooms right uh labeled from zero to n minus one and then we start from room zero okay and we will visit one room a day okay initially we visited room zero and the order we visited the roo... | 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 |
2,000 | hi guys I'm in this video see problem Le code reverse prefix of a word so given zero index string and character reverse the segment of the word that starts at the index zero and ends at the index or the first occur occurrence of that character so if the character is uh not present in the string in the word then do noth... | Reverse Prefix of Word | minimum-speed-to-arrive-on-time | Given a **0-indexed** string `word` and a character `ch`, **reverse** the segment of `word` that starts at index `0` and ends at the index of the **first occurrence** of `ch` (**inclusive**). If the character `ch` does not exist in `word`, do nothing.
* For example, if `word = "abcdefd "` and `ch = "d "`, then you s... | Given the speed the trains are traveling at, can you find the total time it takes for you to arrive? Is there a cutoff where any speeds larger will always allow you to arrive on time? | Array,Binary Search | Medium | 1335,2013,2294 |
1,400 | hello friends so today we can discuss another problem from lead code problem name construct k palindrome strings it's a very standard problem and i hope you have seen a lot of videos on it but i am making few videos on greedy problems so that's why i have chosen this problem if you have seen this problem you can skip t... | Construct K Palindrome Strings | find-winner-on-a-tic-tac-toe-game | Given a string `s` and an integer `k`, return `true` _if you can use all the characters in_ `s` _to construct_ `k` _palindrome strings or_ `false` _otherwise_.
**Example 1:**
**Input:** s = "annabelle ", k = 2
**Output:** true
**Explanation:** You can construct two palindromes using all characters in s.
Some possibl... | It's straightforward to check if A or B won or not, check for each row/column/diag if all the three are the same. Then if no one wins, the game is a draw iff the board is full, i.e. moves.length = 9 otherwise is pending. | Array,Hash Table,Matrix,Simulation | Easy | null |
258 | hello everybody it's neodris here and welcome to my channel today's video we're gonna do the add digits lead code problem so as you can see it's a really simple problem this is a really beginner friendly video so we have a given integer none so repeatedly at all its digits until the result has only one digit and return... | 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,844 | hey everybody this is larry this is me going with q1 of the leeco uh by weekly contest 51 replace all digits of characters so this one i thought was a straightforward um followed instruction bomb to be honest so hit the like button hit the subscribe and join me in discord and yeah uh this is the way that i did in pytho... | Replace All Digits with Characters | maximum-number-of-balls-in-a-box | You are given a **0-indexed** string `s` that has lowercase English letters in its **even** indices and digits in its **odd** indices.
There is a function `shift(c, x)`, where `c` is a character and `x` is a digit, that returns the `xth` character after `c`.
* For example, `shift('a', 5) = 'f'` and `shift('x', 0) =... | Note that both lowLimit and highLimit are of small constraints so you can iterate on all nubmer between them You can simulate the boxes by counting for each box the number of balls with digit sum equal to that box number | Hash Table,Math,Counting | Easy | null |
278 | number 278 first bad person so what are we given is an integer n which means that there are n number of persons starting from 1 to n and we need to find a person which is bad I mean like which I mean that the version the first person which is bad because every person after the bad person is going to be bad so suppose u... | First Bad Version | first-bad-version | You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.
Suppose you have `n` versions `[1, 2, ..., n]` an... | null | Binary Search,Interactive | Easy | 34,35,374 |
1,846 | uh hi everyone I think we should be live can let me know if you can hear me uh hi everyone I think we should be live can let me know okay cool so let's get started so this was the question of today uh quite honestly uh yes it was a medium question but uh it required some amount of thinking uh so I would grade it as a g... | Maximum Element After Decreasing and Rearranging | maximum-element-after-decreasing-and-rearranging | You are given an array of positive integers `arr`. Perform some operations (possibly none) on `arr` so that it satisfies these conditions:
* The value of the **first** element in `arr` must be `1`.
* The absolute difference between any 2 adjacent elements must be **less than or equal to** `1`. In other words, `abs... | null | null | Medium | null |
943 | hey everybody this is larry this is day 23 of the may league daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's forum i have some allergy stuff so if i'm talking really um well it's just allergies i apologize i am recording this live so if it's a lit... | Find the Shortest Superstring | sum-of-subarray-minimums | Given an array of strings `words`, return _the smallest string that contains each string in_ `words` _as a substring_. If there are multiple valid strings of the smallest length, return **any of them**.
You may assume that no string in `words` is a substring of another string in `words`.
**Example 1:**
**Input:** wo... | null | Array,Dynamic Programming,Stack,Monotonic Stack | Medium | 2227 |
733 | hey what's up guys think about here I detect growing stuff on twitch and YouTube check the description for all my information I do the premium leak Oh problems on my patreon join the disk or message me I try and get back to everyone as an easy problem called flood fill pretty cool 733 a lot of likes and image is repres... | Flood Fill | flood-fill | An image is represented by an `m x n` integer grid `image` where `image[i][j]` represents the pixel value of the image.
You are also given three integers `sr`, `sc`, and `color`. You should perform a **flood fill** on the image starting from the pixel `image[sr][sc]`.
To perform a **flood fill**, consider the startin... | Write a recursive function that paints the pixel if it's the correct color, then recurses on neighboring pixels. | Array,Depth-First Search,Breadth-First Search,Matrix | Easy | 463 |
63 | hello everyone so i am sankalpdhya and a final student of computer science at vrt valor and i solve some questions to help other people so that they can do good in the coding rounds and interviews and get placed very soon so today we have this question that is unique paths part two and yesterday we had solved unique pa... | Unique Paths II | unique-paths-ii | You are given an `m x n` integer array `grid`. There is a robot initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time.
An obstacle and space are marked as ... | The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be
if obstacleGrid[i][j] is not an obstacle
... | Array,Dynamic Programming,Matrix | Medium | 62,1022 |
1,436 | Hello everyone welcome to my channel code story with mike so today we are going to change the video number of our lead code GG's playlist ok lead code 1436 is easy question but it means this is the test which is done online na i think this type is in hacker rank I have seen this question once long ago, ok, it was not e... | Destination City | get-watched-videos-by-your-friends | You are given the array `paths`, where `paths[i] = [cityAi, cityBi]` means there exists a direct path going from `cityAi` to `cityBi`. _Return the destination city, that is, the city without any path outgoing to another city._
It is guaranteed that the graph of paths forms a line without any loop, therefore, there wil... | Do BFS to find the kth level friends. Then collect movies saw by kth level friends and sort them accordingly. | Array,Hash Table,Breadth-First Search,Sorting | Medium | null |
319 | so the name of the problem is bulb switcher it is a famous bleed code problem so in this problem there are n bulbs that are initially off okay all bulbs are off and in the first round we have to toggle every bulb the meaning of toggle is if the bulb is switched off we have to switch and switch it on and if the bulb is ... | Bulb Switcher | bulb-switcher | There are `n` bulbs that are initially off. You first turn on all the bulbs, then you turn off every second bulb.
On the third round, you toggle every third bulb (turning on if it's off or turning off if it's on). For the `ith` round, you toggle every `i` bulb. For the `nth` round, you only toggle the last bulb.
Retu... | null | Math,Brainteaser | Medium | 672,1037,1491 |
101 | Them Box Screen Inside A Well Known As Its Problems Mystery Solved Problems Statement Say Will Help You Identify Weather Give Entries Cement Factory Notes For The Definition Attri Buddhi Symmetric Liberated From Distant Up Sid To V Like She Was Not Difficult To Write Off Laptop Subscribe The Subscribe To If You Have 15... | Symmetric Tree | symmetric-tree | Given the `root` of a binary tree, _check whether it is a mirror of itself_ (i.e., symmetric around its center).
**Example 1:**
**Input:** root = \[1,2,2,3,4,4,3\]
**Output:** true
**Example 2:**
**Input:** root = \[1,2,2,null,3,null,3\]
**Output:** false
**Constraints:**
* The number of nodes in the tree is in... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
231 | Hello Everyone Welcome to the Channel Today's Question is the Power of Two YouTube Channel Please subscribe our YouTube Channel and tap on Twitter - 20121 tap on Twitter - 20121 How to Difficult 1622 So Let's Move to See the Question Subscribe Tab Page Number 90 A That Every One of These Is Clear Tour Not As Well As Wi... | Power of Two | power-of-two | Given an integer `n`, return _`true` if it is a power of two. Otherwise, return `false`_.
An integer `n` is a power of two, if there exists an integer `x` such that `n == 2x`.
**Example 1:**
**Input:** n = 1
**Output:** true
**Explanation:** 20 = 1
**Example 2:**
**Input:** n = 16
**Output:** true
**Explanation:**... | null | Math,Bit Manipulation,Recursion | Easy | 191,326,342 |
1,813 | Scientist A Hello Hi Guys How Are You I Am To Avoid Doing Good Day So In This Question We Are Going To Do Indescribable Ko Sun Tan Question Is Sentence Similarity Third And You So Before Proceeding If You Are You This Channel Subscribe Please Like Please Comment What You have in this to please comment what you have und... | Sentence Similarity III | maximum-erasure-value | A sentence is a list of words that are separated by a single space with no leading or trailing spaces. For example, `"Hello World "`, `"HELLO "`, `"hello world hello world "` are all sentences. Words consist of **only** uppercase and lowercase English letters.
Two sentences `sentence1` and `sentence2` are **similar** ... | The main point here is for the subarray to contain unique elements for each index. Only the first subarrays starting from that index have unique elements. This can be solved using the two pointers technique | Array,Hash Table,Sliding Window | Medium | 3 |
792 | hello all welcome to code hub let us solve the today's lead score daily challenge the question is number of matching subsequences uh given a string yes and an array of string words return the number of words of i that is a subsequence of yes a subsequence of a string is a new string generated from the original string w... | Number of Matching Subsequences | binary-search | Given a string `s` and an array of strings `words`, return _the number of_ `words[i]` _that is a subsequence of_ `s`.
A **subsequence** of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.
* For exa... | null | Array,Binary Search | Easy | 786 |
137 | Hello gas I am Lalita Agarwal welcome you on your on coding channel trick made by you on that date cold problem today's late problem what is the problem saying good before moving towards the problem na 1 minute par dose jino ko a problem achhe What you have understood is that you have to try it yourself. Look, this que... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.