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 |
|---|---|---|---|---|---|---|---|---|
54 | That Aapke Ajay Ko Hua Hai Hello Everyone Welcome to New Video India Going to Discuss Another Problem Solving Its Problems Spiral Matrix Let's Get to the Problem Statement Problems and Write All Elements of Matrix in Spiral What Said We a Given the matrix and what we have to do is to make a spiral by retaining all its ... | Spiral Matrix | spiral-matrix | Given an `m x n` `matrix`, return _all elements of the_ `matrix` _in spiral order_.
**Example 1:**
**Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[1,2,3,6,9,8,7,4,5\]
**Example 2:**
**Input:** matrix = \[\[1,2,3,4\],\[5,6,7,8\],\[9,10,11,12\]\]
**Output:** \[1,2,3,4,8,12,11,10,9,5,6,7\]
**Const... | Well for some problems, the best way really is to come up with some algorithms for simulation. Basically, you need to simulate what the problem asks us to do. We go boundary by boundary and move inwards. That is the essential operation. First row, last column, last row, first column and then we move inwards by 1 and th... | Array,Matrix,Simulation | Medium | 59,921 |
49 | welcome to august leco challenge today's problem is group anagrams given an array 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 that's th... | 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,819 | hey everybody this is larry this is me going over q4 of the weekly contest 285 a very hard problem for me anyway number of different subsequent gcds so this one there's actually a little bit of a thing as well i took a long time to solve this in general but i got two wrong answers be or too long two time limited uh exc... | Number of Different Subsequences GCDs | construct-the-lexicographically-largest-valid-sequence | You are given an array `nums` that consists of positive integers.
The **GCD** of a sequence of numbers is defined as the greatest integer that divides **all** the numbers in the sequence evenly.
* For example, the GCD of the sequence `[4,6,16]` is `2`.
A **subsequence** of an array is a sequence that can be formed... | Heuristic algorithm may work. | Array,Backtracking | Medium | null |
109 | foreign so before starting the video what I want to tell the main motive of this video is to solve this question to approach this question in a very simple manner video okay so what is the main mode I am able to solve this question the way I approach this I want to deliver that part only in a very simple and Innovative... | 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 |
15 | for some reason this problem is asked in a lot of coding interviews and I believe that is primarily because it is an extension of the problem too firm which is already a very famous problem if you know about it so what is so special about it let's find it out Hello friends welcome back to my Channel first I will explai... | 3Sum | 3sum | Given an integer array nums, return all the triplets `[nums[i], nums[j], nums[k]]` such that `i != j`, `i != k`, and `j != k`, and `nums[i] + nums[j] + nums[k] == 0`.
Notice that the solution set must not contain duplicate triplets.
**Example 1:**
**Input:** nums = \[-1,0,1,2,-1,-4\]
**Output:** \[\[-1,-1,2\],\[-1,0... | So, we essentially need to find three numbers x, y, and z such that they add up to the given value. If we fix one of the numbers say x, we are left with the two-sum problem at hand! For the two-sum problem, if we fix one of the numbers, say x, we have to scan the entire array to find the next numbery which is value - x... | Array,Two Pointers,Sorting | Medium | 1,16,18,259 |
759 | hey what's up guys John here today let's talk about another leader called problem number 759 employee free time and it's its markets hard yeah I think I don't know if it's a really hard problem where it's like I need to meet you like a more like medium to hard problem since the I mean the thinking process is pretty str... | Employee Free Time | set-intersection-size-at-least-two | We are given a list `schedule` of employees, which represents the working time for each employee.
Each employee has a list of non-overlapping `Intervals`, and these intervals are in sorted order.
Return the list of finite intervals representing **common, positive-length free time** for _all_ employees, also in sorted... | null | Array,Greedy,Sorting | Hard | null |
1,007 | hello everyone Alico today our question is minimum dominos rotations for equal row this is a very popular Google interview question as we can see Google has asked this question a lot of times over the past half year so that's directly look into the question essentially this question is about to a race but in the settin... | 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 |
606 | Challenge and so far again we haven't missed even a single day for all those who tried searching for daily lead Cod problems on coding decoded channel would have got the solutions and for all those who didn't please guys check out you'll definitely find the solution if it is not there then I'm there to create the video... | Construct String from Binary Tree | construct-string-from-binary-tree | Given the `root` of a binary tree, construct a string consisting of parenthesis and integers from a binary tree with the preorder traversal way, and return it.
Omit all the empty parenthesis pairs that do not affect the one-to-one mapping relationship between the string and the original binary tree.
**Example 1:**
*... | null | String,Tree,Depth-First Search,Binary Tree | Easy | 536,652 |
145 | today we have the binary tree but like it's similar to the last problem but it's instead of a pre-order it's uh post it's instead of a pre-order it's uh post it's instead of a pre-order it's uh post order so basically I have a binary tree that I should return in post order so it will be three to one so uh what basicall... | Binary Tree Postorder Traversal | binary-tree-postorder-traversal | Given the `root` of a binary tree, return _the postorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[3,2,1\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of the n... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 94,776 |
56 | Shruti Hello friends welcome to Tech's new video your blind 725 and dead chal raha hai hamara jo that is seventeenth Tomar Jain travels watch zoom game we had seen last day ok hai tu mar in trouble question very nice I liked it As soon as you see it, you will understand that he is giving an interview and he is merging ... | Merge Intervals | merge-intervals | Given an array of `intervals` where `intervals[i] = [starti, endi]`, merge all overlapping intervals, and return _an array of the non-overlapping intervals that cover all the intervals in the input_.
**Example 1:**
**Input:** intervals = \[\[1,3\],\[2,6\],\[8,10\],\[15,18\]\]
**Output:** \[\[1,6\],\[8,10\],\[15,18\]\... | null | Array,Sorting | Medium | 57,252,253,495,616,715,761,768,1028,2297,2319 |
1,833 | Hey gas welcome back tu de new video you guys watching in this video today's daily lead challenge name is maximum ice cream baras so there is a boy he wants ice cream in summer season ok so whatever is it what is the price of it so Ice cream outside these points, so basically you have been given this, like 13241, so wh... | Maximum Ice Cream Bars | find-the-highest-altitude | It is a sweltering summer day, and a boy wants to buy some ice cream bars.
At the store, there are `n` ice cream bars. You are given an array `costs` of length `n`, where `costs[i]` is the price of the `ith` ice cream bar in coins. The boy initially has `coins` coins to spend, and he wants to buy as many ice cream bar... | Let's note that the altitude of an element is the sum of gains of all the elements behind it Getting the altitudes can be done by getting the prefix sum array of the given array | Array,Prefix Sum | Easy | null |
138 | hey hello there so today I'm talking about this question 138 copy lista with Brendon pointer we have a linked list the thing that's a special about this link list is that the nodes inside this linked list contains not only a next pointer which points to obviously the next two node in the sequence but also a random poin... | Copy List with Random Pointer | copy-list-with-random-pointer | A linked list of length `n` is given such that each node contains an additional random pointer, which could point to any node in the list, or `null`.
Construct a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) of the list. The deep copy should consist of exactly `n` **brand new** nodes, where e... | Just iterate the linked list and create copies of the nodes on the go. Since a node can be referenced from multiple nodes due to the random pointers, make sure you are not making multiple copies of the same node. You may want to use extra space to keep old node ---> new node mapping to prevent creating multiples copies... | Hash Table,Linked List | Medium | 133,1624,1634 |
278 | hey alex here and today we'll be going over the problem called the first bad version it's a number 278 on lead code and it's an easy so essentially we're a product manager and we're currently leading a team to develop a new product unfortunately the latest version of our product fails the quality check since each versi... | 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 |
78 | hi everyone my name is sakshi and in this video we are going to solve a very common interview problem subsets this is the problem number 78 only code let us first look at the problem statement given an integer array nouns of unique elements return all possible subsets that is the power set of the integer the solution s... | Subsets | subsets | Given an integer array `nums` of **unique** elements, 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,3\]
**Output:** \[\[\],\[1\],\[2\],\[1,2\],\[3\],\[1,3\],\[2,3\],\[1,2,3\]\]
... | null | Array,Backtracking,Bit Manipulation | Medium | 90,320,800,2109,2170 |
1,563 | hey everybody this is larry this is me going with stone game five uh the reason q4 hard problem with the leeco contest uh hit the like button hit the subscribe button join me on discord uh so one thing i'm a little bit sad about is that uh i feel a little bit bad that i keep on doing this um where i actually don't know... | Stone Game V | maximum-number-of-darts-inside-of-a-circular-dartboard | There are several stones **arranged in a row**, and each stone has an associated value which is an integer given in the array `stoneValue`.
In each round of the game, Alice divides the row into **two non-empty rows** (i.e. left row and right row), then Bob calculates the value of each row which is the sum of the value... | If there is an optimal solution, you can always move the circle so that two points lie on the boundary of the circle. When the radius is fixed, you can find either 0 or 1 or 2 circles that pass two given points at the same time. Loop for each pair of points and find the center of the circle, after that count the number... | Array,Math,Geometry | Hard | null |
1,504 | A [MUSIC] [MUSIC] [MUSIC] RIVER IN THE QUESTION HAS ACCOUNT WAS AMAZED WITH ALL ONE CHAPTER QUESTION SEE THIS AND SOME MORE TO SAY SCHEME AND CROSS AND TRICKS 540 HOW MANY SQUARE SUB LEADERS HAVE ALWAYS MEANS WE KEEP EMBROIDERY MYSELF I JUST 1GHZ What do we know that when Meghnad that we can subscribe anything that all... | Count Submatrices With All Ones | get-the-second-most-recent-activity | Given an `m x n` binary matrix `mat`, _return the number of **submatrices** that have all ones_.
**Example 1:**
**Input:** mat = \[\[1,0,1\],\[1,1,0\],\[1,1,0\]\]
**Output:** 13
**Explanation:**
There are 6 rectangles of side 1x1.
There are 2 rectangles of side 1x2.
There are 3 rectangles of side 2x1.
There is 1 rec... | null | Database | Hard | null |
345 | number 345 reverse vowels of a string go write a function that takes a string as input and reverses oh there goes the grammar again only the vowels of a string example one hello you reverse the o and the e whoops now elite code you reverse all the vowels are there the vowels does not include the letter y the grammar do... | Reverse Vowels of a String | reverse-vowels-of-a-string | Given a string `s`, reverse only all the vowels in the string and return it.
The vowels are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`, and they can appear in both lower and upper cases, more than once.
**Example 1:**
**Input:** s = "hello"
**Output:** "holle"
**Example 2:**
**Input:** s = "leetcode"
**Output:** "leotc... | null | Two Pointers,String | Easy | 344,1089 |
1,425 | Table Today They Are Going To Discuss Elite Problem Tasty Maximum Subject Some Governor Content Ashok Tanwar Na Important Terms And Example Se 021 To Take Medicine From This Subscribe And Numbers In All Soon Subscribe Button More That Where Is Take Jin-Jin Swadesh That Where Is Take Jin-Jin Swadesh That Where Is Take J... | Constrained Subsequence Sum | weather-type-in-each-country | Given an integer array `nums` and an integer `k`, return the maximum sum of a **non-empty** subsequence of that array such that for every two **consecutive** integers in the subsequence, `nums[i]` and `nums[j]`, where `i < j`, the condition `j - i <= k` is satisfied.
A _subsequence_ of an array is obtained by deleting... | null | Database | Easy | null |
1,957 | hello welcome back today let's try to solve another lyrical problem 1957 the lead characters to make fancy stream so it's really easy to understand a first history is a stream we are no three consecutive characters are equal so for example the lead code for this e there are three characters so it's a fancy actually we ... | Delete Characters to Make Fancy String | closest-room | A **fancy string** is a string where no **three** **consecutive** characters are equal.
Given a string `s`, delete the **minimum** possible number of characters from `s` to make it **fancy**.
Return _the final string after the deletion_. It can be shown that the answer will always be **unique**.
**Example 1:**
**In... | Is there a way to sort the queries so it's easier to search the closest room larger than the size? Use binary search to speed up the search time. | Array,Binary Search,Sorting | Hard | 2179 |
146 | hello friends welcome to joy of life so today we are going to look at another medium level problem from leadput the problem number is 146. so it's a lru cache so design a data structure that follows the constraint of which recently used or lru dash so implement the learning cache class so you have to implement this ent... | 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 |
520 | Hello Guys Welcome Back To Decades And This Video Will See The State Capital Problem Wishes From List To Dog Assailant Conscience Planning You To Approach In Order To Solve This Problem Solve Latest Read Problem No Problem Gives What You Need To Judge Weather Or Not Define The Uses of the following is The First Preside... | Detect Capital | detect-capital | We define the usage of capitals in a word to be right when one of the following cases holds:
* All letters in this word are capitals, like `"USA "`.
* All letters in this word are not capitals, like `"leetcode "`.
* Only the first letter in this word is capital, like `"Google "`.
Given a string `word`, return `... | null | String | Easy | 2235 |
1,764 | 200 Welcome to my channel So in this video I am for those who are migrating survey surfers, it is a very simple problem so first of all in the video I will discuss the problem then we will quote again on that mic you will make you think ok so the problem is basically me I have given a group of address and find me, plea... | Form Array by Concatenating Subarrays of Another Array | maximum-repeating-substring | You are given a 2D integer array `groups` of length `n`. You are also given an integer array `nums`.
You are asked if you can choose `n` **disjoint** subarrays from the array `nums` such that the `ith` subarray is equal to `groups[i]` (**0-indexed**), and if `i > 0`, the `(i-1)th` subarray appears **before** the `ith`... | The constraints are low enough for a brute force approach. Try every k value from 0 upwards until word is no longer k-repeating. | String,String Matching | Easy | 1689 |
55 | uh so hi guys we have given a question which is called as a jump game it's taken from lead code itself so we have given array of numbers and each index represent a value uh that value means we can go maximum that value from that distance for example here i've taken the test case from lead code itself if i am here at in... | Jump Game | jump-game | You are given an integer array `nums`. You are initially positioned at the array's **first index**, and each element in the array represents your maximum jump length at that position.
Return `true` _if you can reach the last index, or_ `false` _otherwise_.
**Example 1:**
**Input:** nums = \[2,3,1,1,4\]
**Output:** t... | null | Array,Dynamic Programming,Greedy | Medium | 45,1428,2001 |
214 | Hai gas welcome back to me youtube channel so today we will be solving a problem from late goal d problem name is shortest plane rom d problem number is 2 and 4 and it is off level heart ok so first let us try to understand what d problem If you are living a string then you can convert it into a palindrome by adding ch... | Shortest Palindrome | shortest-palindrome | You are given a string `s`. You can convert `s` to a palindrome by adding characters in front of it.
Return _the shortest palindrome you can find by performing this transformation_.
**Example 1:**
**Input:** s = "aacecaaa"
**Output:** "aaacecaaa"
**Example 2:**
**Input:** s = "abcd"
**Output:** "dcbabcd"
**Constr... | null | String,Rolling Hash,String Matching,Hash Function | Hard | 5,28,336 |
206 | A Republic Lift Very Fundamental Concepts of Inner Light of Food Interview You Will Give the Head of Ling Left and You Need to Return Alif in River Water Activist Problem No Problem Statement That You Need to Return the Rebel to the Solution Hello Friends Welcome Back Two players were made to learn the first how to mak... | Reverse Linked List | reverse-linked-list | Given the `head` of a singly linked list, reverse the list, and return _the reversed list_.
**Example 1:**
**Input:** head = \[1,2,3,4,5\]
**Output:** \[5,4,3,2,1\]
**Example 2:**
**Input:** head = \[1,2\]
**Output:** \[2,1\]
**Example 3:**
**Input:** head = \[\]
**Output:** \[\]
**Constraints:**
* The number... | null | Linked List,Recursion | Easy | 92,156,234,2196,2236 |
1,962 | so hello everyone and welcome to today's lead code daily question that is remove Stone to minimize the total so you have been given an array called piles and uh where each index that is piles of I represent the number of zones in the ith pile and also we have been given an integer k so um and you should apply a certain... | 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 |
1,760 | Hello brother, let's keep today's portion but minimum limit, boss, we have given it back, so we are given one and rectangle index is dedicated to it, how much boil is given, Namaskar, and we have appointed, so this is the maximum, we can do this, any subscribe. We will divide it into two parts like we can divide it int... | Minimum Limit of Balls in a Bag | check-array-formation-through-concatenation | You are given an integer array `nums` where the `ith` bag contains `nums[i]` balls. You are also given an integer `maxOperations`.
You can perform the following operation at most `maxOperations` times:
* Take any bag of balls and divide it into two new bags with a **positive** number of balls.
* For example, ... | Note that the distinct part means that every position in the array belongs to only one piece Note that you can get the piece every position belongs to naively | Array,Hash Table | Easy | null |
453 | hey folks welcome to another video today we'll be looking at version 453 minimum number of uh moves to equal array elements so the way we would be approaching this problem is by sorting the entire array and moving from the right let me explain the solution as i implemented the first thing we would do is let's just sort... | 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 |
130 | hello welcome back today's question is 130 surrounded regions we are given a matrix containing X and O's and our job is to find all the O's that are completely surrounded by axes and flip them to X so looking at the example provided you can see the O's here are completely surrounded by Axis or on all sides right so the... | 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 |
899 | Hi gas welcome and welcome back to my channel so today our problem is what have you given us in the statement here you have given us a sting s and have given us a wait for them okay what do we have to do with this sting first cactus What has to be done by one of the cutters and it has to be appended in the last step? N... | Orderly Queue | binary-gap | You are given a string `s` and an integer `k`. You can choose one of the first `k` letters of `s` and append it at the end of the string..
Return _the lexicographically smallest string you could have after applying the mentioned step any number of moves_.
**Example 1:**
**Input:** s = "cba ", k = 1
**Output:** "ac... | null | Math,Bit Manipulation | Easy | null |
1,639 | hey what's up guys this is chung here so today let's take a look at the latest bi-weekly contest problem number 1639 bi-weekly contest problem number 1639 bi-weekly contest problem number 1639 number of ways to form a target stream given a dictionary i mean this is like uh i think it's a standard heart problem so you'r... | Number of Ways to Form a Target String Given a Dictionary | friendly-movies-streamed-last-month | You are given a list of strings of the **same length** `words` and a string `target`.
Your task is to form `target` using the given `words` under the following rules:
* `target` should be formed from left to right.
* To form the `ith` character (**0-indexed**) of `target`, you can choose the `kth` character of th... | null | Database | Easy | null |
287 | show you how to solve legal question 287 find the duplicate number giving a array integers nums containing n plus 1 integers where each integer is in the range 1 to n inclusive so pay attention here is one to n not starting from zero and that there is only one repeated number in the nums only one this is also another k... | Find the Duplicate Number | find-the-duplicate-number | Given an array of integers `nums` containing `n + 1` integers where each integer is in the range `[1, n]` inclusive.
There is only **one repeated number** in `nums`, return _this repeated number_.
You must solve the problem **without** modifying the array `nums` and uses only constant extra space.
**Example 1:**
**... | null | Array,Two Pointers,Binary Search,Bit Manipulation | Medium | 41,136,142,268,645 |
1,631 | hey everyone today we are going to solve the beautiful question pass with minimum effort so you are higher preparing for upcoming hike so you need to return the minimum effort required to travel from top left sale to bottom right cell so from here so this is the start point and the goal is here and then what is our eff... | Path With Minimum Effort | number-of-sub-arrays-with-odd-sum | You are a hiker preparing for an upcoming hike. You are given `heights`, a 2D array of size `rows x columns`, where `heights[row][col]` represents the height of cell `(row, col)`. You are situated in the top-left cell, `(0, 0)`, and you hope to travel to the bottom-right cell, `(rows-1, columns-1)` (i.e., **0-indexed**... | Can we use the accumulative sum to keep track of all the odd-sum sub-arrays ? if the current accu sum is odd, we care only about previous even accu sums and vice versa. | Array,Math,Dynamic Programming,Prefix Sum | Medium | 2242 |
352 | Welcome and welcome back to my channel so today our problem is data steam ahead this joint interval so in this problem what have you given us in the un statement here we have been given a data steam input in which aapke sir kya hoga non negative inteasers ok And what you have to do here is to implement a class by the n... | Data Stream as Disjoint Intervals | data-stream-as-disjoint-intervals | Given a data stream input of non-negative integers `a1, a2, ..., an`, summarize the numbers seen so far as a list of disjoint intervals.
Implement the `SummaryRanges` class:
* `SummaryRanges()` Initializes the object with an empty stream.
* `void addNum(int value)` Adds the integer `value` to the stream.
* `int... | null | Binary Search,Design,Ordered Set | Hard | 228,436,715 |
230 | today we will see how to find kth smallest element in a binary search tree and this k can be any uh fixed number also it can be given like third smallest element fourth smallest element or it can be given a general kth smallest element and here it's not a binary tree it's a binary search tree and we know that in binary... | Kth Smallest Element in a BST | kth-smallest-element-in-a-bst | Given the `root` of a binary search tree, and an integer `k`, return _the_ `kth` _smallest value (**1-indexed**) of all the values of the nodes in the tree_.
**Example 1:**
**Input:** root = \[3,1,4,null,2\], k = 1
**Output:** 1
**Example 2:**
**Input:** root = \[5,3,6,2,4,null,null,1\], k = 3
**Output:** 3
**Cons... | Try to utilize the property of a BST. Try in-order traversal. (Credits to @chan13) What if you could modify the BST node's structure? The optimal runtime complexity is O(height of BST). | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | 94,671 |
201 | welcome back to my YouTube channel today's lead Cod DCC question is bitwise and of numbers range so let's read the question given two integer left and right that represents the range from left to right inclusive return the bitwise and of all the numbers in this range so what question is saying so given a left value let... | 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 |
907 | day 25th of November lead code challenge the problem that we have in today is some of subar minimum this question is a medium level question on lead code and I totally feel the same also it is based on the concept of stacks and the question may appear really difficult but it is easy and has a very important underlying ... | Sum of Subarray Minimums | koko-eating-bananas | Given an array of integers arr, find the sum of `min(b)`, where `b` ranges over every (contiguous) subarray of `arr`. Since the answer may be large, return the answer **modulo** `109 + 7`.
**Example 1:**
**Input:** arr = \[3,1,2,4\]
**Output:** 17
**Explanation:**
Subarrays are \[3\], \[1\], \[2\], \[4\], \[3,1\], \... | null | Array,Binary Search | Medium | 788,1335,2188 |
355 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem design twitter this is a somewhat challenging problem for a medium and spoiler alert this is actually really similar to another leak code problem which is called merge k sorted lists and that problem is actually a hard ... | Design Twitter | design-twitter | Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the `10` most recent tweets in the user's news feed.
Implement the `Twitter` class:
* `Twitter()` Initializes your twitter object.
* `void postTweet(int userId, int tweetId)` Composes a new tweet w... | null | Hash Table,Linked List,Design,Heap (Priority Queue) | Medium | 1640 |
222 | Loot Hai Abhi Badi Welcome To My Channel Today Twenty-Three Of June Recording Talent Twenty-Three Of June Recording Talent Twenty-Three Of June Recording Talent And Problem Is Account Complete Cream Notes For Giving A Complete Daddy Free Account Number Of Notice Update Definition Of Complementary From Dar Wikipedia Is ... | Count Complete Tree Nodes | count-complete-tree-nodes | Given the `root` of a **complete** binary tree, return the number of the nodes in the tree.
According to **[Wikipedia](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled in a complete binary tree, and all nodes in the last level are as far lef... | null | Binary Search,Tree,Depth-First Search,Binary Tree | Medium | 270 |
1,762 | hello guys so in this video we're gonna discuss the second most popular liquid question for um Facebook for the past year which is the buildings with an ocean view so for this question we're gonna be given an array of heights of size n which represents the highs of the building in the line and the ocean is to the right... | 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 |
20 | I work ethic and Gentlemen I counted lstore Tunisia broke down for instance it recently Come and well furnished somat Android phone and reviews and more with Sweet shops are their work from no understand when you get is strange as containing all there is seeking the pace with printer shita kara brightest Promise to rec... | Valid Parentheses | valid-parentheses | Given a string `s` containing just the characters `'('`, `')'`, `'{'`, `'}'`, `'['` and `']'`, determine if the input string is valid.
An input string is valid if:
1. Open brackets must be closed by the same type of brackets.
2. Open brackets must be closed in the correct order.
3. Every close bracket has a corres... | An interesting property about a valid parenthesis expression is that a sub-expression of a valid expression should also be a valid expression. (Not every sub-expression) e.g.
{ { } [ ] [ [ [ ] ] ] } is VALID expression
[ [ [ ] ] ] is VALID sub-expression
{ } [ ] is VALID sub-express... | String,Stack | Easy | 22,32,301,1045,2221 |
1,854 | so hey guys welcome to another video so today we are solving maximum population here so in this question we have given a 2d integer array logs where each of H blocks of I represents birth of I and the death of I so indicates the birth and death years of the I person so if the population of some person some population o... | Maximum Population Year | maximum-population-year | You are given a 2D integer array `logs` where each `logs[i] = [birthi, deathi]` indicates the birth and death years of the `ith` person.
The **population** of some year `x` is the number of people alive during that year. The `ith` person is counted in year `x`'s population if `x` is in the **inclusive** range `[birthi... | null | null | Easy | null |
1,952 | welcome back everyone we're gonna be solving Lee code 1952 three divisors so we're given an integer and we want to return true if n has exactly three positive divisors otherwise we want to return false and an integer m is a divisor of n if there exists an integer K such that n is equal to K times m so example one and e... | 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 |
116 | hey guys welcome back to another video and today we're going to be solving the leak code question populating next right pointers in each node all right so let's first try to understand what the question is i think it's a little bit confusing so let's just go through it step by step all right so over here we're going to... | Populating Next Right Pointers in Each Node | populating-next-right-pointers-in-each-node | You are given a **perfect binary tree** where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:
struct Node {
int val;
Node \*left;
Node \*right;
Node \*next;
}
Populate each next pointer to point to its next right node. If there is no next righ... | null | Linked List,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 117,199 |
993 | Jai Hind Is Tutorial Am Going To Discuss A Program In Question Comes Once In Binary Tree Pure Problem Statement Is Given To Value Sucks And Violations How To Write A Code To Take Notes Kar Is Point To Value Action Wires And Note Soiled Not Kar Is Point To 10 Viewers 10 1MB Mode Turn Into This Will Reduce One Switch To ... | Cousins in Binary Tree | tallest-billboard | Given the `root` of a binary tree with unique values and the values of two different nodes of the tree `x` and `y`, return `true` _if the nodes corresponding to the values_ `x` _and_ `y` _in the tree are **cousins**, or_ `false` _otherwise._
Two nodes of a binary tree are **cousins** if they have the same depth with d... | null | Array,Dynamic Programming | Hard | 2162 |
329 | hello hi everyone welcome back to the channel so today in this video lecture we're going to be solving this problem longest increasing path in a matrix so basically you are given a two dimensional Matrix of Dimensions M cross n it contains integers we want to return the length of the longest increasing path in Matrix s... | Longest Increasing Path in a Matrix | longest-increasing-path-in-a-matrix | Given an `m x n` integers `matrix`, return _the length of the longest increasing path in_ `matrix`.
From each cell, you can either move in four directions: left, right, up, or down. You **may not** move **diagonally** or move **outside the boundary** (i.e., wrap-around is not allowed).
**Example 1:**
**Input:** matr... | null | Dynamic Programming,Depth-First Search,Breadth-First Search,Graph,Topological Sort,Memoization | Hard | null |
1,734 | hey what's up guys this is chung so this time uh number 1734 decodex word permutation so this one is very interesting uh bit manipulation problem okay so you're given like an integer array a permutation that is a permutation of the first and positive number on unpositive integers where n is always odd so keep in mind s... | 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 |
70 | okay hello so today we are looking at question 70 climbing stairs you are given you are climbing its decades and it takes n steps to reach the top each time you can either climb one or two steps so how many distinct ways can you climb to the top right so for this question we will need to get out our drawing pads and dr... | Climbing Stairs | climbing-stairs | You are climbing a staircase. It takes `n` steps to reach the top.
Each time you can either climb `1` or `2` steps. In how many distinct ways can you climb to the top?
**Example 1:**
**Input:** n = 2
**Output:** 2
**Explanation:** There are two ways to climb to the top.
1. 1 step + 1 step
2. 2 steps
**Example 2:**
... | To reach nth step, what could have been your previous steps? (Think about the step sizes) | Math,Dynamic Programming,Memoization | Easy | 747,1013,1236 |
1,925 | in this question we are given a number n and return the number of square triples such that abc is between one and n and a square plus b square equals to c square this question is pretty straightforward let's take a look at the solution initially they define a variable count equals to 0 to keep track of the number of sq... | Count Square Sum Triples | count-nice-pairs-in-an-array | A **square triple** `(a,b,c)` is a triple where `a`, `b`, and `c` are **integers** and `a2 + b2 = c2`.
Given an integer `n`, return _the number of **square triples** such that_ `1 <= a, b, c <= n`.
**Example 1:**
**Input:** n = 5
**Output:** 2
**Explanation**: The square triples are (3,4,5) and (4,3,5).
**Example 2... | The condition can be rearranged to (nums[i] - rev(nums[i])) == (nums[j] - rev(nums[j])). Transform each nums[i] into (nums[i] - rev(nums[i])). Then, count the number of (i, j) pairs that have equal values. Keep a map storing the frequencies of values that you have seen so far. For each i, check if nums[i] is in the map... | Array,Hash Table,Math,Counting | Medium | 2129 |
207 | and welcome back to the cracking fan youtube channel today we're going to be solving lead code problem 207 course schedule before we get into the question prompt you guys know the drill please subscribe to the channel and like the video it really helps me grow all right there are total of numb courses you have to take ... | Course Schedule | course-schedule | There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`.
* For example, the pair `[0, 1]`, indicates that to take cou... | This problem is equivalent to finding if a cycle exists in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topologica... | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 210,261,310,630 |
382 | hey everybody this is larry this is day seven of the league code daily challenge hit the like button to subscribe and join me on discord let me know what you think about today's bomb link list random note give me a single link list return a random note row from the linked list has the same probability okay so okay so i... | Linked List Random Node | linked-list-random-node | Given a singly linked list, return a random node's value from the linked list. Each node must have the **same probability** of being chosen.
Implement the `Solution` class:
* `Solution(ListNode head)` Initializes the object with the head of the singly-linked list `head`.
* `int getRandom()` Chooses a node randoml... | null | Linked List,Math,Reservoir Sampling,Randomized | Medium | 398 |
101 | hi guys welcome to one more video in this one we'll take a look at symmetric tree problem difficulty level is easy so I have few trees drawn over here so what is symmetric tree so symmetric tree is a binary tree where left no hold on is this left for you guys no this is left for you guys so left tree of the left child ... | 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 |
525 | or let's talk about catalyst coding question that contiguous array so we have a binary array with number 0 and 1 and we need to find a maximal length of a contiguous sub array with equal number of 0 and 1 so this is a very similar to question a few question I'd already made videos about you know the sub array is basica... | Contiguous Array | contiguous-array | Given a binary array `nums`, return _the maximum length of a contiguous subarray with an equal number of_ `0` _and_ `1`.
**Example 1:**
**Input:** nums = \[0,1\]
**Output:** 2
**Explanation:** \[0, 1\] is the longest contiguous subarray with an equal number of 0 and 1.
**Example 2:**
**Input:** nums = \[0,1,0\]
**O... | null | Array,Hash Table,Prefix Sum | Medium | 325 |
95 | Hello friends today I'm going to solve political problem number 95 unique binary search tree too in this problem we are given an integer n we need to return all the structurally unique binary search trees which can be formed using the values starting from 1 to n inclusive okay and we return the answer it could be in an... | Unique Binary Search Trees II | unique-binary-search-trees-ii | Given an integer `n`, return _all the structurally unique **BST'**s (binary search trees), which has exactly_ `n` _nodes of unique values from_ `1` _to_ `n`. Return the answer in **any order**.
**Example 1:**
**Input:** n = 3
**Output:** \[\[1,null,2,null,3\],\[1,null,3,2\],\[2,1,3\],\[3,1,null,null,2\],\[3,2,null,1\... | null | Dynamic Programming,Backtracking,Tree,Binary Search Tree,Binary Tree | Medium | 96,241 |
395 | good evening, Fedor, less coffee, we continue to solve problems that come up during interviews, let’s come up during interviews, let’s come up during interviews, let’s now see that everything here is translated almost normally and, in fact, the task today 395 of the site is easy with a longhi tray with about string hei... | Longest Substring with At Least K Repeating Characters | longest-substring-with-at-least-k-repeating-characters | Given a string `s` and an integer `k`, return _the length of the longest substring of_ `s` _such that the frequency of each character in this substring is greater than or equal to_ `k`.
**Example 1:**
**Input:** s = "aaabb ", k = 3
**Output:** 3
**Explanation:** The longest substring is "aaa ", as 'a' is repeated 3... | null | Hash Table,String,Divide and Conquer,Sliding Window | Medium | 2140,2209 |
304 | hey everybody this is larry this is day third the third day of june uh for the june the code daily challenge hit the like button to subscribe and join me in discord let me know what you think about today's problem um range some query 2d immutable okay so this one i'll go over a little bit but not gonna lie uh the mb th... | Range Sum Query 2D - Immutable | range-sum-query-2d-immutable | Given a 2D matrix `matrix`, handle multiple queries of the following type:
* Calculate the **sum** of the elements of `matrix` inside the rectangle defined by its **upper left corner** `(row1, col1)` and **lower right corner** `(row2, col2)`.
Implement the `NumMatrix` class:
* `NumMatrix(int[][] matrix)` Initial... | null | Array,Design,Matrix,Prefix Sum | Medium | 303,308 |
127 | hey everyone welcome back to the channel i hope you guys are doing extremely well so in this video we are going to solve this word ladder one problem which is an extremely hard problem so what does the problem state the problem states you're given two distinct words two distinct so a start word and a target word and a ... | Word Ladder | word-ladder | 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,Breadth-First Search | Hard | 126,433 |
587 | hey everybody this is larry this is day three day third day of september hit the like button hit the subscribe button join me on discord let me know what you think i will be doing this all month and maybe beyond anyway today's problem is direct defense um i usually solve this live so if it's a little bit slower awkward... | Erect the Fence | erect-the-fence | You are given an array `trees` where `trees[i] = [xi, yi]` represents the location of a tree in the garden.
Fence the entire garden using the minimum length of rope, as it is expensive. The garden is well-fenced only if **all the trees are enclosed**.
Return _the coordinates of trees that are exactly located on the f... | null | Array,Math,Geometry | Hard | 2074 |
1,958 | hey everybody this is larry just me going with q2 of the biweekly contest 58 check if move is legal hit the like button to subscribe and join me on discord let me know what you think about this prom and if you are here right after the contest come join me on discord because there are a lot of other smart people who uh ... | Check if Move is Legal | ad-free-sessions | You are given a **0-indexed** `8 x 8` grid `board`, where `board[r][c]` represents the cell `(r, c)` on a game board. On the board, free cells are represented by `'.'`, white cells are represented by `'W'`, and black cells are represented by `'B'`.
Each move in this game consists of choosing a free cell and changing i... | null | Database | Easy | null |
16 | hey Dad is again and welcome back to another co2 channel today by the captain number one six and its recent closest it is another version threesome is here we can apply the same logic to it yeah so we have a way with target engines read now burning center route to sound we have to make sure that we ace must be here Mad... | 3Sum Closest | 3sum-closest | Given an integer array `nums` of length `n` and an integer `target`, find three integers in `nums` such that the sum is closest to `target`.
Return _the sum of the three integers_.
You may assume that each input would have exactly one solution.
**Example 1:**
**Input:** nums = \[-1,2,1,-4\], target = 1
**Output:** ... | null | Array,Two Pointers,Sorting | Medium | 15,259 |
29 | all right let's do a much hated question today at this question 29 divided two integers we have two integers divine and divisor we need to perform a division between this two without using multiplication division and mod so we're looking at addition subtraction and potential a bit wise operation like a shift so when yo... | 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,751 | hi guys good morning welcome back to the new video and firstly if you want to get the intuition please give the next 15-20 the intuition please give the next 15-20 the intuition please give the next 15-20 seconds which I'm gonna tell if you had done this then please try it by yourself so if you have watched our complet... | Maximum Number of Events That Can Be Attended II | slowest-key | You are given an array of `events` where `events[i] = [startDayi, endDayi, valuei]`. The `ith` event starts at `startDayi` and ends at `endDayi`, and if you attend this event, you will receive a value of `valuei`. You are also given an integer `k` which represents the maximum number of events you can attend.
You can o... | Get for each press its key and amount of time taken. Iterate on the presses, maintaining the answer so far. The current press will change the answer if and only if its amount of time taken is longer than that of the previous answer, or they are equal but the key is larger than that of the previous answer. | Array,String | Easy | null |
51 | in this video we're going to look at a legal problem called in queens so basically in queens the end queen's puzzle is the problem of placing a number of queens on a end times n chess board such that no two queens can be put to kill each others so given a integer n and this n integer value is between one to nine we tur... | N-Queens | n-queens | The **n-queens** puzzle is the problem of placing `n` queens on an `n x n` chessboard such that no two queens attack each other.
Given an integer `n`, return _all distinct solutions to the **n-queens puzzle**_. You may return the answer in **any order**.
Each solution contains a distinct board configuration of the n-... | null | Array,Backtracking | Hard | 52,1043 |
981 | Hi gas welcome and welcome back to my channel so today our problem is to store the value of time waste so what is given to us in this problem statement here we have to implement a time waste key value data structure what to do is to implement okay Which is what will store for a particular key different at different tim... | Time Based Key-Value Store | delete-columns-to-make-sorted | Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key's value at a certain timestamp.
Implement the `TimeMap` class:
* `TimeMap()` Initializes the object of the data structure.
* `void set(String key, String value, int timestamp)... | null | Array,String | Easy | null |
78 | hey guys welcome back to helper function in this video we will discuss a popular question subsets so the problem statement says that given a set of distinct integers none return all the possible subsets now all the possible subsets of any set is also known as a power set and also there should not be any duplicate subse... | Subsets | subsets | Given an integer array `nums` of **unique** elements, 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,3\]
**Output:** \[\[\],\[1\],\[2\],\[1,2\],\[3\],\[1,3\],\[2,3\],\[1,2,3\]\]
... | null | Array,Backtracking,Bit Manipulation | Medium | 90,320,800,2109,2170 |
208 | hi everyone my name is Steve today we're going to talk about try or implement try prefix train while use legal problem 208 to help us go through this problem because since LICO has a lot of wonderful corner cases in its code base so we can use this to make sure that our code is correct but actually this tribe is a very... | Implement Trie (Prefix Tree) | implement-trie-prefix-tree | A [**trie**](https://en.wikipedia.org/wiki/Trie) (pronounced as "try ") or **prefix tree** is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker.
Implement the Trie class:
* `Trie()` ... | null | Hash Table,String,Design,Trie | Medium | 211,642,648,676,1433,1949 |
449 | okay let's discuss about this question uh nicole 449 series lines and a d series lines bst so what's the mean of this question so given this a binary circuit wait so what's the mean of bandwidth surgery so it means that the elements on the left side of the root is smaller than the root all the elements on the right sid... | Serialize and Deserialize BST | serialize-and-deserialize-bst | Serialization is converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment.
Design an algorithm to serialize and deserialize a **binary search t... | null | String,Tree,Depth-First Search,Breadth-First Search,Design,Binary Search Tree,Binary Tree | Medium | 297,652,765 |
1,071 | Hey guys welcome back to my channel and this is a new question of lead code 75 challenge whose name is Greatest Common Divisor of Strings. This is a very lovely question. It has been termed in easy but it may seem difficult at times for beginners. Let's see what is there, so if you look, we have given the string ABC an... | Greatest Common Divisor of Strings | binary-prefix-divisible-by-5 | For two strings `s` and `t`, we say "`t` divides `s` " if and only if `s = t + ... + t` (i.e., `t` is concatenated with itself one or more times).
Given two strings `str1` and `str2`, return _the largest string_ `x` _such that_ `x` _divides both_ `str1` _and_ `str2`.
**Example 1:**
**Input:** str1 = "ABCABC ", str2... | If X is the first i digits of the array as a binary number, then 2X + A[i] is the first i+1 digits. | Array | Easy | null |
1,962 | so you are given 0 index integer array files and where piles represent the number of stone in ith files and integer K you should apply the following operation exactly K times right so what we can what we have to do we have to choose any piles right this is the array right that is given right it's it stores number of st... | 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 |
1,395 | Hi to Jhal I am the option that Rajan will solve the question which will be taken from account number 3. Who will be tried after leaving the question? It will be seen how you think of the question. When any question is found then how should it be answered from the fruit. Can be insulting and optimization cost. Original... | Count Number of Teams | minimum-time-visiting-all-points | There are `n` soldiers standing in a line. Each soldier is assigned a **unique** `rating` value.
You have to form a team of 3 soldiers amongst them under the following rules:
* Choose 3 soldiers with index (`i`, `j`, `k`) with rating (`rating[i]`, `rating[j]`, `rating[k]`).
* A team is valid if: (`rating[i] < rat... | To walk from point A to point B there will be an optimal strategy to walk ? Advance in diagonal as possible then after that go in straight line. Repeat the process until visiting all the points. | Array,Math,Geometry | Easy | null |
699 | by 699 clone squares on an infinite infinity no infinite number line we drop different squares in order they're given the I Squared's Bob position goes left silent is a square of the leftmost point decision hi Sue and Simon x1 okay we just have a square that starts on that point and it's of length you doctor named your... | Falling Squares | falling-squares | There are several squares being dropped onto the X-axis of a 2D plane.
You are given a 2D integer array `positions` where `positions[i] = [lefti, sideLengthi]` represents the `ith` square with a side length of `sideLengthi` that is dropped with its left edge aligned with X-coordinate `lefti`.
Each square is dropped o... | If positions = [[10, 20], [20, 30]], this is the same as [[1, 2], [2, 3]]. Currently, the values of positions are very large. Can you generalize this approach so as to make the values in positions manageable? | Array,Segment Tree,Ordered Set | Hard | 218 |
35 | hello today we're going to go through Elite code problem 35 which is search insert position let's look at the problem here so basically it's saying given a sorted array of distinct integers and a Target value return the index if the target is found if not you need to return the index where it would be if it were insert... | 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 |
767 | hello and welcome to another video in this video we're going to be going over reorganized spring so in this problem you're given a string s and you want to rearrange the characters such that any two adjacent characters are not the same and you want to return any possible rearrangement of s so it's pretty intuitive what... | Reorganize String | prime-number-of-set-bits-in-binary-representation | Given a string `s`, rearrange the characters of `s` so that any two adjacent characters are not the same.
Return _any possible rearrangement of_ `s` _or return_ `" "` _if not possible_.
**Example 1:**
**Input:** s = "aab"
**Output:** "aba"
**Example 2:**
**Input:** s = "aaab"
**Output:** ""
**Constraints:**
* ... | Write a helper function to count the number of set bits in a number, then check whether the number of set bits is 2, 3, 5, 7, 11, 13, 17 or 19. | Math,Bit Manipulation | Easy | 191 |
1,727 | hello guys and welcome back to lead Logics this is the largest submatrix with rearrangement problem it is a lead code medium and the number for this is 1727 so in this problem we are given with a binary Matrix of size M cross n and we are allowed to rearrange The Columns of the Matrix that means we can move the columns... | Largest Submatrix With Rearrangements | cat-and-mouse-ii | You are given a binary matrix `matrix` of size `m x n`, and you are allowed to rearrange the **columns** of the `matrix` in any order.
Return _the area of the largest submatrix within_ `matrix` _where **every** element of the submatrix is_ `1` _after reordering the columns optimally._
**Example 1:**
**Input:** matri... | Try working backward: consider all trivial states you know to be winning or losing, and work backward to determine which other states can be labeled as winning or losing. | Math,Dynamic Programming,Breadth-First Search,Graph,Memoization,Game Theory | Hard | 805,949 |
432 | hey everybody this is larry this is me doing a bonus question a problem that i haven't done before on lead code hit the like button hit the subscribe button join me on discord let me know what you think about today's randomness let's see which one we are we going to get all one status structure oh one what does what is... | All O`one Data Structure | all-oone-data-structure | Design a data structure to store the strings' count with the ability to return the strings with minimum and maximum counts.
Implement the `AllOne` class:
* `AllOne()` Initializes the object of the data structure.
* `inc(String key)` Increments the count of the string `key` by `1`. If `key` does not exist in the d... | null | Hash Table,Linked List,Design,Doubly-Linked List | Hard | null |
983 | hey guys in this video we shall sell the problem only for myself on guitar so today's problem is minimum cost for tickets we have planned some train traveling one year in advance the days of the year in which you travel are given as the integer that it is from 1 to 365 that's that means it's a long leap year and what e... | Minimum Cost For Tickets | validate-stack-sequences | You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array `days`. Each day is an integer from `1` to `365`.
Train tickets are sold in **three different ways**:
* a **1-day** pass is sold for `costs[0]` dollars,
* a **7-day** pass is sold... | null | Array,Stack,Simulation | Medium | null |
131 | of legal question palindrome partitioning and this is a median legal question so giving a string as partition s such that every sub uh every substring of the partition is a palindrome return all possible palindrome partitioning of s so if you take a look at the example is oh a palindrome string is a string that reads t... | Palindrome Partitioning | palindrome-partitioning | Given a string `s`, partition `s` such that every substring of the partition is a **palindrome**. Return _all possible palindrome partitioning of_ `s`.
**Example 1:**
**Input:** s = "aab"
**Output:** \[\["a","a","b"\],\["aa","b"\]\]
**Example 2:**
**Input:** s = "a"
**Output:** \[\["a"\]\]
**Constraints:**
* `1... | null | String,Dynamic Programming,Backtracking | Medium | 132,1871 |
286 | hello welcome back today let's try to solve another lead called Problem 286 Wars and dates so for this problem yeah we can understand it according to destroying example one yeah because example two is a substitute forward if there's a minus one needs it is worse yeah we're gonna just have to return the rooms our final ... | Walls and Gates | walls-and-gates | You are given an `m x n` grid `rooms` initialized with these three possible values.
* `-1` A wall or an obstacle.
* `0` A gate.
* `INF` Infinity means an empty room. We use the value `231 - 1 = 2147483647` to represent `INF` as you may assume that the distance to a gate is less than `2147483647`.
Fill each empt... | null | Array,Breadth-First Search,Matrix | Medium | 130,200,317,865,1036 |
1,004 | hey what's up guys this is juan here so this time they called 1004 max consecutive ones number three so you're given like a binary array numbers and an integer k you need to return the maximum number of consecutive ones in the array if you can flip at most k zeros okay so for example we have the cell rays here and k is... | 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 |
48 | okay so let's start our today's daily recoding so today's question is rotate image and i checked it is a medium question so uh let's see how much time for me to spend on this question if i could resolve it okay so let's take a look at the question so rotate image you are given an m by n2d matrix representing an image r... | Rotate Image | rotate-image | You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise).
You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati... | null | Array,Math,Matrix | Medium | 2015 |
34 | foreign welcome back to the DSA classes dear friends today we are going to be solving a question from leap code 34 right and this is a medium level question and this question goes something like this you need to find the first and the last position of the element in a sorted array and this question has been asked previ... | Find First and Last Position of Element in Sorted Array | find-first-and-last-position-of-element-in-sorted-array | Given an array of integers `nums` sorted in non-decreasing order, find the starting and ending position of a given `target` value.
If `target` is not found in the array, return `[-1, -1]`.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[5,7,7,8,8,10\], target = 8
*... | null | Array,Binary Search | Medium | 278,2165,2210 |
1,370 | welcome back to our Channel where we discuss and solve popular coding problems today we're going to be tackling leap code problem 1370 increasing decreasing string the problem statement is pretty straightforward given a string s we need to reorder the characters in such a way that the characters in the resulting string... | Increasing Decreasing String | count-number-of-nice-subarrays | You are given a string `s`. Reorder the string using the following algorithm:
1. Pick the **smallest** character from `s` and **append** it to the result.
2. Pick the **smallest** character from `s` which is greater than the last appended character to the result and **append** it.
3. Repeat step 2 until you cannot ... | After replacing each even by zero and every odd by one can we use prefix sum to find answer ? Can we use two pointers to count number of sub-arrays ? Can we store indices of odd numbers and for each k indices count number of sub-arrays contains them ? | Array,Hash Table,Math,Sliding Window | Medium | null |
148 | yo what is up youtube today i'm going to be going over sort list it's a medium leap code problem asked by amazon if you guys haven't already check out my channel i post these videos every week today and i'll see you guys soon okay so now we have sort this sort of linked list and of end login time using constant space c... | Sort List | sort-list | Given the `head` of a linked list, return _the list after sorting it in **ascending order**_.
**Example 1:**
**Input:** head = \[4,2,1,3\]
**Output:** \[1,2,3,4\]
**Example 2:**
**Input:** head = \[-1,5,3,4,0\]
**Output:** \[-1,0,3,4,5\]
**Example 3:**
**Input:** head = \[\]
**Output:** \[\]
**Constraints:**
* ... | null | Linked List,Two Pointers,Divide and Conquer,Sorting,Merge Sort | Medium | 21,75,147,1992 |
1,094 | Hello hello everyone happy wala doing well so im back with another letter from delhi zip code number 104 car polling station medium level question and subscribe the channel kilometers from the mission possible dot com changer for all the given tips and false advice So if taken in the Distic in the question example in s... | Car Pooling | matrix-cells-in-distance-order | There is a car with `capacity` empty seats. The vehicle only drives east (i.e., it cannot turn around and drive west).
You are given the integer `capacity` and an array `trips` where `trips[i] = [numPassengersi, fromi, toi]` indicates that the `ith` trip has `numPassengersi` passengers and the locations to pick them u... | null | Array,Math,Geometry,Sorting,Matrix | Easy | 2304 |
474 | hey everybody this is larry this is day 23 of the may leco day challenge hit the like button to subscribe and join me in discord let me know what you think about today's font so you're given binary strings m and n what does that mean return the size of the largest subset of string such that they're at most m zeros and ... | Ones and Zeroes | ones-and-zeroes | You are given an array of binary strings `strs` and two integers `m` and `n`.
Return _the size of the largest subset of `strs` such that there are **at most**_ `m` `0`_'s and_ `n` `1`_'s in the subset_.
A set `x` is a **subset** of a set `y` if all elements of `x` are also elements of `y`.
**Example 1:**
**Input:**... | null | Array,String,Dynamic Programming | Medium | 510,600,2261 |
139 | welcome to this video now we're going to solve a coding interview question word break you're given a non-empty string s and a you're given a non-empty string s and a you're given a non-empty string s and a dictionary word dict containing a list of non-empty words determine if s can be non-empty words determine if s can... | Word Break | word-break | Given a string `s` and a dictionary of strings `wordDict`, return `true` if `s` can be segmented into a space-separated sequence of one or more dictionary words.
**Note** that the same word in the dictionary may be reused multiple times in the segmentation.
**Example 1:**
**Input:** s = "leetcode ", wordDict = \[ "... | null | Hash Table,String,Dynamic Programming,Trie,Memoization | Medium | 140 |
1,603 | hi everyone today we are going to solve the little question design packing system so design a parking system for 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 parking system class the parking system initialize object of the pa... | 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,489 | hey what's up guys this is chung here so today uh let's take a look at lead code uh problem number 1489 find the critical and pseudo critical edges in minimal spanning tree so this one is a very interesting graph problem okay so you're given like a weighted undirected connected graph right with n vertices a number from... | Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree | pizza-with-3n-slices | Given a weighted undirected connected graph with `n` vertices numbered from `0` to `n - 1`, and an array `edges` where `edges[i] = [ai, bi, weighti]` represents a bidirectional and weighted edge between nodes `ai` and `bi`. A minimum spanning tree (MST) is a subset of the graph's edges that connects all vertices withou... | By studying the pattern of the operations, we can find out that the problem is equivalent to: Given an integer array with size 3N, select N integers with maximum sum and any selected integers are not next to each other in the array. The first one in the array is considered next to the last one in the array. Use Dynamic... | Array,Dynamic Programming,Greedy,Heap (Priority Queue) | Hard | null |
112 | this problem is called path sum and here we are given a binary tree and we have to check whether there is a path from root to its Leaf nodes such that the sum of values equals a given value so let's see the problem statement so we are given this root of the tree and we are also given one target sum and we have to find ... | Path Sum | path-sum | Given the `root` of a binary tree and an integer `targetSum`, return `true` if the tree has a **root-to-leaf** path such that adding up all the values along the path equals `targetSum`.
A **leaf** is a node with no children.
**Example 1:**
**Input:** root = \[5,4,8,11,null,13,4,7,2,null,null,null,1\], targetSum = 22... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 113,124,129,437,666 |
1,854 | hey everybody this is larry this is me going over weekly contest 240 q1 maximum population year so this is a simulation problem or just do what they tell you problem um uh to be honest i did it even more naively the key thing to note is that there's only 100 n and the difference can only be a hundred so you're gonna do... | Maximum Population Year | maximum-population-year | You are given a 2D integer array `logs` where each `logs[i] = [birthi, deathi]` indicates the birth and death years of the `ith` person.
The **population** of some year `x` is the number of people alive during that year. The `ith` person is counted in year `x`'s population if `x` is in the **inclusive** range `[birthi... | null | null | Easy | null |
958 | hey guys in this video we shall see another problem on the record check completeness of a binary tree so given the root of a binary it will determine if it is a concrete binary key or not in a complete binary tree every level except possibly the last is completely full and all nodes in the last level are as far as left... | Check Completeness of a Binary Tree | sort-array-by-parity-ii | Given the `root` of a binary tree, determine if it is a _complete binary tree_.
In a **[complete binary tree](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between ... | null | Array,Two Pointers,Sorting | Easy | 2271,2283,2327 |
491 | Hello friends today I'm going to saw with good problem number 491 non-decreasing subsequences so in this non-decreasing subsequences so in this non-decreasing subsequences so in this problem we are given an integer array numps and what we need to do is return all the possible non-decreasing subsequence of that array no... | Non-decreasing Subsequences | increasing-subsequences | Given an integer array `nums`, return _all the different possible non-decreasing subsequences of the given array with at least two elements_. You may return the answer in **any order**.
**Example 1:**
**Input:** nums = \[4,6,7,7\]
**Output:** \[\[4,6\],\[4,6,7\],\[4,6,7,7\],\[4,7\],\[4,7,7\],\[6,7\],\[6,7,7\],\[7,7\]... | null | Array,Hash Table,Backtracking,Bit Manipulation | Medium | 646 |
1,700 | let's look at the problem 170 of lead code number of students unable to eat lunch so the question is long but you can I can summarize it as follows so they essentially saying that there are n number of students in the class okay and there are equal number of sandwiches that are there in the class right so students is e... | Number of Students Unable to Eat Lunch | minimum-time-to-make-rope-colorful | The school cafeteria offers circular and square sandwiches at lunch break, referred to by numbers `0` and `1` respectively. All students stand in a queue. Each student either prefers square or circular sandwiches.
The number of sandwiches in the cafeteria is equal to the number of students. The sandwiches are placed i... | Maintain the running sum and max value for repeated letters. | Array,String,Dynamic Programming,Greedy | Medium | null |
1,413 | hello everyone welcome to coderscam we are at 11th day of november record challenge and the problem we are going to see today is minimum value to get positive step by step so the input given here is an integer array with both positive and negative values and we have to return the minimum positive value as a start value... | Minimum Value to Get Positive Step by Step Sum | maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold | Given an array of integers `nums`, you start with an initial **positive** value _startValue__._
In each iteration, you calculate the step by step sum of _startValue_ plus elements in `nums` (from left to right).
Return the minimum **positive** value of _startValue_ such that the step by step sum is never less than 1.... | Store prefix sum of all grids in another 2D array. Try all possible solutions and if you cannot find one return -1. If x is a valid answer then any y < x is also valid answer. Use binary search to find answer. | Array,Binary Search,Matrix,Prefix Sum | Medium | null |
1,649 | hey everybody this is larry this is day 10 of the league code daily challenge uh hit the like button hit the subscribe button join me on discord let me know what you think about today's prom uh create it sorted away for instructions okay uh so yeah so i do usually read self and uh ex do the explanations live so let me ... | Create Sorted Array through Instructions | maximum-number-of-non-overlapping-subarrays-with-sum-equals-target | Given an integer array `instructions`, you are asked to create a sorted array from the elements in `instructions`. You start with an empty container `nums`. For each element from **left to right** in `instructions`, insert it into `nums`. The **cost** of each insertion is the **minimum** of the following:
* The numb... | Keep track of prefix sums to quickly look up what subarray that sums "target" can be formed at each step of scanning the input array. It can be proved that greedily forming valid subarrays as soon as one is found is optimal. | Array,Hash Table,Greedy,Prefix Sum | Medium | null |
414 | Hello everyone welcome back tu andar video site and today maximum number and return d third distance maximum number in this arrest if d third maximum number ok so like firstly i k u d input like three tu van so what is d third maximum number is first maximum Number is 3 seconds, you output this one, OK, example, OK, so... | Third Maximum Number | third-maximum-number | Given an integer array `nums`, return _the **third distinct maximum** number in this array. If the third maximum does not exist, return the **maximum** number_.
**Example 1:**
**Input:** nums = \[3,2,1\]
**Output:** 1
**Explanation:**
The first distinct maximum is 3.
The second distinct maximum is 2.
The third distin... | null | Array,Sorting | Easy | 215 |
393 | hello everyone today I will solve the question number 393 and the question type is medium and the question is they will give us Vector integer and we need to return Boolean true or false after checking whether it is a valid UTF at encoding or not so first we need to know what is utf-8 so first we need to know what is u... | UTF-8 Validation | utf-8-validation | Given an integer array `data` representing the data, return whether it is a valid **UTF-8** encoding (i.e. it translates to a sequence of valid UTF-8 encoded characters).
A character in **UTF8** can be from **1 to 4 bytes** long, subjected to the following rules:
1. For a **1-byte** character, the first bit is a `0`... | All you have to do is follow the rules. For a given integer, obtain its binary representation in the string form and work with the rules given in the problem. An integer can either represent the start of a UTF-8 character, or a part of an existing UTF-8 character. There are two separate rules for these two scenarios in... | Array,Bit Manipulation | Medium | null |
1,248 | Hello everyone Hello well today I am going to solve the problem number lead in the name of problem number 12 4 account number of problem statement then we have to return the result to the account of total number of sub raise in which there will be more numbers then it is basic If we look at the first test case, we have... | Count Number of Nice Subarrays | binary-tree-coloring-game | Given an array of integers `nums` and an integer `k`. A continuous subarray is called **nice** if there are `k` odd numbers on it.
Return _the number of **nice** sub-arrays_.
**Example 1:**
**Input:** nums = \[1,1,2,1,1\], k = 3
**Output:** 2
**Explanation:** The only sub-arrays with 3 odd numbers are \[1,1,2,1\] an... | The best move y must be immediately adjacent to x, since it locks out that subtree. Can you count each of (up to) 3 different subtrees neighboring x? | Tree,Depth-First Search,Binary Tree | Medium | null |
792 | hello everyone welcome to learn overflow in this video we'll discuss about today's liquid problem there is a number of matching substring okay so this is a medium level problem and understand what this question is asking us to do and how we should think on solving a question like this and what can be the multiple uh so... | 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 |
1,832 | hey everybody this is Larry this is Daya let's click on the 17th of the late decode daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's problem is it easy what are we doing 1832 check up the sentences pentagram okay I'm in San Francisco right now I'm ... | Check if the Sentence Is Pangram | minimum-operations-to-make-a-subsequence | A **pangram** is a sentence where every letter of the English alphabet appears at least once.
Given a string `sentence` containing only lowercase English letters, return `true` _if_ `sentence` _is a **pangram**, or_ `false` _otherwise._
**Example 1:**
**Input:** sentence = "thequickbrownfoxjumpsoverthelazydog "
**O... | The problem can be reduced to computing Longest Common Subsequence between both arrays. Since one of the arrays has distinct elements, we can consider that these elements describe an arrangement of numbers, and we can replace each element in the other array with the index it appeared at in the first array. Then the pro... | Array,Hash Table,Binary Search,Greedy | Hard | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.