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 |
|---|---|---|---|---|---|---|---|---|
687 | Hello Hi Guys How Are You I Hope All You Are Doing Good Welcome To The Land Cords Lee Today Will Do The Longest Union Value Path Withdrawal Question So Let's Video Give Inside And Outside Returns The Length Of The Longest Pass Thursday And Not Passed Through The length of the match between to note servi now in which wi... | Longest Univalue Path | longest-univalue-path | Given the `root` of a binary tree, return _the length of the longest path, where each node in the path has the same value_. This path may or may not pass through the root.
**The length of the path** between two nodes is represented by the number of edges between them.
**Example 1:**
**Input:** root = \[5,4,5,1,1,nul... | null | Tree,Depth-First Search,Binary Tree | Medium | 124,250,437 |
344 | Ki Welcome Back Everyone in this Video Bihar Ko * Solid Code Easy Level Question and the Ko * Solid Code Easy Level Question and the Ko * Solid Code Easy Level Question and the Question is Reverse Swing in this question will be given and head of characters and what we have two years were written directed by reversing t... | Reverse String | reverse-string | Write a function that reverses a string. The input string is given as an array of characters `s`.
You must do this by modifying the input array [in-place](https://en.wikipedia.org/wiki/In-place_algorithm) with `O(1)` extra memory.
**Example 1:**
**Input:** s = \["h","e","l","l","o"\]
**Output:** \["o","l","l","e","h... | The entire logic for reversing a string is based on using the opposite directional two-pointer approach! | Two Pointers,String,Recursion | Easy | 345,541 |
5 | how's it going everyone today we're gonna try to solve one of the really popular questions on li code this is gonna be the something called the longest palindromic substring now if we look at this question majority of the people would solve it in various ways that it's kind of brute force e but actually in this episode... | 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,047 | hi everyone it's Soren today we have a problem when we are given a string s and we need to repeatedly make a duplicate removals from s until we no longer can so what's a duplicate is if the two adjacent characters are equal so for example in this case we have a b a c a so these two characters are equal right so we are ... | 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 |
1,611 | as most of you know every day we try to pick one the code one interview experience from read code and try to solve all the interesting question of the interview experience not only that we also try to solve all the possible follow-ups of solve all the possible follow-ups of solve all the possible follow-ups of that par... | Minimum One Bit Operations to Make Integers Zero | making-file-names-unique | Given an integer `n`, you must transform it into `0` using the following operations any number of times:
* Change the rightmost (`0th`) bit in the binary representation of `n`.
* Change the `ith` bit in the binary representation of `n` if the `(i-1)th` bit is set to `1` and the `(i-2)th` through `0th` bits are set... | Keep a map of each name and the smallest valid integer that can be appended as a suffix to it. If the name is not present in the map, you can use it without adding any suffixes. If the name is present in the map, append the smallest proper suffix, and add the new name to the map. | Array,Hash Table,String | Medium | null |
128 | Rico's question is called longest consecutive sequence this has given an unsorted array of integers find the length of the longest consecutive element sequence so for this question a sequence could be something like 0 1 2 or 10 11 12 13 14 things like that then it says your algorithm should run an O of n complexity so ... | Longest Consecutive Sequence | longest-consecutive-sequence | Given an unsorted array of integers `nums`, return _the length of the longest consecutive elements sequence._
You must write an algorithm that runs in `O(n)` time.
**Example 1:**
**Input:** nums = \[100,4,200,1,3,2\]
**Output:** 4
**Explanation:** The longest consecutive elements sequence is `[1, 2, 3, 4]`. Therefor... | null | Array,Hash Table,Union Find | Medium | 298,2278 |
31 | hey guys welcome back to another video and today we're going to be solving the lead code question next permutation all right so in this question we need to implement next permutation which rearranges the number into lexicographically next greater permutation of numbers if such arrangement is not possible it must rearra... | Next Permutation | next-permutation | A **permutation** of an array of integers is an arrangement of its members into a sequence or linear order.
* For example, for `arr = [1,2,3]`, the following are all the permutations of `arr`: `[1,2,3], [1,3,2], [2, 1, 3], [2, 3, 1], [3,1,2], [3,2,1]`.
The **next permutation** of an array of integers is the next le... | null | Array,Two Pointers | Medium | 46,47,60,267,1978 |
981 | Question No. 981 & D Question In this Question No. 981 & D Question In this Question No. 981 & D Question In this time based key value, what do you remember from the value of the store? If you code in Python, then you must be remembering the dictionary from the key value. Okay, if you do it in Aisi Plus, th... | 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 |
1,750 | hello developers let's start developing today we're going to take on The Daily pration for on lit code for the 5th of March so it's task 1750 we need to we have a string and we need to keep deleting the same parts of it until we are left within unmanageable kernel so let's start the minut it's a relatively simple setup... | Minimum Length of String After Deleting Similar Ends | check-if-two-expression-trees-are-equivalent | Given a string `s` consisting only of characters `'a'`, `'b'`, and `'c'`. You are asked to apply the following algorithm on the string any number of times:
1. Pick a **non-empty** prefix from the string `s` where all the characters in the prefix are equal.
2. Pick a **non-empty** suffix from the string `s` where all... | Count for each variable how many times it appeared in the first tree. Do the same for the second tree and check if the count is the same for both tree. | Tree,Depth-First Search,Binary Tree | Medium | 1736 |
746 | hi all welcome back to another video from cracking the fang interviews today i'm going to be talking about lead code 746 which is minimum cost of climbing stats this is a popular problem from amazon google microsoft and netflix interviews if you haven't already please check out the climbing stairs problem which is not ... | Min Cost Climbing Stairs | prefix-and-suffix-search | You are given an integer array `cost` where `cost[i]` is the cost of `ith` step on a staircase. Once you pay the cost, you can either climb one or two steps.
You can either start from the step with index `0`, or the step with index `1`.
Return _the minimum cost to reach the top of the floor_.
**Example 1:**
**Input... | For a word like "test", consider "#test", "t#test", "st#test", "est#test", "test#test". Then if we have a query like prefix = "te", suffix = "t", we can find it by searching for something we've inserted starting with "t#te". | String,Design,Trie | Hard | 211 |
11 | hey guys it's off by one here and today we're going to be solving container with most water in this problem we're given an integer array height of length n and in this problem each index represents a line that when drawn has the endpoints I zero and I of height I so for example let's say we start at this point here whi... | Container With Most Water | container-with-most-water | You are given an integer array `height` of length `n`. There are `n` vertical lines drawn such that the two endpoints of the `ith` line are `(i, 0)` and `(i, height[i])`.
Find two lines that together with the x-axis form a container, such that the container contains the most water.
Return _the maximum amount of water... | The aim is to maximize the area formed between the vertical lines. The area of any container is calculated using the shorter line as length and the distance between the lines as the width of the rectangle.
Area = length of shorter vertical line * distance between lines
We can definitely get the maximum width ... | Array,Two Pointers,Greedy | Medium | 42 |
452 | hello guys today's problem for lead code is minimum number of Arrow to burst a balloon so they will be given 2D array of Point uh X starting point from X start and ending point okay so there will be a balloon which starts from uh start from 0 till end okay so it always this should be lower and this should be higher we ... | Minimum Number of Arrows to Burst Balloons | minimum-number-of-arrows-to-burst-balloons | There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array `points` where `points[i] = [xstart, xend]` denotes a balloon whose **horizontal diameter** stretches between `xstart` and `xend`. You do not know the exact y-coordinates of the ball... | null | Array,Greedy,Sorting | Medium | 253,435 |
1,339 | hello everyone welcome to day 19th of august lootco challenge and today's question is maximum product or splitted binary tree in this question we are given a binary tree and we need to find out the maximum products that can be generated by splitting this tree at one possible end and how will you calculate uh the produc... | Maximum Product of Splitted Binary Tree | team-scores-in-football-tournament | Given the `root` of a binary tree, split the binary tree into two subtrees by removing one edge such that the product of the sums of the subtrees is maximized.
Return _the maximum product of the sums of the two subtrees_. Since the answer may be too large, return it **modulo** `109 + 7`.
**Note** that you need to max... | null | Database | Medium | null |
1,423 | Problem Maximum Points Pen Cards From Defense According to Looter Film Institute Actually course relatives and dedicated number of points deposit sediments in the interior that in one step in the phone call from the beginning and from the end through this trick 18 to it Dr 10,000 points of cards You have it Dr 10,000 p... | Maximum Points You Can Obtain from Cards | maximum-number-of-occurrences-of-a-substring | There are several cards **arranged in a row**, and each card has an associated number of points. The points are given in the integer array `cardPoints`.
In one step, you can take one card from the beginning or from the end of the row. You have to take exactly `k` cards.
Your score is the sum of the points of the card... | Check out the constraints, (maxSize <=26). This means you can explore all substrings in O(n * 26). Find the Maximum Number of Occurrences of a Substring with bruteforce. | Hash Table,String,Sliding Window | Medium | null |
427 | hey everybody this is Larry this is day 27 of the legal daily challenge hit the like button hit the Subscribe button drama and Discord let me know what you think about this part I mean apparently I haven't done before so yay let's do something fun uh or something like that uh yeah I hope everyone's have a great weekend... | Construct Quad Tree | construct-quad-tree | Given a `n * n` matrix `grid` of `0's` and `1's` only. We want to represent `grid` with a Quad-Tree.
Return _the root of the Quad-Tree representing_ `grid`.
A Quad-Tree is a tree data structure in which each internal node has exactly four children. Besides, each node has two attributes:
* `val`: True if the node r... | null | null | Medium | null |
15 | in this video we'll go over lead code question number 15 threesome now if you haven't already seen my video on twosome I highly recommend you go watch that first because threesome is very similar to twosome but it's a bit harder the link is in the description so please go ahead and watch that first okay now here's the ... | 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 |
818 | and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem 818 race car your car starts at position 0 and speed plus 1 on an infinite number line your car can go in negative positions your car drives automatically according to a sequence of instructions a for accelerate and ... | Race Car | similar-rgb-color | Your car starts at position `0` and speed `+1` on an infinite number line. Your car can go into negative positions. Your car drives automatically according to a sequence of instructions `'A'` (accelerate) and `'R'` (reverse):
* When you get an instruction `'A'`, your car does the following:
* `position += spee... | null | Math,String,Enumeration | Easy | null |
154 | Hello hello everyone welcome to date 20th family four interpress question research indicates what is a country and in this question give a thought if chosen by one of the selected and selected item withdrawal in more subscribe and subscribe this Video plz subscribe Channel subscribe our a Place to this site is created ... | Find Minimum in Rotated Sorted Array II | find-minimum-in-rotated-sorted-array-ii | Suppose an array of length `n` sorted in ascending order is **rotated** between `1` and `n` times. For example, the array `nums = [0,1,4,4,5,6,7]` might become:
* `[4,5,6,7,0,1,4]` if it was rotated `4` times.
* `[0,1,4,4,5,6,7]` if it was rotated `7` times.
Notice that **rotating** an array `[a[0], a[1], a[2], .... | null | Array,Binary Search | Hard | 153 |
421 | hi everyone welcome to my channel let's solve the lit code problem maximum jar of two numbers in an array so given a non empty array of numbers a 0 a 1 a 2 and a n minus 1 where all the numbers i lie between 0 to 2 to the power 31 so we have to find the maximum result of ai or aj such that inj lies between the range 0 ... | Maximum XOR of Two Numbers in an Array | maximum-xor-of-two-numbers-in-an-array | Given an integer array `nums`, return _the maximum result of_ `nums[i] XOR nums[j]`, where `0 <= i <= j < n`.
**Example 1:**
**Input:** nums = \[3,10,5,25,2,8\]
**Output:** 28
**Explanation:** The maximum result is 5 XOR 25 = 28.
**Example 2:**
**Input:** nums = \[14,70,53,83,49,91,36,80,92,51,66,70\]
**Output:** 1... | null | Array,Hash Table,Bit Manipulation,Trie | Medium | 1826 |
228 | Hello Hi Everyone Welcome To My Channel It's All The Problem Summary Ranges So You Are Tunic Interior Anthems Returned As Molested List Of Ranges Is That Cover All Numbers In The Land Of Blood And Subscribe One Of The World With Me If This Are Sorted Unique Are one to three is 1012 Subscribe now to receive new updates ... | Summary Ranges | summary-ranges | You are given a **sorted unique** integer array `nums`.
A **range** `[a,b]` is the set of all integers from `a` to `b` (inclusive).
Return _the **smallest sorted** list of ranges that **cover all the numbers in the array exactly**_. That is, each element of `nums` is covered by exactly one of the ranges, and there is... | null | Array | Easy | 163,352 |
33 | what is up guys Xavier LAN here I'm prepping for interviews so I'm doing a lot of leak code videos so please subscribe to my channel if you haven't already I'm gonna be posting fairly frequently today I'm going over searching sorted a rotated sorted array so the description reads suppose an array sorted in ascending or... | Search in Rotated Sorted Array | search-in-rotated-sorted-array | There is an integer array `nums` sorted in ascending order (with **distinct** values).
Prior to being passed to your function, `nums` is **possibly rotated** at an unknown pivot index `k` (`1 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]]` ... | null | Array,Binary Search | Medium | 81,153,2273 |
1,935 | that's all from 1935 maximum number of words you can type this lead good problem says that you'll be given two experts one is a string uh string which would be a sentence okay the second string will be the list of characters and we need to find how many words in the sentence so if the sentence is called text so how man... | Maximum Number of Words You Can Type | minimum-number-of-operations-to-reinitialize-a-permutation | There is a malfunctioning keyboard where some letter keys do not work. All other keys on the keyboard work properly.
Given a string `text` of words separated by a single space (no leading or trailing spaces) and a string `brokenLetters` of all **distinct** letter keys that are broken, return _the **number of words** i... | It is safe to assume the number of operations isn't more than n The number is small enough to apply a brute force solution. | Array,Math,Simulation | Medium | null |
316 | hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you have not liked the video please like it subscribe to my channel and hit the bell icon so that you get notified whenever post a new video so without any further ado let's get started prob... | 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 |
705 | um hello so today we are going to do this problem which is part of lead code daily challenge so what we are asking to do is basically um just to design a hash set without using any built-in hash tables so we using any built-in hash tables so we using any built-in hash tables so we can't use um a python dictionary um an... | Design HashSet | design-hashset | Design a HashSet without using any built-in hash table libraries.
Implement `MyHashSet` class:
* `void add(key)` Inserts the value `key` into the HashSet.
* `bool contains(key)` Returns whether the value `key` exists in the HashSet or not.
* `void remove(key)` Removes the value `key` in the HashSet. If `key` do... | null | null | Easy | null |
6 | Hey gas welcome back, you have kept my channel and have given the number of days, okay what do you have to do, row on zigzag pattern, we have to arrange 22, we have to arrange as many days as we have given, we have to arrange it and the string. What we have to do is to read line by line and the sting that will be ours ... | Zigzag Conversion | zigzag-conversion | The string `"PAYPALISHIRING "` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S I I G
Y I R
And then read line by line: `"PAHNAPLSIIGYIR "`
Write the code that will take a string and make this co... | null | String | Medium | null |
94 | this is binary tree in order traversal its lead code question 94 and is one of the Google interview questions so we have the roots of e3 we are dealing with the binary tree here and we need to return the in order traversal of each nodes values this looks very simple we already know the formula to do this we can use a d... | Binary Tree Inorder Traversal | binary-tree-inorder-traversal | Given the `root` of a binary tree, return _the inorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[1,3,2\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of nodes i... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 98,144,145,173,230,272,285,758,799 |
283 | what is up YouTube today I'm going to be going over move zeroes it's a easy problem on the code I know I said I wasn't gonna do easy anymore but I really like this one I thought it was a little bit harder than most of the easies so it's a good one to know check out my slack channel subscribe if you haven't already now ... | Move Zeroes | move-zeroes | Given an integer array `nums`, move all `0`'s to the end of it while maintaining the relative order of the non-zero elements.
**Note** that you must do this in-place without making a copy of the array.
**Example 1:**
**Input:** nums = \[0,1,0,3,12\]
**Output:** \[1,3,12,0,0\]
**Example 2:**
**Input:** nums = \[0\]... | In-place means we should not be allocating any space for extra array. But we are allowed to modify the existing array. However, as a first step, try coming up with a solution that makes use of additional space. For this problem as well, first apply the idea discussed using an additional array and the in-place solution ... | Array,Two Pointers | Easy | 27 |
935 | um hello so today we are going to do this problem which is part of leod daily challenge night dialer so basically we have sort of a chess Knight so just similar to chess where basically Knight can move in L shape it can be either first two step horizontally and then one step uh sorry two steps vertically One Step horiz... | Knight Dialer | orderly-queue | The chess knight has a **unique movement**, it may move two squares vertically and one square horizontally, or two squares horizontally and one square vertically (with both forming the shape of an **L**). The possible movements of chess knight are shown in this diagaram:
A chess knight can move as indicated in the che... | null | Math,String,Sorting | Hard | null |
1,512 | so this problem is leak code id 1512 number of good pairs so given an array of integers nums a pair i and j is called good if nums at i is equal to nums at j and i is less than j return the number of good pairs so this problem is one of the best problems to explain time complexity because intuitively a new programmer m... | Number of Good Pairs | design-underground-system | Given an array of integers `nums`, return _the number of **good pairs**_.
A pair `(i, j)` is called _good_ if `nums[i] == nums[j]` and `i` < `j`.
**Example 1:**
**Input:** nums = \[1,2,3,1,1,3\]
**Output:** 4
**Explanation:** There are 4 good pairs (0,3), (0,4), (3,4), (2,5) 0-indexed.
**Example 2:**
**Input:** nu... | Use two hash tables. The first to save the check-in time for a customer and the second to update the total time between two stations. | Hash Table,String,Design | Medium | 2285 |
332 | in this problem we have to reconstruct itinerary from a given list of flights between different cities so you will be given a list so let's say this city is a this city is b and this city is c so you may be given a list like uh ba then you will be given a list of all the edges so ba means flying from b to a and these a... | Reconstruct Itinerary | reconstruct-itinerary | You are given a list of airline `tickets` where `tickets[i] = [fromi, toi]` represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it.
All of the tickets belong to a man who departs from `"JFK "`, thus, the itinerary must begin with `"JFK "`. If there are multiple... | null | Depth-First Search,Graph,Eulerian Circuit | Hard | 2051,2201 |
1,914 | Ki Rupa Is This Video Baikunthpur Discuss About This Question In The East Coast Celebrity Speaker Advocate In Great Souls Scooter Question Was So He Jehovah's Rules Against Matrix Where Women Are Both Very Fierce And Forgive And Jerk A Consistent Amazon Nutritious Several Years Were Now Show Me the picture image where ... | Cyclically Rotating a Grid | find-the-subtasks-that-did-not-execute | You are given an `m x n` integer matrix `grid`, where `m` and `n` are both **even** integers, and an integer `k`.
The matrix is composed of several layers, which is shown in the below image, where each color is its own layer:
A cyclic rotation of the matrix is done by cyclically rotating **each layer** in the matr... | null | Database | Hard | null |
650 | Show More MP3 Video Song Hi Guys Anurag Side So We're Back General Questions 10 Minutes Call to Keyboard So what to say in it He is saying Initials Otherwise Keyboard Only One Character S President A Keyboard A Notepad Surya Went On That One Character Presented Okay You can perform two operations from another notepad. ... | 2 Keys Keyboard | 2-keys-keyboard | There is only one character `'A'` on the screen of a notepad. You can perform one of two operations on this notepad for each step:
* Copy All: You can copy all the characters present on the screen (a partial copy is not allowed).
* Paste: You can paste the characters which are copied last time.
Given an integer `... | How many characters may be there in the clipboard at the last step if n = 3? n = 7? n = 10? n = 24? | Math,Dynamic Programming | Medium | 651,1033 |
1,042 | hey what's going on guys it's ilya bali here i recorded stuff on youtube chat description for all my information i do all liquid problems uh make sure you subscribe to the channel give me a big thumbs up to support it and this is called flower planted with no adjacent you have and gardens labeled one to n in each garde... | Flower Planting With No Adjacent | minimum-cost-to-merge-stones | You have `n` gardens, labeled from `1` to `n`, and an array `paths` where `paths[i] = [xi, yi]` describes a bidirectional path between garden `xi` to garden `yi`. In each garden, you want to plant one of 4 types of flowers.
All gardens have **at most 3** paths coming into or leaving it.
Your task is to choose a flowe... | null | Array,Dynamic Programming | Hard | 312,1126 |
284 | hello so this question is picking iterator so you have to design the iterator let's support the picking operation on the existing iterator in addition to the test next and then next operation so this is uh pretty straightforward for iterator uh implementation so uh what do I need to do is I need to uh incremental class... | Peeking Iterator | peeking-iterator | Design an iterator that supports the `peek` operation on an existing iterator in addition to the `hasNext` and the `next` operations.
Implement the `PeekingIterator` class:
* `PeekingIterator(Iterator nums)` Initializes the object with the given integer iterator `iterator`.
* `int next()` Returns the next element... | Think of "looking ahead". You want to cache the next element. Is one variable sufficient? Why or why not? Test your design with call order of peek() before next() vs next() before peek(). For a clean implementation, check out Google's guava library source code. | Array,Design,Iterator | Medium | 173,251,281 |
548 | okay so starting to so now I have three five six eight nine is the total sum here and then starting at 3 and a 3 that is 1 and this adds 2 3 4 6 and 7 and similarly God just let see if we construct this table 5 6 and this is 1 3 4 I still this table 2 & 1 this is not 1 4 I still this table 2 & 1 this is not 1 4... | Split Array with Equal Sum | split-array-with-equal-sum | Given an integer array `nums` of length `n`, return `true` if there is a triplet `(i, j, k)` which satisfies the following conditions:
* `0 < i, i + 1 < j, j + 1 < k < n - 1`
* The sum of subarrays `(0, i - 1)`, `(i + 1, j - 1)`, `(j + 1, k - 1)` and `(k + 1, n - 1)` is equal.
A subarray `(l, r)` represents a sli... | null | Array,Prefix Sum | Hard | 1678 |
387 | he-hello there so got to quickly talk he-hello there so got to quickly talk he-hello there so got to quickly talk about today's recruiting challenge question it's called first a unique a character in the string and the question is as follows given a string we want to find the first non repeating character in it and ret... | 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 |
458 | Hello friends to Jhal Ajay, once again welcome all of you to your YouTube channel Teacher Thi, so in today's video we will list some very interesting questions of Purti Vriksha, so basically the questions are of mathematics category type and a little bit of Ko Minute Vriksha is also included. Have to pay money to this ... | Poor Pigs | poor-pigs | There are `buckets` buckets of liquid, where **exactly one** of the buckets is poisonous. To figure out which one is poisonous, you feed some number of (poor) pigs the liquid to see whether they will die or not. Unfortunately, you only have `minutesToTest` minutes to determine which bucket is poisonous.
You can feed t... | What if you only have one shot? Eg. 4 buckets, 15 mins to die, and 15 mins to test. How many states can we generate with x pigs and T tests? Find minimum x such that (T+1)^x >= N | Math,Dynamic Programming,Combinatorics | Hard | null |
289 | hey what's up guys in this video i'm going to go through this uh liquor 289 game of life so um yeah there's a lot of wording in here but let's dive into the example directly so uh for each sub this is uh the cells uh so zero means that cell and one means uh a living cell and we need to look at the surrounding cell for ... | Game of Life | game-of-life | According to [Wikipedia's article](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life): "The **Game of Life**, also known simply as **Life**, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. "
The board is made up of an `m x n` grid of cells, where each cell has an initial st... | null | Array,Matrix,Simulation | Medium | 73 |
1,503 | hey everybody this is Larry this is day four of the Leo daily challenge just want to make sure because I got it wrong yesterday uh hit the like button hit the Subscribe button join me on Discord let me know what you think about today's F and let me know what you think about yeah these intros in general I'm here again s... | Last Moment Before All Ants Fall Out of a Plank | reducing-dishes | We have a wooden plank of the length `n` **units**. Some ants are walking on the plank, each ant moves with a speed of **1 unit per second**. Some of the ants move to the **left**, the other move to the **right**.
When two ants moving in two **different** directions meet at some point, they change their directions and... | Use dynamic programming to find the optimal solution by saving the previous best like-time coefficient and its corresponding element sum. If adding the current element to the previous best like-time coefficient and its corresponding element sum would increase the best like-time coefficient, then go ahead and add it. Ot... | Array,Dynamic Programming,Greedy,Sorting | Hard | null |
1,639 | number of ways to form a Target string given a dictionary means just some words so let's quickly jump on to the problem statement and it's pretty big so yeah I have just broken down into actual components so yeah let's see it's firstly it's given that okay you are given a string a list of strings of same length and tha... | 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 |
427 | represent in the Daily Challenge constructor and what do we have to do if false if lift if false then the value? We must not be understanding this. Let's go ahead. There was no point in giving it here. Internal loan is four, but what are the attributes? What is said in the factory, does it represent or not? If the valu... | Construct Quad Tree | construct-quad-tree | Given a `n * n` matrix `grid` of `0's` and `1's` only. We want to represent `grid` with a Quad-Tree.
Return _the root of the Quad-Tree representing_ `grid`.
A Quad-Tree is a tree data structure in which each internal node has exactly four children. Besides, each node has two attributes:
* `val`: True if the node r... | null | null | Medium | null |
485 | foreign problem and the problem's name is Max consecutive ones so in this question we're given array nums and we have to return the maximum number of consecutive ones inside the array so in this example there are two consecutive ones but there is also another set of ones which is longer than the previous set having thr... | Max Consecutive Ones | max-consecutive-ones | Given a binary array `nums`, return _the maximum number of consecutive_ `1`_'s in the array_.
**Example 1:**
**Input:** nums = \[1,1,0,1,1,1\]
**Output:** 3
**Explanation:** The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s is 3.
**Example 2:**
**Input:** nums = ... | You need to think about two things as far as any window is concerned. One is the starting point for the window. How do you detect that a new window of 1s has started? The next part is detecting the ending point for this window.
How do you detect the ending point for an existing window? If you figure these two things... | Array | Easy | 487,1046,1542,1999 |
9 | That's it, welcome back to my YouTube channel, I am Jyotish and in this video series, we are solving the problems of lift. The format of this video is because today we are going to solve a classical problem which is Calendar. Number So let's see what this problem statement says which is melanin teacher we have to retur... | Palindrome Number | palindrome-number | Given an integer `x`, return `true` _if_ `x` _is a_ _**palindrome**__, and_ `false` _otherwise_.
**Example 1:**
**Input:** x = 121
**Output:** true
**Explanation:** 121 reads as 121 from left to right and from right to left.
**Example 2:**
**Input:** x = -121
**Output:** false
**Explanation:** From left to right, i... | Beware of overflow when you reverse the integer. | Math | Easy | 234,1375 |
551 | hi my name is david today we're going to do number 551 student attendance record one only code this is an easy level problem and we're going to solve it in javascript so this one was kind of like a fun one a simple if else statement while we're looping through so we have a function that takes an s is a string right yea... | Student Attendance Record I | student-attendance-record-i | You are given a string `s` representing an attendance record for a student where each character signifies whether the student was absent, late, or present on that day. The record only contains the following three characters:
* `'A'`: Absent.
* `'L'`: Late.
* `'P'`: Present.
The student is eligible for an attend... | null | String | Easy | 552 |
124 | hey guys welcome or welcome back to my channel so today we are going to discuss another problem is binary tree maximum path sum very easy problem in this problem we have to find a path in the binary tree and uh so each node can only appear at most once path does not need to pass through the root so it's not necessary t... | Binary Tree Maximum Path Sum | binary-tree-maximum-path-sum | A **path** in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence **at most once**. Note that the path does not need to pass through the root.
The **path sum** of a path is the sum of the node's values in the path.
... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Hard | 112,129,666,687,1492 |
3 | I will come in this edition they appeal to discuss about one of the common interview questions friends this question bill out at least five times and top-10 interview given input times and top-10 interview given input times and top-10 interview given input singh identified length of the longest subscribe according to m... | Longest Substring Without Repeating Characters | longest-substring-without-repeating-characters | Given a string `s`, find the length of the **longest** **substring** without repeating characters.
**Example 1:**
**Input:** s = "abcabcbb "
**Output:** 3
**Explanation:** The answer is "abc ", with the length of 3.
**Example 2:**
**Input:** s = "bbbbb "
**Output:** 1
**Explanation:** The answer is "b ", with t... | null | Hash Table,String,Sliding Window | Medium | 159,340,1034,1813,2209 |
1,684 | let's solve lead code 16864 count the number of consistent strings so the question gives you two inputs first is allowed which is a string so allowed for example could be something like ab and it will be a string of unique characters so there won't be any repeats on this something like a b c d there cannot be another A... | Count the Number of Consistent Strings | find-latest-group-of-size-m | You are given a string `allowed` consisting of **distinct** characters and an array of strings `words`. A string is **consistent** if all characters in the string appear in the string `allowed`.
Return _the number of **consistent** strings in the array_ `words`.
**Example 1:**
**Input:** allowed = "ab ", words = \[... | Since the problem asks for the latest step, can you start the searching from the end of arr? Use a map to store the current “1” groups. At each step (going backwards) you need to split one group and update the map. | Array,Binary Search,Simulation | Medium | null |
1,003 | hey what's up guys so let's one over three check if a word is valid after substitutions so given string s determine if it's valid so string s is valid if you're starting with empty string and you can form a t into s after performing following operations so basically you will have the string called abc and you can add a... | Check If Word Is Valid After Substitutions | minimum-area-rectangle-ii | Given a string `s`, determine if it is **valid**.
A string `s` is **valid** if, starting with an empty string `t = " "`, you can **transform** `t` **into** `s` after performing the following operation **any number of times**:
* Insert string `"abc "` into any position in `t`. More formally, `t` becomes `tleft + "ab... | null | Array,Math,Geometry | Medium | null |
17 | hello everyone welcome back here is vanamsen today we have an exciting problem to solve it's called letter combination of phone number and guess what we will not only write the solution in Python but also share implementation in various languages in the description below so let's Dive Right In imagine you have a old-fa... | Letter Combinations of a Phone Number | letter-combinations-of-a-phone-number | Given a string containing digits from `2-9` inclusive, return all possible letter combinations that the number could represent. Return the answer in **any order**.
A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.
**Example 1:**
**Input:** di... | null | Hash Table,String,Backtracking | Medium | 22,39,401 |
17 | hello guys now I would solve the letter combinations of a phone number let's do the problem statement first given a string containing digits from 2 to 9 inclusive return all possible letter combinations that the number could represent a mapping of digits are two letters are like under telephone patent city even below n... | Letter Combinations of a Phone Number | letter-combinations-of-a-phone-number | Given a string containing digits from `2-9` inclusive, return all possible letter combinations that the number could represent. Return the answer in **any order**.
A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.
**Example 1:**
**Input:** di... | null | Hash Table,String,Backtracking | Medium | 22,39,401 |
1,704 | hey everybody this is Larry this is it the first day it is of the December the code day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's bomb we'll be doing the December things or month because I don't know we've we have a big street going so it's not go... | Determine if String Halves Are Alike | special-positions-in-a-binary-matrix | You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half.
Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppe... | Keep track of 1s in each row and in each column. Then while iterating over matrix, if the current position is 1 and current row as well as current column contains exactly one occurrence of 1. | Array,Matrix | Easy | null |
724 | hey what's up guys think whitey already you're talking coding stuff on twitching YouTube check the description for all my information I do the premium problems on my patreon for two bucks and you can join my discord I'm building a community here if you message me I try to respond to everyone this is fine pivot Index th... | 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 |
371 | So hello friends, new day of Blind 75 and today is our 69th day Sam of Tu Inteasers question is easy type medium type but it will be easy because I will explain the logic so it is going to happen so in this we have given two interiors A and B, they have to be solved. Without using Sam, it is okay, so one has two joined... | Sum of Two Integers | sum-of-two-integers | Given two integers `a` and `b`, return _the sum of the two integers without using the operators_ `+` _and_ `-`.
**Example 1:**
**Input:** a = 1, b = 2
**Output:** 3
**Example 2:**
**Input:** a = 2, b = 3
**Output:** 5
**Constraints:**
* `-1000 <= a, b <= 1000` | null | Math,Bit Manipulation | Medium | 2 |
35 | okay 35th task of flip code to search insert position okay we have sorted array in the new element and we should either find it or we should give a position in which we would insert it so that we can keep the sortedness of the array so this time would use std lower bound okay so sorry the lower bound will give us the p... | Search Insert Position | search-insert-position | Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[1,3,5,6\], target = 5
**Output:** 2
**Exa... | null | Array,Binary Search | Easy | 278 |
1,884 | A Azam is going to call list d4 extra bittu is a st andrews questions statement you are you want to identical addition you have access to now building with and plural form 121 that vinod were juice of lower left strong 90 slide and drop test very Beneficial That An Alarm Clock Set And Billu Slow App Will Not Take Any M... | Egg Drop With 2 Eggs and N Floors | minimum-changes-to-make-alternating-binary-string | You are given **two identical** eggs and you have access to a building with `n` floors labeled from `1` to `n`.
You know that there exists a floor `f` where `0 <= f <= n` such that any egg dropped at a floor **higher** than `f` will **break**, and any egg dropped **at or below** floor `f` will **not break**.
In each ... | Think about how the final string will look like. It will either start with a '0' and be like '010101010..' or with a '1' and be like '10101010..' Try both ways, and check for each way, the number of changes needed to reach it from the given string. The answer is the minimum of both ways. | String | Easy | null |
42 | hi everyone welcome to sudokoda my name is raveena and today we are going to solve lead code problem number 42 which is trapping rainwater so let's start by reading the question it says that uh given non-negative integers representing given non-negative integers representing given non-negative integers representing an ... | Trapping Rain Water | trapping-rain-water | Given `n` non-negative integers representing an elevation map where the width of each bar is `1`, compute how much water it can trap after raining.
**Example 1:**
**Input:** height = \[0,1,0,2,1,0,1,3,2,1,2,1\]
**Output:** 6
**Explanation:** The above elevation map (black section) is represented by array \[0,1,0,2,1,... | null | Array,Two Pointers,Dynamic Programming,Stack,Monotonic Stack | Hard | 11,238,407,756 |
47 | hello everyone welcome to the backtracking series of videos so in the previous video i have explained the permutation 1 problem so in this video i will explain permutation 2 problem and the problem number is 47 so the problem statement is saying given a collection of numbers norms that might contain duplicates return a... | Permutations II | permutations-ii | Given a collection of numbers, `nums`, that might contain duplicates, return _all possible unique permutations **in any order**._
**Example 1:**
**Input:** nums = \[1,1,2\]
**Output:**
\[\[1,1,2\],
\[1,2,1\],
\[2,1,1\]\]
**Example 2:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,... | null | Array,Backtracking | Medium | 31,46,267,1038 |
901 | hello there so let's look at the today's legal in China question it's called online stock span we need to implement a class stock spanner which will be updated with daily stock prices and after the update you will be able to return the span of the stock's price of the current day the definition for the span is as follo... | Online Stock Span | advantage-shuffle | Design an algorithm that collects daily price quotes for some stock and returns **the span** of that stock's price for the current day.
The **span** of the stock's price in one day is the maximum number of consecutive days (starting from that day and going backward) for which the stock price was less than or equal to ... | null | Array,Greedy,Sorting | Medium | null |
101 | hi there welcome to my channel i'm here to do some easy and medium legal problems and my goal is finish a hundred of them today we have nico 101 so we're gonna finish this today it's symmetric tree so giving a binary check whether it is a mirror of itself basically is if you see a tree in this uh example is one on the ... | 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 |
959 | foreign we're given a grid of intense and squares where each one times one square is either a black space or contains a slash or a backslash these characters divide the scores into different regions and the goal is to counter number of cognitive regions in the grid to solve this question we first divide each one times ... | Regions Cut By Slashes | 3sum-with-multiplicity | An `n x n` grid is composed of `1 x 1` squares where each `1 x 1` square consists of a `'/'`, `'\'`, or blank space `' '`. These characters divide the square into contiguous regions.
Given the grid `grid` represented as a string array, return _the number of regions_.
Note that backslash characters are escaped, so a `... | null | Array,Hash Table,Two Pointers,Sorting,Counting | Medium | null |
886 | so today's question is possible by partition so in this question we have given the set of n peoples and we have to split them in two groups we have given group of people who dislike each other so we have to do is we have to put them in different groups so that they are known in the same group so what can we do so as we... | Possible Bipartition | score-of-parentheses | We want to split a group of `n` people (labeled from `1` to `n`) into two groups of **any size**. Each person may dislike some other people, and they should not go into the same group.
Given the integer `n` and the array `dislikes` where `dislikes[i] = [ai, bi]` indicates that the person labeled `ai` does not like the... | null | String,Stack | Medium | null |
1,887 | hello and welcome to today's daily lead code challenge today we'll be solving question 1,887 reduction of operations to make an 1,887 reduction of operations to make an 1,887 reduction of operations to make an array elements equal okay so let's go straight to the question um given an integer array nums uh let's see thi... | Reduction Operations to Make the Array Elements Equal | minimum-degree-of-a-connected-trio-in-a-graph | Given an integer array `nums`, your goal is to make all elements in `nums` equal. To complete one operation, follow these steps:
1. Find the **largest** value in `nums`. Let its index be `i` (**0-indexed**) and its value be `largest`. If there are multiple elements with the largest value, pick the smallest `i`.
2. F... | Consider a trio with nodes u, v, and w. The degree of the trio is just degree(u) + degree(v) + degree(w) - 6. The -6 comes from subtracting the edges u-v, u-w, and v-w, which are counted twice each in the vertex degree calculation. To get the trios (u,v,w), you can iterate on u, then iterate on each w,v such that w and... | Graph | Hard | null |
138 | hey everyone welcome back and today we'll be doing another lead code problem one three eight copy list with random pointer this is the medium one so the description is pretty large but what they are saying is we have a normal linked list uh with the next pointer but it does have another pointer name random so what does... | 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 |
134 | Hello viewers welcome to test this pending in this video discuss problem very important interview problem gas station is taken from list code 134 problem and medium level problem is a very interesting problem if you want to watch then in this video we will first understand the problem statement and We will see his diff... | Gas Station | gas-station | There are `n` gas stations along a circular route, where the amount of gas at the `ith` station is `gas[i]`.
You have a car with an unlimited gas tank and it costs `cost[i]` of gas to travel from the `ith` station to its next `(i + 1)th` station. You begin the journey with an empty tank at one of the gas stations.
Gi... | null | Array,Greedy | Medium | 1346 |
43 | welcome back to code Meets World and today we're looking at a leak code problem number 43 which is called multiply strings so if we're given two non-negative so if we're given two non-negative so if we're given two non-negative integers represented as strings we need to return the product of the two of them also repres... | Multiply Strings | multiply-strings | Given two non-negative integers `num1` and `num2` represented as strings, return the product of `num1` and `num2`, also represented as a string.
**Note:** You must not use any built-in BigInteger library or convert the inputs to integer directly.
**Example 1:**
**Input:** num1 = "2", num2 = "3"
**Output:** "6"
**Ex... | null | Math,String,Simulation | Medium | 2,66,67,415 |
1,029 | so hey guys welcome to my channel i am sithis and today we will be doing another very interesting problem from the lead code daily challenge day 25. that is the lead code problem number 1029 two city scheduling in the problem statement we are given a cost array where cost of i is basically a pair of a cost and b cost w... | Two City Scheduling | vertical-order-traversal-of-a-binary-tree | A company is planning to interview `2n` people. Given the array `costs` where `costs[i] = [aCosti, bCosti]`, the cost of flying the `ith` person to city `a` is `aCosti`, and the cost of flying the `ith` person to city `b` is `bCosti`.
Return _the minimum cost to fly every person to a city_ such that exactly `n` people... | null | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Hard | null |
124 | Hello hello guys welcome back to take two this video will see press entry maximum after we problem system list date one of the dead skin challenge so let's look at problem Thursday maximum can start a node for example you can see some parts of 99 subscribe and subscribe the 1995 me stan at any point but it's always for... | Binary Tree Maximum Path Sum | binary-tree-maximum-path-sum | A **path** in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence **at most once**. Note that the path does not need to pass through the root.
The **path sum** of a path is the sum of the node's values in the path.
... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Hard | 112,129,666,687,1492 |
36 | hello welcome to my channel i'm here to do my honzolico challenge and today we have leeco 36 valid pseudocode so this question is really classic so we said determine if a nighttime knight pseudocode board is valid so only the fuel cell needs to be validated according to the following rules so first each rows must conta... | 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 |
275 | hi guys welcome to algorithms made easy today we will go through the day 18 problem 8 index part 2 please like the video and if you're new don't forget to subscribe to our channel so that you never miss any update given an array of salutation sorted in ascending order where each citation is a non-negative where each ci... | H-Index II | h-index-ii | Given an array of integers `citations` where `citations[i]` is the number of citations a researcher received for their `ith` paper and `citations` is sorted in **ascending order**, return _the researcher's h-index_.
According to the [definition of h-index on Wikipedia](https://en.wikipedia.org/wiki/H-index): The h-ind... | Expected runtime complexity is in O(log n) and the input is sorted. | Array,Binary Search | Medium | 274 |
1,008 | Hai gas welcome to today's video and today we are going to do lead code problem 1008 which is named Construct Binary Search Tree from Prior Order Driver so basically we have a preorder area and we have to construct a binary using this array. And this binary search should be free okay so we will see how we will approach... | Construct Binary Search Tree from Preorder Traversal | binary-tree-cameras | Given an array of integers preorder, which represents the **preorder traversal** of a BST (i.e., **binary search tree**), construct the tree and return _its root_.
It is **guaranteed** that there is always possible to find a binary search tree with the given requirements for the given test cases.
A **binary search tr... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Hard | 1021 |
1,743 | uh hey everybody this is larry this is me going with q2 of the lego contest 226. we stored it away from adjacent pairs so the key note for this problem is hit the like button hit the subscribe button join me on discord let me know what you think about this form and so forth um but yeah for the key note for this problem... | Restore the Array From Adjacent Pairs | count-substrings-that-differ-by-one-character | There is an integer array `nums` that consists of `n` **unique** elements, but you have forgotten it. However, you do remember every pair of adjacent elements in `nums`.
You are given a 2D integer array `adjacentPairs` of size `n - 1` where each `adjacentPairs[i] = [ui, vi]` indicates that the elements `ui` and `vi` a... | Take every substring of s, change a character, and see how many substrings of t match that substring. Use a Trie to store all substrings of t as a dictionary. | Hash Table,String,Dynamic Programming | Medium | 2256 |
1,646 | hey guys welcome back to my channel and i'm back again with another really interesting coding interview question video this time guys we are going to solve question number 1646 get maximum in generated array which is a dynamic programming question before i started the video guys just want to request you that if you hav... | Get Maximum in Generated Array | kth-missing-positive-number | You are given an integer `n`. A **0-indexed** integer array `nums` of length `n + 1` is generated in the following way:
* `nums[0] = 0`
* `nums[1] = 1`
* `nums[2 * i] = nums[i]` when `2 <= 2 * i <= n`
* `nums[2 * i + 1] = nums[i] + nums[i + 1]` when `2 <= 2 * i + 1 <= n`
Return _the **maximum** integer in the... | Keep track of how many positive numbers are missing as you scan the array. | Array,Binary Search | Easy | 2305 |
693 | Hello everyone welcome, today's problem is alternating bits, so in the problem statement we are given a positive expectation and we have to tell whether alternating beats are present in it or not, like mother, take the first example, N = 5. So mother, take the first example, N = 5. So mother, take the first example, N ... | Binary Number with Alternating Bits | binary-number-with-alternating-bits | Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.
**Example 1:**
**Input:** n = 5
**Output:** true
**Explanation:** The binary representation of 5 is: 101
**Example 2:**
**Input:** n = 7
**Output:** false
**Explanation:** The binary repr... | null | Bit Manipulation | Easy | 191 |
106 | Wedding Welcome To My Channel Today 2070 Problems Constructive Manner Retreat From India And Posters Given In Adhir Veervati History And Subscribe Button More Benefits Loot That Similarly In Post Operative Ward Process Factory 's Combustion Lights Of Tree 's Combustion Lights Of Tree 's Combustion Lights Of Tree That A... | Construct Binary Tree from Inorder and Postorder Traversal | construct-binary-tree-from-inorder-and-postorder-traversal | Given two integer arrays `inorder` and `postorder` where `inorder` is the inorder traversal of a binary tree and `postorder` is the postorder traversal of the same tree, construct and return _the binary tree_.
**Example 1:**
**Input:** inorder = \[9,3,15,20,7\], postorder = \[9,15,7,20,3\]
**Output:** \[3,9,20,null,n... | null | Array,Hash Table,Divide and Conquer,Tree,Binary Tree | Medium | 105 |
1,802 | so hello everyone welcome to this new video and i will be explaining the problem maximum value at a given index in bounded area so this problem is exactly medium one and you know this kind of problems uh are become i have realized that they are asked regularly these are binary search problems so in this video first i w... | Maximum Value at a Given Index in a Bounded Array | number-of-students-unable-to-eat-lunch | You are given three positive integers: `n`, `index`, and `maxSum`. You want to construct an array `nums` (**0-indexed**) that satisfies the following conditions:
* `nums.length == n`
* `nums[i]` is a **positive** integer where `0 <= i < n`.
* `abs(nums[i] - nums[i+1]) <= 1` where `0 <= i < n-1`.
* The sum of a... | Simulate the given in the statement Calculate those who will eat instead of those who will not. | Array,Stack,Queue,Simulation | Easy | 2195 |
73 | hello everyone welcome to day 13 the focus liquid challenge and today's question is set matrix zeros in this question we are given a matrix of size m cross n where each element is kind of an integer and we need to set the complete row and column if this current element happens to be 0 let's talk about it by an example ... | Set Matrix Zeroes | set-matrix-zeroes | Given an `m x n` integer matrix `matrix`, if an element is `0`, set its entire row and column to `0`'s.
You must do it [in place](https://en.wikipedia.org/wiki/In-place_algorithm).
**Example 1:**
**Input:** matrix = \[\[1,1,1\],\[1,0,1\],\[1,1,1\]\]
**Output:** \[\[1,0,1\],\[0,0,0\],\[1,0,1\]\]
**Example 2:**
**In... | If any cell of the matrix has a zero we can record its row and column number using additional memory.
But if you don't want to use extra memory then you can manipulate the array instead. i.e. simulating exactly what the question says. Setting cell values to zero on the fly while iterating might lead to discrepancies. ... | Array,Hash Table,Matrix | Medium | 289,2244,2259,2314 |
21 | welcome to january's lego challenge today's problem is merge two sorted lists merge two sorted linked lists and return it as a sorted list the list should be made by splicing together the nodes of the first two lists we're given two linked lists here and they're going to be sorted and we want to merge them together to ... | Merge Two Sorted Lists | merge-two-sorted-lists | You are given the heads of two sorted linked lists `list1` and `list2`.
Merge the two lists in a one **sorted** list. The list should be made by splicing together the nodes of the first two lists.
Return _the head of the merged linked list_.
**Example 1:**
**Input:** list1 = \[1,2,4\], list2 = \[1,3,4\]
**Output:**... | null | Linked List,Recursion | Easy | 23,88,148,244,1774,2071 |
96 | Hello friends welcome to my channel let's have a look at another unique binary search trees problem 96 in this video we are going to continue the video on problem 95. in problem 95 we explained how to build all the unique Banner searches by recursion so this problem here concerns the number of unique banners to trees i... | Unique Binary Search Trees | unique-binary-search-trees | Given an integer `n`, return _the number of structurally unique **BST'**s (binary search trees) which has exactly_ `n` _nodes of unique values from_ `1` _to_ `n`.
**Example 1:**
**Input:** n = 3
**Output:** 5
**Example 2:**
**Input:** n = 1
**Output:** 1
**Constraints:**
* `1 <= n <= 19` | null | Math,Dynamic Programming,Tree,Binary Search Tree,Binary Tree | Medium | 95 |
279 | Perfect square which is here, we have given, so our people solve it, let's see how our people will do this, first of all we read the question problem statement, what do we have, then inside the question we have a wait and given, we have to return. List number of perfect square number tu dat sam tu n ok hai as here I am... | Perfect Squares | perfect-squares | Given an integer `n`, return _the least number of perfect square numbers that sum to_ `n`.
A **perfect square** is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, `1`, `4`, `9`, and `16` are perfect squares while `3` and `11` are not.
**Example ... | null | Math,Dynamic Programming,Breadth-First Search | Medium | 204,264 |
123 | hi guys welcome to algorithms made easy my name is khushpu and in this video we'll see the question best time to buy and sell stock part three you are given an array prices where prices of i is the price of the given stock on ith day we need to find the maximum profit that we can achieve given that you may complete at ... | Best Time to Buy and Sell Stock III | best-time-to-buy-and-sell-stock-iii | You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
Find the maximum profit you can achieve. You may complete **at most two transactions**.
**Note:** You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).
**Exampl... | null | Array,Dynamic Programming | Hard | 121,122,188,689 |
1,870 | hello everyone welcome to my your programming Club today we will be solving another daily code Challenge and the challenge name is minimum speed to arrive on time so the channel statement is like this you are given a floating Point number or representing the amount of time you have to reach the office to commute to the... | Minimum Speed to Arrive on Time | minimum-speed-to-arrive-on-time | You are given a floating-point number `hour`, representing the amount of time you have to reach the office. To commute to the office, you must take `n` trains in sequential order. You are also given an integer array `dist` of length `n`, where `dist[i]` describes the distance (in kilometers) of the `ith` train ride.
E... | null | null | Medium | null |
956 | hello friends today list of tallest billboard problem you are installing a billboard and you want to have the lag largest height the billboard will have two steel spots one on each side each steel spout must be an equal height so simply put that is we are given an integer rate we want to separate into two buckets each ... | 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 |
238 | Hello friends in this section we are going to discuss about another light co problem product of acceptance of deposits of luxury all will do we call the product of all elements acid pimple or pimple 3000 will do protector of all elements subscribe The Channel do all Elements Element Product 5130 subscribe and subscribe... | Product of Array Except Self | product-of-array-except-self | Given an integer array `nums`, return _an array_ `answer` _such that_ `answer[i]` _is equal to the product of all the elements of_ `nums` _except_ `nums[i]`.
The product of any prefix or suffix of `nums` is **guaranteed** to fit in a **32-bit** integer.
You must write an algorithm that runs in `O(n)` time and without... | null | Array,Prefix Sum | Medium | 42,152,265,2267 |
1,716 | hello and welcome to another video in this video we're going to be working on calculate money in Elite code bank and in this problem someone wants to save money for his first car he puts money in a Le code Bank every day he puts $1 a Le code Bank every day he puts $1 a Le code Bank every day he puts $1 Monday and then ... | Calculate Money in Leetcode Bank | maximum-non-negative-product-in-a-matrix | Hercy wants to save money for his first car. He puts money in the Leetcode bank **every day**.
He starts by putting in `$1` on Monday, the first day. Every day from Tuesday to Sunday, he will put in `$1` more than the day before. On every subsequent Monday, he will put in `$1` more than the **previous Monday**.
Given... | Use Dynamic programming. Keep the highest value and lowest value you can achieve up to a point. | Array,Dynamic Programming,Matrix | Medium | null |
22 | in this video we have to uh generate uh all the possible parentheses valid parenthesis with a given length so let's understand the problem so here we are given some input in n is 3 in this case so in this case we have to generate all the valid parenthesis which can be formed using three open and three closing parenthes... | Generate Parentheses | generate-parentheses | Given `n` pairs of parentheses, write a function to _generate all combinations of well-formed parentheses_.
**Example 1:**
**Input:** n = 3
**Output:** \["((()))","(()())","(())()","()(())","()()()"\]
**Example 2:**
**Input:** n = 1
**Output:** \["()"\]
**Constraints:**
* `1 <= n <= 8` | null | String,Dynamic Programming,Backtracking | Medium | 17,20,2221 |
735 | hello and welcome to today's daily lead code challenge let's begin question 735 asteroid Collision in this question we are given an array of asteroids of integers representing asteroids in a row for each asteroid the absolute value represents its size and the sign represents its direction positive meaning right negativ... | Asteroid Collision | asteroid-collision | We are given an array `asteroids` of integers representing asteroids in a row.
For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed.
Find out the state of the asteroids after all collisio... | Say a row of asteroids is stable. What happens when a new asteroid is added on the right? | Array,Stack | Medium | 605,2245,2317 |
224 | hey everybody this is larry this is the 11th of september so that you'll have on the september league daily challenge hit the like button to subscribe and join me on discord let me know what you think about today's problem basic calculator um you know i'm from new york i grew up in new york my high school was actually ... | Basic Calculator | basic-calculator | Given a string `s` representing a valid expression, implement a basic calculator to evaluate it, and return _the result of the evaluation_.
**Note:** You are **not** allowed to use any built-in function which evaluates strings as mathematical expressions, such as `eval()`.
**Example 1:**
**Input:** s = "1 + 1 "
**O... | null | Math,String,Stack,Recursion | Hard | 150,227,241,282,785,2147,2328 |
1,696 | you are initially standing at index zero in one move you can jump at most k steps in one movie jump to those k steps without going outside the boundaries obviously and the index i to any index in the range of i plus 1 minimum of n minus 1 till i plus k so you want to reach the last index of the array which is n minus 1... | Jump Game VI | strange-printer-ii | You are given a **0-indexed** integer array `nums` and an integer `k`.
You are initially standing at index `0`. In one move, you can jump at most `k` steps forward without going outside the boundaries of the array. That is, you can jump from index `i` to any index in the range `[i + 1, min(n - 1, i + k)]` **inclusive*... | Try thinking in reverse. Given the grid, how can you tell if a colour was painted last? | Array,Graph,Topological Sort,Matrix | Hard | 664 |
778 | hey what's up guys this is chung here so today uh lead called number 778 swim in rising water okay so you're given like an unbiased grade right so each element or each position represents the elevation of that point and now the rain water starts to fall now the rain starts to fall and that's why i know the water will k... | Swim in Rising Water | reorganize-string | You are given an `n x n` integer matrix `grid` where each value `grid[i][j]` represents the elevation at that point `(i, j)`.
The rain starts to fall. At time `t`, the depth of the water everywhere is `t`. You can swim from a square to another 4-directionally adjacent square if and only if the elevation of both square... | Alternate placing the most common letters. | Hash Table,String,Greedy,Sorting,Heap (Priority Queue),Counting | Medium | 358,621,1304 |
152 | so we are looking at this question maximum products of array and it's a variation of basically maximum sums of array so uh i won't go into detail you might have already seen so many videos but this is specifically for the edge cases the test cases which are failing generally because everyone is telling this max and men... | Maximum Product Subarray | maximum-product-subarray | Given an integer array `nums`, find a subarray that has the largest product, and return _the product_.
The test cases are generated so that the answer will fit in a **32-bit** integer.
**Example 1:**
**Input:** nums = \[2,3,-2,4\]
**Output:** 6
**Explanation:** \[2,3\] has the largest product 6.
**Example 2:**
**I... | null | Array,Dynamic Programming | Medium | 53,198,238,628,713 |
540 | Have Hello Guys Welcome Back To Back Door Sign In This Video Will See How To Find The Evening Element In Adhere This Is From List To Date Waiver Of The Match Challenge So Let's Not Look At The Problem Statement The Problems That Are Very Single Unique Element Noida To have unique element and they are not listening to k... | Single Element in a Sorted Array | single-element-in-a-sorted-array | You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once.
Return _the single element that appears only once_.
Your solution must run in `O(log n)` time and `O(1)` space.
**Example 1:**
**Input:** nums = \[1,1,2,3,3,4,4,8,8\... | null | Array,Binary Search | Medium | null |
792 | hey hi guys today we will see the good problem 792 which is saying number of matching subsequences what does it mean so the problem is saying that we have a given a string and we have given an array of words now we have to return the total number of subsequences which are available in the given string s so how do we do... | 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 |
256 | intel's problem that we are going to discuss today let me just write it here so there is a famous lead code problem okay so what is given here is there are n number of houses so i have taken only three houses which are presented in the rows and they are colored with three colors okay red green and blue here there can b... | Paint House | paint-house | There is a row of `n` houses, where each house can be painted one of three colors: red, blue, or green. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color.
The cost of painting each house with a certain color is repre... | null | Array,Dynamic Programming | Medium | 198,213,265,276 |
980 | Hello Hi Everyone Welcome To My Channel It's All The Best Quotes From Unique Bar 300 Basis Of Your Problem Of Uniform 125 Amount As Well As Opening Day Of Mushroom Grid Yaar Four Types Of One Representing Starting Competition Lever Starting And Ending Teri Dekhi 150 Ki Pitch Ball Subscribe our channel subscribe our cha... | Unique Paths III | find-the-shortest-superstring | You are given an `m x n` integer array `grid` where `grid[i][j]` could be:
* `1` representing the starting square. There is exactly one starting square.
* `2` representing the ending square. There is exactly one ending square.
* `0` representing empty squares we can walk over.
* `-1` representing obstacles tha... | null | Array,String,Dynamic Programming,Bit Manipulation,Bitmask | Hard | null |
284 | hello everyone welcome today we are looking at another lead code question which is speaking iterator now this question is being asked in the february first second week of 2021 and what this question says is we are given an integrator class interface with method next and has next design an implemented picking iterator t... | Peeking Iterator | peeking-iterator | Design an iterator that supports the `peek` operation on an existing iterator in addition to the `hasNext` and the `next` operations.
Implement the `PeekingIterator` class:
* `PeekingIterator(Iterator nums)` Initializes the object with the given integer iterator `iterator`.
* `int next()` Returns the next element... | Think of "looking ahead". You want to cache the next element. Is one variable sufficient? Why or why not? Test your design with call order of peek() before next() vs next() before peek(). For a clean implementation, check out Google's guava library source code. | Array,Design,Iterator | Medium | 173,251,281 |
1,066 | hey what's up guys this is john here again so uh today uh let's take a look at this problem here number 1066 campus bike bikes number two very interesting it's not it's a good problem you know it's a media level i think it's a good medium level problem okay you know i think i have uploaded another videos regarding camp... | Campus Bikes II | fixed-point | On a campus represented as a 2D grid, there are `n` workers and `m` bikes, with `n <= m`. Each worker and bike is a 2D coordinate on this grid.
We assign one unique bike to each worker so that the sum of the **Manhattan distances** between each worker and their assigned bike is minimized.
Return `the minimum possible... | Loop over the array and check the first index i such A[i] == i | Array,Binary Search | Easy | null |
171 | To a pick hello welcome on the channel so a question we are doing 171 excel sheet column bird game first let's understand what is the question so basically this you have equal in this we title will be your screen life and you have to tell which one It will come on the number, okay, so I have given you an example to APN... | Excel Sheet Column Number | excel-sheet-column-number | Given a string `columnTitle` that represents the column title as appears in an Excel sheet, return _its corresponding column number_.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
**Example 1:**
**Input:** columnTitle = "A "
**Output:** 1
**Example 2:**
**Input:** columnTitle = "AB "
**Ou... | null | Math,String | Easy | 168,2304 |
314 | hello guys they will try to solve the binary vertical order traversal profit and see the problem statement given by me tree return the vertical altered force all his notes value from top to bottom and column by : if two notes are bottom and column by : if two notes are bottom and column by : if two notes are in the sam... | Binary Tree Vertical Order Traversal | binary-tree-vertical-order-traversal | Given the `root` of a binary tree, return _**the vertical order traversal** of its nodes' values_. (i.e., from top to bottom, column by column).
If two nodes are in the same row and column, the order should be from **left to right**.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[9\],\[3,... | null | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 102 |
887 | Hello Hi Ap Me Zu Lakshan To The Super Hero Problem And Dasha Problem And The Video then subscribe to the Page if you liked The Video then subscribe to Ya Baby When You Have A Center Of You To Find The Number Of Birth youtu.be that I will tell you what Mamu sa flat you checked and difficult video subscribe the channel ... | Super Egg Drop | minimum-cost-to-hire-k-workers | You are given `k` identical eggs and you have access to a building with `n` floors labeled from `1` to `n`.
You know that there exists a floor `f` where `0 <= f <= n` such that any egg dropped at a floor **higher** than `f` will **break**, and any egg dropped **at or below** floor `f` will **not break**.
Each move, y... | null | Array,Greedy,Sorting,Heap (Priority Queue) | Hard | null |
5 | hello guys welcome to another video in the series of coding today we are going to do the problem which is called longest palindromic substring so given a string s you have to return the longest palindromic substring in s let's try to take an example to understand so we are given b a d we have to return which is the lon... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.