id int64 1 2k | content stringlengths 272 88.9k | title stringlengths 3 77 | title_slug stringlengths 3 79 | question_content stringlengths 230 5k | question_hints stringclasses 695
values | tag stringclasses 618
values | level stringclasses 3
values | similar_question_ids stringclasses 822
values |
|---|---|---|---|---|---|---|---|---|
1,639 | um hello so um today we are going to do this problem from lead code daily challenge number of ways to form a Target string given a dictionary so basically we have a list of strings that have the same length um and those are in words array and we have a Target stitching and our task is to form this Target string using t... | 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 |
122 | hi guys welcome to algorithms made easy my name is khushboo and in this video we'll see the question best time to buy and sell stock part 2. you are given an array of prices where price at index i is the price of the given stock on ith t on each day you may decide to buy and or sell the stock you can hold at most one s... | 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 |
724 | hello good evening friends good to see you again at code master quest today we've got another problem find pivot index and we are going to solve this question in Python so let's get started and find the question description in later here's the problem statement given an array of integer Norms we should calculate the pi... | Find Pivot Index | find-pivot-index | Given an array of integers `nums`, calculate the **pivot index** of this array.
The **pivot index** is the index where the sum of all the numbers **strictly** to the left of the index is equal to the sum of all the numbers **strictly** to the index's right.
If the index is on the left edge of the array, then the left... | We can precompute prefix sums P[i] = nums[0] + nums[1] + ... + nums[i-1].
Then for each index, the left sum is P[i], and the right sum is P[P.length - 1] - P[i] - nums[i]. | Array,Prefix Sum | Easy | 560,2102,2369 |
1,488 | what's up everybody today we're gonna be talking about LICO problem 1488 avoid flood in the city so reading this problem was kind of confusing to be honest and I didn't understand it for like the first minute that I was reading it so if that's why you're here hopefully I can help explain it and you know you can solve i... | Avoid Flood in The City | sort-integers-by-the-power-value | Your country has an infinite number of lakes. Initially, all the lakes are empty, but when it rains over the `nth` lake, the `nth` lake becomes full of water. If it rains over a lake that is **full of water**, there will be a **flood**. Your goal is to avoid floods in any lake.
Given an integer array `rains` where:
*... | Use dynamic programming to get the power of each integer of the intervals. Sort all the integers of the interval by the power value and return the k-th in the sorted list. | Dynamic Programming,Memoization,Sorting | Medium | null |
11 | hello everyone and welcome to today's programming video in today's video we will solve the lead code problem called container with most water in this problem we have been given an integer array height of length n and each value or each number in that array represents the height of a line the vertical height or height o... | 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 |
83 | okay to solve one of the problem on lead code which is related to remove duplicates from the sorted list so you will be given a sorted list uh this is linked list not normally so you will give a sorted link list and you need to remove the duplicates from it so for example if uh 1 2 is given so the next value will alway... | Remove Duplicates from Sorted List | remove-duplicates-from-sorted-list | Given the `head` of a sorted linked list, _delete all duplicates such that each element appears only once_. Return _the linked list **sorted** as well_.
**Example 1:**
**Input:** head = \[1,1,2\]
**Output:** \[1,2\]
**Example 2:**
**Input:** head = \[1,1,2,3,3\]
**Output:** \[1,2,3\]
**Constraints:**
* The numb... | null | Linked List | Easy | 82,1982 |
105 | in this video we're going to take a look at a legal problem called construct binary tree from pre-order and in order binary tree from pre-order and in order binary tree from pre-order and in order traversal so given two integer array pre-order and so given two integer array pre-order and so given two integer array pre-... | Construct Binary Tree from Preorder and Inorder Traversal | construct-binary-tree-from-preorder-and-inorder-traversal | Given two integer arrays `preorder` and `inorder` where `preorder` is the preorder traversal of a binary tree and `inorder` is the inorder traversal of the same tree, construct and return _the binary tree_.
**Example 1:**
**Input:** preorder = \[3,9,20,15,7\], inorder = \[9,3,15,20,7\]
**Output:** \[3,9,20,null,null,... | null | Array,Hash Table,Divide and Conquer,Tree,Binary Tree | Medium | 106 |
380 | hey everybody this is Larry this is day 12 of to June the code daily challenge hit the like button hit the subscribe button let me know what you think how did you do in this farm did you do okay was it interesting and all that stuff okay cool insert the lead get random or one design a data structure that supports all f... | 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 |
875 | hello everyone welcome to day twentieth of january code challenge and the question that we have in today is coco eating bananas here in this question we are given the piles of bananas in the form of an array also there is a person named coco who decides to eat bananas but are at the eating speed of k each hour she choo... | Koko Eating Bananas | longest-mountain-in-array | Koko loves to eat bananas. There are `n` piles of bananas, the `ith` pile has `piles[i]` bananas. The guards have gone and will come back in `h` hours.
Koko can decide her bananas-per-hour eating speed of `k`. Each hour, she chooses some pile of bananas and eats `k` bananas from that pile. If the pile has less than `k... | null | Array,Two Pointers,Dynamic Programming,Enumeration | Medium | 1766,2205 |
1,743 | hey there everyone welcome back to lead coding so it is 8 am in the morning and i am solving the contest number 226 it is the second problem of the contest i'm gonna upload this soon after the contest ends so do hit the subscribe button to get more such content in future as well and press the bell icon because i am fre... | 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 |
222 | hello guys welcome back to take tours and in this video we will see the count complete three notes problem which is from lead code day 23 of the June challenge so before seeing the problem statement let us now see the definition of complete binary tree so in a complete binary tree all the levels till the second last le... | Count Complete Tree Nodes | count-complete-tree-nodes | Given the `root` of a **complete** binary tree, return the number of the nodes in the tree.
According to **[Wikipedia](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled in a complete binary tree, and all nodes in the last level are as far lef... | null | Binary Search,Tree,Depth-First Search,Binary Tree | Medium | 270 |
416 | hello friends to the rest of the partition eco subset-sum problem let's partition eco subset-sum problem let's partition eco subset-sum problem let's first see a statement given a non empty array contain only positive integers find if the array can be partitioned into two subsets such that the sum of elements in for su... | Partition Equal Subset Sum | partition-equal-subset-sum | Given an integer array `nums`, return `true` _if you can partition the array into two subsets such that the sum of the elements in both subsets is equal or_ `false` _otherwise_.
**Example 1:**
**Input:** nums = \[1,5,11,5\]
**Output:** true
**Explanation:** The array can be partitioned as \[1, 5, 5\] and \[11\].
**E... | null | Array,Dynamic Programming | Medium | 698,2108,2135,2162 |
268 | hello guys welcome to another video and the thing is according today we are going to do a very simple problem which is called missing number simple but interesting let's see the problem you are given an array numbers containing n distinct numbers in the range 0 to n you have to return the only number in the range that ... | Missing Number | missing-number | Given an array `nums` containing `n` distinct numbers in the range `[0, n]`, return _the only number in the range that is missing from the array._
**Example 1:**
**Input:** nums = \[3,0,1\]
**Output:** 2
**Explanation:** n = 3 since there are 3 numbers, so all numbers are in the range \[0,3\]. 2 is the missing number... | null | Array,Hash Table,Math,Bit Manipulation,Sorting | Easy | 41,136,287,770,2107 |
1,802 | hey what's up guys uh this is sean here again so uh this time on one 1802 maximum value at a given index in a bounded array okay so you're given like three positive integers and index and the max sum and you want to construct an array nums right that satisfy the following conditions so the length has to be n and each n... | 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 |
1,861 | hey everyone how are you guys doing hope you guys are doing well long time no see today let's go through another legal problem 1861 rotating the box let's take a look at the problem you're given an m by n matrix of characters box representing a side view of a box each cell of the box is one of the following it could be... | Rotating the Box | building-boxes | You are given an `m x n` matrix of characters `box` representing a side-view of a box. Each cell of the box is one of the following:
* A stone `'#'`
* A stationary obstacle `'*'`
* Empty `'.'`
The box is rotated **90 degrees clockwise**, causing some of the stones to fall due to gravity. Each stone falls down u... | Suppose We can put m boxes on the floor, within all the ways to put the boxes, what’s the maximum number of boxes we can put in? The first box should always start in the corner | Math,Binary Search,Greedy | Hard | null |
1,808 | Hello Hi Everyone Welcome Back Click Wedding Sudhir Fourth Roshan Office Contest 234 Question Is Your Appointed On Prime Factors Which You Can Start Appointed And Satisfied Fall In The Condition Sir The Number Of Prime Factors Of Can Not Necessarily A Distant Is At Most Prime Factors To Towards Nice View of NH Maximize... | Maximize Number of Nice Divisors | stone-game-vii | You are given a positive integer `primeFactors`. You are asked to construct a positive integer `n` that satisfies the following conditions:
* The number of prime factors of `n` (not necessarily distinct) is **at most** `primeFactors`.
* The number of nice divisors of `n` is maximized. Note that a divisor of `n` is... | The constraints are small enough for an N^2 solution. Try using dynamic programming. | Array,Math,Dynamic Programming,Game Theory | Medium | 909,1240,1522,1617,1685,1788,1896,2002,2156 |
1,743 | Hello, meeting you all after a long time and also our budget has also increased, this time it is fine, so let's see what is today's problem, so brother, let's do a little flexing, otherwise before that it has been said to restore the are from the Adjacent pairs okay so there is an injury are names that consist of a uni... | 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 |
744 | okay let's talk about the find smallest letter greater than the target so you are given the character letters which is already sorted in non-decreasing order and character non-decreasing order and character non-decreasing order and character target so return the smallest keratin array is larger than the topic so here's... | Find Smallest Letter Greater Than Target | network-delay-time | You are given an array of characters `letters` that is sorted in **non-decreasing order**, and a character `target`. There are **at least two different** characters in `letters`.
Return _the smallest character in_ `letters` _that is lexicographically greater than_ `target`. If such a character does not exist, return t... | We visit each node at some time, and if that time is better than the fastest time we've reached this node, we travel along outgoing edges in sorted order. Alternatively, we could use Dijkstra's algorithm. | Depth-First Search,Breadth-First Search,Graph,Heap (Priority Queue),Shortest Path | Medium | 2151,2171 |
1,482 | hello friends so today we're gonna discuss yet another problem from the latest binary search series i'm working on the problem name is minimum number of days to make m bookings now this is also a medium problem so let's discuss this problem this is also an interesting problem for you doing you are given an integer arra... | Minimum Number of Days to Make m Bouquets | how-many-numbers-are-smaller-than-the-current-number | You are given an integer array `bloomDay`, an integer `m` and an integer `k`.
You want to make `m` bouquets. To make a bouquet, you need to use `k` **adjacent flowers** from the garden.
The garden consists of `n` flowers, the `ith` flower will bloom in the `bloomDay[i]` and then can be used in **exactly one** bouquet... | Brute force for each array element. In order to improve the time complexity, we can sort the array and get the answer for each array element. | Array,Hash Table,Sorting,Counting | Easy | 315 |
927 | hi guys welcome to algorithms made easy my name is khushboo and in this video we are going to see the question three equal parts you are given an array which consists of only zeros and ones divide the array into three non-empty divide the array into three non-empty divide the array into three non-empty paths such that ... | Three Equal Parts | sum-of-subsequence-widths | You are given an array `arr` which consists of only zeros and ones, divide the array into **three non-empty parts** such that all of these parts represent the same binary value.
If it is possible, return any `[i, j]` with `i + 1 < j`, such that:
* `arr[0], arr[1], ..., arr[i]` is the first part,
* `arr[i + 1], ar... | null | Array,Math,Sorting | Hard | null |
1,461 | hello everyone welcome to day 12th of march lead code challenge and today's question is check if a string contains all binary codes or size k so in this question you are given a binary string an initial k you need to check whether for every binary code of length k is the substring of the given input string s if all the... | Check If a String Contains All Binary Codes of Size K | count-all-valid-pickup-and-delivery-options | Given a binary string `s` and an integer `k`, return `true` _if every binary code of length_ `k` _is a substring of_ `s`. Otherwise, return `false`.
**Example 1:**
**Input:** s = "00110110 ", k = 2
**Output:** true
**Explanation:** The binary codes of length 2 are "00 ", "01 ", "10 " and "11 ". They can be all f... | Use the permutation and combination theory to add one (P, D) pair each time until n pairs. | Math,Dynamic Programming,Combinatorics | Hard | null |
249 | how's it going everyone michael here so today we're going to go over the algorithm problem group shifted strings this is a very popular facebook problem and you kind of have to think outside of the box to solve it's definitely not your typical problem at least not from my experience but i'm gonna walk through it step b... | Group Shifted Strings | group-shifted-strings | We can shift a string by shifting each of its letters to its successive letter.
* For example, `"abc "` can be shifted to be `"bcd "`.
We can keep shifting the string to form a sequence.
* For example, we can keep shifting `"abc "` to form the sequence: `"abc " -> "bcd " -> ... -> "xyz "`.
Given an array of str... | null | Array,Hash Table,String | Medium | 49 |
1,823 | hello everyone today I'm going to solve code problem find the winner of the circular game there are n fres that are playing a game the fres are sitting in a circle and are numbered from one to n in a clockwise order more formally moving clockwise from the ice FR brings you to the I plus one's FR for one is L than oral ... | Find the Winner of the Circular Game | determine-if-string-halves-are-alike | There are `n` friends that are playing a game. The friends are sitting in a circle and are numbered from `1` to `n` in **clockwise order**. More formally, moving clockwise from the `ith` friend brings you to the `(i+1)th` friend for `1 <= i < n`, and moving clockwise from the `nth` friend brings you to the `1st` friend... | Create a function that checks if a character is a vowel, either uppercase or lowercase. | String,Counting | Easy | null |
1,399 | Hi everyone, I am Nishant and you have joined with the entry. In this video series, we will prepare for the interview by doing a lot of questions of lead code, so which question are we going to do today, let's see let's dive in. Hi everyone, I am Nishant. Today we are going to do question number 1399 on lead code i.e. ... | Count Largest Group | page-recommendations | You are given an integer `n`.
Each number from `1` to `n` is grouped according to the sum of its digits.
Return _the number of groups that have the largest size_.
**Example 1:**
**Input:** n = 13
**Output:** 4
**Explanation:** There are 9 groups in total, they are grouped according sum of its digits of numbers from... | null | Database | Medium | 2046,2097 |
494 | so today we're looking at lead code number 494 it's a question called target sum and so we are continuing on using our backtracking recursive template our depth first search recursive helper and we are solving this using that method and it's the same method that we're using to solve all the other questions in this play... | Target Sum | target-sum | You are given an integer array `nums` and an integer `target`.
You want to build an **expression** out of nums by adding one of the symbols `'+'` and `'-'` before each integer in nums and then concatenate all the integers.
* For example, if `nums = [2, 1]`, you can add a `'+'` before `2` and a `'-'` before `1` and ... | null | Array,Dynamic Programming,Backtracking | Medium | 282 |
1,221 | hello everyone welcome to question coder so in this video we will see the question 1221 that is split a string in balanced strings so this is a lead good question and it can be asked in an interview because it is an easy level question or it can be asked as a level one question for competitive programming if you would ... | Split a String in Balanced Strings | element-appearing-more-than-25-in-sorted-array | **Balanced** strings are those that have an equal quantity of `'L'` and `'R'` characters.
Given a **balanced** string `s`, split it into some number of substrings such that:
* Each substring is balanced.
Return _the **maximum** number of balanced strings you can obtain._
**Example 1:**
**Input:** s = "RLRRLLRLR... | Divide the array in four parts [1 - 25%] [25 - 50 %] [50 - 75 %] [75% - 100%] The answer should be in one of the ends of the intervals. In order to check which is element is the answer we can count the frequency with binarySearch. | Array | Easy | null |
1,604 | hey what's up guys this is john here so uh someone suggests me to increase the font a little bit more so i zoom in this page a little bit more to 150 percent so let me know what you guys think about this found i think this should be big enough right for you guys to see it okay cool let me know okay so let's take a look... | Alert Using Same Key-Card Three or More Times in a One Hour Period | least-number-of-unique-integers-after-k-removals | LeetCode company workers use key-cards to unlock office doors. Each time a worker uses their key-card, the security system saves the worker's name and the time when it was used. The system emits an **alert** if any worker uses the key-card **three or more times** in a one-hour period.
You are given a list of strings `... | Use a map to count the frequencies of the numbers in the array. An optimal strategy is to remove the numbers with the smallest count first. | Array,Hash Table,Greedy,Sorting,Counting | Medium | null |
63 | question so this one's about graph apparently let's read it a robot is located at the top left corner of a and by n grid okay the robot can only move at the down right at any point in time the robot is trying to reach the bottom right corner of the grid okay now um consider some obstacles are added to the grid how many... | Unique Paths II | unique-paths-ii | You are given an `m x n` integer array `grid`. There is a robot initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time.
An obstacle and space are marked as ... | The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be
if obstacleGrid[i][j] is not an obstacle
... | Array,Dynamic Programming,Matrix | Medium | 62,1022 |
91 | this video we're going to take a look at a legal problem called the codeways so we're basically given a string with numbers like this and we want to find the total number of ways to encode this number so in this case we want to uh if we have a right if we have a one that match with a if i have a two that match with let... | Decode Ways | decode-ways | A message containing letters from `A-Z` can be **encoded** into numbers using the following mapping:
'A' -> "1 "
'B' -> "2 "
...
'Z' -> "26 "
To **decode** an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For examp... | null | String,Dynamic Programming | Medium | 639,2091 |
345 | all right this question is called reverse vowels of a string it says write a function it takes a string as input and reverse only the bowels of the string so for example 1 the input is hello and the output is hol L e because the e and the O are flipped and for the second example you have the word leet code and the outp... | Reverse Vowels of a String | reverse-vowels-of-a-string | Given a string `s`, reverse only all the vowels in the string and return it.
The vowels are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`, and they can appear in both lower and upper cases, more than once.
**Example 1:**
**Input:** s = "hello"
**Output:** "holle"
**Example 2:**
**Input:** s = "leetcode"
**Output:** "leotc... | null | Two Pointers,String | Easy | 344,1089 |
1,473 | hello everyone welcome to coding decoded my name is sanchez deja i am working as technical architect sd4 at adobe and here i present the 8th of july liquid problem the question that we have in today is house paint three this question is a hard level question on lead code however i don't feel the same and i'm pretty sur... | Paint House III | find-the-longest-substring-containing-vowels-in-even-counts | There is a row of `m` houses in a small city, each house must be painted with one of the `n` colors (labeled from `1` to `n`), some houses that have been painted last summer should not be painted again.
A neighborhood is a maximal group of continuous houses that are painted with the same color.
* For example: `hous... | Represent the counts (odd or even) of vowels with a bitmask. Precompute the prefix xor for the bitmask of vowels and then get the longest valid substring. | Hash Table,String,Bit Manipulation,Prefix Sum | Medium | null |
1,706 | So and the question is where will the ball fall so like we got a grade here so like here we have a grade so here this ball is zero ball you are so this is telling if this ball zero if this grid If we drop it, from which place will it come out and from which column will it come out? What does it mean? Like if we drop th... | 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 |
1,042 | hi everyone I'm Jack how are you doing today let's take a look at this problem 10:42 flower planting with no adjacent 10:42 flower planting with no adjacent 10:42 flower planting with no adjacent we have n gardens labeled 1 to n each garden you want to plant one of four types flowers so these paths XY describes the exi... | 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 |
377 | hello everyone welcome to quartus camp we are at the 19th day of april late code challenge and the problem we are going to cover today is combination sum 4. the input given here is an integer array nums and a target value again an integer and we have to return the possible combination of ways we can form the target val... | Combination Sum IV | combination-sum-iv | Given an array of **distinct** integers `nums` and a target integer `target`, return _the number of possible combinations that add up to_ `target`.
The test cases are generated so that the answer can fit in a **32-bit** integer.
**Example 1:**
**Input:** nums = \[1,2,3\], target = 4
**Output:** 7
**Explanation:**
Th... | null | Array,Dynamic Programming | Medium | 39 |
917 | hey what's a Knick white a Tekken I do tech encoding stuff on Twitch in YouTube and if you check the description you can find everything and I do all the hack ranking link code solutions I play for playlist for both of them so I just check those out this is called reversed only letters and we did reverse string and rev... | Reverse Only Letters | boats-to-save-people | Given a string `s`, reverse the string according to the following rules:
* All the characters that are not English letters remain in the same position.
* All the English letters (lowercase or uppercase) should be reversed.
Return `s` _after reversing it_.
**Example 1:**
**Input:** s = "ab-cd"
**Output:** "dc-ba... | null | Array,Two Pointers,Greedy,Sorting | Medium | null |
1,530 | uh hey everybody this is larry talking about a number of good leaves notes pair uh recently code contest so you'll see me solve this live later um but so this one is a tricky one i think the thing to notice is that distance is at most 10. so that um along with this which is a really awkward 1000 uh or i mean i know it'... | Number of Good Leaf Nodes Pairs | check-if-a-string-can-break-another-string | You are given the `root` of a binary tree and an integer `distance`. A pair of two different **leaf** nodes of a binary tree is said to be good if the length of **the shortest path** between them is less than or equal to `distance`.
Return _the number of good leaf node pairs_ in the tree.
**Example 1:**
**Input:** r... | Sort both strings and then check if one of them can break the other. | String,Greedy,Sorting | Medium | null |
63 | this question is unique paths too it was requested so this one's for you midilesh a robot is located at the top left corner of an m times n grid the robot can only move down or right at any point in time and it's trying to reach the bottom right corner now consider if there are some obstacles added to the grids how man... | Unique Paths II | unique-paths-ii | You are given an `m x n` integer array `grid`. There is a robot initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time.
An obstacle and space are marked as ... | The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be
if obstacleGrid[i][j] is not an obstacle
... | Array,Dynamic Programming,Matrix | Medium | 62,1022 |
1,029 | hey guys welcome to the core Matt if you are new to the Channel please do subscribe we solve a lot of competitive problems today's problem is a to city scheduling so the problem says there are two and people a company's planning to interview the cost of the flying the ID pass sent to the CTA is caused by of zero and th... | 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 |
111 | hey guys in this video i'll be going through how to solve lead code question 111 minimum depth of a binary tree okay so for this question we're going to be given a binary tree and we just have to find the minimum depth meaning the height of the first node that is considered a leaf and a leaf is just going to be anythin... | Minimum Depth of Binary Tree | minimum-depth-of-binary-tree | Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
**Note:** A leaf is a node with no children.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 2
**Example 2:**
**Input:** root = \[2... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 102,104 |
1,630 | hello and welcome to another video in this problem we're going to be working on arithmetic sub rays and in this problem a sequence of numbers is called arithmetic if it consists of at least two elements and the difference between every two elements is the same more forly they Define it for you so for example this is ar... | Arithmetic Subarrays | count-odd-numbers-in-an-interval-range | A sequence of numbers is called **arithmetic** if it consists of at least two elements, and the difference between every two consecutive elements is the same. More formally, a sequence `s` is arithmetic if and only if `s[i+1] - s[i] == s[1] - s[0]` for all valid `i`.
For example, these are **arithmetic** sequences:
1... | If the range (high - low + 1) is even, the number of even and odd numbers in this range will be the same. If the range (high - low + 1) is odd, the solution will depend on the parity of high and low. | Math | Easy | null |
338 | Jai hind is tutorial am going to discuss a program in question counting bags for the problem statement given unknown negative interior number name and for every numbers of indian research data from 129 for example de villiers number 15 it means number which ranges from 0257 what do you How to Calculate Number of Ways i... | Counting Bits | counting-bits | Given an integer `n`, return _an array_ `ans` _of length_ `n + 1` _such that for each_ `i` (`0 <= i <= n`)_,_ `ans[i]` _is the **number of**_ `1`_**'s** in the binary representation of_ `i`.
**Example 1:**
**Input:** n = 2
**Output:** \[0,1,1\]
**Explanation:**
0 --> 0
1 --> 1
2 --> 10
**Example 2:**
**Input:** n =... | You should make use of what you have produced already. Divide the numbers in ranges like [2-3], [4-7], [8-15] and so on. And try to generate new range from previous. Or does the odd/even status of the number help you in calculating the number of 1s? | Dynamic Programming,Bit Manipulation | Easy | 191 |
62 | in this video we'll be going over unique paths so a robot is located at the top left corner of m times n grid marks start in the diagram below so the robot is here the robot can move either down or right at any point in time the robot is trying to reach the bottom right corner of the grid mark finish in the diagram how... | Unique Paths | unique-paths | There is a robot on an `m x n` grid. The robot is initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time.
Given the two integers `m` and `n`, return _the nu... | null | Math,Dynamic Programming,Combinatorics | Medium | 63,64,174,2192 |
125 | Hello friends, welcome to the new video, question number 125 is on the loot court, Velvet is the name of the first in Rome, this is the question of this level, this question is basically of the springs category, you will get an interview with the talent from the string, it is okay with the name, let's start the questio... | Valid Palindrome | valid-palindrome | A phrase is a **palindrome** if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.
Given a string `s`, return `true` _if it is a **palindrome**, or_ `false` _otherwise_... | null | Two Pointers,String | Easy | 234,680,2130,2231 |
230 | hi everyone welcome to my channel I am solving my little challenge and today is a day 20 and the problem is K the smallest element in binary search tree so we are given a binary search tree and we have to return the K the smallest element in that tree so like you may be familiar with the binary search tree so binary se... | 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 |
1,732 | hey everyone uh today i'll be going over elite code 1732. uh find the highest altitude so this one is very easy but that doesn't mean i'm not going to do it and post it so basically there's a biker going on a road trip it consists of n plus one points at different altitudes a given array gain each gain of i represents ... | Find the Highest Altitude | minimum-one-bit-operations-to-make-integers-zero | There is a biker going on a road trip. The road trip consists of `n + 1` points at different altitudes. The biker starts his trip on point `0` with altitude equal `0`.
You are given an integer array `gain` of length `n` where `gain[i]` is the **net gain in altitude** between points `i` and `i + 1` for all (`0 <=... | The fastest way to convert n to zero is to remove all set bits starting from the leftmost one. Try some simple examples to learn the rule of how many steps are needed to remove one set bit. consider n=2^k case first, then solve for all n. | Dynamic Programming,Bit Manipulation,Memoization | Hard | 2119 |
258 | so in today's video we are going to discuss lead code problem number 258 that is ADD digits so let's get started given an integer num repeatedly add all its digit until the result has only one digit and return it so in the example you can see we have been given one number that is 38 so we have to sum its digits which i... | Add Digits | add-digits | Given an integer `num`, repeatedly add all its digits until the result has only one digit, and return it.
**Example 1:**
**Input:** num = 38
**Output:** 2
**Explanation:** The process is
38 --> 3 + 8 --> 11
11 --> 1 + 1 --> 2
Since 2 has only one digit, return it.
**Example 2:**
**Input:** num = 0
**Output:** 0
*... | A naive implementation of the above process is trivial. Could you come up with other methods? What are all the possible results? How do they occur, periodically or randomly? You may find this Wikipedia article useful. | Math,Simulation,Number Theory | Easy | 202,1082,2076,2264 |
1,544 | Hello hello everybody welcome to my channel it's all the record problem one too spring red problem 154 president problem solve in this problem give a string is of lower and upper case english latest if destroy subscribe between 20 - more than 200 subscribe between 20 - more than 200 subscribe between 20 - more than 200... | Make The String Great | count-good-nodes-in-binary-tree | Given a string `s` of lower and upper case English letters.
A good string is a string which doesn't have **two adjacent characters** `s[i]` and `s[i + 1]` where:
* `0 <= i <= s.length - 2`
* `s[i]` is a lower-case letter and `s[i + 1]` is the same letter but in upper-case or **vice-versa**.
To make the string go... | Use DFS (Depth First Search) to traverse the tree, and constantly keep track of the current path maximum. | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
123 | what's up nerds welcome back to tee time with your favorite software engineer so i know i've been missing a while finally got my desk set up and like settled into my new job so i'm going to be making videos more often now um just preparing for interviews in general so today well actually first i wanted to mention we're... | 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,748 | hey everyone uh today i'll be going over lead code 1748 some of unique elements uh this one's a very easy one um and i'm probably just doing it just the most basic way possible but that doesn't mean i'm not going to make a video on it because we all start from somewhere and i'll try to explain it so anyways we're given... | Sum of Unique Elements | best-team-with-no-conflicts | You are given an integer array `nums`. The unique elements of an array are the elements that appear **exactly once** in the array.
Return _the **sum** of all the unique elements of_ `nums`.
**Example 1:**
**Input:** nums = \[1,2,3,2\]
**Output:** 4
**Explanation:** The unique elements are \[1,3\], and the sum is 4.
... | First, sort players by age and break ties by their score. You can now consider the players from left to right. If you choose to include a player, you must only choose players with at least that score later on. | Array,Dynamic Programming,Sorting | Medium | null |
462 | hello everyone welcome to learn overflow in this video we will discuss about the another liquid problem there is a minimum moves to equal array elements and this is the second part of the question so other elements two uh this is a middle level question we'll understand what this question is trying to say and then we'l... | Minimum Moves to Equal Array Elements II | minimum-moves-to-equal-array-elements-ii | Given an integer array `nums` of size `n`, return _the minimum number of moves required to make all array elements equal_.
In one move, you can increment or decrement an element of the array by `1`.
Test cases are designed so that the answer will fit in a **32-bit** integer.
**Example 1:**
**Input:** nums = \[1,2,3... | null | Array,Math,Sorting | Medium | 296,453,2160,2290 |
752 | hey everybody this is larry this is june 4th of the june the code daily challenge uh hit the like button in the subscribe button join me on discord let me know what you think about today uh and the daily challenge and stuff like that uh yeah i usually solve these live so it's a little bit slow you know well fast forwar... | Open the Lock | ip-to-cidr | You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: `'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'`. The wheels can rotate freely and wrap around: for example we can turn `'9'` to be `'0'`, or `'0'` to be `'9'`. Each move consists of turning one wheel one slot.
The lock initially starts... | Convert the ip addresses to and from (long) integers. You want to know what is the most addresses you can put in this block starting from the "start" ip, up to n. It is the smallest between the lowest bit of start and the highest bit of n. Then, repeat this process with a new start and n. | String,Bit Manipulation | Medium | 93,468 |
86 | hello friends uh welcome to my channel let's have a look at problem 86 partition list so this is a daily challenge problem so here in this video we're going to share first a broad first solution and then we trust form the brute force solution in a better format so this problem is the following given the head of linked ... | 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 |
123 | hello everyone so let's talk about baseline to buy and sell stock three so in this question you can only do a transaction in most two right so which means two for buy two for sale so in this idea um what you can actually do is you can use a method from 121 so 121 is actually you only buy one time and sell one time righ... | 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,603 | hey there today we'll solve one of the little problem design parking system it's problem number 1603 so in the given part parking system there is three types of vehicle that can come big small and medium size so for example in this case if big and medium is allocated then begin medium will be allowed and then remaining... | Design Parking System | running-sum-of-1d-array | Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size.
Implement the `ParkingSystem` class:
* `ParkingSystem(int big, int medium, int small)` Initializes object of the `ParkingSystem` class. The number of slot... | Think about how we can calculate the i-th number in the running sum from the (i-1)-th number. | Array,Prefix Sum | Easy | null |
1,642 | hello guys welcome to another video in the series of coding we are going to do the problem which is called furthest building you can reach let's try to take an example to understand this so we are given some input of numbers okay by the way this question is a very beautiful diagram so let me explain with the help of th... | Furthest Building You Can Reach | water-bottles | You are given an integer array `heights` representing the heights of buildings, some `bricks`, and some `ladders`.
You start your journey from building `0` and move to the next building by possibly using bricks or ladders.
While moving from building `i` to building `i+1` (**0-indexed**),
* If the current building'... | Simulate the process until there are not enough empty bottles for even one full bottle of water. | Math,Simulation | Easy | null |
725 | 200 Bluetooth is the problem No fog Play list How to split into quantity Milenge is the length of parts Rate occupations 75 Question is the language of Bagasi College and school name and password Have size different by more than 1000 Subscribe Return of the day That Sonakshi has this problem Settings Open Example2 Zinc... | Split Linked List in Parts | split-linked-list-in-parts | Given the `head` of a singly linked list and an integer `k`, split the linked list into `k` consecutive linked list parts.
The length of each part should be as equal as possible: no two parts should have a size differing by more than one. This may lead to some parts being null.
The parts should be in the order of occ... | If there are N nodes in the list, and k parts, then every part has N/k elements, except the first N%k parts have an extra one. | Linked List | Medium | 61,328 |
221 | okay guys so let's solve today let's go daily problem it is lit code number 221 question number and it is maximal square so this is the question you are given an m into n m binary matrix played with 0 and 1 find the largest square content only once and return its area so i have taken this example number one so let's ge... | Maximal Square | maximal-square | Given an `m x n` binary `matrix` filled with `0`'s and `1`'s, _find the largest square containing only_ `1`'s _and return its area_.
**Example 1:**
**Input:** matrix = \[\[ "1 ", "0 ", "1 ", "0 ", "0 "\],\[ "1 ", "0 ", "1 ", "1 ", "1 "\],\[ "1 ", "1 ", "1 ", "1 ", "1 "\],\[ "1 ", "0 ", "0 ", "1 ", "0 "\]\]
**Output:*... | null | Array,Dynamic Programming,Matrix | Medium | 85,769,1312,2200 |
5 | boom what up Zayn here and we are going to be doing the longest palindromic substring I hope I'm pronouncing that right so basically we're given a string called s in this case and we just have to figure out the characters that are symmetrical the longest consecutive characters are symmetrical so it's much easier just t... | 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,775 | hey what's up guys this is chung here so uh 1775 equal sum arrays with minimum number of operations so given like two arrays of integers numbers one and nums two and the only consisting the only possible numbers is from one to six and in one operations you can change any integers values in any of the arrays to any numb... | Equal Sum Arrays With Minimum Number of Operations | design-an-ordered-stream | You are given two arrays of integers `nums1` and `nums2`, possibly of different lengths. The values in the arrays are between `1` and `6`, inclusive.
In one operation, you can change any integer's value in **any** of the arrays to **any** value between `1` and `6`, inclusive.
Return _the minimum number of operations ... | Maintain the next id that should be outputted. Maintain the ids that were inserted in the stream. Per each insert, make a loop where you check if the id that has the turn has been inserted, and if so increment the id that has the turn and continue the loop, else break. | Array,Hash Table,Design,Data Stream | Easy | null |
63 | hey so welcome back and there's another daily code problem so today it's called unique pass2 it's basically a follow-up unique pass2 it's basically a follow-up unique pass2 it's basically a follow-up from yesterday's question which is called unique paths and so essentially what you're given here is a two-dimensional Ma... | Unique Paths II | unique-paths-ii | You are given an `m x n` integer array `grid`. There is a robot initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time.
An obstacle and space are marked as ... | The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be
if obstacleGrid[i][j] is not an obstacle
... | Array,Dynamic Programming,Matrix | Medium | 62,1022 |
1,968 | hey coders welcome back to this channel so in today's video we will be solving the code 1968 which is array with elements not equal to average of neighbors so in simple terms we are given an array and we need to arrange rearrange that array in such a way that if there are three consecutive numbers then the average of t... | Array With Elements Not Equal to Average of Neighbors | maximum-building-height | You are given a **0-indexed** array `nums` of **distinct** integers. You want to rearrange the elements in the array such that every element in the rearranged array is **not** equal to the **average** of its neighbors.
More formally, the rearranged array should have the property such that for every `i` in the range `1... | Is it possible to find the max height if given the height range of a particular building? You can find the height range of a restricted building by doing 2 passes from the left and right. | Array,Math | Hard | null |
1,822 | foreign problem and the problem's name is sign of the product of an array in this question we are given an integer array called nums and we need to find the product of all the values present inside the integer RN arms and using this product we have to determine the sign of the product if the sign of the product is a po... | Sign of the Product of an Array | longest-palindromic-subsequence-ii | There is a function `signFunc(x)` that returns:
* `1` if `x` is positive.
* `-1` if `x` is negative.
* `0` if `x` is equal to `0`.
You are given an integer array `nums`. Let `product` be the product of all values in the array `nums`.
Return `signFunc(product)`.
**Example 1:**
**Input:** nums = \[-1,-2,-3,-4,... | As with any good dp problem that uses palindromes, try building the palindrome from the edges The prime point is to check that no two adjacent characters are equal, so save the past character while building the palindrome. | String,Dynamic Programming | Medium | 516 |
1,332 | welcome to march's leeco challenge today's problem is remove palindromic subsequences given a string s consisting of only of letters a and b in a single step you can remove one palindromic subsequence from s return the minimum number of steps to make the given string empty okay and the string is called pound row if it ... | Remove Palindromic Subsequences | count-vowels-permutation | You are given a string `s` consisting **only** of letters `'a'` and `'b'`. In a single step you can remove one **palindromic subsequence** from `s`.
Return _the **minimum** number of steps to make the given string empty_.
A string is a **subsequence** of a given string if it is generated by deleting some characters o... | Use dynamic programming. Let dp[i][j] be the number of strings of length i that ends with the j-th vowel. Deduce the recurrence from the given relations between vowels. | Dynamic Programming | Hard | null |
672 | hey everybody this is Larry it's December 29th of the 2022 yeah so today I'm just going to do a bonus extra question that I haven't done before um yeah so okay so I won't have a difficulty limiter so we'll see maybe it'll be hard maybe it'll be easy maybe it'll be a medium and today's plan is going to be a medium 672 a... | Bulb Switcher II | bulb-switcher-ii | There is a room with `n` bulbs labeled from `1` to `n` that all are turned on initially, and **four buttons** on the wall. Each of the four buttons has a different functionality where:
* **Button 1:** Flips the status of all the bulbs.
* **Button 2:** Flips the status of all the bulbs with even labels (i.e., `2, 4... | null | Math,Bit Manipulation,Depth-First Search,Breadth-First Search | Medium | 319,1491 |
953 | hello everyone so in this video let us talk about a problem from lead code it is an easy problem name is verifying an alien dictionary okay so the problem statement goes like this that you're given an alien language surprisingly the aliens also use english lowercase alphabets but possibly in different order by order it... | Verifying an Alien Dictionary | reverse-only-letters | In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different `order`. The `order` of the alphabet is some permutation of lowercase letters.
Given a sequence of `words` written in the alien language, and the `order` of the alphabet, return `true` if and only if the given `wor... | This problem is exactly like reversing a normal string except that there are certain characters that we have to simply skip. That should be easy enough to do if you know how to reverse a string using the two-pointer approach. | Two Pointers,String | Easy | null |
881 | hey everybody this is Larry this is day three of the little April daily challenge uh hit the like button hit the Subscribe button drop me in this squad let me know what you think about today's Farm uh since I've done it recently apparently I'm out over to that reason but I'll try to do another premium problem right aft... | Boats to Save People | loud-and-rich | You are given an array `people` where `people[i]` is the weight of the `ith` person, and an **infinite number of boats** where each boat can carry a maximum weight of `limit`. Each boat carries at most two people at the same time, provided the sum of the weight of those people is at most `limit`.
Return _the minimum n... | null | Array,Depth-First Search,Graph,Topological Sort | Medium | null |
1,011 | Hello everyone so today we will be discussing question number 101 of lead code which is capacity tu shiv package with in d country now this one which is part of question play list whatever I will discuss in this video is a moderate solution which I have made His playlist has been discussed in great detail in the first ... | Capacity To Ship Packages Within D Days | flip-binary-tree-to-match-preorder-traversal | A conveyor belt has packages that must be shipped from one port to another within `days` days.
The `ith` package on the conveyor belt has a weight of `weights[i]`. Each day, we load the ship with packages on the conveyor belt (in the order given by `weights`). We may not load more weight than the maximum weight capaci... | null | Tree,Depth-First Search,Binary Tree | Medium | null |
316 | hello everyone welcome to our channel code with sunny and in this video we will be talking about the problem remove duplicate letters its index is 316 and it is the medium problem of the lead code okay so without wasting our time let's start like we would be involving the concepts of stack that is how the elements that... | 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 |
1,046 | whereas a last stone wait we have a collection of stones each stone has a positive integer weight each turn or doing some kind of simulation we choose to choose the two heaviest the stones and the smash them together so for every iteration we get the two heaviest them so we're looking at some kind of maximum priority q... | Last Stone Weight | max-consecutive-ones-iii | You are given an array of integers `stones` where `stones[i]` is the weight of the `ith` stone.
We are playing a game with the stones. On each turn, we choose the **heaviest two stones** and smash them together. Suppose the heaviest two stones have weights `x` and `y` with `x <= y`. The result of this smash is:
* I... | One thing's for sure, we will only flip a zero if it extends an existing window of 1s. Otherwise, there's no point in doing it, right? Think Sliding Window! Since we know this problem can be solved using the sliding window construct, we might as well focus in that direction for hints. Basically, in a given window, we c... | Array,Binary Search,Sliding Window,Prefix Sum | Medium | 340,424,485,487,2134 |
1,668 | Hello, in this video we will see Maximum Repeating Substring, so this is an easy level question of lead code and let us understand from the example, so the first word is opened in sequence, the second word is called word itself, right, so we have to find this thing in it, so if Now it is right, how many times is it rep... | Maximum Repeating Substring | find-longest-awesome-substring | For a string `sequence`, a string `word` is **`k`\-repeating** if `word` concatenated `k` times is a substring of `sequence`. The `word`'s **maximum `k`\-repeating value** is the highest value `k` where `word` is `k`\-repeating in `sequence`. If `word` is not a substring of `sequence`, `word`'s maximum `k`\-repeating v... | Given the character counts, under what conditions can a palindrome be formed ? From left to right, use bitwise xor-operation to compute for any prefix the number of times modulo 2 of each digit. (mask ^= (1<<(s[i]-'0')). Expected complexity is O(n*A) where A is the alphabet (10). | Hash Table,String,Bit Manipulation | Hard | null |
1,980 | hello hi guys welcome back to the new video uh sub Changi I hope that you guys are doing good so in this video the problem find unique binary strings we'll see all the variations as in from the very basic Brute Force to actually optimal more optimal like we will see four optimality for it cool uh let's see let's start ... | Find Unique Binary String | faulty-sensor | Given an array of strings `nums` containing `n` **unique** binary strings each of length `n`, return _a binary string of length_ `n` _that **does not appear** in_ `nums`_. If there are multiple answers, you may return **any** of them_.
**Example 1:**
**Input:** nums = \[ "01 ", "10 "\]
**Output:** "11 "
**Explanatio... | Check for a common prefix of the two arrays. After this common prefix, there should be one array similar to the other but shifted by one. If both arrays can be shifted, return -1. | Array,Two Pointers | Easy | null |
1,562 | hey everybody this is larry this is me going over q3 find latest group of size m uh so this is actually a tricky problem uh i think the easiest way to do is by simulation um so the first thing to notice with simulation uh is that notice the n so n is going to be 10 to the fifth which is a hundred thousand so you so rea... | Find Latest Group of Size M | people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list | Given an array `arr` that represents a permutation of numbers from `1` to `n`.
You have a binary string of size `n` that initially has all its bits set to zero. At each step `i` (assuming both the binary string and `arr` are 1-indexed) from `1` to `n`, the bit at position `arr[i]` is set to `1`.
You are also given an... | Use hashing to convert company names in numbers and then for each list check if this is a subset of any other list. In order to check if a list is a subset of another list, use two pointers technique to get a linear solution for this task. The total complexity will be O(n^2 * m) where n is the number of lists and m is ... | Array,Hash Table,String | Medium | null |
1,010 | hi everyone welcome back for another video we are going to do another little question the question is pairs of suns with total durations divisible by 60. you are given a list of sounds where the iv song has a duration of time i seconds return the number of pairs of suns for which their total duration in seconds is divi... | Pairs of Songs With Total Durations Divisible by 60 | powerful-integers | You are given a list of songs where the `ith` song has a duration of `time[i]` seconds.
Return _the number of pairs of songs for which their total duration in seconds is divisible by_ `60`. Formally, we want the number of indices `i`, `j` such that `i < j` with `(time[i] + time[j]) % 60 == 0`.
**Example 1:**
**Input... | null | Hash Table,Math | Medium | null |
1,071 | hi everyone so let's talk about greatest common divisor of string so you're given s and t so we said that t can divide by s only is equal to t plus t right so uh you're given two uh two string and you have to return a larger string x such that x can divide by both rooms both are in fact so uh here's a quickly solution ... | Greatest Common Divisor of Strings | binary-prefix-divisible-by-5 | For two strings `s` and `t`, we say "`t` divides `s` " if and only if `s = t + ... + t` (i.e., `t` is concatenated with itself one or more times).
Given two strings `str1` and `str2`, return _the largest string_ `x` _such that_ `x` _divides both_ `str1` _and_ `str2`.
**Example 1:**
**Input:** str1 = "ABCABC ", str2... | If X is the first i digits of the array as a binary number, then 2X + A[i] is the first i+1 digits. | Array | Easy | null |
1,675 | Hello Guys Welcome to Your Dreams Video subscribe and subscribe the Video then subscribe to The Amazing Difference Between There Operations Subscribe Now To Subscribe Maulik Chintak V Dhund Problem Will Help Us Understand Subscribe to the Video then subscribe to the Page if you liked The Video then subscribe to The Ama... | Minimize Deviation in Array | magnetic-force-between-two-balls | You are given an array `nums` of `n` positive integers.
You can perform two types of operations on any element of the array any number of times:
* If the element is **even**, **divide** it by `2`.
* For example, if the array is `[1,2,3,4]`, then you can do this operation on the last element, and the array wil... | If you can place balls such that the answer is x then you can do it for y where y < x. Similarly if you cannot place balls such that the answer is x then you can do it for y where y > x. Binary search on the answer and greedily see if it is possible. | Array,Binary Search,Sorting | Medium | 2188 |
326 | welcome to april's lego challenge today's problem is power of three given an integer n return true if it is a power of three otherwise we turn false an integer n is a power of three if there exists an integer such that n equals three to the x power now you can see that 27 is going to be true because that's 3 times 3 wh... | Power of Three | power-of-three | Given an integer `n`, return _`true` if it is a power of three. Otherwise, return `false`_.
An integer `n` is a power of three, if there exists an integer `x` such that `n == 3x`.
**Example 1:**
**Input:** n = 27
**Output:** true
**Explanation:** 27 = 33
**Example 2:**
**Input:** n = 0
**Output:** false
**Explanat... | null | Math,Recursion | Easy | 231,342,1889 |
501 | Hi friends, our problem today is Find Mode in Binary Search Tree is a daily problem for the lead, it is easy level and I think it is not so tough, it is easy to understand, the problem statement is also there, so what is given to us in this, a binary search tree is given to us in which If duplicate elements are allowed... | Find Mode in Binary Search Tree | find-mode-in-binary-search-tree | Given the `root` of a binary search tree (BST) with duplicates, return _all the [mode(s)](https://en.wikipedia.org/wiki/Mode_(statistics)) (i.e., the most frequently occurred element) in it_.
If the tree has more than one mode, return them in **any order**.
Assume a BST is defined as follows:
* The left subtree of... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | 98 |
1,732 | hi everyone in today challenge we are going to solve this problem the problem name is find the highest altitude and the problem number is 1732 only case so as usual first of all we are going to clearly understand this problem statement after that we are going to move to the logic part we are going to see how we can sol... | Find the Highest Altitude | minimum-one-bit-operations-to-make-integers-zero | There is a biker going on a road trip. The road trip consists of `n + 1` points at different altitudes. The biker starts his trip on point `0` with altitude equal `0`.
You are given an integer array `gain` of length `n` where `gain[i]` is the **net gain in altitude** between points `i` and `i + 1` for all (`0 <=... | The fastest way to convert n to zero is to remove all set bits starting from the leftmost one. Try some simple examples to learn the rule of how many steps are needed to remove one set bit. consider n=2^k case first, then solve for all n. | Dynamic Programming,Bit Manipulation,Memoization | Hard | 2119 |
228 | Jai Hind This Video Will Solve Problem Chord Summary Ranges Surya Problems Is The Winner List Of Units In Tears In Your Eyes Are Like 12345 7th August Subscribe Aaj Date Jump Hai Amazon Hai To Yeh Tu Shoes Mauj Numbers In 2124 Is This Is 7219 Ki And It's Just Told Oo That Suthar Dhvani Just Lal Inter College Will Have ... | 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 |
863 | hey everyone welcome back today we are going to solve problem number 863 all notes distance K in binary tree first we will see the explanation of the problem statement then the logic on the code now let's dive into the solution so in this problem we have a binary tree with Target and variable K right so we need to find... | All Nodes Distance K in Binary Tree | sum-of-distances-in-tree | Given the `root` of a binary tree, the value of a target node `target`, and an integer `k`, return _an array of the values of all nodes that have a distance_ `k` _from the target node._
You can return the answer in **any order**.
**Example 1:**
**Input:** root = \[3,5,1,6,2,0,8,null,null,7,4\], target = 5, k = 2
**O... | null | Dynamic Programming,Tree,Depth-First Search,Graph | Hard | 1021,2175 |
700 | hey guys welcome back to the coordinate our it's a day 15 from the June lick code challenge and to this problem is a search in a binary search tree so in this problem we will go through the problem description we'll understand the examples and also we will write the code and understand the time complexity of this probl... | Search in a Binary Search Tree | search-in-a-binary-search-tree | You are given the `root` of a binary search tree (BST) and an integer `val`.
Find the node in the BST that the node's value equals `val` and return the subtree rooted with that node. If such a node does not exist, return `null`.
**Example 1:**
**Input:** root = \[4,2,7,1,3\], val = 2
**Output:** \[2,1,3\]
**Example... | null | null | Easy | null |
344 | all right back at leak code again today this is the reverse string problem it's also known as leak code 344 and i found this underneath the top interview questions easy section so this algorithm wants you to write a function that reverses a string but the catch on this one is that you have to do it in place so how i'd ... | 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 |
1,624 | what's up guys so let's solve this one six two four largest substring between two evil characters so given a string s return length of longest substring between two evil characters excluding the two character characters if there is a no substring from a return minus one so a you get zero and one right so it's one minus... | Largest Substring Between Two Equal Characters | clone-binary-tree-with-random-pointer | Given a string `s`, return _the length of the longest substring between two equal characters, excluding the two characters._ If there is no such substring return `-1`.
A **substring** is a contiguous sequence of characters within a string.
**Example 1:**
**Input:** s = "aa "
**Output:** 0
**Explanation:** The optim... | Traverse the tree, keep a hashtable with you and create a nodecopy for each node in the tree. Start traversing the original tree again and connect the left, right and random pointers in the cloned tree the same way as the original tree with the help of the hashtable. | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 133,138,1634 |
30 | okay thirdly at task of lit code substring and concatenation of all words okay pretty interesting task i would say so we have an initial string of length up to 10 to the power of four and we have a word array with which is extremely important with equal length of words and we pretty much have to find all the substrings... | Substring with Concatenation of All Words | substring-with-concatenation-of-all-words | You are given a string `s` and an array of strings `words`. All the strings of `words` are of **the same length**.
A **concatenated substring** in `s` is a substring that contains all the strings of any permutation of `words` concatenated.
* For example, if `words = [ "ab ", "cd ", "ef "]`, then `"abcdef "`, `"abef... | null | Hash Table,String,Sliding Window | Hard | 76 |
18 | hello everybody so in this video we will be looking at the lead code problem 18 that is foursome so the problem statement states that we are given an array numbers of an integer so we have to return an array of all unique quadruples so we have a num of a number of b number c and m of d such that their sum is equal to a... | 4Sum | 4sum | Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that:
* `0 <= a, b, c, d < n`
* `a`, `b`, `c`, and `d` are **distinct**.
* `nums[a] + nums[b] + nums[c] + nums[d] == target`
You may return the answer in **any order**.
**Examp... | null | Array,Two Pointers,Sorting | Medium | 1,15,454,2122 |
973 | Hello Hi Guys Welcome to Volumes and I will go through 3030 problem from the middle challenge is that Bihar will stop point on the play and win to find the cost point during the distance between two points on plane UP and distance it is the answer is NO The answer is the example of distance point Must subscribe this po... | K Closest Points to Origin | stamping-the-sequence | Given an array of `points` where `points[i] = [xi, yi]` represents a point on the **X-Y** plane and an integer `k`, return the `k` closest points to the origin `(0, 0)`.
The distance between two points on the **X-Y** plane is the Euclidean distance (i.e., `√(x1 - x2)2 + (y1 - y2)2`).
You may return the answer in **an... | null | String,Stack,Greedy,Queue | Hard | null |
103 | hey guys welcome back to another video and in today's video we're going to be solving the lead code question binary tree zigzag level order traversal all right so in this question we're going to be given a binary tree and we need to return the zigzag level order traversal of its node's values so what this means is we g... | Binary Tree Zigzag Level Order Traversal | binary-tree-zigzag-level-order-traversal | Given the `root` of a binary tree, return _the zigzag level order traversal of its nodes' values_. (i.e., from left to right, then right to left for the next level and alternate between).
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[3\],\[20,9\],\[15,7\]\]
**Example 2:**
**Input:** roo... | null | Tree,Breadth-First Search,Binary Tree | Medium | 102 |
21 | another day another problem so let's Solve IT hello guys I hope you are all doing well so before I start explaining how we're gonna solve the merge to sorted list problem support me with the Subscribe a like to the video so let's get started so the problem is that they give us a tool linked list and they ask us to merg... | 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 |
976 | hey guys welcome back to helper function in this video we will discuss another popular question largest perimeter triangle so the problem says that we are given with array of possible lengths we need to return the largest perimeter of a triangle with non-zero area now this nonzero area means that basically the triangle... | Largest Perimeter Triangle | minimum-area-rectangle | Given an integer array `nums`, return _the largest perimeter of a triangle with a non-zero area, formed from three of these lengths_. If it is impossible to form any triangle of a non-zero area, return `0`.
**Example 1:**
**Input:** nums = \[2,1,2\]
**Output:** 5
**Explanation:** You can form a triangle with three si... | null | Array,Hash Table,Math,Geometry,Sorting | Medium | null |
316 | to remove duplicate letters so given a string s we have to remove duplicate letter so that every letter appears only one and one is only once so you must make sure that your result is in the smallest lexicographical order among all the possible results suppose we have a string this is equal to BC ABC after doing ABC be... | 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 |
1,464 | Hello everyone welcome to my channel code story with mike so today I am going to share the video number of my lead code easy playlist lead code number 1464 maximum product of two elements in n Hey look problem before starting I want to tell you a very important thing. I want to tell you, look, I know this is an easy qu... | 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,268 | hey guys how's it going in this video i'm gonna walk through this legal problem search saturation system um i'm gonna solve this problem using two methods uh one is the binary search another one is uh a try i will use try first because that's more intuitive uh binary search is a little bit it's a more creative way i wo... | Search Suggestions System | market-analysis-i | You are given an array of strings `products` and a string `searchWord`.
Design a system that suggests at most three product names from `products` after each character of `searchWord` is typed. Suggested products should have common prefix with `searchWord`. If there are more than three products with a common prefix ret... | null | Database | Medium | null |
11 | Hi guys I am Nishant Chahar welcome back to the channel Aago Prep in today's video we are going to talk about this question its name is container with most water what is given in this question friend we are given a histogram we are not making containers in it Pass na like have different heights first let's read the que... | 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 |
24 | Hello everyone welcome to me channel in pairs ok read number 24 medium to mark but aap sorry sun lo you bill be able to solve it on your own I am pretty sir ok very similar researcher solution today I will tell on this video ok so It is not medium at which is fine, it will be very easy, trust me, look at the input outp... | Swap Nodes in Pairs | swap-nodes-in-pairs | Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.)
**Example 1:**
**Input:** head = \[1,2,3,4\]
**Output:** \[2,1,4,3\]
**Example 2:**
**Input:** head = \[\]
**Output:** \[\... | null | Linked List,Recursion | Medium | 25,528 |
191 | hey everyone welcome back and let's write some more neat code today so today let's solve number of one bits this is actually another blind 75 problem and we've been tracking all blind 75 problems on this spreadsheet the link to that will be in the description today we'll be doing number of one bits one of the last prob... | Number of 1 Bits | number-of-1-bits | Write a function that takes the binary representation of an unsigned integer and returns the number of '1' bits it has (also known as the [Hamming weight](http://en.wikipedia.org/wiki/Hamming_weight)).
**Note:**
* Note that in some languages, such as Java, there is no unsigned integer type. In this case, the input ... | null | Bit Manipulation | Easy | 190,231,338,401,461,693,767 |
1,455 | hey what's up guys today not true alex at this connection structures and algorithms check if a word occurs as a prefix of any word in a sentence so prefix so given a sentence that contains of some words separated by a single space and a search word so search words and uh sentences you have to check if a search word is ... | Check If a Word Occurs As a Prefix of Any Word in a Sentence | filter-restaurants-by-vegan-friendly-price-and-distance | Given a `sentence` that consists of some words separated by a **single space**, and a `searchWord`, check if `searchWord` is a prefix of any word in `sentence`.
Return _the index of the word in_ `sentence` _(**1-indexed**) where_ `searchWord` _is a prefix of this word_. If `searchWord` is a prefix of more than one wor... | Do the filtering and sort as said. Note that the id may not be the index in the array. | Array,Sorting | Medium | null |
1,461 | hello welcome to my channel today I am solving the problem 1 4 6 1 check if my string contains all binary codes of size K so given a string s and an integer K we have to return true if all the binary codes of length K is a substring of s otherwise return false so for the example 1 we have a string 0 1 0 and K is 2 so f... | Check If a String Contains All Binary Codes of Size K | count-all-valid-pickup-and-delivery-options | Given a binary string `s` and an integer `k`, return `true` _if every binary code of length_ `k` _is a substring of_ `s`. Otherwise, return `false`.
**Example 1:**
**Input:** s = "00110110 ", k = 2
**Output:** true
**Explanation:** The binary codes of length 2 are "00 ", "01 ", "10 " and "11 ". They can be all f... | Use the permutation and combination theory to add one (P, D) pair each time until n pairs. | Math,Dynamic Programming,Combinatorics | Hard | null |
63 | Big Max Speech on WhatsApp Welcome Back To This Note YouTube Video Dance Video Vishal Ginger Hai Number 63 Also Called S Unique Path To File 2004 List To Challenge Solt With A Robot Is Located Top Left Corner Of My Grand Master Tinder Diagram Below The robot can only move down or sight at any point of time on this fron... | Unique Paths II | unique-paths-ii | You are given an `m x n` integer array `grid`. There is a robot initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time.
An obstacle and space are marked as ... | The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be
if obstacleGrid[i][j] is not an obstacle
... | Array,Dynamic Programming,Matrix | Medium | 62,1022 |
55 | hello everyone welcome back to sudokoda this is raveena and today we're gonna solve problem number 55 that is Jump game so let's start by reading the problem statement it says that you are given an integer array nums you are initially positioned at an arrays first index and each element in the array represents a maximu... | Jump Game | jump-game | You are given an integer array `nums`. You are initially positioned at the array's **first index**, and each element in the array represents your maximum jump length at that position.
Return `true` _if you can reach the last index, or_ `false` _otherwise_.
**Example 1:**
**Input:** nums = \[2,3,1,1,4\]
**Output:** t... | null | Array,Dynamic Programming,Greedy | Medium | 45,1428,2001 |
1,822 | okay lead code number 1822 sine of the product of an array the task is pretty much what the title says we have to find the sum of the product negative minus one positive one and then if it is zero we should return to zero the curious thing about this is that when i was checking the acceptance rate it has 60 and that is... | Sign of the Product of an Array | longest-palindromic-subsequence-ii | There is a function `signFunc(x)` that returns:
* `1` if `x` is positive.
* `-1` if `x` is negative.
* `0` if `x` is equal to `0`.
You are given an integer array `nums`. Let `product` be the product of all values in the array `nums`.
Return `signFunc(product)`.
**Example 1:**
**Input:** nums = \[-1,-2,-3,-4,... | As with any good dp problem that uses palindromes, try building the palindrome from the edges The prime point is to check that no two adjacent characters are equal, so save the past character while building the palindrome. | String,Dynamic Programming | Medium | 516 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.