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 |
|---|---|---|---|---|---|---|---|---|
138 | hey friends today let's practice lead code number 138 coffee list with random pointers so this problem is given a linked list such that each note contains an additional random pointer which could point to any node in the list or no and we need to return a deep copy of the list so my approach to this problem is to use m... | 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 |
35 | hey everyone welcome to Tech white in this video we are going to solve problem number 35 search insert position so given a sorted array of distinct integers and a Target value we need to return the index of the Target and if the target is not found in my input array then I need to return the index where the target woul... | 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 |
127 | Jhaal Hello guys welcome to here Amazing question world in this question Thursday subscribe and subscribe the Channel Please subscribe And subscribe Video to like subscribe Video subscribe ki sapoch this is the example given winners subscribe this rumor subscribe And subscribe The Amazing spider-man Acidity subscribe T... | Word Ladder | word-ladder | A **transformation sequence** from word `beginWord` to word `endWord` using a dictionary `wordList` is a sequence of words `beginWord -> s1 -> s2 -> ... -> sk` such that:
* Every adjacent pair of words differs by a single letter.
* Every `si` for `1 <= i <= k` is in `wordList`. Note that `beginWord` does not need ... | null | Hash Table,String,Breadth-First Search | Hard | 126,433 |
572 | when it comes to Binary trees we all know about the inorder pre-order and know about the inorder pre-order and know about the inorder pre-order and post order traversal techniques right but what happens when you start solving problems we forget about them correct so let us try to explore a problem on lead code that use... | Subtree of Another Tree | subtree-of-another-tree | Given the roots of two binary trees `root` and `subRoot`, return `true` if there is a subtree of `root` with the same structure and node values of `subRoot` and `false` otherwise.
A subtree of a binary tree `tree` is a tree that consists of a node in `tree` and all of this node's descendants. The tree `tree` could als... | Which approach is better here- recursive or iterative? If recursive approach is better, can you write recursive function with its parameters? Two trees s and t are said to be identical if their root values are same and their left and right subtrees are identical. Can you write this in form of recursive formulae? Recurs... | Tree,Depth-First Search,String Matching,Binary Tree,Hash Function | Easy | 250,508 |
107 | okay let's talk about binary level order traversal 2 so you are given the root of a binary tree return the button up label order traversal official value so 3 9 20 15 7 right you have to written 15 7 9 20 and 3. so this is uh straightforward for preferences so you're adding the queue into i'm adding a node into a queue... | 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 |
1,792 | hi everyone it's albert today let's solve the contest median question maximum average pass ratio and before we start don't forget to subscribe to my channel i'll be constantly solving good and classic clinical questions with clear explanation animation and visualization now let's look at a question in this question the... | Maximum Average Pass Ratio | find-the-most-competitive-subsequence | There is a school that has classes of students and each class will be having a final exam. You are given a 2D integer array `classes`, where `classes[i] = [passi, totali]`. You know beforehand that in the `ith` class, there are `totali` total students, but only `passi` number of students will pass the exam.
You are al... | In lexicographical order, the elements to the left have higher priority than those that come after. Can you think of a strategy that incrementally builds the answer from left to right? | Array,Stack,Greedy,Monotonic Stack | Medium | 402,1159 |
384 | with go to question number 384 Chevrolet this is medium question let's get into it shuffle off set of numbers without the pretension ok let's check it again for the one really super nonsense one two three so we able to shepherd 1 2 3 & 3 1 three so we able to shepherd 1 2 3 & 3 1 three so we able to shepherd 1 ... | Shuffle an Array | shuffle-an-array | Given an integer array `nums`, design an algorithm to randomly shuffle the array. All permutations of the array should be **equally likely** as a result of the shuffling.
Implement the `Solution` class:
* `Solution(int[] nums)` Initializes the object with the integer array `nums`.
* `int[] reset()` Resets the arr... | The solution expects that we always use the original array to shuffle() else some of the test cases fail. (Credits; @snehasingh31) | Array,Math,Randomized | Medium | null |
1,380 | hello viewers welcome back to my channel I hope you are enjoying all the problems that I am uploading if you haven't subscribed to my channel yet please go ahead and subscribe today's problem is lucky numbers in a matrix given M by n matrix of distinct numbers written all lucky numbers in the matrix in any order a luck... | Lucky Numbers in a Matrix | number-of-closed-islands | Given an `m x n` matrix of **distinct** numbers, return _all **lucky numbers** in the matrix in **any** order_.
A **lucky number** is an element of the matrix such that it is the minimum element in its row and maximum in its column.
**Example 1:**
**Input:** matrix = \[\[3,7,8\],\[9,11,13\],\[15,16,17\]\]
**Output:*... | Exclude connected group of 0s on the corners because they are not closed island. Return number of connected component of 0s on the grid. | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | null |
110 | Friends welcome again to my channel so in today's video we are going to see the balance by tree problem ok and earlier the problem we had seen was the diameter of binary tree which I have just opened and we have just completed it on the white board. I understood it and did it here also after understanding it. So guys, ... | Balanced Binary Tree | balanced-binary-tree | Given a binary tree, determine if it is **height-balanced**.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** true
**Example 2:**
**Input:** root = \[1,2,2,3,3,null,null,4,4\]
**Output:** false
**Example 3:**
**Input:** root = \[\]
**Output:** true
**Constraints:**
* The number of nodes ... | null | Tree,Depth-First Search,Binary Tree | Easy | 104 |
504 | hello everyone so in this video let us talk about base 7 problem from lead code the problem is very simple that you are given an integer num you just have to return a string of your particular number in base 7 representation now uh if you know how to represent in binary form or any particular form it's very simple what... | Base 7 | base-7 | Given an integer `num`, return _a string of its **base 7** representation_.
**Example 1:**
**Input:** num = 100
**Output:** "202"
**Example 2:**
**Input:** num = -7
**Output:** "-10"
**Constraints:**
* `-107 <= num <= 107` | null | Math | Easy | null |
297 | hello everyone welcome to the channel today's question is serialize and deserialize binary tree the question says serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer or transmitted across a network connection link to be recons... | Serialize and Deserialize Binary Tree | serialize-and-deserialize-binary-tree | Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment.
Design an algorithm to serialize and deserialize a bi... | null | String,Tree,Depth-First Search,Breadth-First Search,Design,Binary Tree | Hard | 271,449,652,765 |
984 | hi guys this is another nickel problem called string without aaa or bbb given two integers a and b return any string s such that s has nest in plus b and it consists exactly a letters in definitely b d letters the sub screen a does not occur in s the substring dbb does not occur in s so for this example a equal to one ... | String Without AAA or BBB | most-stones-removed-with-same-row-or-column | Given two integers `a` and `b`, return **any** string `s` such that:
* `s` has length `a + b` and contains exactly `a` `'a'` letters, and exactly `b` `'b'` letters,
* The substring `'aaa'` does not occur in `s`, and
* The substring `'bbb'` does not occur in `s`.
**Example 1:**
**Input:** a = 1, b = 2
**Output:... | null | Depth-First Search,Union Find,Graph | Medium | null |
316 | today we're gonna be working on lead code question number 316. uh it's called remove and duplicate letters uh given the given a string uh s i remove duplicate letter so that um every letter appears once and only once you must make sure your result is the smallest and lexico graphical order uh among all possible results... | 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 |
922 | welcome to september's leco challenge today's problem is sword array by parody 2. given an array of integers nums half the integers and nums are odd and the other half are even now sort the array so that whenever num's i is odd i is also odd and whenever nums i is even i is talking about the index number return any ans... | Sort Array By Parity II | possible-bipartition | Given an array of integers `nums`, half of the integers in `nums` are **odd**, and the other half are **even**.
Sort the array so that whenever `nums[i]` is odd, `i` is **odd**, and whenever `nums[i]` is even, `i` is **even**.
Return _any answer array that satisfies this condition_.
**Example 1:**
**Input:** nums =... | null | Depth-First Search,Breadth-First Search,Union Find,Graph | Medium | null |
1,348 | well I'm going to do problem number 1,348 of the it code which is called twitcams 1,348 of the it code which is called twitcams 1,348 of the it code which is called twitcams performance and what this problem is about is that you have to teach a class that does certain things with the tweets so to speak we are going to ... | Tweet Counts Per Frequency | tweet-counts-per-frequency | A social media company is trying to monitor activity on their site by analyzing the number of tweets that occur in select periods of time. These periods can be partitioned into smaller **time chunks** based on a certain frequency (every **minute**, **hour**, or **day**).
For example, the period `[10, 10000]` (in **sec... | null | null | Medium | null |
273 | hello friends now let's try to solve the integer to English words okay convert a non-negative integer to English words non-negative integer to English words non-negative integer to English words representation given input is a guaranteed to be less than 2 to the 30 one minus one see example 123 the choctaw enter 345 an... | Integer to English Words | integer-to-english-words | Convert a non-negative integer `num` to its English words representation.
**Example 1:**
**Input:** num = 123
**Output:** "One Hundred Twenty Three "
**Example 2:**
**Input:** num = 12345
**Output:** "Twelve Thousand Three Hundred Forty Five "
**Example 3:**
**Input:** num = 1234567
**Output:** "One Million Tw... | Did you see a pattern in dividing the number into chunk of words? For example, 123 and 123000. Group the number by thousands (3 digits). You can write a helper function that takes a number less than 1000 and convert just that chunk to words. There are many edge cases. What are some good test cases? Does your code work ... | Math,String,Recursion | Hard | 12 |
38 | let's hello morning count and say if think yeah i've done this okay let's see how i did it counter say is a sequence of digit strings defined by the recursive formula um okay count say one is gives you one count say with an n is the way you would say okay the digit string from uh count and same n minus one which is the... | Count and Say | count-and-say | The **count-and-say** sequence is a sequence of digit strings defined by the recursive formula:
* `countAndSay(1) = "1 "`
* `countAndSay(n)` is the way you would "say " the digit string from `countAndSay(n-1)`, which is then converted into a different digit string.
To determine how you "say " a digit string, spli... | The following are the terms from n=1 to n=10 of the count-and-say sequence:
1. 1
2. 11
3. 21
4. 1211
5. 111221
6. 312211
7. 13112221
8. 1113213211
9. 31131211131221
10. 13211311123113112211 To generate the nth term, just count and say the n-1th term. | String | Medium | 271,443 |
5 | longest palindromic substring is a quite easy problem especially if you have some experience in competitive programming we were given a string s with lengths up to 1000 and we should find the longest palindromic substring a substring which is a palindrome so it reads the same backwards first let's think how to check if... | 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 |
127 | hey everyone in this video let's take a look at question 127 Word ladder on lead code this is part of our blind 75 list of questions on Lee code so let's begin in this question a transformation sequence from word begin word to word N word using a dictionary word list is a sequence of words begin word S1 S2 all the way ... | Word Ladder | word-ladder | A **transformation sequence** from word `beginWord` to word `endWord` using a dictionary `wordList` is a sequence of words `beginWord -> s1 -> s2 -> ... -> sk` such that:
* Every adjacent pair of words differs by a single letter.
* Every `si` for `1 <= i <= k` is in `wordList`. Note that `beginWord` does not need ... | null | Hash Table,String,Breadth-First Search | Hard | 126,433 |
96 | Hello hello guys welcome back to tech division in this video you will see the unique entries problem system list date 4th june challenge personal problem given to the number possible tasty unique and having its number from one to the number from one to three subscribe for Subscribe Notes Number One To Three 500 Notes A... | 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 |
135 | Hello gas, I am Lalita Aggarwal, welcome friend, who has understood the problem well, there are six things to try, see this D question literature is very much, it is a question, it is not a matter of taking much quotation, see the tag of hard here. Do n't be afraid, this can be done with a literally greedy approach. Th... | Candy | candy | There are `n` children standing in a line. Each child is assigned a rating value given in the integer array `ratings`.
You are giving candies to these children subjected to the following requirements:
* Each child must have at least one candy.
* Children with a higher rating get more candies than their neighbors.... | null | Array,Greedy | Hard | null |
389 | Jhaal Hello Hi Guys Welcome To Cold Be Used As Question Spinal Difference In This Question Being Given To Streets As A Team Which Consists Of Only Lower Case Latest Printed Per And Subscribe The Amazing Position Mid Day Miles Per Hour Will Contain All Of Hindi World Channel Like This acid subscribe and subscribe the Ch... | Find the Difference | find-the-difference | You are given two strings `s` and `t`.
String `t` is generated by random shuffling string `s` and then add one more letter at a random position.
Return the letter that was added to `t`.
**Example 1:**
**Input:** s = "abcd ", t = "abcde "
**Output:** "e "
**Explanation:** 'e' is the letter that was added.
**Exam... | null | Hash Table,String,Bit Manipulation,Sorting | Easy | 136 |
29 | hello everyone let's talk about um this little problem divide two integers it's actually a good problem i think but in because there are a lot of some sounds it's because um there are a lot corner cases and said make people very upset for example second cases are about integer maxima integer minimum and sometimes it wi... | Divide Two Integers | divide-two-integers | Given two integers `dividend` and `divisor`, divide two integers **without** using multiplication, division, and mod operator.
The integer division should truncate toward zero, which means losing its fractional part. For example, `8.345` would be truncated to `8`, and `-2.7335` would be truncated to `-2`.
Return _the... | null | Math,Bit Manipulation | Medium | null |
342 | all right what's going on gents ladies and folks today we're going to go ahead and solve this question over here power of four using recursion so let me just go ahead we saw that we'll reset the code we can go from there so let me just move this second there we go okay given an integer and return truth powders four oth... | 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 |
1,973 | hello everyone welcome to my channel this is Leo let's do some more lead code problems today so this problem is called count no equal to sum of descendants so basically we were given the root of a binary tree and we were asked to return the number of nodes where the value of nodes is equal to the sum of the values of h... | Count Nodes Equal to Sum of Descendants | count-nodes-equal-to-sum-of-descendants | Given the `root` of a binary tree, return _the number of nodes where the value of the node is equal to the **sum** of the values of its descendants_.
A **descendant** of a node `x` is any node that is on the path from node `x` to some leaf node. The sum is considered to be `0` if the node has no descendants.
**Exampl... | null | null | Medium | null |
392 | hey guys how's it been going this is Jay sir in this video I'm going to take a 392 is sub sequence for given a string s and a string T check everything as is subsequent of T a subsequence of a string is a new string which is formed from the original string from deleting by deleting some can be none of the characters wi... | Is Subsequence | is-subsequence | Given two strings `s` and `t`, return `true` _if_ `s` _is a **subsequence** of_ `t`_, or_ `false` _otherwise_.
A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i... | null | Two Pointers,String,Dynamic Programming | Easy | 808,1051 |
1,690 | Hey guys welcome to our channel co division in this video you will be talking about 10 leaves of problems cold store game and will be facing problem number seventh office serious problems cold store game ok and it's n Medium Problem Udhar Leaf Way Can Experience Of Problems Of Stone Pumice 1.10 I Think Similar Problems... | Stone Game VII | maximum-length-of-subarray-with-positive-product | Alice and Bob take turns playing a game, with **Alice starting first**.
There are `n` stones arranged in a row. On each player's turn, they can **remove** either the leftmost stone or the rightmost stone from the row and receive points equal to the **sum** of the remaining stones' values in the row. The winner is the ... | Split the whole array into subarrays by zeroes since a subarray with positive product cannot contain any zero. If the subarray has even number of negative numbers, the whole subarray has positive product. Otherwise, we have two choices, either - remove the prefix till the first negative element in this subarray, or rem... | Array,Dynamic Programming,Greedy | Medium | null |
1,753 | hello everyone welcome back to cs for all so today we are going to do the fourth problem from the stl module of the algo master sheet so it's a problem which you can find in lead code and i won't be telling you the concept right now so i will read the question once and i would ask you to think about the solution on you... | Maximum Score From Removing Stones | path-with-minimum-effort | You are playing a solitaire game with **three piles** of stones of sizes `a`, `b`, and `c` respectively. Each turn you choose two **different non-empty** piles, take one stone from each, and add `1` point to your score. The game stops when there are **fewer than two non-empty** piles (meaning there ar... | Consider the grid as a graph, where adjacent cells have an edge with cost of the difference between the cells. If you are given threshold k, check if it is possible to go from (0, 0) to (n-1, m-1) using only edges of ≤ k cost. Binary search the k value. | Array,Binary Search,Depth-First Search,Breadth-First Search,Union Find,Heap (Priority Queue),Matrix | Medium | 794,1099 |
274 | welcome to august leeco challenge today's problem is h index yes my favorite h index given an array of citations each citation is a non-negative integer each citation is a non-negative integer each citation is a non-negative integer of a researcher write a function to compute the researchers h index they give you the d... | H-Index | h-index | Given an array of integers `citations` where `citations[i]` is the number of citations a researcher received for their `ith` paper, return _the researcher's h-index_.
According to the [definition of h-index on Wikipedia](https://en.wikipedia.org/wiki/H-index): The h-index is defined as the maximum value of `h` such th... | An easy approach is to sort the array first. What are the possible values of h-index? A faster approach is to use extra space. | Array,Sorting,Counting Sort | Medium | 275 |
472 | hello everyone let's solve today's lead code problem concatenated words we are given an array of words and we need to find out order concatenated words in the given words array in this example cat dog cat is comprised of cats dog and cat so it is concatenated word and dog Cat's dog is comprised of dog cats dog so it is... | Concatenated Words | concatenated-words | Given an array of strings `words` (**without duplicates**), return _all the **concatenated words** in the given list of_ `words`.
A **concatenated word** is defined as a string that is comprised entirely of at least two shorter words (not necesssarily distinct) in the given array.
**Example 1:**
**Input:** words = \... | null | Array,String,Dynamic Programming,Depth-First Search,Trie | Hard | 140 |
1,318 | hello so today I'm going through problems of this weekly contest 171 we'll start with the I'm going to do now the second problem which is minimum flips to make a or B equal to C and so the problem says we get three positive integers or numbers a B and C and we want to return the minimum number of flips in some of the b... | Minimum Flips to Make a OR b Equal to c | tournament-winners | Given 3 positives numbers `a`, `b` and `c`. Return the minimum flips required in some bits of `a` and `b` to make ( `a` OR `b` == `c` ). (bitwise OR operation).
Flip operation consists of change **any** single bit 1 to 0 or change the bit 0 to 1 in their binary representation.
**Example 1:**
**Input:** a = 2, b = 6... | null | Database | Hard | null |
421 | hey everybody this is larry this is day 16 of the leeco daily challenge uh hit the like button hit the subscribe button join me on discord uh and let's get started on today's maximum xr of two numbers in a way okay um okay i mean it is what it sounds like and i think uh if you have you know the naive way would be just ... | 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 |
1,913 | hello guys my name is arsala and welcome back to my channel and today we will be solving a new lead code portion that is maximum product between two PS with the help of the JavaScript we will be following this question so the question says the product difference between 2ps a b and CD is defined as a into B minus C int... | Maximum Product Difference Between Two Pairs | make-the-xor-of-all-segments-equal-to-zero | The **product difference** between two pairs `(a, b)` and `(c, d)` is defined as `(a * b) - (c * d)`.
* For example, the product difference between `(5, 6)` and `(2, 7)` is `(5 * 6) - (2 * 7) = 16`.
Given an integer array `nums`, choose four **distinct** indices `w`, `x`, `y`, and `z` such that the **product differ... | Let's note that for the XOR of all segments with size K to be equal to zeros, nums[i] has to be equal to nums[i+k] Basically, we need to make the first K elements have XOR = 0 and then modify them. | Array,Dynamic Programming,Bit Manipulation | Hard | null |
37 | hey everybody this is larry this is day 21st of the august record daily challenge hit the like button hit the subscribe button and join me in discord let me know what you think about 280's problem oh now it's a dugo salva uh okay to be honest i wrote a really optimized version of relatively sudoku self like maybe a lon... | Sudoku Solver | sudoku-solver | Write a program to solve a Sudoku puzzle by filling the empty cells.
A sudoku solution must satisfy **all of the following rules**:
1. Each of the digits `1-9` must occur exactly once in each row.
2. Each of the digits `1-9` must occur exactly once in each column.
3. Each of the digits `1-9` must occur exactly onc... | null | Array,Backtracking,Matrix | Hard | 36,1022 |
162 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem find Peak element we're given an array of integers and they don't mention it here it's mentioned all the way at the bottom of the description but it's a very important fact and it is that any two adjacent elements suppo... | Find Peak Element | find-peak-element | A peak element is an element that is strictly greater than its neighbors.
Given a **0-indexed** integer array `nums`, find a peak element, and return its index. If the array contains multiple peaks, return the index to **any of the peaks**.
You may imagine that `nums[-1] = nums[n] = -∞`. In other words, an element is... | null | Array,Binary Search | Medium | 882,2047,2273,2316 |
133 | Welcome to the new video of the state assigned to and today we are going to see problem number-34 line 7530 follow graph so problem number-34 line 7530 follow graph so problem number-34 line 7530 follow graph so tell us a little about this problem so that we can refer to given reference journey no dinner connected and ... | 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 |
118 | hi everyone today we are going to solve the little question Pascal's triangle so you are given integer numerals Returns the first nominals of Pascal's triangle in Pascal's triangle each number is the sum of the two numbers directly above it as shown so let's see the example you are given numerals equal 5 and the output... | Pascal's Triangle | pascals-triangle | Given an integer `numRows`, return the first numRows of **Pascal's triangle**.
In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown:
**Example 1:**
**Input:** numRows = 5
**Output:** \[\[1\],\[1,1\],\[1,2,1\],\[1,3,3,1\],\[1,4,6,4,1\]\]
**Example 2:**
**Input:** numRows = ... | null | Array,Dynamic Programming | Easy | 119 |
491 | hey everybody this is Larry this is actually me doing day 20 of delete code daily challenge hit the like button hit the Subscribe button drop me on Discord let me know what you think about this poem another one that I haven't done so yay 491 non-decreasing done so yay 491 non-decreasing done so yay 491 non-decreasing s... | Non-decreasing Subsequences | increasing-subsequences | Given an integer array `nums`, return _all the different possible non-decreasing subsequences of the given array with at least two elements_. You may return the answer in **any order**.
**Example 1:**
**Input:** nums = \[4,6,7,7\]
**Output:** \[\[4,6\],\[4,6,7\],\[4,6,7,7\],\[4,7\],\[4,7,7\],\[6,7\],\[6,7,7\],\[7,7\]... | null | Array,Hash Table,Backtracking,Bit Manipulation | Medium | 646 |
309 | uh hey everybody this is larry this is day 29 of the july lead code daily challenge did hit the like button to subscribe one drummer on discord and let's get at it best time to buy and sell stock with cooldown say you have an away if elements the price of a given stock in a given day design algorithm to find the maximu... | Best Time to Buy and Sell Stock with Cooldown | best-time-to-buy-and-sell-stock-with-cooldown | 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 as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the following restrictions:
* After you sell your stock, yo... | null | Array,Dynamic Programming | Medium | 121,122 |
35 | welcome back everybody today we're doing problem 35 searching insert position and this time we're going to be doing it in javascript this was a problem given by amazon in a coding interview now let's read the problem and then we're going to figure out a solution as usual give it a sorted array of distinct integers and ... | 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 |
674 | all right guys so let's talk about longest continuous increasing subsequence so you are given an unsorted array of individual numbers and you just have to return the length of the longest continuous increasing subsequence and the subsequence must be strictly increasing so this is the definition of continuous increasing... | Longest Continuous Increasing Subsequence | longest-continuous-increasing-subsequence | Given an unsorted array of integers `nums`, return _the length of the longest **continuous increasing subsequence** (i.e. subarray)_. The subsequence must be **strictly** increasing.
A **continuous increasing subsequence** is defined by two indices `l` and `r` (`l < r`) such that it is `[nums[l], nums[l + 1], ..., num... | null | Array | Easy | 673,727 |
547 | in this video we're going to look at a legal problem called number of provinces so there are a number of cities some of them are connected while some of them are not so if city a is connected directly with city b and city b is connected directly with cdc then the city a is connected indirectly with city c right so you ... | Number of Provinces | number-of-provinces | There are `n` cities. Some of them are connected, while some are not. If city `a` is connected directly with city `b`, and city `b` is connected directly with city `c`, then city `a` is connected indirectly with city `c`.
A **province** is a group of directly or indirectly connected cities and no other cities outside ... | null | Depth-First Search,Breadth-First Search,Union Find,Graph | Medium | 323,657,734,737,1085,2206 |
1,801 | hey everybody this is larry this is me going with q2 of the uh weekly contest 2.3 uh weekly contest 2.3 uh weekly contest 2.3 uh number of orders in the backlog so this is just a simulation um you have to do things in a heap i think that's the biggest part um i actually had a what did i do oh i had a typo that's why bu... | Number of Orders in the Backlog | average-time-of-process-per-machine | You are given a 2D integer array `orders`, where each `orders[i] = [pricei, amounti, orderTypei]` denotes that `amounti` orders have been placed of type `orderTypei` at the price `pricei`. The `orderTypei` is:
* `0` if it is a batch of `buy` orders, or
* `1` if it is a batch of `sell` orders.
Note that `orders[i]... | null | Database | Easy | null |
12 | everyone welcome back and let's write some more neat code today so today let's solve the problem integer to roman recently we solved the opposite problem roman to integer i'll link to that somewhere in the top right if you want to check out that solution it's a pretty similar problem in this case though we are given so... | Integer to Roman | integer-to-roman | Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`.
**Symbol** **Value**
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, `2` is written as `II` in Roman numeral, just two one's adde... | null | Hash Table,Math,String | Medium | 13,273 |
581 | hi guys hope you're doing great a today's question is shortest unsalted continuous sub-array given an integer continuous sub-array given an integer continuous sub-array given an integer array you need to find one continuous sub array then if you only sought this sub array in ascending order then the whole array will be... | Shortest Unsorted Continuous Subarray | shortest-unsorted-continuous-subarray | Given an integer array `nums`, you need to find one **continuous subarray** that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order.
Return _the shortest such subarray and output its length_.
**Example 1:**
**Input:** nums = \[2,6,4,8,10,9,15\]
**Output:** 5
**E... | null | Array,Two Pointers,Stack,Greedy,Sorting,Monotonic Stack | Medium | null |
253 | okay so lead code practice time so two goals the first one is to see how to solve this problem and then we also put some solid code here and the other thing is to see how to behave properly in the interview so let's get started so remember the first thing in the interview is always to try to understand the problem uh i... | 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 |
380 | hey everybody this is Larry this is day 16 of the leco daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's PR and today's uh video and all these things uh we'll just go straight to the pr this time I'm a little bit tired I'm trying to take a nap but I... | Insert Delete GetRandom O(1) | insert-delete-getrandom-o1 | Implement the `RandomizedSet` class:
* `RandomizedSet()` Initializes the `RandomizedSet` object.
* `bool insert(int val)` Inserts an item `val` into the set if not present. Returns `true` if the item was not present, `false` otherwise.
* `bool remove(int val)` Removes an item `val` from the set if present. Retur... | null | Array,Hash Table,Math,Design,Randomized | Medium | 381 |
1,785 | hey everybody this is larry this is me going with q2 of the weekly contest 231 minimum elements to add to form a given sum i did trash on this form uh i have as you can see i spent eight minutes and two wrong answers um and you can watch me start with live afterwards because the short answer is i misread the prom uh so... | Minimum Elements to Add to Form a Given Sum | hopper-company-queries-ii | You are given an integer array `nums` and two integers `limit` and `goal`. The array `nums` has an interesting property that `abs(nums[i]) <= limit`.
Return _the minimum number of elements you need to add to make the sum of the array equal to_ `goal`. The array must maintain its property that `abs(nums[i]) <= limit`.
... | null | Database | Hard | 262,1779,1795,2376 |
628 | hello everyone so in this video let us talk about a problem from lead code the problem name is maximum product of three numbers so the problem goes like this that you're given an integer array nums find three numbers whose product is maximum and return the maximum product of those three numbers so given a nums area as ... | Maximum Product of Three Numbers | maximum-product-of-three-numbers | Given an integer array `nums`, _find three numbers whose product is maximum and return the maximum product_.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** 6
**Example 2:**
**Input:** nums = \[1,2,3,4\]
**Output:** 24
**Example 3:**
**Input:** nums = \[-1,-2,-3\]
**Output:** -6
**Constraints:**
* `3 <... | null | Array,Math,Sorting | Easy | 152 |
539 | you what's up guys think we're here and you Tecna coding stuff on twitch and YouTube check the description for all my information I do premium link oh problems on my patreon you can reach out to me via discord this is 539 minimum time difference I like this problem I think it's a one that definitely makes you think for... | Minimum Time Difference | minimum-time-difference | Given a list of 24-hour clock time points in **"HH:MM "** format, return _the minimum **minutes** difference between any two time-points in the list_.
**Example 1:**
**Input:** timePoints = \["23:59","00:00"\]
**Output:** 1
**Example 2:**
**Input:** timePoints = \["00:00","23:59","00:00"\]
**Output:** 0
**Constrai... | null | Array,Math,String,Sorting | Medium | 2266 |
1,339 | hello this is problem number three of contest 174 here we are given a binary tree and we have to spread the binary tree into two parts and take separately the sum of each part and then multiply it so we have to maximize the product for example here we are given a binary tree and we are going to split the binary tree fr... | 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,021 | hey how you doing guys it's ilya bella here i recorded stuff on youtube share description for all my information i do all political problems make sure you um subscribe to this channel give me a big thumbs up to support it and this is called remove outermost parentheses a valid parenthesis rin is either empty uh this ri... | Remove Outermost Parentheses | distribute-coins-in-binary-tree | A valid parentheses string is either empty `" "`, `"( " + A + ") "`, or `A + B`, where `A` and `B` are valid parentheses strings, and `+` represents string concatenation.
* For example, `" "`, `"() "`, `"(())() "`, and `"(()(())) "` are all valid parentheses strings.
A valid parentheses string `s` is primitive if i... | null | Tree,Depth-First Search,Binary Tree | Medium | 863,1008 |
38 | whoo hey everybody this is Larry this is day 18 of the legal daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's poem count and say I'm in I'm still in San Francisco I don't know why I'm speaking a little bit of a lisp right now but I hope you don't k... | Count and Say | count-and-say | The **count-and-say** sequence is a sequence of digit strings defined by the recursive formula:
* `countAndSay(1) = "1 "`
* `countAndSay(n)` is the way you would "say " the digit string from `countAndSay(n-1)`, which is then converted into a different digit string.
To determine how you "say " a digit string, spli... | The following are the terms from n=1 to n=10 of the count-and-say sequence:
1. 1
2. 11
3. 21
4. 1211
5. 111221
6. 312211
7. 13112221
8. 1113213211
9. 31131211131221
10. 13211311123113112211 To generate the nth term, just count and say the n-1th term. | String | Medium | 271,443 |
209 | hi everyone it's Soren today we are going to solve minimum size subarray sound problem the problem is that we are given an array for example in this case we are given this array and we are given a Target we need to find the minimum uh minimum we need to find the subarray with the minimum length that makes to our Target... | 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 |
1,720 | hey everybody this is larry this is me going with q1 of the weekly contest 223 uh decode xor array um yeah so this one is a little bit um for easy problem it's a little bit tricky uh because you're basically asked to decode something given an encoded version so in theory what they're saying is you know given this thing... | 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 |
216 | hello everyone welcome to day 10 of lead code may challenge today we have question number 216 combination sum 3 where we have to find all the valid combination of k numbers that sum up to n such that the following conditions are true only number 1 through 9 are used and each number is used at most once we have to writt... | Combination Sum III | combination-sum-iii | Find all valid combinations of `k` numbers that sum up to `n` such that the following conditions are true:
* Only numbers `1` through `9` are used.
* Each number is used **at most once**.
Return _a list of all possible valid combinations_. The list must not contain the same combination twice, and the combinations... | null | Array,Backtracking | Medium | 39 |
1,759 | so hello everyone welcome to my channel so in this video i will be solving this problem uh explaining this problem uh count number of homogeneous substring so in this video first of all we will discuss the problem then we will build our approach and then we will code it okay so problem uh it makes its clear itself so g... | Count Number of Homogenous Substrings | find-the-missing-ids | Given a string `s`, return _the number of **homogenous** substrings of_ `s`_._ Since the answer may be too large, return it **modulo** `109 + 7`.
A string is **homogenous** if all the characters of the string are the same.
A **substring** is a contiguous sequence of characters within a string.
**Example 1:**
**Inpu... | null | Database | Medium | 1357,1420,1467 |
1,395 | hey how are you doing guys it's ilya bella here i recording stuff on youtube chat description for all my information i do all lead code problems make sure you um subscribe to the channel give me big thumbs up to support it and this is called count number of teams there are n soldiers standing in a line each soldier is ... | Count Number of Teams | minimum-time-visiting-all-points | There are `n` soldiers standing in a line. Each soldier is assigned a **unique** `rating` value.
You have to form a team of 3 soldiers amongst them under the following rules:
* Choose 3 soldiers with index (`i`, `j`, `k`) with rating (`rating[i]`, `rating[j]`, `rating[k]`).
* A team is valid if: (`rating[i] < rat... | To walk from point A to point B there will be an optimal strategy to walk ? Advance in diagonal as possible then after that go in straight line. Repeat the process until visiting all the points. | Array,Math,Geometry | Easy | null |
468 | hey everybody this is larry this is day 16 of the june the code daily challenge let's actually update the page uh hit the like button hit the subscribe button join the discord channel there's a link somewhere below uh yeah let's get started okay validate ip address that's like a claim uh well data an ip address okay th... | Validate IP Address | validate-ip-address | Given a string `queryIP`, return `"IPv4 "` if IP is a valid IPv4 address, `"IPv6 "` if IP is a valid IPv6 address or `"Neither "` if IP is not a correct IP of any type.
**A valid IPv4** address is an IP in the form `"x1.x2.x3.x4 "` where `0 <= xi <= 255` and `xi` **cannot contain** leading zeros. For example, `"192.16... | null | String | Medium | 752 |
206 | Jhaal Hello Hi Guys Welcome To Korba Express Today Score Dinesh Trivedi Liquid Being Given A Single English Hindi Input Endeavor To Return Dhoy Vriddhi Reverse Of Liquid Temple Which Was Given To A Person In This One To Three 500 And Returned To 54321 Will Do This Question On Which reversal of liquid convenient base fi... | Reverse Linked List | reverse-linked-list | Given the `head` of a singly linked list, reverse the list, and return _the reversed list_.
**Example 1:**
**Input:** head = \[1,2,3,4,5\]
**Output:** \[5,4,3,2,1\]
**Example 2:**
**Input:** head = \[1,2\]
**Output:** \[2,1\]
**Example 3:**
**Input:** head = \[\]
**Output:** \[\]
**Constraints:**
* The number... | null | Linked List,Recursion | Easy | 92,156,234,2196,2236 |
1,431 | hey everyone welcome to Tech quiet in this video we are going to solve problem number 1431 kids with the greatest number of candies first we will see the explanation of the problem statement in the logic and the code now let's dive into the solution so here I have taken the first example from the leeco website so here ... | Kids With the Greatest Number of Candies | all-ancestors-of-a-node-in-a-directed-acyclic-graph | There are `n` kids with candies. You are given an integer array `candies`, where each `candies[i]` represents the number of candies the `ith` kid has, and an integer `extraCandies`, denoting the number of extra candies that you have.
Return _a boolean array_ `result` _of length_ `n`_, where_ `result[i]` _is_ `true` _i... | Consider how reversing each edge of the graph can help us. How can performing BFS/DFS on the reversed graph help us find the ancestors of every node? | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 1912 |
1,186 | Hello hello everyone welcome to my channel but today we will discuss problem list as d maximum morning evening with one devotion and the problem number is 186 so let's talk about the problems statement name problem statement pimple use to find the maximum morning evening with world election A Superheroine Exam Police's... | Maximum Subarray Sum with One Deletion | building-h2o | Given an array of integers, return the maximum sum for a **non-empty** subarray (contiguous elements) with at most one element deletion. In other words, you want to choose a subarray and optionally delete one element from it so that there is still at least one element left and the sum of the remaining elements is maxim... | null | Concurrency | Medium | null |
474 | Jhal Ajay Ko Hello friends welcome to my YouTube channel Tier-3 channel Tier-3 channel Tier-3 Author Health Problem for 1974 Problem Yashwant Ji Shyam Problem which is Medium Category A Prerequisite for the Problem Dynamic Programming Author Equation So Let's Do Problem Statement This York Times in 0 Subscribe 1001 Sub... | Ones and Zeroes | ones-and-zeroes | You are given an array of binary strings `strs` and two integers `m` and `n`.
Return _the size of the largest subset of `strs` such that there are **at most**_ `m` `0`_'s and_ `n` `1`_'s in the subset_.
A set `x` is a **subset** of a set `y` if all elements of `x` are also elements of `y`.
**Example 1:**
**Input:**... | null | Array,String,Dynamic Programming | Medium | 510,600,2261 |
1,444 | hello welcome to lead code number 1444 number of ways of cutting a pizza so this is a really nice problem i really like this problem and let's actually go through this right so uh we given rectangular pizza so first thing first pizzas are usually circular but the question gives us a rectangular pizza represented as row... | Number of Ways of Cutting a Pizza | number-of-steps-to-reduce-a-number-to-zero | Given a rectangular pizza represented as a `rows x cols` matrix containing the following characters: `'A'` (an apple) and `'.'` (empty cell) and given the integer `k`. You have to cut the pizza into `k` pieces using `k-1` cuts.
For each cut you choose the direction: vertical or horizontal, then you choose a cut positi... | Simulate the process to get the final answer. | Math,Bit Manipulation | Easy | 1303,2288 |
303 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem range sum query immutable we're given an integer array of nums and we want to be able to handle multiple queries that are pretty simple we're just going to be given a left value and a right value which are going to repr... | Range Sum Query - Immutable | range-sum-query-immutable | Given an integer array `nums`, handle multiple queries of the following type:
1. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`.
Implement the `NumArray` class:
* `NumArray(int[] nums)` Initializes the object with the integer array `nums`.
* ... | null | Array,Design,Prefix Sum | Easy | 304,307,325 |
1,700 | foreign series you can go and you can check out the series as well you can check the series and you can learn whatever you want so there are some of the problems I have solved here so this is from the very basic you can go through and solve by yourself so here it is given there are lots of things are given so what it i... | 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 |
368 | it has been asked by Amazon Microsoft Bloomberg Apple Yahoo and Google hi guys good morning welcome back to a new video this we going see problem largest divisible subset and for most of you including me it was a problem like oh ASA this kind of reaction for sure might have come or will come uh if you will solve this p... | Largest Divisible Subset | largest-divisible-subset | Given a set of **distinct** positive integers `nums`, return the largest subset `answer` such that every pair `(answer[i], answer[j])` of elements in this subset satisfies:
* `answer[i] % answer[j] == 0`, or
* `answer[j] % answer[i] == 0`
If there are multiple solutions, return any of them.
**Example 1:**
**Inp... | null | Array,Math,Dynamic Programming,Sorting | Medium | null |
639 | hey everybody this is larry this is day 10 of the july league code daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's problem decode race 2 okay i mean i will say well one is i usually solve these lives so if it's a little bit slow fast forward what ... | Decode Ways II | decode-ways-ii | A message containing letters from `A-Z` can be **encoded** into numbers using the following mapping:
'A' -> "1 "
'B' -> "2 "
...
'Z' -> "26 "
To **decode** an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For examp... | null | String,Dynamic Programming | Hard | 91,2091,2251 |
786 | hey what's up guys this is chung here so today uh let's take a look at another lead code problem here number 786 case smallest prime fraction so okay you're given like a sorted array integer array containing a one and prime numbers only the one and the prime numbers again right so one is not a prime number right so pri... | K-th Smallest Prime Fraction | search-in-a-sorted-array-of-unknown-size | You are given a sorted integer array `arr` containing `1` and **prime** numbers, where all the integers of `arr` are unique. You are also given an integer `k`.
For every `i` and `j` where `0 <= i < j < arr.length`, we consider the fraction `arr[i] / arr[j]`.
Return _the_ `kth` _smallest fraction considered_. Return y... | null | Array,Binary Search,Interactive | Medium | 792,1672 |
82 | Hello Hi Guys Welcome To Our Dhundhi See Today Will See The Question Remove Duplicates From Left To Delete All No Specific Number 19 Number From The Return Of The Value Of Three And Not Content With Values But Only Of Three And Not Content With Values But Only Of Three And Not Content With Values But Only One To ... | Remove Duplicates from Sorted List II | remove-duplicates-from-sorted-list-ii | Given the `head` of a sorted linked list, _delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list_. Return _the linked list **sorted** as well_.
**Example 1:**
**Input:** head = \[1,2,3,3,4,4,5\]
**Output:** \[1,2,5\]
**Example 2:**
**Input:** head = \[1,1,1,2,3\]
**Outpu... | null | Linked List,Two Pointers | Medium | 83,1982 |
150 | Hello everyone welcome, this is the question of my channel and such questions are very popular. Literally such questions are asked everywhere. I am fine in multiple times. Who asked who? Microsoft Amazon Apple Flipkart Transactions Okay. Let's understand by looking at the input and output of the question. What is the q... | Evaluate Reverse Polish Notation | evaluate-reverse-polish-notation | You are given an array of strings `tokens` that represents an arithmetic expression in a [Reverse Polish Notation](http://en.wikipedia.org/wiki/Reverse_Polish_notation).
Evaluate the expression. Return _an integer that represents the value of the expression_.
**Note** that:
* The valid operators are `'+'`, `'-'`, ... | null | Array,Math,Stack | Medium | 224,282 |
1,975 | hi everyone it's sorin today we have a problem when we are given n to n Matrix and we can do the following operation to The Matrix so we can take the two any adjacent two elements and multiply that 2 minus one so for example in this case we have 1 - one - one and one right so we have 1 - one - one and one right so we h... | Maximum Matrix Sum | minimum-distance-to-the-target-element | You are given an `n x n` integer `matrix`. You can do the following operation **any** number of times:
* Choose any two **adjacent** elements of `matrix` and **multiply** each of them by `-1`.
Two elements are considered **adjacent** if and only if they share a **border**.
Your goal is to **maximize** the summatio... | Loop in both directions until you find the target element. For each index i such that nums[i] == target calculate abs(i - start). | Array | Easy | null |
47 | um hello so today we are going to take a look at this problem called uh permutations with duplicates so what this problem asks us to do is to return all possible permutations of a list of integers that may contain duplicates so for example here we have a list of integers two to three and we want to return the all the p... | 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 |
1,706 | welcome to Lakewood JavaScript a channel where we solve every single little question using JavaScript today we have 1706 where will the ball fall this is a medium question um the implementation really isn't that difficult but it might be a bit harder to understand initially so let's begin we have a 2d grid of size M ti... | Where Will the Ball Fall | min-cost-to-connect-all-points | You have a 2-D `grid` of size `m x n` representing a box, and you have `n` balls. The box is open on the top and bottom sides.
Each cell in the box has a diagonal board spanning two corners of the cell that can redirect a ball to the right or to the left.
* A board that redirects the ball to the right spans the top... | Connect each pair of points with a weighted edge, the weight being the manhattan distance between those points. The problem is now the cost of minimum spanning tree in graph with above edges. | Array,Union Find,Minimum Spanning Tree | Medium | 2287 |
507 | that is equal to the sum of its positive devices excluding the number itself a divisor of an integer X is an integer that can divide X evenly so given integer and we can prove if it is a perfect number otherwise rate of false so what do you mean by perfect numbers you have given a number and we have to check whether th... | Perfect Number | perfect-number | A [**perfect number**](https://en.wikipedia.org/wiki/Perfect_number) is a **positive integer** that is equal to the sum of its **positive divisors**, excluding the number itself. A **divisor** of an integer `x` is an integer that can divide `x` evenly.
Given an integer `n`, return `true` _if_ `n` _is a perfect number,... | null | Math | Easy | 728 |
368 | hello everyone this is DSS zindabad let's talk about the daily challenge for today on code so the problem given to us as largest divisible subset let's jump into the problem statement given a set of distinct positive integers nums we need to return the largest subset answer such that every pair that means answer I comm... | Largest Divisible Subset | largest-divisible-subset | Given a set of **distinct** positive integers `nums`, return the largest subset `answer` such that every pair `(answer[i], answer[j])` of elements in this subset satisfies:
* `answer[i] % answer[j] == 0`, or
* `answer[j] % answer[i] == 0`
If there are multiple solutions, return any of them.
**Example 1:**
**Inp... | null | Array,Math,Dynamic Programming,Sorting | Medium | null |
349 | hey and welcome today we will solve intersection of two arrays interview question this question has been mostly asked by Google as well as some other companies like so we will explore two solutions for this problem so without further Ado let's Dive In so first example here we have two arrays and we only look upon numbe... | Intersection of Two Arrays | intersection-of-two-arrays | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must be **unique** and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2\]
**Example 2:**
**Input:** nums1 = \[4,9,5\], nums2 = \... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 350,1149,1392,2190,2282 |
1,768 | hey everyone welcome to Tech quiet in this video we are going to solve problem number 1768 merge strings alternately first we will see the explanation of the problem statement then the logic and the code now let's dive into the solution so here I have taken an example so here we are given two words right word one and w... | Merge Strings Alternately | design-an-expression-tree-with-evaluate-function | You are given two strings `word1` and `word2`. Merge the strings by adding letters in alternating order, starting with `word1`. If a string is longer than the other, append the additional letters onto the end of the merged string.
Return _the merged string._
**Example 1:**
**Input:** word1 = "abc ", word2 = "pqr "... | Apply the concept of Polymorphism to get a good design Implement the Node class using NumericNode and OperatorNode classes. NumericNode only maintains the value and evaluate returns this value. OperatorNode Maintains the left and right nodes representing the left and right operands, and the evaluate function applies th... | Math,Stack,Tree,Design,Binary Tree | Medium | null |
1,837 | lead code 1837 sum of digits in base K given an integer n in base 10 and a base K return the sum of the digits of n after converting n from base 10 to base K after converting each digit should be interpreted as a base 10 number and the sum should be returned in base 10 so basically what they're saying is they'll give a... | Sum of Digits in Base K | daily-leads-and-partners | Given an integer `n` (in base `10`) and a base `k`, return _the **sum** of the digits of_ `n` _**after** converting_ `n` _from base_ `10` _to base_ `k`.
After converting, each digit should be interpreted as a base `10` number, and the sum should be returned in base `10`.
**Example 1:**
**Input:** n = 34, k = 6
**Out... | null | Database | Easy | null |
873 | hey everybody this is larry this is august 20th 2022. um we're gonna try to do me let's just say a medium one uh and a bonus question for the day and hopefully one day i haven't done b well it'll have to be one i haven't done before but i'm gonna choose a medium one usually i don't choose the difficulty but we did a ha... | Length of Longest Fibonacci Subsequence | guess-the-word | A sequence `x1, x2, ..., xn` is _Fibonacci-like_ if:
* `n >= 3`
* `xi + xi+1 == xi+2` for all `i + 2 <= n`
Given a **strictly increasing** array `arr` of positive integers forming a sequence, return _the **length** of the longest Fibonacci-like subsequence of_ `arr`. If one does not exist, return `0`.
A **subseq... | null | Array,Math,String,Interactive,Game Theory | Hard | null |
9 | everyone welcome back and let's write some more neat code today so today let's solve the problem palindrome number in this problem we're given an integer x and we want to return true if and only if this integer x is a palindrome number and what exactly is a palindrome well basically a number that reads the same way as ... | 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 |
1,189 | all right so let's talk about the maximum number of balloons so you're giving it a string text so you want to use a character of text to form as many as instant of the word balloon as possible so in this example okay i'm just giving two examples so uh this is b this is a and double l and double and y so balloon is spel... | Maximum Number of Balloons | encode-number | Given a string `text`, you want to use the characters of `text` to form as many instances of the word **"balloon "** as possible.
You can use each character in `text` **at most once**. Return the maximum number of instances that can be formed.
**Example 1:**
**Input:** text = "nlaebolko "
**Output:** 1
**Example 2... | Try to find the number of binary digits returned by the function. The pattern is to start counting from zero after determining the number of binary digits. | Math,String,Bit Manipulation | Medium | 1070 |
525 | hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you not like the video please like it subscribe to my channel and hit the bell icon so that you get notified whenever i post a new video so without any further ado let's get started so probl... | Contiguous Array | contiguous-array | Given a binary array `nums`, return _the maximum length of a contiguous subarray with an equal number of_ `0` _and_ `1`.
**Example 1:**
**Input:** nums = \[0,1\]
**Output:** 2
**Explanation:** \[0, 1\] is the longest contiguous subarray with an equal number of 0 and 1.
**Example 2:**
**Input:** nums = \[0,1,0\]
**O... | null | Array,Hash Table,Prefix Sum | Medium | 325 |
333 | hey guys what's up today's question what we're going to say is 363 the largest bic sub-tree bic sub-tree bic sub-tree it says that given the root of binary tree find the largest sub tree which will also be aps t and just so you can see from this graph uh the original root for from this tree will not might not be a bst ... | Largest BST Subtree | largest-bst-subtree | Given the root of a binary tree, find the largest subtree, which is also a Binary Search Tree (BST), where the largest means subtree has the largest number of nodes.
A **Binary Search Tree (BST)** is a tree in which all the nodes follow the below-mentioned properties:
* The left subtree values are less than the val... | You can recursively use algorithm similar to 98. Validate Binary Search Tree at each node of the tree, which will result in O(nlogn) time complexity. | Dynamic Programming,Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | null |
1,464 | hey guys this is yessir has been going this video I'm going to take a look at 1:46 for a easy one maximum product 1:46 for a easy one maximum product 1:46 for a easy one maximum product of two elements in the array we're giving array of integers I will choose two different indices I and J that of the array return the m... | Maximum Product of Two Elements in an Array | reduce-array-size-to-the-half | Given the array of integers `nums`, you will choose two different indices `i` and `j` of that array. _Return the maximum value of_ `(nums[i]-1)*(nums[j]-1)`.
**Example 1:**
**Input:** nums = \[3,4,5,2\]
**Output:** 12
**Explanation:** If you choose the indices i=1 and j=2 (indexed from 0), you will get the maximum v... | Count the frequency of each integer in the array. Start with an empty set, add to the set the integer with the maximum frequency. Keep Adding the integer with the max frequency until you remove at least half of the integers. | Array,Hash Table,Greedy,Sorting,Heap (Priority Queue) | Medium | null |
1,696 | hello everyone welcome to learn how flow in this video we will look into another difficult problem that is a jump game six so this is an a medium level problem we will go through the question and then try to understand what the question is asking us to do and how exactly we can uh do that question uh in a better way we... | 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 |
230 | Hello Everyone Today's Question Obscene Statement in BSC 1st Friday Function K Small Is To Find The K Smallest Element Pith Not Given May Zoom K Is Always Valid K Always Get Victory In The Districts To Bsc Total Elements Nine Inmates Of Paper Near Whole And Cents Questions And You Will Not Get Solution On Soi Pawar Ke ... | 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 |
307 | Text is so ifine messages Gautam Cheeni to update the past behavior subscribe Free 087 subscribe and subscribe the Video then subscribe to the Page article check brothers where kids note and this is interfering subscribe 9 hai to victim of and twenty - victim of and twenty - victim of and twenty - 20 of - 151 - Davidso... | Range Sum Query - Mutable | range-sum-query-mutable | Given an integer array `nums`, handle multiple queries of the following types:
1. **Update** the value of an element in `nums`.
2. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`.
Implement the `NumArray` class:
* `NumArray(int[] nums)` Initi... | null | Array,Design,Binary Indexed Tree,Segment Tree | Medium | 303,308 |
1,284 | hey guys welcome to my channel i am napia so today we will be solving read good question number one two eight four minimum number of lips to convert binary matrix to a zero matrix so let's see what the question is along with some given examples so uh the question says that we are given an n m cross n binary matrix so b... | Minimum Number of Flips to Convert Binary Matrix to Zero Matrix | four-divisors | Given a `m x n` binary matrix `mat`. In one step, you can choose one cell and flip it and all the four neighbors of it if they exist (Flip is changing `1` to `0` and `0` to `1`). A pair of cells are called neighbors if they share one edge.
Return the _minimum number of steps_ required to convert `mat` to a zero matrix... | Find the divisors of each element in the array. You only need to loop to the square root of a number to find its divisors. | Array,Math | Medium | null |
228 | hello and welcome to another Elite code problem we're going to be doing the problem of the day for June 12th and it's pretty straightforward in summary ranges so you're giving it uh assorted unique integer array nums and then it's telling you a range is a set of integers from all the A to B inclusive return the smalles... | 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 |
122 | hi guys welcome to channel this is vaga we're going to do another leash good question and the question in question is going to be number one to two best time to buy and sell stock parts two right so you're given an array of prices you're supposed to buy and sell as many times as possible with the aim of making as much ... | Best Time to Buy and Sell Stock II | best-time-to-buy-and-sell-stock-ii | You are given an integer array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
On each day, you may decide to buy and/or sell the stock. You can only hold **at most one** share of the stock at any time. However, you can buy it then immediately sell it on the **same day**.
Find and return _t... | null | Array,Dynamic Programming,Greedy | Medium | 121,123,188,309,714 |
1,192 | hey what's up guys uh this is jung here so today uh today's daily challenge problem right number 1192 critical connections in a network so this one is a very classic you know a graph problem you know okay so let's take a look at this description here so your direct n servers numbered from n to zero to n minus one right... | Critical Connections in a Network | divide-chocolate | There are `n` servers numbered from `0` to `n - 1` connected by undirected server-to-server `connections` forming a network where `connections[i] = [ai, bi]` represents a connection between servers `ai` and `bi`. Any server can reach other servers directly or indirectly through the network.
A _critical connection_ is ... | After dividing the array into K+1 sub-arrays, you will pick the sub-array with the minimum sum. Divide the sub-array into K+1 sub-arrays such that the minimum sub-array sum is as maximum as possible. Use binary search with greedy check. | Array,Binary Search | Hard | 410,1056 |
168 | hello and welcome to another video in this video we're going to be going over Excel sheet column title so in this problem you're given an integer and you want to return its corresponding column title as it appears on the Excel sheet for example a should be 1 B2 C3 z26 a2728 so the difference between this and a base 26 ... | Excel Sheet Column Title | excel-sheet-column-title | Given an integer `columnNumber`, return _its corresponding column title as it appears in an Excel sheet_.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
**Example 1:**
**Input:** columnNumber = 1
**Output:** "A "
**Example 2:**
**Input:** columnNumber = 28
**Output:** "AB "
**Example 3:**... | null | Math,String | Easy | 171,2304 |
229 | Hello, this will be discussing question number 229 of majority element 1000. Before this, what was asked in the discussion that we have about the element which is majority element, there is nothing in it and this notation is given in it, floor notation, it is called rotation. So there is nothing in this that which was ... | Majority Element II | majority-element-ii | Given an integer array of size `n`, find all elements that appear more than `⌊ n/3 ⌋` times.
**Example 1:**
**Input:** nums = \[3,2,3\]
**Output:** \[3\]
**Example 2:**
**Input:** nums = \[1\]
**Output:** \[1\]
**Example 3:**
**Input:** nums = \[1,2\]
**Output:** \[1,2\]
**Constraints:**
* `1 <= nums.length <... | How many majority elements could it possibly have?
Do you have a better hint? Suggest it! | Array,Hash Table,Sorting,Counting | Medium | 169,1102 |
128 | 128 longest consecutive sequence now the question is a medium level question and it is saying that given an unsorted array of integers so the example we have here is a hundred four two hundred one three 132 return the longest length of the consecutive elements and we have a constraint here saying that we have to write ... | 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 |
86 | Jhaal Loot Hello Hi Gaye Is Letter To A Question Limitless Questions Politics Media Question Awadhi Hello Friends Politicians Not Lose subscribe our Channel Ko sabsakraib a hai to Interest Rates Vihar-3 Hospital Interest Rates Vihar-3 Hospital Interest Rates Vihar-3 Hospital Admit Want to and to write what will give on... | Partition List | partition-list | Given the `head` of a linked list and a value `x`, partition it such that all nodes **less than** `x` come before nodes **greater than or equal** to `x`.
You should **preserve** the original relative order of the nodes in each of the two partitions.
**Example 1:**
**Input:** head = \[1,4,3,2,5,2\], x = 3
**Output:**... | null | Linked List,Two Pointers | Medium | 2265 |
32 | hello everybody and welcome to another episode of your favorite algorithm channel my name is Ryan powers and today I'm gonna be taking you through longest valid parentheses so this is the third parentheses problem that we've done valid parentheses we've done generate parentheses and now we're going to do longest valid ... | Longest Valid Parentheses | longest-valid-parentheses | Given a string containing just the characters `'('` and `')'`, return _the length of the longest valid (well-formed) parentheses_ _substring_.
**Example 1:**
**Input:** s = "(() "
**Output:** 2
**Explanation:** The longest valid parentheses substring is "() ".
**Example 2:**
**Input:** s = ")()()) "
**Output:** ... | null | String,Dynamic Programming,Stack | Hard | 20 |
174 | hey hello there today's liquor in challenge cousins comment on Jenga the description about the problem is pretty long let me try to give a summarization we have a 2d grid that's all the positions we can be in this game we have a princess alone on the bottom right and we're starting out as a knight on the top left our t... | Dungeon Game | dungeon-game | The demons had captured the princess and imprisoned her in **the bottom-right corner** of a `dungeon`. The `dungeon` consists of `m x n` rooms laid out in a 2D grid. Our valiant knight was initially positioned in **the top-left room** and must fight his way through `dungeon` to rescue the princess.
The knight has an i... | null | Array,Dynamic Programming,Matrix | Hard | 62,64,741,2354 |
101 | Were and ₹ 1000 National Knowledge Commission are Were and ₹ 1000 National Knowledge Commission are Were and ₹ 1000 National Knowledge Commission are connecting the Africa series well, it must be understood that it is a very good conference of Bakyan Maximum, now according to me there are 12 more concepts left, so in t... | 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 |
129 | a holiday after Daisley coding challenge question is called some root to leaf numbers we have a binary tree containing digits for non zero tonight so each node inside this binary tree will have a value to be a single digit from 0 to 9 and each root to leave pass inside the spidery free represents a number and the quest... | Sum Root to Leaf Numbers | sum-root-to-leaf-numbers | You are given the `root` of a binary tree containing digits from `0` to `9` only.
Each root-to-leaf path in the tree represents a number.
* For example, the root-to-leaf path `1 -> 2 -> 3` represents the number `123`.
Return _the total sum of all root-to-leaf numbers_. Test cases are generated so that the answer w... | null | Tree,Depth-First Search,Binary Tree | Medium | 112,124,1030 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.