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 |
|---|---|---|---|---|---|---|---|---|
1,239 | Welcome to my channel code Sorry with Mike So today we are going to do video number 10 of the bit manipulation playlist, okay the lead is marked number 12 239 medium, already I have given a solution to this problem of this video in my DP's playlist. His question number is two, I think, I had posted it a year ago, okay,... | Maximum Length of a Concatenated String with Unique Characters | largest-1-bordered-square | You are given an array of strings `arr`. A string `s` is formed by the **concatenation** of a **subsequence** of `arr` that has **unique characters**.
Return _the **maximum** possible length_ of `s`.
A **subsequence** is an array that can be derived from another array by deleting some or no elements without changing ... | For each square, know how many ones are up, left, down, and right of this square. You can find it in O(N^2) using dynamic programming. Now for each square ( O(N^3) ), we can evaluate whether that square is 1-bordered in O(1). | Array,Dynamic Programming,Matrix | Medium | null |
837 | hey guys today we're going to be solving lead code question 837 new 21 game this is a medium lead code problem but it's actually a little tougher than a usual lead cold medium problem i would say it's leaning towards a heart problem what makes this problem difficult is not just the solution but the question like the pr... | New 21 Game | most-common-word | Alice plays the following game, loosely based on the card game **"21 "**.
Alice starts with `0` points and draws numbers while she has less than `k` points. During each draw, she gains an integer number of points randomly from the range `[1, maxPts]`, where `maxPts` is an integer. Each draw is independent and the outc... | null | Hash Table,String,Counting | Easy | null |
1,281 | hey everyone today we're going to be going over leak code 1281 subtract the product and sum of digits of an integer so given an integer number and return the difference between the product of its digits and the sum of its digits so we go down to this example um two three one if we take that and go over here the individ... | Subtract the Product and Sum of Digits of an Integer | can-make-palindrome-from-substring | Given an integer number `n`, return the difference between the product of its digits and the sum of its digits.
**Example 1:**
**Input:** n = 234
**Output:** 15
**Explanation:**
Product of digits = 2 \* 3 \* 4 = 24
Sum of digits = 2 + 3 + 4 = 9
Result = 24 - 9 = 15
**Example 2:**
**Input:** n = 4421
**Output:**... | Since we can rearrange the substring, all we care about is the frequency of each character in that substring. How to find the character frequencies efficiently ? As a preprocess, calculate the accumulate frequency of all characters for all prefixes of the string. How to check if a substring can be changed to a palindro... | Hash Table,String,Bit Manipulation,Prefix Sum | Medium | 2165 |
494 | Hello hello my dear friend for the question is targets of I will explain the question ok so basically award given in this question a will be given to correct an SMS given date we want targets MS Word question what we can do is used plus minus sign and The equation and the desire or will tell you how fast you plus minus... | Target Sum | target-sum | You are given an integer array `nums` and an integer `target`.
You want to build an **expression** out of nums by adding one of the symbols `'+'` and `'-'` before each integer in nums and then concatenate all the integers.
* For example, if `nums = [2, 1]`, you can add a `'+'` before `2` and a `'-'` before `1` and ... | null | Array,Dynamic Programming,Backtracking | Medium | 282 |
145 | in this video we're going to look at a legal problem called binary tree post order traversal so given that the root of the binary tree return the post-order traversal of its the post-order traversal of its the post-order traversal of its node's value so this question for post-order traversal basically we want post-orde... | 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 |
142 | then play cycle 2 giving a head of Link this return the node where the save will begin if there is no cycle return now there's a cycle in English if there is some note in the list that can be reached Again by continuously following the next pointer and internally position is used to denote the index of the node that th... | Linked List Cycle II | linked-list-cycle-ii | Given the `head` of a linked list, return _the node where the cycle begins. If there is no cycle, return_ `null`.
There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that ta... | null | Hash Table,Linked List,Two Pointers | Medium | 141,287 |
1,184 | in this video I will solve this between bus stops from wig code so in this problem we are given and bus stops and they form a circle and we are also given distances between all the neighboring bus stops and our bus can go along in both of the directions so it can go clockwise and counterclockwise and our problem is to ... | Distance Between Bus Stops | car-pooling | A bus has `n` stops numbered from `0` to `n - 1` that form a circle. We know the distance between all pairs of neighboring stops where `distance[i]` is the distance between the stops number `i` and `(i + 1) % n`.
The bus goes along both directions i.e. clockwise and counterclockwise.
Return the shortest distance betw... | Sort the pickup and dropoff events by location, then process them in order. | Array,Sorting,Heap (Priority Queue),Simulation,Prefix Sum | Medium | 253 |
144 | all right let's talk about binary triple the traversal so pre-order traversal the traversal so pre-order traversal the traversal so pre-order traversal mean you are yourself you are your left you are your right and if a list is uh av i mean i created this right if a root is not it's equal to no so if a blue is not i ca... | 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 |
392 | Well, it's in the golden cage, our 3D up's c, they wrapped it in the microphone, Ah Sumina, the 2nd team, without Corliss, Guns, so uh, even if you use it's done with PVC, the B side, maybe the Seventh 4, the maximum LSC course, which 103 days ago, the capital city Whisper You and I hang out, drink quickly, there is no... | Is Subsequence | is-subsequence | Given two strings `s` and `t`, return `true` _if_ `s` _is a **subsequence** of_ `t`_, or_ `false` _otherwise_.
A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i... | null | Two Pointers,String,Dynamic Programming | Easy | 808,1051 |
771 | okay welcome to my channel i'm here to do my hundred little challenge today we have leeco 771 juice and stones your given string juice represent the type of stone that are jews and stones represent the stone that you have each character in stone is the type of stone that you have you want to know how many of the stone ... | Jewels and Stones | encode-n-ary-tree-to-binary-tree | You're given strings `jewels` representing the types of stones that are jewels, and `stones` representing the stones you have. Each character in `stones` is a type of stone you have. You want to know how many of the stones you have are also jewels.
Letters are case sensitive, so `"a "` is considered a different type o... | null | Tree,Depth-First Search,Breadth-First Search,Design,Binary Tree | Hard | 765 |
253 | hi i'm ali today i want to talk about another important interview question this question is called meeting rooms and it is among one of the most recurrent and important interview questions this question has been asked by lots of companies like amazon google facebook bloomberg and others so in order to solve this proble... | Meeting Rooms II | meeting-rooms-ii | Given an array of meeting time intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of conference rooms required_.
**Example 1:**
**Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\]
**Output:** 2
**Example 2:**
**Input:** intervals = \[\[7,10\],\[2,4\]\]
**Output:** 1
**Constr... | Think about how we would approach this problem in a very simplistic way. We will allocate rooms to meetings that occur earlier in the day v/s the ones that occur later on, right? If you've figured out that we have to sort the meetings by their start time, the next thing to think about is how do we do the allocation? Th... | Array,Two Pointers,Greedy,Sorting,Heap (Priority Queue) | Medium | 56,252,452,1184 |
791 | everyone welcome to my channel so in this video there are two goals the first goal is to see how to solve this problem and then we are going to do some live coding the second goal is to see how you should be helping in a real good interview so before we start the real content for today i would really appreciate that if... | Custom Sort String | split-bst | You are given two strings order and s. All the characters of `order` are **unique** and were sorted in some custom order previously.
Permute the characters of `s` so that they match the order that `order` was sorted. More specifically, if a character `x` occurs before a character `y` in `order`, then `x` should occur ... | Use recursion. If root.val <= V, you split root.right into two halves, then join it's left half back on root.right. | Tree,Binary Search Tree,Recursion,Binary Tree | Medium | 450 |
1,043 | Problem 1043 Partition Here For Maxim Sir Problem Statement Is Given Darkness Name Se Z2 Play N To Continue Savera Length Don't After First Name Is Savera Hair Oil Change To Bank Wave New Updates Amazon People Have Been Told We Have Said This And people have to share the size of donut which is in the lunch survey, we c... | Partition Array for Maximum Sum | grid-illumination | Given an integer array `arr`, partition the array into (contiguous) subarrays of length **at most** `k`. After partitioning, each subarray has their values changed to become the maximum value of that subarray.
Return _the largest sum of the given array after partitioning. Test cases are generated so that the answer fi... | null | Array,Hash Table | Hard | 51 |
203 | Lead Code Question 203 Remove Link List Elements It is written sir that you will be given the head, the edge of the link list is normal and an integer will be given, whose value of node will be equal to this integer, you have to remove that node from the link list. As you will see here, value equal to 6 is given, so we... | Remove Linked List Elements | remove-linked-list-elements | Given the `head` of a linked list and an integer `val`, remove all the nodes of the linked list that has `Node.val == val`, and return _the new head_.
**Example 1:**
**Input:** head = \[1,2,6,3,4,5,6\], val = 6
**Output:** \[1,2,3,4,5\]
**Example 2:**
**Input:** head = \[\], val = 1
**Output:** \[\]
**Example 3:**... | null | Linked List,Recursion | Easy | 27,237,2216 |
395 | you there is like something on the chat like give me a sec yeah I also wanted to mention that for the previous problem water and jet problem when I was like looking into it there is also a mathematical formula that can lead us to a very fast solution using GCD okay I will encourage like people to read if they're intere... | 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 |
202 | Hello my dear friend so today you are going to solve d lead code problem happy numbers ok so what will be given in this question number so what is d happy number positive wait and what c have you do c have you replace d number by Sam of d square of un digital ok suppose if van and nine is given it means you have tu squ... | Happy Number | happy-number | Write an algorithm to determine if a number `n` is happy.
A **happy number** is a number defined by the following process:
* Starting with any positive integer, replace the number by the sum of the squares of its digits.
* Repeat the process until the number equals 1 (where it will stay), or it **loops endlessly ... | null | Hash Table,Math,Two Pointers | Easy | 141,258,263,2076 |
967 | in this problem we have to return a list of numbers such that they are all of same size that is if we are talking about three digit numbers then the list will contain only three digit numbers and another condition is that it has three digits so we will take the difference between first and second and we are interested ... | Numbers With Same Consecutive Differences | minimum-falling-path-sum | Given two integers n and k, return _an array of all the integers of length_ `n` _where the difference between every two consecutive digits is_ `k`. You may return the answer in **any order**.
Note that the integers should not have leading zeros. Integers as `02` and `043` are not allowed.
**Example 1:**
**Input:** n... | null | Array,Dynamic Programming,Matrix | Medium | 1224 |
109 | That a Hello Issue Se Samay Channel Debit Solid Liquid * Benefits Share and Solid Liquid * Benefits Share and Solid Liquid * Benefits Share and subscribe the Channel and Unlimited Slides Unlimited is the captain that today he is in more subscribe to subscribe Video Please subscribe and subscribe the Video then subscrib... | 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 |
57 | insert interval it's a median legal question so basically you're giving array of non-overlapping intervals array of non-overlapping intervals array of non-overlapping intervals where interval i equals start to end represents the start and the end of the i interval and the interval is sorted as in ascending order by sta... | Insert Interval | insert-interval | You are given an array of non-overlapping intervals `intervals` where `intervals[i] = [starti, endi]` represent the start and the end of the `ith` interval and `intervals` is sorted in ascending order by `starti`. You are also given an interval `newInterval = [start, end]` that represents the start and end of another i... | null | Array | Medium | 56,715 |
107 | welcome back everyone we're gonna be solving Lee Code 107 a binary tree level order traversal 2. so we're given the root of a binary tree we need to return the bottom up level order traversal of its nodes values so they give us the tree 3 9 20 15 and 7. we need to return the levels 15 and 7. first then 9 and 20 and the... | Binary Tree Level Order Traversal II | binary-tree-level-order-traversal-ii | Given the `root` of a binary tree, return _the bottom-up level order traversal of its nodes' values_. (i.e., from left to right, level by level from leaf to root).
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[15,7\],\[9,20\],\[3\]\]
**Example 2:**
**Input:** root = \[1\]
**Output:** \[... | null | Tree,Breadth-First Search,Binary Tree | Medium | 102,637 |
519 | all right uh doing this problem called random flip Matrix let's have a read given a m cross n binary grid Matrix uh with all the values set to 0 initially okay design an algorithm to randomly pick an index IG where Matrix I J equals to zero and flip it to 1 okay so we have to pick one index which is non-zero and to pic... | Random Flip Matrix | widest-pair-of-indices-with-equal-range-sum | There is an `m x n` binary grid `matrix` with all the values set `0` initially. Design an algorithm to randomly pick an index `(i, j)` where `matrix[i][j] == 0` and flips it to `1`. All the indices `(i, j)` where `matrix[i][j] == 0` should be equally likely to be returned.
Optimize your algorithm to minimize the numbe... | Keep prefix sums of both arrays. Can the difference between the prefix sums at an index help us? What happens if the difference between the two prefix sums at an index a is x, and x again at a different index b? This means that the sum of nums1 from index a + 1 to index b is equal to the sum of nums2 from index a + 1 t... | Array,Hash Table,Prefix Sum | Medium | null |
948 | hey guys welcome back to this video now we're going to solve liquid problem bag of tokens you have an initial power p an initial score of zero and a bag of tokens where tokens i is the value of the ith token your goal is to maximize your total score by potentially playing is token in one of two ways if your current pow... | Bag of Tokens | sort-an-array | You have an initial **power** of `power`, an initial **score** of `0`, and a bag of `tokens` where `tokens[i]` is the value of the `ith` token (0-indexed).
Your goal is to maximize your total **score** by potentially playing each token in one of two ways:
* If your current **power** is at least `tokens[i]`, you may... | null | Array,Divide and Conquer,Sorting,Heap (Priority Queue),Merge Sort,Bucket Sort,Radix Sort,Counting Sort | Medium | null |
342 | Jai Hind this problem this picture where number 13 is a power for and note Sudhir different from power to check all they can modify the to check the power of formal wear look at a few more solution starting with its truly great Vriksh solution and one solution and In service company call to learn is a flat CEO Vikram T... | Power of Four | power-of-four | Given an integer `n`, return _`true` if it is a power of four. Otherwise, return `false`_.
An integer `n` is a power of four, if there exists an integer `x` such that `n == 4x`.
**Example 1:**
**Input:** n = 16
**Output:** true
**Example 2:**
**Input:** n = 5
**Output:** false
**Example 3:**
**Input:** n = 1
**O... | null | Math,Bit Manipulation,Recursion | Easy | 231,326 |
292 | hey everybody welcome back and today I'll be doing another lead code 292 name game you are this is an easy one you are playing the following name game with your friend initially there is a heap of stones on the table you and your friend will alternate taking turns and you will go first uh on the each then the person wh... | Nim Game | nim-game | You are playing the following Nim Game with your friend:
* Initially, there is a heap of stones on the table.
* You and your friend will alternate taking turns, and **you go first**.
* On each turn, the person whose turn it is will remove 1 to 3 stones from the heap.
* The one who removes the last stone is the... | If there are 5 stones in the heap, could you figure out a way to remove the stones such that you will always be the winner? | Math,Brainteaser,Game Theory | Easy | 294 |
278 | first day of mail it coding challenge and we are solving lead code problem number 278 it's called first bad version and this problem is very similar to typical binary search with very little variation here so you are given a list of versions of a product and you are told that the current version is faulty this you are ... | 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,455 | Jhal 208 hai ki Nirmal Singh khele match [ __ ] next hai ki Nirmal Singh khele match [ __ ] next hai ki Nirmal Singh khele match [ __ ] next portion and local bodies like it is canceled that so many security questions now half yes ok half soya Sudesh questions write me too come in filter article will be provided in the... | 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 |
412 | hey guys welcome back to another video and today we're going to be solving the lead code question fizz buzz all right so this question is pretty simple and what we need to do is we write a program that outputs the string representation of numbers from 1 through n so every time there's a multiple of 3 we output fizz eve... | Fizz Buzz | fizz-buzz | Given an integer `n`, return _a string array_ `answer` _(**1-indexed**) where_:
* `answer[i] == "FizzBuzz "` if `i` is divisible by `3` and `5`.
* `answer[i] == "Fizz "` if `i` is divisible by `3`.
* `answer[i] == "Buzz "` if `i` is divisible by `5`.
* `answer[i] == i` (as a string) if none of the above condit... | null | Math,String,Simulation | Easy | 1316 |
1,630 | hi everyone welcome back to a new video today's lead code daily challenges arithmetic sub array this is a medium level question although it has been mentioned as medium but after understanding it will be quite easy for us to solve so basically in this question we have been given an array and we have to find that if the... | Arithmetic Subarrays | count-odd-numbers-in-an-interval-range | A sequence of numbers is called **arithmetic** if it consists of at least two elements, and the difference between every two consecutive elements is the same. More formally, a sequence `s` is arithmetic if and only if `s[i+1] - s[i] == s[1] - s[0]` for all valid `i`.
For example, these are **arithmetic** sequences:
1... | If the range (high - low + 1) is even, the number of even and odd numbers in this range will be the same. If the range (high - low + 1) is odd, the solution will depend on the parity of high and low. | Math | Easy | null |
1,656 | uh well i think it's recording uh let's jump into the um problem sections um i've tried some of the area problems before and i have some to-do's and i have some to-do's and i have some to-do's and let me see how many problems i've shown you guys i used to solve easy questions first so uh okay acceptance rate is 81.9 wh... | Design an Ordered Stream | count-good-triplets | There is a stream of `n` `(idKey, value)` pairs arriving in an **arbitrary** order, where `idKey` is an integer between `1` and `n` and `value` is a string. No two pairs have the same `id`.
Design a stream that returns the values in **increasing order of their IDs** by returning a **chunk** (list) of values after each... | Notice that the constraints are small enough for a brute force solution to pass. Loop through all triplets, and count the ones that are good. | Array,Enumeration | Easy | 2122 |
387 | hello and welcome to another video in this video we're going to be doing first unique character in a string and in the problem you're given a string s and you want to find the first non-re repeating want to find the first non-re repeating want to find the first non-re repeating character in it and returns index if it d... | First Unique Character in a String | first-unique-character-in-a-string | Given a string `s`, _find the first non-repeating character in it and return its index_. If it does not exist, return `-1`.
**Example 1:**
**Input:** s = "leetcode"
**Output:** 0
**Example 2:**
**Input:** s = "loveleetcode"
**Output:** 2
**Example 3:**
**Input:** s = "aabb"
**Output:** -1
**Constraints:**
* `... | null | Hash Table,String,Queue,Counting | Easy | 451 |
496 | welcome to day 19th of october lead code challenge and today's question is next greater element one the question is an easy question on lead code but it has a very important underlying message or concept which is monotonic stack i'll be talking about it as we go through the presentation let's try and understand the que... | Next Greater Element I | next-greater-element-i | The **next greater element** of some element `x` in an array is the **first greater** element that is **to the right** of `x` in the same array.
You are given two **distinct 0-indexed** integer arrays `nums1` and `nums2`, where `nums1` is a subset of `nums2`.
For each `0 <= i < nums1.length`, find the index `j` such ... | null | Array,Hash Table,Stack,Monotonic Stack | Easy | 503,556,739,2227 |
230 | okay hello everybody uh today i'm going to solve lead code problem number 230 kth smallest element in a binary search tree and in the description it says given the root of a binary search tree and an integer k return the k smallest value of all the values of the nod in the tree so let's see what we have here in the exa... | 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 |
170 | YouTube welcome back today we have this problem it's uh two sum it's a data structure design problem actually the data structure design are becoming quite popular reason they actually I and I did like you know fuse uh in the last three months and I found tons of data structure design instead of just the function and an... | Two Sum III - Data structure design | two-sum-iii-data-structure-design | Design a data structure that accepts a stream of integers and checks if it has a pair of integers that sum up to a particular value.
Implement the `TwoSum` class:
* `TwoSum()` Initializes the `TwoSum` object, with an empty array initially.
* `void add(int number)` Adds `number` to the data structure.
* `boolean... | null | Array,Hash Table,Two Pointers,Design,Data Stream | Easy | 1,288,653 |
268 | hey guys welcome to a new video in today's video we're going to look at lead code problem and the problem's name is missing number so in this question we given a integer array called nums consisting of n District numbers in the range 0 through n both inclusives and our task is to return the only number in that range th... | Missing Number | missing-number | Given an array `nums` containing `n` distinct numbers in the range `[0, n]`, return _the only number in the range that is missing from the array._
**Example 1:**
**Input:** nums = \[3,0,1\]
**Output:** 2
**Explanation:** n = 3 since there are 3 numbers, so all numbers are in the range \[0,3\]. 2 is the missing number... | null | Array,Hash Table,Math,Bit Manipulation,Sorting | Easy | 41,136,287,770,2107 |
155 | in this video we're going to take a look at a legal problem called min stack so we want to design a stack that supports push pop top and retrieving the minimum element in constant time so implement the min stack class so basically we have a couple methods here so min stack basically initialize the stack object and push... | Min Stack | min-stack | Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
Implement the `MinStack` class:
* `MinStack()` initializes the stack object.
* `void push(int val)` pushes the element `val` onto the stack.
* `void pop()` removes the element on the top of the stack.
* `int top(... | Consider each node in the stack having a minimum value. (Credits to @aakarshmadhavan) | Stack,Design | Easy | 239,716 |
1,720 | Shri Ram Liquid Problem Hum 720 Decoded During Bihar Government And Thursday Appointed Sexual Subscribe Video To Secure Property And Now In The Property Of Yes This Video Stretch Returns The Amazing Yes Yaar And Five Plus One Acid Hour Holare That Day Su And Use It Pain and agree to terms with five plus one cold here a... | Decode XORed Array | crawler-log-folder | There is a **hidden** integer array `arr` that consists of `n` non-negative integers.
It was encoded into another integer array `encoded` of length `n - 1`, such that `encoded[i] = arr[i] XOR arr[i + 1]`. For example, if `arr = [1,0,2,1]`, then `encoded = [1,2,3]`.
You are given the `encoded` array. You are also give... | Simulate the process but don’t move the pointer beyond the main folder. Simulate the process but don’t move the pointer beyond the main folder. | Array,String,Stack | Easy | 682,874 |
337 | house rubber 3 is again a slight modification from house driver 1. where we remember in house driver 1 we have houses on a straight street and we use a integer number to represent how much money is in each house and the goal is to rob as much as money without robbing houses that are next to each other however in house ... | House Robber III | house-robber-iii | The thief has found himself a new place for his thievery again. There is only one entrance to this area, called `root`.
Besides the `root`, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will automatically contact the police if ... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Medium | 198,213 |
724 | all right let's talk about fine privilege in this so given array of integer numbers calculate the previous index of this array the favorite index is the index for the sum of all the numbers strictly to the left of the index is equal to the sum of all numbers repeated to index right so uh for example uh a b c b e f g ri... | Find Pivot Index | find-pivot-index | Given an array of integers `nums`, calculate the **pivot index** of this array.
The **pivot index** is the index where the sum of all the numbers **strictly** to the left of the index is equal to the sum of all the numbers **strictly** to the index's right.
If the index is on the left edge of the array, then the left... | We can precompute prefix sums P[i] = nums[0] + nums[1] + ... + nums[i-1].
Then for each index, the left sum is P[i], and the right sum is P[P.length - 1] - P[i] - nums[i]. | Array,Prefix Sum | Easy | 560,2102,2369 |
1,962 | hello guys welcome to code enzyme and in this video we are going to discuss the problem 1960 of lead code uh remove stones to minimize the total in this playlist I make daily videos on lead code problems so if you like my content you can subscribe right now okay so the problem statement goes like you are given a zero i... | 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 |
257 | to return the path from root to leaf okay so the path from left subtree is one two and five and in right subtree one and three so suppose that there was here one more node in the four then the path would be one three and four okay right let and how you will tackle this problem let me take into the demo board so you get... | Binary Tree Paths | binary-tree-paths | Given the `root` of a binary tree, return _all root-to-leaf paths in **any order**_.
A **leaf** is a node with no children.
**Example 1:**
**Input:** root = \[1,2,3,null,5\]
**Output:** \[ "1->2->5 ", "1->3 "\]
**Example 2:**
**Input:** root = \[1\]
**Output:** \[ "1 "\]
**Constraints:**
* The number of nodes ... | null | String,Backtracking,Tree,Depth-First Search,Binary Tree | Easy | 113,1030,2217 |
331 | today i'm gonna be working only at code question number 331 um verify pre-order serialization of a um verify pre-order serialization of a um verify pre-order serialization of a binary tree so one way to serialize a binary is to use pre-order traversal binary is to use pre-order traversal binary is to use pre-order trav... | Verify Preorder Serialization of a Binary Tree | verify-preorder-serialization-of-a-binary-tree | One way to serialize a binary tree is to use **preorder traversal**. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as `'#'`.
For example, the above binary tree can be serialized to the string `"9,3,4,#,#,1,#,#,2,#,6,#,# "`, where `'#'` repres... | null | String,Stack,Tree,Binary Tree | Medium | null |
1,354 | hey what's up guys uh this is sean here so today at today's daily challenge problem right number 1354 construct target array with multiple sums um so this one is a very tricky problem yeah to be honest okay so you're giving like array of integers target okay and from a starting array uh so which is consisting of all on... | Construct Target Array With Multiple Sums | find-players-with-zero-or-one-losses | You are given an array `target` of n integers. From a starting array `arr` consisting of `n` 1's, you may perform the following procedure :
* let `x` be the sum of all elements currently in your array.
* choose index `i`, such that `0 <= i < n` and set the value of `arr` at index `i` to `x`.
* You may repeat thi... | Count the number of times a player loses while iterating through the matches. | Array,Hash Table,Sorting,Counting | Medium | 236 |
698 | everyone welcome back and let's write some more neat code today so today let's solve the problem partition to k equal subset sum so this is definitely a challenging problem especially for a medium but it is a very good problem to understand you can definitely learn a lot we're given an integer array of nums and we're g... | Partition to K Equal Sum Subsets | partition-to-k-equal-sum-subsets | Given an integer array `nums` and an integer `k`, return `true` if it is possible to divide this array into `k` non-empty subsets whose sums are all equal.
**Example 1:**
**Input:** nums = \[4,3,2,3,5,2,1\], k = 4
**Output:** true
**Explanation:** It is possible to divide it into 4 subsets (5), (1, 4), (2,3), (2,3) w... | We can figure out what target each subset must sum to. Then, let's recursively search, where at each call to our function, we choose which of k subsets the next value will join. | Array,Dynamic Programming,Backtracking,Bit Manipulation,Memoization,Bitmask | Medium | 416,2135 |
240 | foreign challenge the problem that we have in today is search a 2d Matrix 2. here in this question we are given a matrix a size M cross n wherein the elements are sorted along the rows and across the columns what we need to do we need to tell whether a particular Target element exists in this Matrix or not if it does t... | Search a 2D Matrix II | search-a-2d-matrix-ii | Write an efficient algorithm that searches for a value `target` in an `m x n` integer matrix `matrix`. This matrix has the following properties:
* Integers in each row are sorted in ascending from left to right.
* Integers in each column are sorted in ascending from top to bottom.
**Example 1:**
**Input:** matri... | null | Array,Binary Search,Divide and Conquer,Matrix | Medium | 74 |
877 | uh hey juno okay hey everybody this is larry this is the may 5th of the league code may 5th this is the fifth day of august the code daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's prom so yeah so that i had to edit it but hopefully you enjoy seei... | Stone Game | shortest-path-visiting-all-nodes | Alice and Bob play a game with piles of stones. There are an **even** number of piles arranged in a row, and each pile has a **positive** integer number of stones `piles[i]`.
The objective of the game is to end with the most stones. The **total** number of stones across all the piles is **odd**, so there are no ties.
... | null | Dynamic Programming,Bit Manipulation,Breadth-First Search,Graph,Bitmask | Hard | null |
459 | Hello hello everybody welcome to my channel it's all no problem repeated after giving one teaspoon check if i can be constructed by taking a sub spring of wheat and pending multiple copies of serving to the u majumdar giving consists of lower case english letters only and friends Will Not Exceed Shyam Whose Example In ... | Repeated Substring Pattern | repeated-substring-pattern | Given a string `s`, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.
**Example 1:**
**Input:** s = "abab "
**Output:** true
**Explanation:** It is the substring "ab " twice.
**Example 2:**
**Input:** s = "aba "
**Output:** false
**Example 3:**
... | null | String,String Matching | Easy | 28,686 |
64 | in this video we'll be going over the bottom up matrix approach of minimum path sum so let's go over the thought process so let's convert the top down memorization approach to a bottom model approach now where do we start in the memorization approach we have cached the current row and column with the minimum path sum v... | Minimum Path Sum | minimum-path-sum | Given a `m x n` `grid` filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path.
**Note:** You can only move either down or right at any point in time.
**Example 1:**
**Input:** grid = \[\[1,3,1\],\[1,5,1\],\[4,2,1\]\]
**Output:** 7
**Explanat... | null | Array,Dynamic Programming,Matrix | Medium | 62,174,741,2067,2192 |
261 | hey everybody this is Larry this is me going to do an extra premium prom one that I haven't done before uh let's just keep it medium for now maybe I'll get an SQL question maybe not hopefully not all right today's live is actually premium is 261 graph Valley tree so you give it a graph of endnotes um and then you have ... | Graph Valid Tree | graph-valid-tree | You have a graph of `n` nodes labeled from `0` to `n - 1`. You are given an integer n and a list of `edges` where `edges[i] = [ai, bi]` indicates that there is an undirected edge between nodes `ai` and `bi` in the graph.
Return `true` _if the edges of the given graph make up a valid tree, and_ `false` _otherwise_.
**... | Given n = 5 and edges = [[0, 1], [1, 2], [3, 4]], what should your return? Is this case a valid tree? According to the definition of tree on Wikipedia: “a tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles is a tree.” | Depth-First Search,Breadth-First Search,Union Find,Graph | Medium | 207,323,871 |
1,461 | Hello friends welcome to the new video question number 1461 check if string content all one week mode of size will our spring always be of a record of size very interesting question this is a medium level question the category may be springs and we beat You can also say Manipulation, let's start the question, given in ... | Check If a String Contains All Binary Codes of Size K | count-all-valid-pickup-and-delivery-options | Given a binary string `s` and an integer `k`, return `true` _if every binary code of length_ `k` _is a substring of_ `s`. Otherwise, return `false`.
**Example 1:**
**Input:** s = "00110110 ", k = 2
**Output:** true
**Explanation:** The binary codes of length 2 are "00 ", "01 ", "10 " and "11 ". They can be all f... | Use the permutation and combination theory to add one (P, D) pair each time until n pairs. | Math,Dynamic Programming,Combinatorics | Hard | null |
18 | Hello everyone welcome back to Shahnawaz Malik going to write July 4th inch the problem is 400 so this is too much problem the interviewer goes then the problem is that we will have an area in the input and we have a target value on us and union quarter. Four elements are needed to extract it. Okay, double Singh on thi... | 4Sum | 4sum | Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that:
* `0 <= a, b, c, d < n`
* `a`, `b`, `c`, and `d` are **distinct**.
* `nums[a] + nums[b] + nums[c] + nums[d] == target`
You may return the answer in **any order**.
**Examp... | null | Array,Two Pointers,Sorting | Medium | 1,15,454,2122 |
95 | Hello hello viewers welcome to my video famous and problem school boys subscribe sorry man manager this channel subscribe 125 gram saunf 125 volume subscribe and love you to quality sub bane Dish well broken left style witch fun unemployed right chal utar always dresses for all the best games for kids us this side - sh... | 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 |
520 | Hello everyone and welcome back again recording, this time our today's question is detect capital, so what we have to do is we will find a string in it and we have to detect that it is capital. If we understand these three conditions, then first of all we have to find out if all the letters are there. We will get the w... | 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,047 | Hello friends, welcome to the new video, question number 1047, remove all duplicates in all exams in spring, this is an easy level question, this is a tech question, this is a classic example of how to use the steps, part to be adjusted in part 2 of this question, we do There was a little question before but it is very... | Remove All Adjacent Duplicates In String | maximize-sum-of-array-after-k-negations | You are given a string `s` consisting of lowercase English letters. A **duplicate removal** consists of choosing two **adjacent** and **equal** letters and removing them.
We repeatedly make **duplicate removals** on `s` until we no longer can.
Return _the final string after all such duplicate removals have been made_... | null | Array,Greedy,Sorting | Easy | 2204 |
413 | um hello friends today less of their arithmetic slices problem this problem is further comparison with their there is much thicker slices to problem so let's first solve this one lesson statement a sequence of numbers called arithmetic if it consists of at least three elements and if the distance between any two could ... | 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 |
489 | in this video we're going to take a look at a lego problem called robot room cleaner so you're given so you're controlling a robot that is located somewhere in the room is modeled as an m times n binary grid where uh zero represents a wall and then one represents an empty slot so a robot starts a unknown location in th... | Robot Room Cleaner | kth-smallest-instructions | You are controlling a robot that is located somewhere in a room. The room is modeled as an `m x n` binary grid where `0` represents a wall and `1` represents an empty slot.
The robot starts at an unknown location in the room that is guaranteed to be empty, and you do not have access to the grid, but you can move the r... | There are nCr(row + column, row) possible instructions to reach (row, column). Try building the instructions one step at a time. How many instructions start with "H", and how does this compare with k? | Array,Math,Dynamic Programming,Combinatorics | Hard | null |
1,970 | hi friends welcome back uh today we are going to solve lead code problem 1970 last day where you can still cross recently i come across this very interesting problem on lead code this is one of the hard problems and as you can see this is a very likable problem from like and dislike ratio and uh this also test one of t... | Last Day Where You Can Still Cross | sorting-the-sentence | There is a **1-based** binary matrix where `0` represents land and `1` represents water. You are given integers `row` and `col` representing the number of rows and columns in the matrix, respectively.
Initially on day `0`, the **entire** matrix is **land**. However, each day a new cell becomes flooded with **water**. ... | Divide the string into the words as an array of strings Sort the words by removing the last character from each word and sorting according to it | String,Sorting | Easy | 2168 |
914 | hey what's up guys chung here again and so this time i want to talk about another a different lead called problem here so which is number 914 x of a card in a deck of cards it's an easy problem but i think for me it's more like a medium problem because there's something that i didn't know before doing before solving th... | X of a Kind in a Deck of Cards | random-point-in-non-overlapping-rectangles | You are given an integer array `deck` where `deck[i]` represents the number written on the `ith` card.
Partition the cards into **one or more groups** such that:
* Each group has **exactly** `x` cards where `x > 1`, and
* All the cards in one group have the same integer written on them.
Return `true` _if such pa... | null | Math,Binary Search,Reservoir Sampling,Prefix Sum,Ordered Set,Randomized | Medium | 912,915 |
120 | hello everyone welcome to my channel let's solve the problem triangle given a triangle array return the minimum path sum from top to bottom for each step you may move to an adjacent number of the row more formally if you are on index i on the current row you may move to either index i or index i plus 1 on the next row ... | Triangle | triangle | Given a `triangle` array, return _the minimum path sum from top to bottom_.
For each step, you may move to an adjacent number of the row below. More formally, if you are on index `i` on the current row, you may move to either index `i` or index `i + 1` on the next row.
**Example 1:**
**Input:** triangle = \[\[2\],\[... | null | Array,Dynamic Programming | Medium | null |
93 | Hello, today's pull-up problem Hello, today's pull-up problem is the problem of Litcode 93, Restore Lipier Address. If you interpret this problem a little, it means composing a valid IP. One string is given, and the string is divided into 4 spaces. For this to be a valid IP, one space is required. This now depends on t... | Restore IP Addresses | restore-ip-addresses | A **valid IP address** consists of exactly four integers separated by single dots. Each integer is between `0` and `255` (**inclusive**) and cannot have leading zeros.
* For example, `"0.1.2.201 "` and `"192.168.1.1 "` are **valid** IP addresses, but `"0.011.255.245 "`, `"192.168.1.312 "` and `"192.168@1.1 "` are **... | null | String,Backtracking | Medium | 752 |
956 | Hello gas welcome you me YouTube channel so today we are going to solve problem 956 toilet and what is this question what is the billboard and want you one you have the largest height d billboard bill have you steel support mast be of equal height You are life and collection of road date can they bill date together, so... | Tallest Billboard | number-of-music-playlists | You are installing a billboard and want it to have the largest height. The billboard will have two steel supports, one on each side. Each steel support must be an equal height.
You are given a collection of `rods` that can be welded together. For example, if you have rods of lengths `1`, `2`, and `3`, you can weld the... | null | Math,Dynamic Programming,Combinatorics | Hard | null |
4 | Hello Gas I am Lalit Aggarwal Welcome, this question is literally a very easy question, there is nothing to take much tension here, literally this question can be answered very easily, what simple logic you have to apply here, that is a small brick. It is possible that you have one, can you reduce the vein which is one... | Median of Two Sorted Arrays | median-of-two-sorted-arrays | Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays.
The overall run time complexity should be `O(log (m+n))`.
**Example 1:**
**Input:** nums1 = \[1,3\], nums2 = \[2\]
**Output:** 2.00000
**Explanation:** merged array = \[1,2,3\] and median is ... | null | Array,Binary Search,Divide and Conquer | Hard | null |
1,926 | hey everybody this is Larry this is day 21st of November hit the like button hit the Subscribe button join me on Discord let me know what you think about well yes claim secret reward 10 coins so yeah if you're wondering why I always go to this page that for that reason so I would actually also take a quick pause um the... | Nearest Exit from Entrance in Maze | products-price-for-each-store | You are given an `m x n` matrix `maze` (**0-indexed**) with empty cells (represented as `'.'`) and walls (represented as `'+'`). You are also given the `entrance` of the maze, where `entrance = [entrancerow, entrancecol]` denotes the row and column of the cell you are initially standing at.
In one step, you can move o... | null | Database | Easy | 1948 |
864 | Hello friends welcome to code Sutra in this video we'll be solving lead code 864 shortest path to get all keys this problem is not actually a tricky problem but this problem is something that requires step-by-step approach and that requires step-by-step approach and that requires step-by-step approach and there are mul... | Shortest Path to Get All Keys | image-overlap | You are given an `m x n` grid `grid` where:
* `'.'` is an empty cell.
* `'#'` is a wall.
* `'@'` is the starting point.
* Lowercase letters represent keys.
* Uppercase letters represent locks.
You start at the starting point and one move consists of walking one space in one of the four cardinal directions. ... | null | Array,Matrix | Medium | null |
318 | okay hi guys welcome to our channel code with sunny and today i am going to discuss one of the interesting problems of the lead code and the problem name is maximum product of word's length an index number is 318 and problem is categorized as the medium type note that i've already give it a like over here the design is... | Maximum Product of Word Lengths | maximum-product-of-word-lengths | Given a string array `words`, return _the maximum value of_ `length(word[i]) * length(word[j])` _where the two words do not share common letters_. If no such two words exist, return `0`.
**Example 1:**
**Input:** words = \[ "abcw ", "baz ", "foo ", "bar ", "xtfn ", "abcdef "\]
**Output:** 16
**Explanation:** The two ... | null | Array,String,Bit Manipulation | Medium | null |
316 | Hello to Ajay Hello everyone Diwakar Decide for uploading So today we are going to remove duplicate latest this question, see what to do on this question, you will get a string, on this there will be English small letters to work S English letters, okay I too that ABCD can be something like this, it is possible, it is ... | Remove Duplicate Letters | remove-duplicate-letters | Given a string `s`, remove duplicate letters so that every letter appears once and only once. You must make sure your result is **the smallest in lexicographical order** among all possible results.
**Example 1:**
**Input:** s = "bcabc "
**Output:** "abc "
**Example 2:**
**Input:** s = "cbacdcbc "
**Output:** "a... | Greedily try to add one missing character. How to check if adding some character will not cause problems ? Use bit-masks to check whether you will be able to complete the sub-sequence if you add the character at some index i. | String,Stack,Greedy,Monotonic Stack | Medium | 2157 |
841 | welcome to march's leeco challenge today's problem is keys and rooms there are n rooms and you start in room zero each room has a distinct number in zero one two to n minus one and each room may have some keys to access the next room formally each room i has a list of keys room's eye and each key is an integer blah whe... | Keys and Rooms | shortest-distance-to-a-character | There are `n` rooms labeled from `0` to `n - 1` and all the rooms are locked except for room `0`. Your goal is to visit all the rooms. However, you cannot enter a locked room without having its key.
When you visit a room, you may find a set of **distinct keys** in it. Each key has a number on it, denoting which room i... | null | Array,Two Pointers,String | Easy | null |
209 | okay so this is Chung here again so I'm doing the lead called problems well since I'm also learning there are those algorithms from bit code so and today so we'll be doing this problem 2:09 the minimum size sub array some 2:09 the minimum size sub array some 2:09 the minimum size sub array some okay so let's take a loo... | Minimum Size Subarray Sum | minimum-size-subarray-sum | Given an array of positive integers `nums` and a positive integer `target`, return _the **minimal length** of a_ _subarray_ _whose sum is greater than or equal to_ `target`. If there is no such subarray, return `0` instead.
**Example 1:**
**Input:** target = 7, nums = \[2,3,1,2,4,3\]
**Output:** 2
**Explanation:** Th... | null | Array,Binary Search,Sliding Window,Prefix Sum | Medium | 76,325,718,1776,2211,2329 |
441 | Jai Hind Is Taylor Am Going To Discuss A Program In Question Orange In Points To Problem Statement Has Given A Total Of And Coins Which Have To Arrange Next Year's Shape Wear Every K Through Must Have Exactly Coins Sweet Means First Law Must Have One Coin Control must have two coins through must have three boys on swit... | Arranging Coins | arranging-coins | You have `n` coins and you want to build a staircase with these coins. The staircase consists of `k` rows where the `ith` row has exactly `i` coins. The last row of the staircase **may be** incomplete.
Given the integer `n`, return _the number of **complete rows** of the staircase you will build_.
**Example 1:**
**I... | null | Math,Binary Search | Easy | null |
137 | Hello everyone welcome back to my channel once again so here we are going to talk about today's daily problem and today's question is single number 137, good question if you want to understand your optimization because in this question you Whatever is being asked, you can do it very easily, within the required complexi... | 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 |
412 | hi this is topher with the lonely dash and in this leap code video we're going to go over how to solve the classic question fizzbuzz given an integer n return a string array called answer that is singly indexed and where the index if the index is divisible by both three and five we're going to put the string fizzbuzz i... | Fizz Buzz | fizz-buzz | Given an integer `n`, return _a string array_ `answer` _(**1-indexed**) where_:
* `answer[i] == "FizzBuzz "` if `i` is divisible by `3` and `5`.
* `answer[i] == "Fizz "` if `i` is divisible by `3`.
* `answer[i] == "Buzz "` if `i` is divisible by `5`.
* `answer[i] == i` (as a string) if none of the above condit... | null | Math,String,Simulation | Easy | 1316 |
1,700 | welcome back to my channel and greetings of the day we have an interesting problem to solve ahead today we are going to solve it called Problem 1700 using Java the challenge is to solve and figure out number of students who are unable to eat lunch but area offers two types of sun pictures circular and square they are r... | 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 |
119 | hey guys I think that we should start working on these let's codes problems these systematically which means we should do some of your questions together and find the patterns that we can earn from it so today I'm looking at the recursion this is one of the problems in the explore tab of this code if you tap it click t... | 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 |
827 | Hua Hai Hello Everyone Welcome Difficult Whether Poison Meeting Cure Ireland English President And Withdrawal Subscribe To And Vid Oo Ka Powder All Possibilities 100 Witnesses To Select Query For President subscribe The Channel Liquid Subscribe subscribe to subscribe Video 1234 Paanch Cigarette Answer Subscribe 12345 U... | Making A Large Island | expressive-words | You are given an `n x n` binary matrix `grid`. You are allowed to change **at most one** `0` to be `1`.
Return _the size of the largest **island** in_ `grid` _after applying this operation_.
An **island** is a 4-directionally connected group of `1`s.
**Example 1:**
**Input:** grid = \[\[1,0\],\[0,1\]\]
**Output:** ... | null | Array,Two Pointers,String | Medium | null |
1,961 | that's all the code 1961 check if string is a prefix of an arrrow the question is that you'll be given a string something like I love de code and it will be given an ARR of words we need to check if the string can be broken down into the first in words in the array so I love lead code there is I love lead code at the s... | 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,531 | Hello everyone welcome to my channel code sorry with mike so today we are going to do video number 77 of our diy programming playlist ok number 115 is hard marked but will make it easy just a few things you have to understand in this you will be able to To write your code on your own. Okay, so let's see what the questi... | String Compression II | number-of-ways-to-wear-different-hats-to-each-other | [Run-length encoding](http://en.wikipedia.org/wiki/Run-length_encoding) is a string compression method that works by replacing consecutive identical characters (repeated 2 or more times) with the concatenation of the character and the number marking the count of the characters (length of the run). For example, to compr... | Dynamic programming + bitmask. dp(peopleMask, idHat) number of ways to wear different hats given a bitmask (people visited) and used hats from 1 to idHat-1. | Array,Dynamic Programming,Bit Manipulation,Bitmask | Hard | 2105 |
111 | hello today we'll be working on leak code 111 minimum depth of binary tree so the minimum depth is the shortest path from the root node to a leaf node is a node with no children or in other words both the left and right are null so let's start by working through the different types of inputs we could get all right so t... | Minimum Depth of Binary Tree | minimum-depth-of-binary-tree | Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
**Note:** A leaf is a node with no children.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 2
**Example 2:**
**Input:** root = \[2... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 102,104 |
969 | hello how's it going so today we are going to do the code 969 pancake sorting so um give an array of integer sorter rate by performing a series of pancake flips um in one pancake flip we do the following steps choose an integer uh and reverse the subarray so for example three two one four and can perform pancake flippi... | Pancake Sorting | number-of-recent-calls | Given an array of integers `arr`, sort the array by performing a series of **pancake flips**.
In one pancake flip we do the following steps:
* Choose an integer `k` where `1 <= k <= arr.length`.
* Reverse the sub-array `arr[0...k-1]` (**0-indexed**).
For example, if `arr = [3,2,1,4]` and we performed a pancake f... | null | Design,Queue,Data Stream | Easy | null |
133 | hello everyone welcome to my channel let's write up the solution for clone graph so the first thing we are going to do is to create a hash map so the reason we do that is to be able to access it the clone nodes using the original node so in java we can do something like this and the type will be both nodes a node and w... | Clone Graph | clone-graph | Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph.
Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph.
Each node in the graph contains a value (`int`) and a list (`List[Node]`)... | null | Hash Table,Depth-First Search,Breadth-First Search,Graph | Medium | 138,1624,1634 |
87 | Hello Google, let me tell you the steps, see the steps, like the first string is great, okay, so we have to cut it at any random index, cut means split, two participants, first part Hindi, second part right, what to do after that, now separate on this part. And from this part, let me tell you first of all, here I have ... | Scramble String | scramble-string | We can scramble a string s to get a string t using the following algorithm:
1. If the length of the string is 1, stop.
2. If the length of the string is > 1, do the following:
* Split the string into two non-empty substrings at a random index, i.e., if the string is `s`, divide it to `x` and `y` where `s = x +... | null | String,Dynamic Programming | Hard | null |
146 | political problem 146 lru paths yeah so let me first explain this problem and then I'm going to explain in whiteboard about what kind of a digital structure I'm going to use and then I will write the code in the code editor yeah so first this is a lru Class lru cast means at least recently used yeah this means inside t... | 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 |
1,601 | hi everyone in today's challenge we are going to solve this problem the problem name is maximum number of achievable transfer requests and the problem number is 1601 only case as usual first of all we are going to clearly understand this problem statement after that we are going to move to the logic part we are going t... | Maximum Number of Achievable Transfer Requests | maximum-number-of-achievable-transfer-requests | We have `n` buildings numbered from `0` to `n - 1`. Each building has a number of employees. It's transfer season, and some employees want to change the building they reside in.
You are given an array `requests` where `requests[i] = [fromi, toi]` represents an employee's request to transfer from building `fromi` to bu... | null | null | Hard | null |
1,822 | um hello so continuing today on uh lead code daily challenge today's problem is sign of the product of an array um so here what we have is basically we have this sine function and we want to return one if um if we get X as a parameter we want to return one if x is positive minus one if it's negative and um zero if it's... | 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 |
36 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem valid sudoku and i'm going to be recording this on the 4th of july so hopefully there aren't too many firework noises in the background so we are given a 9x9 sudoku board and all we want to do is determine if the board ... | 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 |
217 | when you begin programming almost every new problem that we solve will teach you either a new concept a new data structure or a new algorithmic paradigm one such problem is available on lead code contain duplicates that comes under the easy category and it is a very good starter problem to help you understand about the... | Contains Duplicate | contains-duplicate | Given an integer array `nums`, return `true` if any value appears **at least twice** in the array, and return `false` if every element is distinct.
**Example 1:**
**Input:** nums = \[1,2,3,1\]
**Output:** true
**Example 2:**
**Input:** nums = \[1,2,3,4\]
**Output:** false
**Example 3:**
**Input:** nums = \[1,1,1,... | null | Array,Hash Table,Sorting | Easy | 219,220 |
25 | hello everyone let's practice a very typical um record problems it's called reverse notes in k group it's a very relative typical linked list problem and it and given us a link list it asks to reverse the notes like for every notes in k in a group set of the k notes went to reversal let's take a look at the example in ... | Reverse Nodes in k-Group | reverse-nodes-in-k-group | Given the `head` of a linked list, reverse the nodes of the list `k` at a time, and return _the modified list_.
`k` is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of `k` then left-out nodes, in the end, should remain as it is.
You may not alt... | null | Linked List,Recursion | Hard | 24,528,2196 |
4 | hello everyone welcome back uh here is Vamps and with another live coding session and today we are going to tackle the problem of finding the median of two sources array and guess what we are going to implement it in Python but don't worry I will provide also implementation in other languages so first thing first what'... | Median of Two Sorted Arrays | median-of-two-sorted-arrays | Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays.
The overall run time complexity should be `O(log (m+n))`.
**Example 1:**
**Input:** nums1 = \[1,3\], nums2 = \[2\]
**Output:** 2.00000
**Explanation:** merged array = \[1,2,3\] and median is ... | null | Array,Binary Search,Divide and Conquer | Hard | null |
713 | Hua Tha Aayi Welcome To Learn Ko Repeat Join Vriddhi Looking End Date 28th September Light Ko Challenge The Name Of The Problem Is Sir Yeh Product Lagan Ke Net Slow End Rate Problems Is Yagya And Nurses Contact Number Of Candidates For All Elements According To 1500000 Subscribe to the palace name cigarette 20 rights o... | Subarray Product Less Than K | subarray-product-less-than-k | Given an array of integers `nums` and an integer `k`, return _the number of contiguous subarrays where the product of all the elements in the subarray is strictly less than_ `k`.
**Example 1:**
**Input:** nums = \[10,5,2,6\], k = 100
**Output:** 8
**Explanation:** The 8 subarrays that have product less than 100 are:
... | For each j, let opt(j) be the smallest i so that nums[i] * nums[i+1] * ... * nums[j] is less than k. opt is an increasing function. | Array,Sliding Window | Medium | 152,325,560,1083,2233 |
1,283 | Hello Guys Ball Directly Singh Subscribe Result Subscribe Pimples Ko Subscribe Button Ko Aar Takht In Every Possible Number Now School Subscribe Pimpal Ve subscribe The Video then subscribe to subscribe Video Ko Loot Lo Question Option Android subscribe And subscribe The Amazing Subscribe To that full hd awadhesh loot ... | Find the Smallest Divisor Given a Threshold | reformat-date | Given an array of integers `nums` and an integer `threshold`, we will choose a positive integer `divisor`, divide all the array by it, and sum the division's result. Find the **smallest** `divisor` such that the result mentioned above is less than or equal to `threshold`.
Each result of the division is rounded to the ... | Handle the conversions of day, month and year separately. Notice that days always have a two-word ending, so if you erase the last two characters of this days you'll get the number. | String | Easy | null |
5 | hello everyone welcome to code and learn in this video we will continue to look at lead code problem five finding the longest padic sub string in a given string I won't go over the problem statement again as we went over it in detail in the last video in this solution we are going to use moner's algorithm to find the l... | Longest Palindromic Substring | longest-palindromic-substring | Given a string `s`, return _the longest_ _palindromic_ _substring_ in `s`.
**Example 1:**
**Input:** s = "babad "
**Output:** "bab "
**Explanation:** "aba " is also a valid answer.
**Example 2:**
**Input:** s = "cbbd "
**Output:** "bb "
**Constraints:**
* `1 <= s.length <= 1000`
* `s` consist of only dig... | How can we reuse a previously computed palindrome to compute a larger palindrome? If “aba” is a palindrome, is “xabax” a palindrome? Similarly is “xabay” a palindrome? Complexity based hint:
If we use brute-force and check whether for every start and end position a substring is a palindrome we have O(n^2) start - end ... | String,Dynamic Programming | Medium | 214,266,336,516,647 |
1,493 | Hi ga namaskar welcome to the channel hum kar 90 days ac prep question number 17 au lead code 75 lead code 493 ok to dekho llenge sub off one after deleting one element a de rakha na aur zero hi hai deleting one element is allowed I have to tell that after deleting one element has to be deleted, it has to be done, it i... | 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 |
739 | hello welcome back today I will solve leeco 739 Dairy temperatures we're given an integer array containing Dairy temperatures for each item in the array we have to determine how many days we had to wait until we have a higher temperature than the current one if we are not able to find such a temperature then we just as... | Daily Temperatures | daily-temperatures | Given an array of integers `temperatures` represents the daily temperatures, return _an array_ `answer` _such that_ `answer[i]` _is the number of days you have to wait after the_ `ith` _day to get a warmer temperature_. If there is no future day for which this is possible, keep `answer[i] == 0` instead.
**Example 1:**... | If the temperature is say, 70 today, then in the future a warmer temperature must be either 71, 72, 73, ..., 99, or 100. We could remember when all of them occur next. | Array,Stack,Monotonic Stack | Medium | 496,937 |
250 | hey everybody this is Larry this is me in a really uh poor posture in the bed here in Lisbon uh but I'm gonna try to do the count uh or this week's uh legal premium weekly problem which is too fitty uh count you know value sub trees what does that mean give me the route of binary tree return the number of universe subt... | Count Univalue Subtrees | count-univalue-subtrees | Given the `root` of a binary tree, return _the number of **uni-value**_ _subtrees_.
A **uni-value subtree** means all nodes of the subtree have the same value.
**Example 1:**
**Input:** root = \[5,1,5,5,5,null,5\]
**Output:** 4
**Example 2:**
**Input:** root = \[\]
**Output:** 0
**Example 3:**
**Input:** root = ... | null | Tree,Depth-First Search,Binary Tree | Medium | 572,687 |
90 | what's up everyone today we're gonna go over elite code number ninety subsets with no duplicates first I'm gonna write out the code and then I'm gonna draw the recursive stack tree diagram so you can see how the subsets are each actually getting populated and which recursive stack is making each one of these subsets th... | 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 |
15 | welcome to Lee codes blind created 75 where I'll be solving the 75 essentially code questions this problem is called threesome and it's mmm very frustrating here's the thing with threesome what I always remembered was you could solve it by using a nested for loop and inside of the nested for simply use a twosome soluti... | 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 |
787 | today's lead Cod DCC question is cheapest flights within K stops let's read the question there are n cities connected by some number of flights you are given an array flights where flights I says from to price indicating that there is a flight from City from to City two and the cost of the flight is price I you are als... | Cheapest Flights Within K Stops | sliding-puzzle | There are `n` cities connected by some number of flights. You are given an array `flights` where `flights[i] = [fromi, toi, pricei]` indicates that there is a flight from city `fromi` to city `toi` with cost `pricei`.
You are also given three integers `src`, `dst`, and `k`, return _**the cheapest price** from_ `src` _... | Perform a breadth-first-search, where the nodes are the puzzle boards and edges are if two puzzle boards can be transformed into one another with one move. | Array,Breadth-First Search,Matrix | Hard | null |
828 | hello and welcome back to the cracking paying YouTube channel today we're going to be solving lead code problem 828 count unique characters of all substrings of a given string let's define a function count unique characters s which Returns the number of unique characters in s for example counting calling count unique c... | Count Unique Characters of All Substrings of a Given String | chalkboard-xor-game | Let's define a function `countUniqueChars(s)` that returns the number of unique characters on `s`.
* For example, calling `countUniqueChars(s)` if `s = "LEETCODE "` then `"L "`, `"T "`, `"C "`, `"O "`, `"D "` are the unique characters since they appear only once in `s`, therefore `countUniqueChars(s) = 5`.
Given a ... | null | Array,Math,Bit Manipulation,Brainteaser,Game Theory | Hard | null |
104 | hi guys welcome to algorithms made easy today we will go through the question maximum depth of a binary tree so given a root of a binary tree we need to return its maximum depth what is the maximum depth of a binary tree is the number of nodes along the longest path from root down to the farthest leaf node okay so if i... | Maximum Depth of Binary Tree | maximum-depth-of-binary-tree | Given the `root` of a binary tree, return _its maximum depth_.
A binary tree's **maximum depth** is the number of nodes along the longest path from the root node down to the farthest leaf node.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 3
**Example 2:**
**Input:** root = \[1,null,2\]
**... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 110,111,774,1492 |
331 | okay so here we are back again another question let's just make sure things are working i think they are hello so if we look at another medium leak code question there we go take just a moment i yeah we'll keep going here we'll keep going so this question is verify pre-order serialization is verify pre-order serializat... | Verify Preorder Serialization of a Binary Tree | verify-preorder-serialization-of-a-binary-tree | One way to serialize a binary tree is to use **preorder traversal**. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as `'#'`.
For example, the above binary tree can be serialized to the string `"9,3,4,#,#,1,#,#,2,#,6,#,# "`, where `'#'` repres... | null | String,Stack,Tree,Binary Tree | Medium | null |
679 | hey what's up guys chung here again so today i want to talk about this lead called problem number 679 24 game it's a hard problem yeah i think it is a hard problem so basically you're giving only four cards and each cards contain a number from one to nine okay and you need to judge whether they could operate it basical... | 24 Game | 24-game | You are given an integer array `cards` of length `4`. You have four cards, each containing a number in the range `[1, 9]`. You should arrange the numbers on these cards in a mathematical expression using the operators `['+', '-', '*', '/']` and the parentheses `'('` and `')'` to get the value 24.
You are restricted wi... | null | Array,Math,Backtracking | Hard | null |
209 | Ajay to Pimpri channel highest and we do yaar medium size ok with me any question you are improve a curtain if understood then according to me you will not speak I consider safe nothing to do final minimum balance and one more and all his Let's subscribe all of them and do it in a good way by subscribing to us that wha... | Minimum Size Subarray Sum | minimum-size-subarray-sum | Given an array of positive integers `nums` and a positive integer `target`, return _the **minimal length** of a_ _subarray_ _whose sum is greater than or equal to_ `target`. If there is no such subarray, return `0` instead.
**Example 1:**
**Input:** target = 7, nums = \[2,3,1,2,4,3\]
**Output:** 2
**Explanation:** Th... | null | Array,Binary Search,Sliding Window,Prefix Sum | Medium | 76,325,718,1776,2211,2329 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.