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,816 | now let's go over legal question number 1816 truncate sentence the question says a sentence is a list of words that are separated by a single space with no leading or chilling spaces so just defining what a sentence is so first condition is it's a single space with no chilling spaces each of the words consists of only ... | Truncate Sentence | lowest-common-ancestor-of-a-binary-tree-iv | A **sentence** is a list of words that are separated by a single space with no leading or trailing spaces. Each of the words consists of **only** uppercase and lowercase English letters (no punctuation).
* For example, `"Hello World "`, `"HELLO "`, and `"hello world hello world "` are all sentences.
You are given a... | Starting from the root, traverse the left and the right subtrees, checking if one of the nodes exist there. If one of the subtrees doesn't contain any given node, the LCA can be the node returned from the other subtree If both subtrees contain nodes, the LCA node is the current node. | Tree,Depth-First Search,Binary Tree | Medium | 235,236,1218,1780,1790,1816 |
1,238 | hello viewers welcome back to my channel I hope you are in there enjoying the videos today I'm back with another problem from read code circular permutations in binary representation given two integers and start your task is written any permutation P of 0 to 2 power n minus 1 such that P of 0 is start PF i is equal to ... | Circular Permutation in Binary Representation | alphabet-board-path | Given 2 integers `n` and `start`. Your task is return **any** permutation `p` of `(0,1,2.....,2^n -1)` such that :
* `p[0] = start`
* `p[i]` and `p[i+1]` differ by only one bit in their binary representation.
* `p[0]` and `p[2^n -1]` must also differ by only one bit in their binary representation.
**Example 1:*... | Create a hashmap from letter to position on the board. Now for each letter, try moving there in steps, where at each step you check if it is inside the boundaries of the board. | Hash Table,String | Medium | null |
380 | hi guys so next we will be solving the problem of insert delete and get random in constant time yeah okay so we have to design a data structure that supports the following operations in average of constant time insert a value if not already present remove an item from the set if present returns a random element from th... | 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,020 | hello guys welcome to deep codes and in today's video we will discuss let's go question one zero two zero that says number of antlers so guys this question is almost similar to yesterday's Daily problem that is number of close Islands so if you guys have any doubts in this question that is number of close Islands or if... | Number of Enclaves | longest-turbulent-subarray | You are given an `m x n` binary matrix `grid`, where `0` represents a sea cell and `1` represents a land cell.
A **move** consists of walking from one land cell to another adjacent (**4-directionally**) land cell or walking off the boundary of the `grid`.
Return _the number of land cells in_ `grid` _for which we cann... | null | Array,Dynamic Programming,Sliding Window | Medium | 53 |
14 | this might be the most asked coding question I've ever seen the question is called longest common prefix and it's really not that bad we're given a list of strings and we need to get the longest common prefix so for flower flow and flight the longest prefix is FL now the longest prefix that we could have is the length ... | Longest Common Prefix | longest-common-prefix | Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string `" "`.
**Example 1:**
**Input:** strs = \[ "flower ", "flow ", "flight "\]
**Output:** "fl "
**Example 2:**
**Input:** strs = \[ "dog ", "racecar ", "car "\]
**Output:** " "... | null | String | Easy | null |
1,941 | today I'm solving check if all characters have equal number of occurrences giving a string s we have to return the Boolean value true if it's a good string otherwise we have to return false a good string is a string where all the characters have the same number of occurrences so here we have s a b a c b c you see that ... | Check if All Characters Have Equal Number of Occurrences | minimum-number-of-operations-to-make-string-sorted | Given a string `s`, return `true` _if_ `s` _is a **good** string, or_ `false` _otherwise_.
A string `s` is **good** if **all** the characters that appear in `s` have the **same** number of occurrences (i.e., the same frequency).
**Example 1:**
**Input:** s = "abacbc "
**Output:** true
**Explanation:** The character... | Note that the operations given describe getting the previous permutation of s To solve this problem you need to solve every suffix separately | Math,String,Combinatorics | Hard | null |
215 | Jhaal Hello guys welcome till Thursday in the pot Video subscribe like subscribe comment and subscribe to subscribe our that gas - vacation president Mirwaiz subscribe and subscribe the and landscape Laxman 9 introduction elements I am India so then good qualities in holidays are this I do You can incident that the fir... | Kth Largest Element in an Array | kth-largest-element-in-an-array | Given an integer array `nums` and an integer `k`, return _the_ `kth` _largest element in the array_.
Note that it is the `kth` largest element in the sorted order, not the `kth` distinct element.
You must solve it in `O(n)` time complexity.
**Example 1:**
**Input:** nums = \[3,2,1,5,6,4\], k = 2
**Output:** 5
**Ex... | null | Array,Divide and Conquer,Sorting,Heap (Priority Queue),Quickselect | Medium | 324,347,414,789,1014,2113,2204,2250 |
1,026 | Hi gas welcome and welcome back to my channel problem is maximum difference between node and sister and see you have to find maximum value week so see you find d value for which there exist different nodes A and B so date will be you not where value Off Anode Mines B Not This Absolute Value Should Be D Maximum A Basica... | Maximum Difference Between Node and Ancestor | string-without-aaa-or-bbb | Given the `root` of a binary tree, find the maximum value `v` for which there exist **different** nodes `a` and `b` where `v = |a.val - b.val|` and `a` is an ancestor of `b`.
A node `a` is an ancestor of `b` if either: any child of `a` is equal to `b` or any child of `a` is an ancestor of `b`.
**Example 1:**
**Input... | null | String,Greedy | Medium | null |
496 | okay so today we're looking at question 496 nick's greater element one the next graded element of sum element x is an array in an array is the first greater element to the right of x in the same array you are given two distinct zero index arrays numbers one number two numbers two is a subset of nums one for each zero i... | Next Greater Element I | next-greater-element-i | The **next greater element** of some element `x` in an array is the **first greater** element that is **to the right** of `x` in the same array.
You are given two **distinct 0-indexed** integer arrays `nums1` and `nums2`, where `nums1` is a subset of `nums2`.
For each `0 <= i < nums1.length`, find the index `j` such ... | null | Array,Hash Table,Stack,Monotonic Stack | Easy | 503,556,739,2227 |
46 | Hello hi guys welcome back point wise and today's demanding question to join but in mutation service what is the first hard work to give are numbered here stitching is written meaning it will not be repeated even once ok return of the possible permission servi meaning Now I can do one to three, I want to subscribe. Are... | Permutations | permutations | Given an array `nums` of distinct integers, return _all the possible permutations_. You can return the answer in **any order**.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,1\],\[3,1,2\],\[3,2,1\]\]
**Example 2:**
**Input:** nums = \[0,1\]
**Output:** \[\[0,1\],\[1,0\... | null | Array,Backtracking | Medium | 31,47,60,77 |
50 | let's look at this problem poll so we have to implement our own poll which calculates the X raised to the power of n X to the n like this to 210 is 1024 there is a case that it might be - the M there is a case that it might be - the M there is a case that it might be - the M might be - so N is a 32-bit signed might be ... | Pow(x, n) | powx-n | Implement [pow(x, n)](http://www.cplusplus.com/reference/valarray/pow/), which calculates `x` raised to the power `n` (i.e., `xn`).
**Example 1:**
**Input:** x = 2.00000, n = 10
**Output:** 1024.00000
**Example 2:**
**Input:** x = 2.10000, n = 3
**Output:** 9.26100
**Example 3:**
**Input:** x = 2.00000, n = -2
**... | null | Math,Recursion | Medium | 69,372 |
1,213 | so lead code practice time so in this video there are two goals the first goal is to see how to solve this problem uh so first of all we are going to do a solution searching and also we are going to do some coding work and the second goal is to see how we should behave in a real interview so let's get started so in rea... | Intersection of Three Sorted Arrays | handshakes-that-dont-cross | Given three integer arrays `arr1`, `arr2` and `arr3` **sorted** in **strictly increasing** order, return a sorted array of **only** the integers that appeared in **all** three arrays.
**Example 1:**
**Input:** arr1 = \[1,2,3,4,5\], arr2 = \[1,2,5,7,9\], arr3 = \[1,3,4,5,8\]
**Output:** \[1,5\]
**Explanation:** Only 1... | Use dynamic programming. Let dp[n] be the number of ways that n people can handshake. Then fix a person as a pivot and turn for every other person who will have a handshake, the answer is the sum of the products of the new two subproblems. | Math,Dynamic Programming | Hard | null |
1,458 | hello and welcome to another video in this video we're going to be working on Max do product of two subsequences so here you're given two arrays nums one and nums 2 and you want to return the maximum dot product between non-empty maximum dot product between non-empty maximum dot product between non-empty subsequences s... | Max Dot Product of Two Subsequences | sort-integers-by-the-number-of-1-bits | Given two arrays `nums1` and `nums2`.
Return the maximum dot product between **non-empty** subsequences of nums1 and nums2 with the same length.
A subsequence of a array is a new array which is formed from the original array by deleting some (can be none) of the characters without disturbing the relative positions of... | Simulate the problem. Count the number of 1's in the binary representation of each integer. Sort by the number of 1's ascending and by the value in case of tie. | Array,Bit Manipulation,Sorting,Counting | Easy | 2204 |
1,035 | hey everybody this is Larry this is day 11 of the uh what's it called amazing what uh why do these things move around I'm a illegal daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's problems or problem uh I am gonna do the JavaScript thing so defini... | Uncrossed Lines | cousins-in-binary-tree | You are given two integer arrays `nums1` and `nums2`. We write the integers of `nums1` and `nums2` (in the order they are given) on two separate horizontal lines.
We may draw connecting lines: a straight line connecting two numbers `nums1[i]` and `nums2[j]` such that:
* `nums1[i] == nums2[j]`, and
* the line we d... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 102 |
435 | hello everyone so let's discuss a lead code problem for today and this is one of the problems within the blind 75 list today we are going to discuss problem 435 nonoverlapping intervals uh so the problem definition says given an array of intervals where every interval is defined by start value and an N value we have to... | Non-overlapping Intervals | non-overlapping-intervals | Given an array of intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping_.
**Example 1:**
**Input:** intervals = \[\[1,2\],\[2,3\],\[3,4\],\[1,3\]\]
**Output:** 1
**Explanation:** \[1,3\] can be removed ... | null | Array,Dynamic Programming,Greedy,Sorting | Medium | 452 |
212 | That a show more that this dominance in spanish video its support staff available this year 2012 subscribe to dad dictionary channel subscribe videos subscribe to pendoo carefully channel and this sucker eases mother's problem in his pocket and distributed to the awards are given to you and water sports Par 1431 check ... | Word Search II | word-search-ii | Given an `m x n` `board` of characters and a list of strings `words`, return _all words on the board_.
Each word must be constructed from letters of sequentially adjacent cells, where **adjacent cells** are horizontally or vertically neighboring. The same letter cell may not be used more than once in a word.
**Exampl... | You would need to optimize your backtracking to pass the larger test. Could you stop backtracking earlier? If the current candidate does not exist in all words' prefix, you could stop backtracking immediately. What kind of data structure could answer such query efficiently? Does a hash table work? Why or why not? How a... | Array,String,Backtracking,Trie,Matrix | Hard | 79,1022,1433 |
290 | foreign only one time right make sure we will divide like that only next we have next what we have pattern two right we have pattern two and in the pattern two what we have to do pattern is given a b a okay we have given pattern A B A let's understand a b a but it is given dog catfish right dog catfish it will divide f... | Word Pattern | word-pattern | Given a `pattern` and a string `s`, find if `s` follows the same pattern.
Here **follow** means a full match, such that there is a bijection between a letter in `pattern` and a **non-empty** word in `s`.
**Example 1:**
**Input:** pattern = "abba ", s = "dog cat cat dog "
**Output:** true
**Example 2:**
**Input:*... | null | Hash Table,String | Easy | 205,291 |
1,305 | hello so today we are doing the contest weekly contest 169 and the second problem which is all elements into binary search in to binary search trees basically its problem 1305 and the problem says given to binary search trees root 1 and root 2 when I return unless containing all the integers from both trees sorted in a... | All Elements in Two Binary Search Trees | number-of-visible-people-in-a-queue | Given two binary search trees `root1` and `root2`, return _a list containing all the integers from both trees sorted in **ascending** order_.
**Example 1:**
**Input:** root1 = \[2,1,4\], root2 = \[1,0,3\]
**Output:** \[0,1,1,2,3,4\]
**Example 2:**
**Input:** root1 = \[1,null,8\], root2 = \[8,1\]
**Output:** \[1,1,8... | How to solve this problem in quadratic complexity ? For every subarray start at index i, keep finding new maximum values until a value larger than arr[i] is found. Since the limits are high, you need a linear solution. Use a stack to keep the values of the array sorted as you iterate the array from the end to the start... | Array,Stack,Monotonic Stack | Hard | 1909,2227 |
54 | hey everyone welcome back to the channel I hope you guys are doing extremely well so this is another lecture from this right verse A2 said DSA course just in case for the first time out this is world's most in-depth course when you world's most in-depth course when you world's most in-depth course when you talk about b... | Spiral Matrix | spiral-matrix | Given an `m x n` `matrix`, return _all elements of the_ `matrix` _in spiral order_.
**Example 1:**
**Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[1,2,3,6,9,8,7,4,5\]
**Example 2:**
**Input:** matrix = \[\[1,2,3,4\],\[5,6,7,8\],\[9,10,11,12\]\]
**Output:** \[1,2,3,4,8,12,11,10,9,5,6,7\]
**Const... | Well for some problems, the best way really is to come up with some algorithms for simulation. Basically, you need to simulate what the problem asks us to do. We go boundary by boundary and move inwards. That is the essential operation. First row, last column, last row, first column and then we move inwards by 1 and th... | Array,Matrix,Simulation | Medium | 59,921 |
1,637 | hey guys welcome back to my channel and in today's video we are going to solve one more lead qu question that is widest vertical area between two points containing no points so in this question we are given n points on a 2d plane where points I that is an array represents x and y coordinate of a particular point and we... | Widest Vertical Area Between Two Points Containing No Points | string-compression-ii | Given `n` `points` on a 2D plane where `points[i] = [xi, yi]`, Return _the **widest vertical area** between two points such that no points are inside the area._
A **vertical area** is an area of fixed-width extending infinitely along the y-axis (i.e., infinite height). The **widest vertical area** is the one with the ... | Use dynamic programming. The state of the DP can be the current index and the remaining characters to delete. Having a prefix sum for each character can help you determine for a certain character c in some specific range, how many characters you need to delete to merge all occurrences of c in that range. | String,Dynamic Programming | Hard | null |
899 | today that's so orderly cute we are given string s and the integer K we can choose one of the first K letters of s and append it at the end of the string we need to return the legs called graphically smallest string we can get so no matter how many number of moves we can Act so in this case let's see these two examples... | Orderly Queue | binary-gap | You are given a string `s` and an integer `k`. You can choose one of the first `k` letters of `s` and append it at the end of the string..
Return _the lexicographically smallest string you could have after applying the mentioned step any number of moves_.
**Example 1:**
**Input:** s = "cba ", k = 1
**Output:** "ac... | null | Math,Bit Manipulation | Easy | null |
833 | hey everyone welcome to my channel so in this video i'm going to try to solve this problem at the same time i'm going to follow the general interview steps while trying to solve this problem so let's read through this question you're given a 0 indexed string s you must perform k replacement operations on so the replace... | Find And Replace in String | bus-routes | You are given a **0-indexed** string `s` that you must perform `k` replacement operations on. The replacement operations are given as three **0-indexed** parallel arrays, `indices`, `sources`, and `targets`, all of length `k`.
To complete the `ith` replacement operation:
1. Check if the **substring** `sources[i]` oc... | null | Array,Hash Table,Breadth-First Search | Hard | null |
406 | hey everybody this is Larry this is day 29 oh second to last day of the June Nico daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's Farm let me make sure that I'm recording the screen okay wait is it recording okay I think so uh yes I've uh I actual... | Queue Reconstruction by Height | queue-reconstruction-by-height | You are given an array of people, `people`, which are the attributes of some people in a queue (not necessarily in order). Each `people[i] = [hi, ki]` represents the `ith` person of height `hi` with **exactly** `ki` other people in front who have a height greater than or equal to `hi`.
Reconstruct and return _the queu... | What can you say about the position of the shortest person?
If the position of the shortest person is i, how many people would be in front of the shortest person? Once you fix the position of the shortest person, what can you say about the position of the second shortest person? | Array,Greedy,Binary Indexed Tree,Segment Tree,Sorting | Medium | 315 |
135 | Problem Which Name on This D New Lead Is Candy Distribution Problem D Problem At List One Candy Mins Each child should get at least one candy Mains is in the rating Which is in each element of each rating They will get one candy and children with D higher rating get more candies give fear nevers it mains zero's perspec... | 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 |
456 | Hello hello everyone welcome and welcome back to my channel suggestion or after hours problems want to pattern to interest problem give them go near to find a subsequent is and subsequent true dot print serious ram bhai namaste nuskhe sankat eye lashes relation's putnam sufficient evidence of According to shoot's lab s... | 132 Pattern | 132-pattern | Given an array of `n` integers `nums`, a **132 pattern** is a subsequence of three integers `nums[i]`, `nums[j]` and `nums[k]` such that `i < j < k` and `nums[i] < nums[k] < nums[j]`.
Return `true` _if there is a **132 pattern** in_ `nums`_, otherwise, return_ `false`_._
**Example 1:**
**Input:** nums = \[1,2,3,4\]
... | null | Array,Binary Search,Stack,Monotonic Stack,Ordered Set | Medium | null |
388 | today we're going to be working on lead code question number 388 longest absolute file path suppose we have a file system that stores both files and directories an example of one file system is represented in the following picture so it's going to be represent we're going to be given uh a file system inside the like in... | Longest Absolute File Path | longest-absolute-file-path | Suppose we have a file system that stores both files and directories. An example of one system is represented in the following picture:
Here, we have `dir` as the only directory in the root. `dir` contains two subdirectories, `subdir1` and `subdir2`. `subdir1` contains a file `file1.ext` and subdirectory `subsubdir1`.... | null | String,Stack,Depth-First Search | Medium | null |
127 | although i am today covering up for yesterday's session uh and yesterday's question was word ladder in this question you are given a dictionary and a beginning word and the end word uh and some rules and the rule says that two words are related if they differ by archmarks one character so what you need to do in this qu... | 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 |
455 | hello hi guys good morning welcome back and assign cookies it has been asked by many companies xedia Adobe Amazon Apple Microsoft and so on and so forth let's see what the problem says uh I give you the C what the problem says you are given an AR G and AR s AR G is the greed factor of the children's what you are having... | Assign Cookies | assign-cookies | Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.
Each child `i` has a greed factor `g[i]`, which is the minimum size of a cookie that the child will be content with; and each cookie `j` has a size `s[j]`. If `s[j] >= g[i]`, we can assign ... | null | Array,Greedy,Sorting | Easy | null |
219 | Hello students of this question offbeat special contested to Ghaghare Ghee I have to do that if two elements are named ok and their index is captured loot which will mean different index which will be the difference please keep in mind if it is of this year then we will do Will give return proof even after full refinem... | Contains Duplicate II | contains-duplicate-ii | Given an integer array `nums` and an integer `k`, return `true` _if there are two **distinct indices**_ `i` _and_ `j` _in the array such that_ `nums[i] == nums[j]` _and_ `abs(i - j) <= k`.
**Example 1:**
**Input:** nums = \[1,2,3,1\], k = 3
**Output:** true
**Example 2:**
**Input:** nums = \[1,0,1,1\], k = 1
**Outp... | null | Array,Hash Table,Sliding Window | Easy | 217,220 |
209 | hello everyone welcome back Shiraz van amsen and today we will try to solve a code in Python number 209 uh minimum size sub array sum so this problem is a great way to practice array manipulation and the sliding window technique as well so let's get started here is the problem statement we are given an array of uh posi... | 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 |
350 | foreign foreign foreign welcome to my channel this is quantum unicorn the lead code problem we are solving this video is intersection of two arrays two well the intuition behind this solution is to use a hashmap AKA dictionary to efficiently track the count of elements in nums 1 and by maintaining a count of each eleme... | Intersection of Two Arrays II | intersection-of-two-arrays-ii | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must appear as many times as it shows in both arrays and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2,2\]
**Example 2:**
**I... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 349,1044,1392,2282 |
203 | hello guys I'm this video we see problem link list elements so given head of the link list and integer value remove all the nodes of the link list that such that the node value is equal to the given integer value and return the new head so what the question is given in a link list and they have given some value if any ... | Remove Linked List Elements | remove-linked-list-elements | Given the `head` of a linked list and an integer `val`, remove all the nodes of the linked list that has `Node.val == val`, and return _the new head_.
**Example 1:**
**Input:** head = \[1,2,6,3,4,5,6\], val = 6
**Output:** \[1,2,3,4,5\]
**Example 2:**
**Input:** head = \[\], val = 1
**Output:** \[\]
**Example 3:**... | null | Linked List,Recursion | Easy | 27,237,2216 |
1,465 | okay we solved the code question in 1465 maximum area of a piece of cake after horizontal and vertical cuts this question came from weekly contest 191 I pause the video if you want to take a look otherwise I'm gonna continue with the approach so let's start from example 1 so the way to do this is by getting the inter g... | Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts | maximum-product-of-splitted-binary-tree | You are given a rectangular cake of size `h x w` and two arrays of integers `horizontalCuts` and `verticalCuts` where:
* `horizontalCuts[i]` is the distance from the top of the rectangular cake to the `ith` horizontal cut and similarly, and
* `verticalCuts[j]` is the distance from the left of the rectangular cake ... | If we know the sum of a subtree, the answer is max( (total_sum - subtree_sum) * subtree_sum) in each node. | Tree,Depth-First Search,Binary Tree | Medium | 2175 |
32 | hey everybody this is larry this is day uh 24 yeah of the may lego daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's problem longest valid parentheses hard okay so give it a string contain just a character find the length of the longest routed paren... | 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 |
152 | right so today we are going to talk about nickel question 152 maximum product summary the question says given an integer very news fire continuous non-anti sub array news fire continuous non-anti sub array news fire continuous non-anti sub array within the array that has the largest product and return the product the t... | Maximum Product Subarray | maximum-product-subarray | Given an integer array `nums`, find a subarray that has the largest product, and return _the product_.
The test cases are generated so that the answer will fit in a **32-bit** integer.
**Example 1:**
**Input:** nums = \[2,3,-2,4\]
**Output:** 6
**Explanation:** \[2,3\] has the largest product 6.
**Example 2:**
**I... | null | Array,Dynamic Programming | Medium | 53,198,238,628,713 |
558 | hey everybody this is Larry is November 15 and this is me trying to do an extra apartment I'm gonna try to do a medium today just because I am trying to do a little bit better about sleeping already I don't know if that's true that's why I have these uh nerdy looking blue glasses let me know how you feel about them uh ... | Logical OR of Two Binary Grids Represented as Quad-Trees | logical-or-of-two-binary-grids-represented-as-quad-trees | A Binary Matrix is a matrix in which all the elements are either **0** or **1**.
Given `quadTree1` and `quadTree2`. `quadTree1` represents a `n * n` binary matrix and `quadTree2` represents another `n * n` binary matrix.
Return _a Quad-Tree_ representing the `n * n` binary matrix which is the result of **logical bitw... | null | null | Medium | null |
119 | design an algorithm to return the cave row index of a Pascal's triangle using only okay extra space how do you do that's about today's video that's I mean Cavani this is where my dream started what's up everybody this is Steve here today we're going through a very classic interview question not only interview but I'm s... | Pascal's Triangle II | pascals-triangle-ii | Given an integer `rowIndex`, return the `rowIndexth` (**0-indexed**) row of the **Pascal's triangle**.
In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown:
**Example 1:**
**Input:** rowIndex = 3
**Output:** \[1,3,3,1\]
**Example 2:**
**Input:** rowIndex = 0
**Output:** \[... | null | Array,Dynamic Programming | Easy | 118,2324 |
688 | hello guys welcome to deep codes and in today's video we will discuss liquid question 688 that says Knight probability on chessboard so guys in this video I will try to explain you this question in very simple manner so that you can quickly understand the code as well as the approach also I will try to uh draw the ches... | Knight Probability in Chessboard | knight-probability-in-chessboard | On an `n x n` chessboard, a knight starts at the cell `(row, column)` and attempts to make exactly `k` moves. The rows and columns are **0-indexed**, so the top-left cell is `(0, 0)`, and the bottom-right cell is `(n - 1, n - 1)`.
A chess knight has eight possible moves it can make, as illustrated below. Each move is ... | null | Dynamic Programming | Medium | 576 |
1,835 | hey what's up guys uh this is chung here so today uh 1835 find x or sum of all pairs bitwise end okay so you're given like a two arrays right and our task is to find the xor right among all the pairs between those two arrays you know where the uh the result of the pairs will be an end right basically so what this one i... | Find XOR Sum of All Pairs Bitwise AND | decode-xored-permutation | The **XOR sum** of a list is the bitwise `XOR` of all its elements. If the list only contains one element, then its **XOR sum** will be equal to this element.
* For example, the **XOR sum** of `[1,2,3,4]` is equal to `1 XOR 2 XOR 3 XOR 4 = 4`, and the **XOR sum** of `[3]` is equal to `3`.
You are given two **0-inde... | Compute the XOR of the numbers between 1 and n, and think about how it can be used. Let it be x. Think why n is odd. perm[0] = x XOR encoded[1] XOR encoded[3] XOR encoded[5] ... perm[i] = perm[i-1] XOR encoded[i-1] | Array,Bit Manipulation | Medium | null |
376 | hello coders welcome back to my channel let's solve lead code medium problem 376 wiggle subsequence uh let's see the description a bigger subsequence is a subsequence where difference between successive numbers strictly alternate between positive and negative okay and a sequence with one element and subsequent uh seque... | Wiggle Subsequence | wiggle-subsequence | A **wiggle sequence** is a sequence where the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with one element and a sequence with two non-equal elements are trivially wiggle sequences.
* For ... | null | Array,Dynamic Programming,Greedy | Medium | 2271 |
350 | That good morning all of you today and world tour discussion with your interests of 217 and in this add ML and in this question and just give a truck and van 102 both are random note easy ignorance pocket 100 on list start that a first form VHP That test is a little bit The all elements of the sequence are mapped to th... | Intersection of Two Arrays II | intersection-of-two-arrays-ii | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must appear as many times as it shows in both arrays and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2,2\]
**Example 2:**
**I... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 349,1044,1392,2282 |
116 | hi everyone i'm bihan chakravarti and today i'll be discussing the problem number 116 from latecode that is populating next right pointers in each node so in this problem we have been given a tree and this is the structure of its nodes so along with the value left and right nodes we have an additional node that is next... | Populating Next Right Pointers in Each Node | populating-next-right-pointers-in-each-node | You are given a **perfect binary tree** where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:
struct Node {
int val;
Node \*left;
Node \*right;
Node \*next;
}
Populate each next pointer to point to its next right node. If there is no next righ... | null | Linked List,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 117,199 |
435 | hi everyone let's look at a legal problem today it's called non overlapping intervals given an array of intervals where intervals I equals start I and I return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping rest of the intervals non-overlapping rest of the intervals... | Non-overlapping Intervals | non-overlapping-intervals | Given an array of intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping_.
**Example 1:**
**Input:** intervals = \[\[1,2\],\[2,3\],\[3,4\],\[1,3\]\]
**Output:** 1
**Explanation:** \[1,3\] can be removed ... | null | Array,Dynamic Programming,Greedy,Sorting | Medium | 452 |
968 | Hello hello brother is welcome to my video phanda seerte baikunth problem magical ko rona vaccine so give the native vaccine for coronavirus i want to for no7 glad to have access to get government where is not representative house England final minimum number of houses of 26 apply the Bed Scene Ketevan Vaccine's Applic... | Binary Tree Cameras | beautiful-array | You are given the `root` of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor its parent, itself, and its immediate children.
Return _the minimum number of cameras needed to monitor all nodes of the tree_.
**Example 1:**
**Input:** root = \[0,0,null,0,0\]
**Output:** 1
**Exp... | null | Array,Math,Divide and Conquer | Medium | null |
44 | hi guys welcome to leeco 44 um we're gonna do wild card matching today so I actually think that this should be one of your first DB questions that you try especially if you have not yet tried number 10 regex matching because this is a bit simpler so given an input string s and a pattern P Implement World Cup better mat... | Wildcard Matching | wildcard-matching | Given an input string (`s`) and a pattern (`p`), implement wildcard pattern matching with support for `'?'` and `'*'` where:
* `'?'` Matches any single character.
* `'*'` Matches any sequence of characters (including the empty sequence).
The matching should cover the **entire** input string (not partial).
**Exam... | null | String,Dynamic Programming,Greedy,Recursion | Hard | 10 |
406 | Hello viewers welcome back to back design this video will see the curious construction by height problem wishes from list co de take of the june challenge so let's not look at the problem statement the problem yes-yes that is supposed to have randomly problem yes-yes that is supposed to have randomly problem yes-yes th... | Queue Reconstruction by Height | queue-reconstruction-by-height | You are given an array of people, `people`, which are the attributes of some people in a queue (not necessarily in order). Each `people[i] = [hi, ki]` represents the `ith` person of height `hi` with **exactly** `ki` other people in front who have a height greater than or equal to `hi`.
Reconstruct and return _the queu... | What can you say about the position of the shortest person?
If the position of the shortest person is i, how many people would be in front of the shortest person? Once you fix the position of the shortest person, what can you say about the position of the second shortest person? | Array,Greedy,Binary Indexed Tree,Segment Tree,Sorting | Medium | 315 |
1,707 | Welcome Back Price Today In This Another Problem From Liquid Maximum Which Ribbon Element From Railway Sudesh Problem Appeared In Till Hottest Flat Solving Problems Aa [ Hottest Flat Solving Problems Aa [ Hottest Flat Solving Problems Aa I Soft Paul Will Replace Yagya Ne Chief Secretary For Negative 2000 Introduction O... | Maximum XOR With an Element From Array | check-if-string-is-transformable-with-substring-sort-operations | You are given an array `nums` consisting of non-negative integers. You are also given a `queries` array, where `queries[i] = [xi, mi]`.
The answer to the `ith` query is the maximum bitwise `XOR` value of `xi` and any element of `nums` that does not exceed `mi`. In other words, the answer is `max(nums[j] XOR xi)` for a... | Suppose the first digit you need is 'd'. How can you determine if it's possible to get that digit there? Consider swapping adjacent characters to maintain relative ordering. | String,Greedy,Sorting | Hard | null |
1,609 | hello hi guys good morning welcome back to a new video in this video even odd trade has been asked by Amazon and Bloomberg it's a very easy problem I swear I have not found any easy tree problem than that uh than this one let's see the problem says the problem simply says that we are given a binary tree named even odd ... | Even Odd Tree | find-all-the-lonely-nodes | A binary tree is named **Even-Odd** if it meets the following conditions:
* The root of the binary tree is at level index `0`, its children are at level index `1`, their children are at level index `2`, etc.
* For every **even-indexed** level, all nodes at the level have **odd** integer values in **strictly increa... | Do a simple tree traversal, try to check if the current node is lonely or not. Node is lonely if at least one of the left/right pointers is null. | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 563,1005 |
1,248 | hello so today we are doing contest weekly context of fleet code we click on tax 161 and one of the problems is this medium problem called count number of nice sub arrays and so the problem says that we'll get an array of integers nums and an integer k and we wanna and the definition of the sub array we call it's nice ... | Count Number of Nice Subarrays | binary-tree-coloring-game | Given an array of integers `nums` and an integer `k`. A continuous subarray is called **nice** if there are `k` odd numbers on it.
Return _the number of **nice** sub-arrays_.
**Example 1:**
**Input:** nums = \[1,1,2,1,1\], k = 3
**Output:** 2
**Explanation:** The only sub-arrays with 3 odd numbers are \[1,1,2,1\] an... | The best move y must be immediately adjacent to x, since it locks out that subtree. Can you count each of (up to) 3 different subtrees neighboring x? | Tree,Depth-First Search,Binary Tree | Medium | null |
32 | hey what's up guys uh this is chung here so today uh today's daily challenge problem right number 32 longest valid uh parenthesis so this one it's a very straightforward problem but you know it has a several like solutions now basically you're given like a string containing only the left and right parentheses and you n... | 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 |
1,768 | we are given two words to take characters from these words alternatively we will use two pointers I and J one by one these characters will be appended to the result paray until one of the pointer reaches the end of word and then the remaining characters will be appended to the result paray let's code the solution now 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 |
917 | reverse the string according to the following rules so all the characters that are not English letters remain in the same position and all the English letters either it can be in the lower case or uppercase should be reversed so written as after reversing it so what the question says is that the given a string press an... | 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 |
421 | hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you've not liked the video please like it subscribe to my channel so that you get notified when i post a new video so without any further ado let's get started so the problem is maximums or ... | 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 |
350 | all right let's talk about the intersection of two array two so you're giving two array and then you just want to return the intersection and this idea is pretty simple just using the map so if i have a map just stored in my number with the frequency so one two so and this one is two and then there's no one right so i ... | Intersection of Two Arrays II | intersection-of-two-arrays-ii | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must appear as many times as it shows in both arrays and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2,2\]
**Example 2:**
**I... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 349,1044,1392,2282 |
81 | hello and welcome to another Elite code video today we're going to be working on search and assorted array 2. and so this is similar to the last problem where you have some array and it could be rotated it could not be so in this case it is rotated in an example so you have something like this and we are trying to find... | Search in Rotated Sorted Array II | search-in-rotated-sorted-array-ii | There is an integer array `nums` sorted in non-decreasing order (not necessarily with **distinct** values).
Before being passed to your function, `nums` is **rotated** at an unknown pivot index `k` (`0 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nu... | null | Array,Binary Search | Medium | 33 |
1,866 | hey everybody this is larry this is me going with q4 of the weekly contest 241 number of ways to rearrange stacks of k sticks visible so actually i solved this with um with dynamic programming and i actually did it um if you watch me solve it live i'm gonna actually go through um how can i click on this oops i did as i... | Number of Ways to Rearrange Sticks With K Sticks Visible | restore-the-array-from-adjacent-pairs | There are `n` uniquely-sized sticks whose lengths are integers from `1` to `n`. You want to arrange the sticks such that **exactly** `k` sticks are **visible** from the left. A stick is **visible** from the left if there are no **longer** sticks to the **left** of it.
* For example, if the sticks are arranged `[1,3,... | Find the first element of nums - it will only appear once in adjacentPairs. The adjacent pairs are like edges of a graph. Perform a depth-first search from the first element. | Array,Hash Table | Medium | null |
238 | we are looking at lead code number 238 it is a question called product of array except self okay and so there are two let's take a look at the prompt here before we jump into our strategy so given a number array nums we want to return an array answer such that the answer at the i-th that the answer at the i-th that the... | Product of Array Except Self | product-of-array-except-self | Given an integer array `nums`, return _an array_ `answer` _such that_ `answer[i]` _is equal to the product of all the elements of_ `nums` _except_ `nums[i]`.
The product of any prefix or suffix of `nums` is **guaranteed** to fit in a **32-bit** integer.
You must write an algorithm that runs in `O(n)` time and without... | null | Array,Prefix Sum | Medium | 42,152,265,2267 |
1,833 | all right trying out a random medium problem and we get a premium one so we go back and we try again okay tasks count in the weekend that's the problem I can see from my taskbar and we're gonna get another Premium One and we go back again um do they have a filter for that can I filter status attacks let's actually do s... | Maximum Ice Cream Bars | find-the-highest-altitude | It is a sweltering summer day, and a boy wants to buy some ice cream bars.
At the store, there are `n` ice cream bars. You are given an array `costs` of length `n`, where `costs[i]` is the price of the `ith` ice cream bar in coins. The boy initially has `coins` coins to spend, and he wants to buy as many ice cream bar... | Let's note that the altitude of an element is the sum of gains of all the elements behind it Getting the altitudes can be done by getting the prefix sum array of the given array | Array,Prefix Sum | Easy | null |
130 | welcome back everyone we're gonna be solving Lee code 130 surrounded regions so we're given an M by n a matrix called board which contains X's and O's we need to capture all regions which are four directionally surrounded by an X and we can call a region captured by flipping all O's into x's in that surrounded region s... | Surrounded Regions | surrounded-regions | Given an `m x n` matrix `board` containing `'X'` and `'O'`, _capture all regions that are 4-directionally surrounded by_ `'X'`.
A region is **captured** by flipping all `'O'`s into `'X'`s in that surrounded region.
**Example 1:**
**Input:** board = \[\[ "X ", "X ", "X ", "X "\],\[ "X ", "O ", "O ", "X "\],\[ "X ", "... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | 200,286 |
326 | hey everybody this is larry this is day 24 of the leeco day challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's prom just trying to find to see if there's extra points uh power of 3 326 okay given in jn return true are you serious um okay the tricky part is... | 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 |
154 | EPF Diwan and welcome to quote card to in and expert solve this problem for a minimum mein chhote-chhote are solve this minimum mein chhote-chhote are solve this minimum mein chhote-chhote are solve this problem with the help of ministers algorithm aware and complexity weight and of log in hindi central to the problem ... | Find Minimum in Rotated Sorted Array II | find-minimum-in-rotated-sorted-array-ii | Suppose an array of length `n` sorted in ascending order is **rotated** between `1` and `n` times. For example, the array `nums = [0,1,4,4,5,6,7]` might become:
* `[4,5,6,7,0,1,4]` if it was rotated `4` times.
* `[0,1,4,4,5,6,7]` if it was rotated `7` times.
Notice that **rotating** an array `[a[0], a[1], a[2], .... | null | Array,Binary Search | Hard | 153 |
12 | Hello everyone welcome and welcome back tu de channel in today's lecture will be interior tu roman number so we have wait and date c are going tu converted tu de no roman number so this is one of the really important and ask question in interviews so Let's see ho see can okay so here is a good thing to understand there... | 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 |
344 | 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 reverse string so problem says write a function that reverses string the input string is given as an error of characters array so we have given as a character array we would like... | 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 |
967 | uh hey everybody this is larry this is the 18th day of the leco daily challenge for august uh hit the like button hit the subscribe button join me on discord hang out and let me know how you feel about you know everything um okay jay's farm is numbers with same consecutive difference return all non-negative integers of... | Numbers With Same Consecutive Differences | minimum-falling-path-sum | Given two integers n and k, return _an array of all the integers of length_ `n` _where the difference between every two consecutive digits is_ `k`. You may return the answer in **any order**.
Note that the integers should not have leading zeros. Integers as `02` and `043` are not allowed.
**Example 1:**
**Input:** n... | null | Array,Dynamic Programming,Matrix | Medium | 1224 |
160 | Jhal Hello Hi Guys Welcome To Questions Today's Questions In Section Or Black List In This Question Behavior To Write A Program To Find The Point Note Amity International Tourist Begins For Example c3312 Link List And Where To Find No Date With Flute To Liquid Suryavanshi President Kshatriya Egg Not being can find anot... | Intersection of Two Linked Lists | intersection-of-two-linked-lists | Given the heads of two singly linked-lists `headA` and `headB`, return _the node at which the two lists intersect_. If the two linked lists have no intersection at all, return `null`.
For example, the following two linked lists begin to intersect at node `c1`:
The test cases are generated such that there are no cycle... | null | Hash Table,Linked List,Two Pointers | Easy | 599 |
279 | hello friends now let's solve the purple squirrels problem Nancy a statement given positive integer and find the least number of contexts where numbers for example 1 4 9 16 which some two and lastly example any caught your health and the result should be 3 well how do you think about this problem we are given 12 then w... | Perfect Squares | perfect-squares | Given an integer `n`, return _the least number of perfect square numbers that sum to_ `n`.
A **perfect square** is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, `1`, `4`, `9`, and `16` are perfect squares while `3` and `11` are not.
**Example ... | null | Math,Dynamic Programming,Breadth-First Search | Medium | 204,264 |
137 | hey everyone welcome back today we are going to solve problem number 137 single number two 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 are given a nums array where we need to find an element which appears once so all the ot... | Single Number II | single-number-ii | Given an integer array `nums` where every element appears **three times** except for one, which appears **exactly once**. _Find the single element and return it_.
You must implement a solution with a linear runtime complexity and use only constant extra space.
**Example 1:**
**Input:** nums = \[2,2,3,2\]
**Output:**... | null | Array,Bit Manipulation | Medium | 136,260 |
329 | hello friends nama thought the longest increasing parts in a matrix problem let's first see the statement given integer metrics find the length of the longest increasing parts for each cell you can either move to full directions left right up and down you may not move it diagonally on move outside of the boundary weath... | Longest Increasing Path in a Matrix | longest-increasing-path-in-a-matrix | Given an `m x n` integers `matrix`, return _the length of the longest increasing path in_ `matrix`.
From each cell, you can either move in four directions: left, right, up, or down. You **may not** move **diagonally** or move **outside the boundary** (i.e., wrap-around is not allowed).
**Example 1:**
**Input:** matr... | null | Dynamic Programming,Depth-First Search,Breadth-First Search,Graph,Topological Sort,Memoization | Hard | null |
395 | okay so this question is longer section with at least K repeating characters so you are giving a student s and an integer K so you have to return the length of the longer substring of s such that as the frequency of each character in Assumption is greater than or equal to K so this question is a little bit difficult fo... | Longest Substring with At Least K Repeating Characters | longest-substring-with-at-least-k-repeating-characters | Given a string `s` and an integer `k`, return _the length of the longest substring of_ `s` _such that the frequency of each character in this substring is greater than or equal to_ `k`.
**Example 1:**
**Input:** s = "aaabb ", k = 3
**Output:** 3
**Explanation:** The longest substring is "aaa ", as 'a' is repeated 3... | null | Hash Table,String,Divide and Conquer,Sliding Window | Medium | 2140,2209 |
16 | so good afternoon friends uh in today's video I'm gonna talk about the problem called threesome processed so uh friends in this video uh I'm gonna explain the solution from this page and it's actually I'm gonna talk about the thought process or the intuition behind how the solving this particular problem so actually th... | 3Sum Closest | 3sum-closest | Given an integer array `nums` of length `n` and an integer `target`, find three integers in `nums` such that the sum is closest to `target`.
Return _the sum of the three integers_.
You may assume that each input would have exactly one solution.
**Example 1:**
**Input:** nums = \[-1,2,1,-4\], target = 1
**Output:** ... | null | Array,Two Pointers,Sorting | Medium | 15,259 |
34 | Doing latest problem cold find first and last question of element in water a day Jai Hind is question you can just read that they can return minus one is element did not exist and which can simply do this question in vivo and complexity of light which Uses for loop in this question but will lead to solve work that has ... | Find First and Last Position of Element in Sorted Array | find-first-and-last-position-of-element-in-sorted-array | Given an array of integers `nums` sorted in non-decreasing order, find the starting and ending position of a given `target` value.
If `target` is not found in the array, return `[-1, -1]`.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[5,7,7,8,8,10\], target = 8
*... | null | Array,Binary Search | Medium | 278,2165,2210 |
120 | hey everyone welcome to lead code programming solutions my name is funny and let's get started in this video I'll be talking about the problem triangle minimum path Sun so what's the description given a triangle find the minimum path sum from top to bottom at each step you may move to the adjacent numbers on the row be... | Triangle | triangle | Given a `triangle` array, return _the minimum path sum from top to bottom_.
For each step, you may move to an adjacent number of the row below. More formally, if you are on index `i` on the current row, you may move to either index `i` or index `i + 1` on the next row.
**Example 1:**
**Input:** triangle = \[\[2\],\[... | null | Array,Dynamic Programming | Medium | null |
516 | hey everybody this is Larry this is day 14 of the leeco daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's Palm which oh wow we haven't done it before yay 516 longest parodramic subsequence hit the like button hit the Subscribe and join me on Discord... | Longest Palindromic Subsequence | longest-palindromic-subsequence | Given a string `s`, find _the longest palindromic **subsequence**'s length in_ `s`.
A **subsequence** is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.
**Example 1:**
**Input:** s = "bbbab "
**Output:** 4
**Explanation:** On... | null | String,Dynamic Programming | Medium | 5,647,730,1250,1822,1897,2130 |
59 | Hello gas, I am Lalit Agarwal, welcome to the country, today's late problem, what are you saying? Okay, before the problem, 1 minute, friends at the station, they have understood this problem very well and those who want to try it themselves are the six. Look, this question has come literally, if you had asked yesterda... | Spiral Matrix II | spiral-matrix-ii | Given a positive integer `n`, generate an `n x n` `matrix` filled with elements from `1` to `n2` in spiral order.
**Example 1:**
**Input:** n = 3
**Output:** \[\[1,2,3\],\[8,9,4\],\[7,6,5\]\]
**Example 2:**
**Input:** n = 1
**Output:** \[\[1\]\]
**Constraints:**
* `1 <= n <= 20` | null | Array,Matrix,Simulation | Medium | 54,921 |
435 | welcome to august leco challenge today's problem is non-overlapping intervals problem is non-overlapping intervals problem is non-overlapping intervals given a collection of intervals find the minimum number that you would need to remove to make the rest of the intervals non-overlapping non-overlapping non-overlapping ... | Non-overlapping Intervals | non-overlapping-intervals | Given an array of intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping_.
**Example 1:**
**Input:** intervals = \[\[1,2\],\[2,3\],\[3,4\],\[1,3\]\]
**Output:** 1
**Explanation:** \[1,3\] can be removed ... | null | Array,Dynamic Programming,Greedy,Sorting | Medium | 452 |
1,996 | hey everybody this is larry this is day nine of the leco day challenge hit the like button hit the subscribe button no three points uh let me know what you think about today's problem and so forth uh no video today or no uh no intro today with uh funky stuff um i'm in london right now uh for the next i guess just one d... | The Number of Weak Characters in the Game | number-of-ways-to-rearrange-sticks-with-k-sticks-visible | You are playing a game that contains multiple characters, and each of the characters has **two** main properties: **attack** and **defense**. You are given a 2D integer array `properties` where `properties[i] = [attacki, defensei]` represents the properties of the `ith` character in the game.
A character is said to be... | Is there a way to build the solution from a base case? How many ways are there if we fix the position of one stick? | Math,Dynamic Programming,Combinatorics | Hard | null |
1,762 | everyone so today we are looking at lead code 1762. it's a question called buildings with an ocean view and what we have to figure out in this question is if we have an array which represents the heights of buildings and we are looking at the buildings from uh east to west which buildings at the index are going to have... | Buildings With an Ocean View | furthest-building-you-can-reach | There are `n` buildings in a line. You are given an integer array `heights` of size `n` that represents the heights of the buildings in the line.
The ocean is to the right of the buildings. A building has an ocean view if the building can see the ocean without obstructions. Formally, a building has an ocean view if al... | Assume the problem is to check whether you can reach the last building or not. You'll have to do a set of jumps, and choose for each one whether to do it using a ladder or bricks. It's always optimal to use ladders in the largest jumps. Iterate on the buildings, maintaining the largest r jumps and the sum of the remain... | Array,Greedy,Heap (Priority Queue) | Medium | null |
611 | hello everyone and welcome back to another video so today we're going to be solving the lead code question valid triangle number so in this question we're going to be given integer area called nums and we need to return the number of triplets chosen from the array that can make triangles if we take them as side lengths... | Valid Triangle Number | valid-triangle-number | Given an integer array `nums`, return _the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle_.
**Example 1:**
**Input:** nums = \[2,2,3,4\]
**Output:** 3
**Explanation:** Valid combinations are:
2,3,4 (using the first 2)
2,3,4 (using the second 2)
2,2,3
*... | null | Array,Two Pointers,Binary Search,Greedy,Sorting | Medium | 259 |
279 | Hua Tha Hello Hi Everyone Welcome To My Channel Today 2074 Recording Challenge Every Problem In Perfect Square So Give Any Positive Interior And Finally This Number Of Perfect Square Numbers For Example 496001 112 Subscribe Minimum From 403 Also From One Plus One Atithi Minimum Nine Two Numbers Minimum Nine Two Things ... | Perfect Squares | perfect-squares | Given an integer `n`, return _the least number of perfect square numbers that sum to_ `n`.
A **perfect square** is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, `1`, `4`, `9`, and `16` are perfect squares while `3` and `11` are not.
**Example ... | null | Math,Dynamic Programming,Breadth-First Search | Medium | 204,264 |
134 | welcome to this video now we're going to solve a coordinate question gas station this is the problem statement there are in gas stations along a circular route where the amount of gas at station i is gas i you have a car with an unlimited gas tank and it caused cost i of gas to travel from station i to its next station... | Gas Station | gas-station | There are `n` gas stations along a circular route, where the amount of gas at the `ith` station is `gas[i]`.
You have a car with an unlimited gas tank and it costs `cost[i]` of gas to travel from the `ith` station to its next `(i + 1)th` station. You begin the journey with an empty tank at one of the gas stations.
Gi... | null | Array,Greedy | Medium | 1346 |
1,559 | Hello Friends Welcome to CP Study List C Another Problem SC Code Contest Per Jhal Ki Police Call Details Cycle * Degree Been Given Police Call Details Cycle * Degree Been Given Police Call Details Cycle * Degree Been Given A Great And They Will Celebrate Contents Any Similar Egg Subscribe And Like Subscribe And Subscri... | Detect Cycles in 2D Grid | cherry-pickup-ii | Given a 2D array of characters `grid` of size `m x n`, you need to find if there exists any cycle consisting of the **same value** in `grid`.
A cycle is a path of **length 4 or more** in the grid that starts and ends at the same cell. From a given cell, you can move to one of the cells adjacent to it - in one of the f... | Use dynammic programming, define DP[i][j][k]: The maximum cherries that both robots can take starting on the ith row, and column j and k of Robot 1 and 2 respectively. | Array,Dynamic Programming,Matrix | Hard | null |
80 | all right so let's talk about the remove duplicate from solder array 2 so this question is pretty straightforward and you are giving the solder array but for every single unit element inside the array you can only have two maximum frequency right two maximum focusing is a ratio uh here we go so let me just draw it so u... | Remove Duplicates from Sorted Array II | remove-duplicates-from-sorted-array-ii | Given an integer array `nums` sorted in **non-decreasing order**, remove some duplicates [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm) such that each unique element appears **at most twice**. The **relative order** of the elements should be kept the **same**.
Since it is impossible to change the len... | null | Array,Two Pointers | Medium | 26 |
424 | okay welcome back to uncle Jess today's question is leak code 424 longest repeating character replacement so in this question we have to return the length of the longest substring that contains the same letters and you're only allowed to perform K operations or k updates so we have two updates that we can perform in ex... | Longest Repeating Character Replacement | longest-repeating-character-replacement | You are given a string `s` and an integer `k`. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most `k` times.
Return _the length of the longest substring containing the same letter you can get after performing the above operations_.
... | null | Hash Table,String,Sliding Window | Medium | 340,1046,2119,2134,2319 |
244 | Hello hi friends welcome back today we are going to solid code problem 24 and 240 500 g test for distance to enter for scissors equal shortest distance problem only it is good to solve the problem statement from the is that you have been given here of words as you can c servi have been given to different words and will... | Shortest Word Distance II | shortest-word-distance-ii | Design a data structure that will be initialized with a string array, and then it should answer queries of the shortest distance between two different strings from the array.
Implement the `WordDistance` class:
* `WordDistance(String[] wordsDict)` initializes the object with the strings array `wordsDict`.
* `int ... | null | Array,Hash Table,Two Pointers,String,Design | Medium | 21,243,245 |
240 | lead code practice time so in this video there are two goals the first goal is to see uh how to solve this problem uh and then we are going to put some code here and the second goal is to see how we should behave in a real interview so let's get started so remember the first step in real interview is always try to full... | Search a 2D Matrix II | search-a-2d-matrix-ii | Write an efficient algorithm that searches for a value `target` in an `m x n` integer matrix `matrix`. This matrix has the following properties:
* Integers in each row are sorted in ascending from left to right.
* Integers in each column are sorted in ascending from top to bottom.
**Example 1:**
**Input:** matri... | null | Array,Binary Search,Divide and Conquer,Matrix | Medium | 74 |
257 | welcome ladies and gentlemen boys and girls today we're going to solve another problem which is binary tree path so basically this is one of the good problem so but the question is it's quite simple so the question is saying like uh we are given a root over by tree and we have to return all root to leave in any order o... | Binary Tree Paths | binary-tree-paths | Given the `root` of a binary tree, return _all root-to-leaf paths in **any order**_.
A **leaf** is a node with no children.
**Example 1:**
**Input:** root = \[1,2,3,null,5\]
**Output:** \[ "1->2->5 ", "1->3 "\]
**Example 2:**
**Input:** root = \[1\]
**Output:** \[ "1 "\]
**Constraints:**
* The number of nodes ... | null | String,Backtracking,Tree,Depth-First Search,Binary Tree | Easy | 113,1030,2217 |
493 | That Everyone Welcome To My Channel Today Will Be Solving Problems Reverse Pastry Sheet Sharif But You Will Give In Exams Date Of Account Number Of Paris I Ko Maje Sach It Is Always Speak And Evaluate Aaye Cigarette The Voice Of Divya J7 Straight Person Others 1323 210 President Top Vegetation And S One Which Mix Playe... | Reverse Pairs | reverse-pairs | Given an integer array `nums`, return _the number of **reverse pairs** in the array_.
A **reverse pair** is a pair `(i, j)` where:
* `0 <= i < j < nums.length` and
* `nums[i] > 2 * nums[j]`.
**Example 1:**
**Input:** nums = \[1,3,2,3,1\]
**Output:** 2
**Explanation:** The reverse pairs are:
(1, 4) --> nums\[1\]... | null | Array,Binary Search,Divide and Conquer,Binary Indexed Tree,Segment Tree,Merge Sort,Ordered Set | Hard | 315,327 |
1,372 | hello fellow ops and welcome to another uh video on the app hacksaw youtube channel uh today we're going to be going over another leak code problem uh 1372 longest zigzag path in a binary tree so this is a tree problem um we're going to be using a depth first search algorithm with a uh that is recursive so this problem... | Longest ZigZag Path in a Binary Tree | check-if-it-is-a-good-array | You are given the `root` of a binary tree.
A ZigZag path for a binary tree is defined as follow:
* Choose **any** node in the binary tree and a direction (right or left).
* If the current direction is right, move to the right child of the current node; otherwise, move to the left child.
* Change the direction f... | Eq. ax+by=1 has solution x, y if gcd(a,b) = 1. Can you generalize the formula?. Check Bézout's lemma. | Array,Math,Number Theory | Hard | null |
322 | hello everyone welcome to codescan and today we are going to cover coin change so the given input here is an integer array coins and an integer value amount we have to return the minimum number of coins needed to form this amount so let's understand this problem statement with an example so here is a given input the in... | Coin Change | coin-change | You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money.
Return _the fewest number of coins that you need to make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `-1`.
You may a... | null | Array,Dynamic Programming,Breadth-First Search | Medium | 1025,1393,2345 |
1,099 | hey everybody this is Larry this is me doing week one of the Le Cod daily challenge or weekly challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about this prom it's a premium prom let's play around with it $199 two sums two sum less than with it $199 two sums two sum l... | Two Sum Less Than K | path-with-maximum-minimum-value | Given an array `nums` of integers and integer `k`, return the maximum `sum` such that there exists `i < j` with `nums[i] + nums[j] = sum` and `sum < k`. If no `i`, `j` exist satisfying this equation, return `-1`.
**Example 1:**
**Input:** nums = \[34,23,1,24,75,33,54,8\], k = 60
**Output:** 58
**Explanation:** We can... | What if we sort each cell of the matrix by the value? Don't include small values in your path if you can only include large values. Let's keep adding a possible cell to use in the path incrementally with decreasing values. If the start and end cells are connected then we don't need to add more cells. Use union-find dat... | Array,Depth-First Search,Breadth-First Search,Union Find,Heap (Priority Queue),Matrix | Medium | 1753 |
106 | Hello gas my name is Geetanjali and today we are going to discuss daily problem of net so let's see what is today's problem Construct binary tree from in order and post order reverse so the question is what is given to us in order and post order reversal Will be any binary tree and we have to construct the binary tree ... | Construct Binary Tree from Inorder and Postorder Traversal | construct-binary-tree-from-inorder-and-postorder-traversal | Given two integer arrays `inorder` and `postorder` where `inorder` is the inorder traversal of a binary tree and `postorder` is the postorder traversal of the same tree, construct and return _the binary tree_.
**Example 1:**
**Input:** inorder = \[9,3,15,20,7\], postorder = \[9,15,7,20,3\]
**Output:** \[3,9,20,null,n... | null | Array,Hash Table,Divide and Conquer,Tree,Binary Tree | Medium | 105 |
223 | hi so today we are doing 223 rectangular problem statement is pretty simple all we got to do is calculate the area of two overlapping rectangles they might be overlapping might be not but we have to calculate their combined area so for example this rectangle and this rectangle have to be calculated and then you subtrac... | Rectangle Area | rectangle-area | Given the coordinates of two **rectilinear** rectangles in a 2D plane, return _the total area covered by the two rectangles_.
The first rectangle is defined by its **bottom-left** corner `(ax1, ay1)` and its **top-right** corner `(ax2, ay2)`.
The second rectangle is defined by its **bottom-left** corner `(bx1, by1)` ... | null | Math,Geometry | Medium | 866 |
1,046 | is the weight of the eighth stone and you are here playing a game with the stones here and on each turn we choose the two highest Stones heaviest stones and smash them together so that smashing condition for this we have is the two highest weighted Stones we will have so net X of the less than or equal to Y in that cas... | 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 |
78 | what's up guys this is the polyglot programmer and i'm here to do one other problem uh i th this program has different names uh different places like on the platform ago expert it's called power sets uh this in here is called subsets but it's basically uh the same thing so uh let's go so uh basically given uh a distinc... | Subsets | subsets | Given an integer array `nums` of **unique** elements, return _all possible_ _subsets_ _(the power set)_.
The solution set **must not** contain duplicate subsets. Return the solution in **any order**.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[\],\[1\],\[2\],\[1,2\],\[3\],\[1,3\],\[2,3\],\[1,2,3\]\]
... | null | Array,Backtracking,Bit Manipulation | Medium | 90,320,800,2109,2170 |
1,318 | hello friends so today we're gonna discuss this question from leadcore weekly 171 problem number one three one eight minimum lips to make a or b equals to see the question statement is very simple it states that you are given three numbers a b c and you have to return the minimum flips which are required such that a an... | 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 |
1,838 | so hi everyone uh in this problem we have to find the frequency of most frequent element so let's say we have uh something like 1 2 4 8 uh and 13 and you can uh only increment any element by uh at most the amount K right so K is some given value some given amount by which you can uh increase an element so you can take ... | Frequency of the Most Frequent Element | number-of-distinct-substrings-in-a-string | The **frequency** of an element is the number of times it occurs in an array.
You are given an integer array `nums` and an integer `k`. In one operation, you can choose an index of `nums` and increment the element at that index by `1`.
Return _the **maximum possible frequency** of an element after performing **at mos... | Calculate the prefix hashing array for s. Use the prefix hashing array to calculate the hashing value of each substring. Compare the hashing values to determine the unique substrings. There could be collisions if you use hashing, what about double hashing. | String,Trie,Rolling Hash,Suffix Array,Hash Function | Medium | null |
245 | hey so welcome back and this is another leeco problem so this one is called shortest word distance three actually and typically I do daily legal problems which are these ones here but uh for this question it's actually from like the premium weekly questions that you can pick from and so let's take a look at it so I don... | Shortest Word Distance III | shortest-word-distance-iii | Given an array of strings `wordsDict` and two strings that already exist in the array `word1` and `word2`, return _the shortest distance between the occurrence of these two words in the list_.
**Note** that `word1` and `word2` may be the same. It is guaranteed that they represent **two individual words** in the list.
... | null | Array,String | Medium | 243,244 |
133 | Loot Hello Everyone Welcome to my channel today in this video Marriage Solving Key Problem Clone Graph Very Famous in Interviews Where is the Decade Problem is Famous Indian Learning List Veervikram Google Microsoft Facebook of the Big Companies Are Stay Connected Happy Return of the King of the List of Indian State fo... | 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 |
1,444 | Hello everyone welcome to my channel very interesting problems date i uncounted in dp lots of good questions when i will explain to you we will make diagram and tree diagram then you will understand very well we will first solve it brother ok Then let's see if we can memorize it, we will do it, otherwise first we will ... | 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 |
507 | all right let's call the perfect number so you are given an integer and return true if a is a perfect number or that's why i return false so a perfect number is a positive integer that's equal to the sum of a positive divisor so this is pretty much it right so uh for the example this is 28 right so how do you actually ... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.