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 |
|---|---|---|---|---|---|---|---|---|
279 | hey guys welcome to a new video in today's video we're going to look at lead code problem and the problem's name is perfect squares so in this question we given an integer n and we have to return the least number of perfect squares that are needed to sum up to n by definition a perfect square is an integer that is a sq... | 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 |
1,332 | Once Hello Everyone Welcome To Day E F Malik And Challenge And I Hope All Of You Doing Well For Electrification Progressive Preparations In Full Swing To Remove Follow Me Must Subscribe Maulvi Subscribe Remove And Subscribe Skin Minimum Subscribe To Subscribe Our Is So Let's Walk Through All Possible After Bana Badhab ... | 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 |
380 | So hello everyone, our problem today is a medium level problem of lead code, so let's see how we will approach it, so today we are given the problem that we have to implement a random set class which has three classes. We have been given small functions for which we have to write the code. Right now let us see what tho... | 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 |
280 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem wiggle sort and if you're wondering that this is kind of a different ui you're right this is not actually on leak code wiggle sort is problem 280 on leak code but it's a premium problem but there's a way to solve premiu... | Wiggle Sort | wiggle-sort | Given an integer array `nums`, reorder it such that `nums[0] <= nums[1] >= nums[2] <= nums[3]...`.
You may assume the input array always has a valid answer.
**Example 1:**
**Input:** nums = \[3,5,2,1,6,4\]
**Output:** \[3,5,1,6,2,4\]
**Explanation:** \[1,6,2,5,3,4\] is also accepted.
**Example 2:**
**Input:** nums... | null | Array,Greedy,Sorting | Medium | 75,324,2085 |
74 | certainly you already know how to perform a binary search on a sorted single dimensional array correct so naturally your interview will be interested to know okay what if you have two dimensional array that is sorted how will you perform this binary search algorithm on that so let's see what we can do about it Hello fr... | Search a 2D Matrix | search-a-2d-matrix | You are given an `m x n` integer matrix `matrix` with the following two properties:
* Each row is sorted in non-decreasing order.
* The first integer of each row is greater than the last integer of the previous row.
Given an integer `target`, return `true` _if_ `target` _is in_ `matrix` _or_ `false` _otherwise_.
... | null | Array,Binary Search,Matrix | Medium | 240 |
1,971 | foreign welcome back to the channel in this video lecture we'll be solving this problem find if path exists in graph or not which is the lead code easy problem in this problem there is a bi-directional graph so what is a bi-directional graph so what is a bi-directional graph so what is a bi-directional graph a graph wh... | Find if Path Exists in Graph | incremental-memory-leak | There is a **bi-directional** graph with `n` vertices, where each vertex is labeled from `0` to `n - 1` (**inclusive**). The edges in the graph are represented as a 2D integer array `edges`, where each `edges[i] = [ui, vi]` denotes a bi-directional edge between vertex `ui` and vertex `vi`. Every vertex pair is connecte... | What is the upper bound for the number of seconds? Simulate the process of allocating memory. | Simulation | Medium | null |
221 | hi everyone today we're gonna solve question number two 21 maximal square I'm gonna give you three solutions we're gonna dive deep into all of them so we understand the thought process of coming up with these solutions and evolving the solutions I think this is a critical step to make you succeed so let's dive into it ... | 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 |
235 | hey everyone today let's go through another classic lyrical problem 235 lowest common ancestor of a binary search tree first we need to Define what is a binary search tree all of the left children nodes are exactly smaller than the parent node this is the left tree it is also a tree a sub tree but all of the nodes on t... | Lowest Common Ancestor of a Binary Search Tree | lowest-common-ancestor-of-a-binary-search-tree | Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST.
According to the [definition of LCA on Wikipedia](https://en.wikipedia.org/wiki/Lowest_common_ancestor): "The lowest common ancestor is defined between two nodes `p` and `q` as the lowest node in `T` that has bo... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | 236,1190,1780,1790,1816 |
1,286 | Hello hello everyone welcome to my channel it's all the problem vibrator for combination 100 designer tractor subscribe english letters and number combination like comment subscribe combination length subscribe indian subscribe combination form of channel subscribe tab 2525 vid oo dushman bhi return gift for The Countr... | Iterator for Combination | constrained-subsequence-sum | Design the `CombinationIterator` class:
* `CombinationIterator(string characters, int combinationLength)` Initializes the object with a string `characters` of **sorted distinct** lowercase English letters and a number `combinationLength` as arguments.
* `next()` Returns the next combination of length `combinationL... | Use dynamic programming. Let dp[i] be the solution for the prefix of the array that ends at index i, if the element at index i is in the subsequence. dp[i] = nums[i] + max(0, dp[i-k], dp[i-k+1], ..., dp[i-1]) Use a heap with the sliding window technique to optimize the dp. | Array,Dynamic Programming,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue | Hard | null |
92 | Hello everyone welcome, you are going to do video number 17 of my channel. Okay lead code number is 92. This is a medium level question. The name of the question is reverse link list. If you are ok then see, this is a medium mark but actually I will solve it for you in any way. I will teach you how I solve such questio... | Reverse Linked List II | reverse-linked-list-ii | Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], left = 2, right = 4
**Output:** \[1,4,3,2,5\]
**Example 2:**
**I... | null | Linked List | Medium | 206 |
303 | hello guys in this video we are going to discuss problem 303 from lead code which is the range some query immutable so the question is pretty simple given an array of integers like this we are to find the sum of elements between any two given indices so we are given in the index I and J and we are guaranteed that I wou... | Range Sum Query - Immutable | range-sum-query-immutable | Given an integer array `nums`, handle multiple queries of the following type:
1. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`.
Implement the `NumArray` class:
* `NumArray(int[] nums)` Initializes the object with the integer array `nums`.
* ... | null | Array,Design,Prefix Sum | Easy | 304,307,325 |
76 | okay so today what we're going to cover is a fairly challenging question which is called minimum Windows substring so what am i given I'm given two strings I'm given a search string or a string s whatever you want to call it this is the string that I'm going to need to search in and I'm given a character string a strin... | Minimum Window Substring | minimum-window-substring | Given two strings `s` and `t` of lengths `m` and `n` respectively, return _the **minimum window**_ **_substring_** _of_ `s` _such that every character in_ `t` _(**including duplicates**) is included in the window_. If there is no such substring, return _the empty string_ `" "`.
The testcases will be generated such tha... | Use two pointers to create a window of letters in S, which would have all the characters from T. Since you have to find the minimum window in S which has all the characters from T, you need to expand and contract the window using the two pointers and keep checking the window for all the characters. This approach is als... | Hash Table,String,Sliding Window | Hard | 30,209,239,567,632,727 |
343 | so lead code problem of the day and here we bring the one more solution for you that is the integer break believe me this is the most interesting question we will come across today again we are going to solve this question in three important steps so I highly recommend you to watch till my third step so that you can co... | Integer Break | integer-break | Given an integer `n`, break it into the sum of `k` **positive integers**, where `k >= 2`, and maximize the product of those integers.
Return _the maximum product you can get_.
**Example 1:**
**Input:** n = 2
**Output:** 1
**Explanation:** 2 = 1 + 1, 1 \* 1 = 1.
**Example 2:**
**Input:** n = 10
**Output:** 36
**Exp... | There is a simple O(n) solution to this problem. You may check the breaking results of n ranging from 7 to 10 to discover the regularities. | Math,Dynamic Programming | Medium | 1936 |
283 | everyone so today we are looking at lead code number two eight three question called move zeros and what we wanna do here is we're gonna have an array and we wanna move all the zeros to the end of the array but we want to do this in place without making a copy of the array so we can't just make a copy of this we have t... | Move Zeroes | move-zeroes | Given an integer array `nums`, move all `0`'s to the end of it while maintaining the relative order of the non-zero elements.
**Note** that you must do this in-place without making a copy of the array.
**Example 1:**
**Input:** nums = \[0,1,0,3,12\]
**Output:** \[1,3,12,0,0\]
**Example 2:**
**Input:** nums = \[0\]... | In-place means we should not be allocating any space for extra array. But we are allowed to modify the existing array. However, as a first step, try coming up with a solution that makes use of additional space. For this problem as well, first apply the idea discussed using an additional array and the in-place solution ... | Array,Two Pointers | Easy | 27 |
714 | hello and welcome to another leak code video today we're going to be doing the problem of the day for June 22nd best time to buy and sell stock with transaction fee and actually in this problem I'm going to go over uh all of the solutions so I'm going to start with the memorization then do the bottom up and then finall... | Best Time to Buy and Sell Stock with Transaction Fee | best-time-to-buy-and-sell-stock-with-transaction-fee | You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day, and an integer `fee` representing a transaction fee.
Find the maximum profit you can achieve. You may complete as many transactions as you like, but you need to pay the transaction fee for each transaction.
**Note:** You... | Consider the first K stock prices. At the end, the only legal states are that you don't own a share of stock, or that you do. Calculate the most profit you could have under each of these two cases. | Array,Dynamic Programming,Greedy | Medium | 122 |
18 | hello and welcome to another Elite code solution video this is problem number 18 for some we are given an array nums of n integers return an array of all the unique quadruplets nums a nums B num C numbers D such that zero is less than or equal to a b c d Which is less than n and a b c and d are distinct numbers a plus ... | 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 |
382 | uh today we're gonna be working on lead code question number 382 linked list a random node okay we have been given a singly linked list okay return now so we cannot go back uh i mean yeah so we're given a singly linked list return a random nodes value uh from the linked list each node must have the same probability of ... | Linked List Random Node | linked-list-random-node | Given a singly linked list, return a random node's value from the linked list. Each node must have the **same probability** of being chosen.
Implement the `Solution` class:
* `Solution(ListNode head)` Initializes the object with the head of the singly-linked list `head`.
* `int getRandom()` Chooses a node randoml... | null | Linked List,Math,Reservoir Sampling,Randomized | Medium | 398 |
242 | okay guys let's solve 242 valid anagram so we're given two strings s and t and we want to return true if T is an anagram of s and false otherwise so an anagram is a word or phrase formed by rearranging the letters of a different word or phrase typically and I don't know why they say typically it means literally using a... | Valid Anagram | valid-anagram | Given two strings `s` and `t`, return `true` _if_ `t` _is an anagram of_ `s`_, and_ `false` _otherwise_.
An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
**Example 1:**
**Input:** s = "anagram", t = "nagaram"
**... | null | Hash Table,String,Sorting | Easy | 49,266,438 |
504 | all right guys so welcome to the lead code series so the question today we are going to solve is called base 7 so the question statement says that given an integer return its base 7 string representation okay so in order to understand base seven let's first understand what's actually base seven and other bases as well ... | Base 7 | base-7 | Given an integer `num`, return _a string of its **base 7** representation_.
**Example 1:**
**Input:** num = 100
**Output:** "202"
**Example 2:**
**Input:** num = -7
**Output:** "-10"
**Constraints:**
* `-107 <= num <= 107` | null | Math | Easy | null |
454 | Ko WhatsApp Ka Screw Driver Not Talking About Talent Problem Name For Song To Mukesh Do Medium Kar Koi Problem Inheritance Statement Piece Ki Jeevan Four List On Abcd And Interior Fruits Computer How Many Top Pochha Ghar Ke A Actually Dheriya A Plus B Jazba Shade Plus Serial 200 I will run into a sophisticated problem ... | 4Sum II | 4sum-ii | Given four integer arrays `nums1`, `nums2`, `nums3`, and `nums4` all of length `n`, return the number of tuples `(i, j, k, l)` such that:
* `0 <= i, j, k, l < n`
* `nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0`
**Example 1:**
**Input:** nums1 = \[1,2\], nums2 = \[-2,-1\], nums3 = \[-1,2\], nums4 = \[0,2\]
**Ou... | null | Array,Hash Table | Medium | 18 |
784 | hi guys welcome to algorithms made easy in this video we'll go through the question letter case permutation given a string s we can transform every letter individually to be lowercase or uppercase to create another string return a list of all possible strings we could create you can return the output in any order so in... | Letter Case Permutation | insert-into-a-binary-search-tree | Given a string `s`, you can transform every letter individually to be lowercase or uppercase to create another string.
Return _a list of all possible strings we could create_. Return the output in **any order**.
**Example 1:**
**Input:** s = "a1b2 "
**Output:** \[ "a1b2 ", "a1B2 ", "A1b2 ", "A1B2 "\]
**Example 2:*... | null | Tree,Binary Search Tree,Binary Tree | Medium | 783 |
338 | hello welcome to my channel today we have leeco 338 counting beats so this question is often asked by amazon blizzard especially facebook apple and microsoft personally i see it from facebook and but i say it's a really good question but i don't know why it's not that popular here it could be one of the question that f... | 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 |
376 | today we're gonna be working on lead quote question number 376 a vehicle subsequence a vehicle sequence is a sequence uh where the differences between successive numbers strictly alternate between positive and negative the first difference if one exists may be either positive or negative uh a sequence with one element ... | 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 |
234 | all right uh so we are live uh so today uh we're going to be talking about our palindrome uh linked list um which is a question on lead code uh let's go ahead so it's a given the head of a single thing uh a singly linked uh linked list uh return true if it is a palindrome or false otherwise so basically a palindrome is... | Palindrome Linked List | palindrome-linked-list | Given the `head` of a singly linked list, return `true` _if it is a_ _palindrome_ _or_ `false` _otherwise_.
**Example 1:**
**Input:** head = \[1,2,2,1\]
**Output:** true
**Example 2:**
**Input:** head = \[1,2\]
**Output:** false
**Constraints:**
* The number of nodes in the list is in the range `[1, 105]`.
* ... | null | Linked List,Two Pointers,Stack,Recursion | Easy | 9,125,206,2236 |
1,845 | hey everyone today we are going to solve theal question seat reservation manager okay so if we only make our reservations this problem is very straight for right but the difficulty is we have unreserved function so numbers will have gaps so what is gaps so when we make a reservation we start from one and if we have ano... | Seat Reservation Manager | largest-submatrix-with-rearrangements | Design a system that manages the reservation state of `n` seats that are numbered from `1` to `n`.
Implement the `SeatManager` class:
* `SeatManager(int n)` Initializes a `SeatManager` object that will manage `n` seats numbered from `1` to `n`. All seats are initially available.
* `int reserve()` Fetches the **sm... | For each column, find the number of consecutive ones ending at each position. For each row, sort the cumulative ones in non-increasing order and "fit" the largest submatrix. | Array,Greedy,Sorting,Matrix | Medium | 695 |
1,675 | Hello guys welcome back to the another video of lit co daily challenge so today our question is minimize deviation in array this is a hard level question so let's read the question once to see what is said in the question at the end so our question is You are given array of numbers of any positive integer. We have to p... | 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 |
288 | hey folks welcome back to another video today we're looking at question 288 unique word abbreviations the way we'll be approaching this problem is by using hashmaps the problem um the solution to this problem itself is relatively simple but the problem with this problem is being able to understand it because this part ... | Unique Word Abbreviation | unique-word-abbreviation | The **abbreviation** of a word is a concatenation of its first letter, the number of characters between the first and last letter, and its last letter. If a word has only two characters, then it is an **abbreviation** of itself.
For example:
* `dog --> d1g` because there is one letter between the first letter `'d'`... | null | Array,Hash Table,String,Design | Medium | 170,320 |
1,296 | hello friends welcome to joy of life so today we are going to look at a medium level problem from lead code the problem number is one two nine six it's a divide array instead of k consecutive numbers so the description says given an array of integer nums and a positive integer k find whether it is possible to divide th... | Divide Array in Sets of K Consecutive Numbers | kth-ancestor-of-a-tree-node | Given an array of integers `nums` and a positive integer `k`, check whether it is possible to divide this array into sets of `k` consecutive numbers.
Return `true` _if it is possible_. Otherwise, return `false`.
**Example 1:**
**Input:** nums = \[1,2,3,3,4,4,5,6\], k = 4
**Output:** true
**Explanation:** Array can b... | The queries must be answered efficiently to avoid time limit exceeded verdict. Use sparse table (dynamic programming application) to travel the tree upwards in a fast way. | Binary Search,Dynamic Programming,Tree,Depth-First Search,Breadth-First Search,Design | Hard | null |
1,937 | hey what's up guys this is chung here uh so this time we called number 1937 maximum number of points with cost okay so you're given like i'm by an integer matrix right points and we want to maximize the number of points we can get from the matrix so the way we're getting the point is that we will pick each one cell obv... | Maximum Number of Points with Cost | maximize-the-beauty-of-the-garden | You are given an `m x n` integer matrix `points` (**0-indexed**). Starting with `0` points, you want to **maximize** the number of points you can get from the matrix.
To gain points, you must pick one cell in **each row**. Picking the cell at coordinates `(r, c)` will **add** `points[r][c]` to your score.
However, yo... | Consider every possible beauty and its first and last index in flowers. Remove all flowers with negative beauties within those indices. | Array,Greedy,Prefix Sum | Hard | null |
1,417 | yeahyeah Hi everyone, I'm a programmer. Today I'm going to teach you a new problem, which is the problem of reformatting a string. The problem requires us as follows. An age that only consists of letters and numbers, in this place it only consists of English letters without capitalization and numerical ideas, our task ... | Reformat The String | reformat-the-string | You are given an alphanumeric string `s`. (**Alphanumeric string** is a string consisting of lowercase English letters and digits).
You have to find a permutation of the string where no letter is followed by another letter and no digit is followed by another digit. That is, no two adjacent characters have the same typ... | null | null | Easy | null |
212 | okay 212 word search to give me a 2d board and a list of words from the dictionary fine all right so no in the boy each one must be construct from a letter of sequentially adjacent cell where adjacent cells are those horizontally or vertically they break the same letter cell may not be used more than once in a work wit... | 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 |
217 | leak code question 217 contains duplicate so given an integer array nums return true if any value appears at least twice in the array and return false if every element is distinct very simple straightforward question what we need to do is we need to just decide whether there is a duplicate in the array and so one way o... | Contains Duplicate | contains-duplicate | Given an integer array `nums`, return `true` if any value appears **at least twice** in the array, and return `false` if every element is distinct.
**Example 1:**
**Input:** nums = \[1,2,3,1\]
**Output:** true
**Example 2:**
**Input:** nums = \[1,2,3,4\]
**Output:** false
**Example 3:**
**Input:** nums = \[1,1,1,... | null | Array,Hash Table,Sorting | Easy | 219,220 |
536 | hey what's up guys john here again so this time let's take a look at this problem here bit cold 536 construct binary tree from string right so you're given like a string with like integers and negative sign and the left and right parentheses and the left and the right parentheses represents the subtree of this of the c... | Construct Binary Tree from String | construct-binary-tree-from-string | You need to construct a binary tree from a string consisting of parenthesis and integers.
The whole input represents a binary tree. It contains an integer followed by zero, one or two pairs of parenthesis. The integer represents the root's value and a pair of parenthesis contains a child binary tree with the same stru... | null | String,Tree,Depth-First Search,Binary Tree | Medium | 606 |
62 | hello everyone let's look at unique path the problem statement is there's a robot located at the top left corner of the m multiplier n grid the robot can only move either down or right at any point in time the robot is trying to reach the bottom right corner of the grade the question is how many possible unique paths w... | 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 |
1,255 | hey what's up guys this is sean here so today uh let's take a look at this 1255 maximum score words formed by letters okay it's a hard problem but i think it's to me it's more like uh between hard between medium hard but i mean regardless let's take a look at this problem okay given a list of words okay so you're given... | Maximum Score Words Formed by Letters | reverse-subarray-to-maximize-array-value | Given a list of `words`, list of single `letters` (might be repeating) and `score` of every character.
Return the maximum score of **any** valid set of words formed by using the given letters (`words[i]` cannot be used two or more times).
It is not necessary to use all characters in `letters` and each letter can only... | What's the score after reversing a sub-array [L, R] ? It's the score without reversing it + abs(a[R] - a[L-1]) + abs(a[L] - a[R+1]) - abs(a[L] - a[L-1]) - abs(a[R] - a[R+1]) How to maximize that formula given that abs(x - y) = max(x - y, y - x) ? This can be written as max(max(a[R] - a[L - 1], a[L - 1] - a[R]) + max(a[... | Array,Math,Greedy | Hard | null |
1,509 | Hello hello everyone welcome to my channel it's all the list problem minimum difference between largest and smallest value in three modes in this problem for women are not quite choose one element of changes festival in one to three minimum difference between the smallest value for example 153 246 To two to the number ... | Minimum Difference Between Largest and Smallest Value in Three Moves | replace-employee-id-with-the-unique-identifier | You are given an integer array `nums`.
In one move, you can choose one element of `nums` and change it to **any value**.
Return _the minimum difference between the largest and smallest value of `nums` **after performing at most three moves**_.
**Example 1:**
**Input:** nums = \[5,3,2,4\]
**Output:** 0
**Explanation... | null | Database | Easy | null |
485 | Jhaal Hello hi guys welcome back to the video you guys watching in this video this try vashisht then you one more question named maximum which u turn punch ok we are a winery hey yaar rahega meaning binary hey kya in which zero and man se We need to stop the maximum number of positive returns which are continuously com... | Max Consecutive Ones | max-consecutive-ones | Given a binary array `nums`, return _the maximum number of consecutive_ `1`_'s in the array_.
**Example 1:**
**Input:** nums = \[1,1,0,1,1,1\]
**Output:** 3
**Explanation:** The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s is 3.
**Example 2:**
**Input:** nums = ... | You need to think about two things as far as any window is concerned. One is the starting point for the window. How do you detect that a new window of 1s has started? The next part is detecting the ending point for this window.
How do you detect the ending point for an existing window? If you figure these two things... | Array | Easy | 487,1046,1542,1999 |
1,007 | hello today we will be doing today's good question that is minimum domino uh rotations for equal row and the question statement uh states that in a row of dominance tops of i and bottoms of i represent the top and bottom halves of the ith domino we may rotate the ith domino so that the tops of i and bottoms of i swaps ... | Minimum Domino Rotations For Equal Row | numbers-with-same-consecutive-differences | In a row of dominoes, `tops[i]` and `bottoms[i]` represent the top and bottom halves of the `ith` domino. (A domino is a tile with two numbers from 1 to 6 - one on each half of the tile.)
We may rotate the `ith` domino, so that `tops[i]` and `bottoms[i]` swap values.
Return the minimum number of rotations so that all... | null | Backtracking,Breadth-First Search | Medium | null |
268 | everyone so today we are looking at lead code number 268 it is a question called missing number and so we have an array uh example one here we have an input array of three zero one and we have zero one we're missing two and we have three so our output is two here our num is two uh it's or the length is two so n is gonn... | 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 |
415 | how's it going everybody so today we're gonna go over a string based problem called add strings and this is a problem asked at Facebook Oracle Amazon and Microsoft so the description says given two non-negative integers num1 and num2 two non-negative integers num1 and num2 two non-negative integers num1 and num2 repres... | Add Strings | add-strings | Given two non-negative integers, `num1` and `num2` represented as string, return _the sum of_ `num1` _and_ `num2` _as a string_.
You must solve the problem without using any built-in library for handling large integers (such as `BigInteger`). You must also not convert the inputs to integers directly.
**Example 1:**
... | null | Math,String,Simulation | Easy | 2,43,1031 |
324 | today we're gonna be working on lead code question number 324 now wiggle sort part two given an integer array nums reorder it such that nums of 0 is less than nums of 1 which is greater than numbers of 2 which is less than numbers of 3 so it's kind of alternating between less than greater than you may assume that the i... | Wiggle Sort II | wiggle-sort-ii | Given an integer array `nums`, reorder it such that `nums[0] < nums[1] > nums[2] < nums[3]...`.
You may assume the input array always has a valid answer.
**Example 1:**
**Input:** nums = \[1,5,1,1,6,4\]
**Output:** \[1,6,1,5,1,4\]
**Explanation:** \[1,4,1,5,1,6\] is also accepted.
**Example 2:**
**Input:** nums = ... | null | Array,Divide and Conquer,Sorting,Quickselect | Medium | 75,215,280,2085 |
349 | welcome to book screen talk and let's write some code today so we given two integer arrays nums one and nums two return an array of their intersection each element and the result must be unique and you may return the result in any order all right so essentially what we're supposed to do is return the common elements be... | Intersection of Two Arrays | intersection-of-two-arrays | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must be **unique** and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2\]
**Example 2:**
**Input:** nums1 = \[4,9,5\], nums2 = \... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 350,1149,1392,2190,2282 |
429 | hey how's it going we got another question today which is nine area tree order level traversal which is a medium given a nine airy tree return the level order traverse of its node's values so a level or a traversal we have level zero here in this example we have actually let me rewrite that looks like level 10 level 0 ... | N-ary Tree Level Order Traversal | n-ary-tree-level-order-traversal | Given an n-ary tree, return the _level order_ traversal of its nodes' values.
_Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples)._
**Example 1:**
**Input:** root = \[1,null,3,2,4,null,5,6\]
**Output:** \[\[1\],\[3,2,4\],\... | null | null | Medium | null |
399 | hey guys welcome back to another video and today we're going to be solving the lead code question evaluate division all right so in this question we're given equations in the format a divided by b which equals to k where a and b are variables represented as strings and k is going to be a real number given some queries ... | Evaluate Division | evaluate-division | You are given an array of variable pairs `equations` and an array of real numbers `values`, where `equations[i] = [Ai, Bi]` and `values[i]` represent the equation `Ai / Bi = values[i]`. Each `Ai` or `Bi` is a string that represents a single variable.
You are also given some `queries`, where `queries[j] = [Cj, Dj]` rep... | Do you recognize this as a graph problem? | Array,Depth-First Search,Breadth-First Search,Union Find,Graph,Shortest Path | Medium | null |
146 | what's going on everybody zane here back with another video for this one we're going to go over question number 146 which is lru cash lru is representing least recently used cache so in this problem here what we're being told is to design a data structure that follows the constraints of the least recently used cache no... | LRU Cache | lru-cache | Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**.
Implement the `LRUCache` class:
* `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`.
* `int get(int key)` Return the valu... | null | Hash Table,Linked List,Design,Doubly-Linked List | Medium | 460,588,604,1903 |
1,269 | Welcome to my channel code Sorry with Mike So today we are going to do video number 70 of our dynamic programming playlist. Okay, this is a very easy question. Actually, this is such a hard question which is quite easy. Okay, it should have been marked as medium. The lead code should be given less than code number 1269... | Number of Ways to Stay in the Same Place After Some Steps | market-analysis-ii | You have a pointer at index `0` in an array of size `arrLen`. At each step, you can move 1 position to the left, 1 position to the right in the array, or stay in the same place (The pointer should not be placed outside the array at any time).
Given two integers `steps` and `arrLen`, return the number of ways such that... | null | Database | Hard | null |
886 | hello everyone welcome to the channel today's question is possible by partition if you are new to the channel please consider subscribe a question says given a set of n people we would like to split every person in two groups of any size each person may dislike some other people and they should not go into same group f... | Possible Bipartition | score-of-parentheses | We want to split a group of `n` people (labeled from `1` to `n`) into two groups of **any size**. Each person may dislike some other people, and they should not go into the same group.
Given the integer `n` and the array `dislikes` where `dislikes[i] = [ai, bi]` indicates that the person labeled `ai` does not like the... | null | String,Stack | Medium | null |
1,470 | hi guys today we are going to do the Western shuffle the array given the added norms consisting of n elements in the form X 1 X 2 xn y 1 y 2 y n return the array in the form x 1 y 1 x 2 y 2 up till xn YN so basically let's take this example where we are given an array of two five one three four seven right so we are gi... | Shuffle the Array | tweet-counts-per-frequency | Given the array `nums` consisting of `2n` elements in the form `[x1,x2,...,xn,y1,y2,...,yn]`.
_Return the array in the form_ `[x1,y1,x2,y2,...,xn,yn]`.
**Example 1:**
**Input:** nums = \[2,5,1,3,4,7\], n = 3
**Output:** \[2,3,5,4,1,7\]
**Explanation:** Since x1\=2, x2\=5, x3\=1, y1\=3, y2\=4, y3\=7 then the answer ... | null | Hash Table,Binary Search,Design,Sorting,Ordered Set | Medium | null |
442 | hey everybody this is larry this is day six i think it's a little bit weird because actually it's october 5th where i am but uh i guess today is day six 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 prom let me know how everyone's d... | Find All Duplicates in an Array | find-all-duplicates-in-an-array | Given an integer array `nums` of length `n` where all the integers of `nums` are in the range `[1, n]` and each integer appears **once** or **twice**, return _an array of all the integers that appears **twice**_.
You must write an algorithm that runs in `O(n)` time and uses only constant extra space.
**Example 1:**
... | null | Array,Hash Table | Medium | 448 |
839 | Question from video number 23 of Hello Gas Welcome Tu Me channel, we have made it in video number 22, but using BFS and DFS, we will make it with DSO, okay, it will be quite easy, we will understand it with DSC also, then what is the requested, those with graph concept. The playlist is DSO, read it, after that this que... | Similar String Groups | short-encoding-of-words | Two strings `X` and `Y` are similar if we can swap two letters (in different positions) of `X`, so that it equals `Y`. Also two strings `X` and `Y` are similar if they are equal.
For example, `"tars "` and `"rats "` are similar (swapping at positions `0` and `2`), and `"rats "` and `"arts "` are similar, but `"star "`... | null | Array,Hash Table,String,Trie | Medium | null |
72 | edit dividends one of the most classical problems when it comes to dynamic programming and surely this problem is asked almost everywhere in one form or the other so by solving this problem I will also focus on how can you come up with a solution like what should be a thought process so that when you encounter similar ... | Edit Distance | edit-distance | Given two strings `word1` and `word2`, return _the minimum number of operations required to convert `word1` to `word2`_.
You have the following three operations permitted on a word:
* Insert a character
* Delete a character
* Replace a character
**Example 1:**
**Input:** word1 = "horse ", word2 = "ros "
**O... | null | String,Dynamic Programming | Hard | 161,583,712,1105,2311 |
426 | hello welcome back to my channel i'm here to do my 100 lego challenge today we have leeco 426 convert binary search tree to sword doubling list and here's the description and you can take a moment to take a look at that but in summary uh you can take a look at this example so now this is the binary search tree and we i... | Convert Binary Search Tree to Sorted Doubly Linked List | convert-binary-search-tree-to-sorted-doubly-linked-list | Convert a **Binary Search Tree** to a sorted **Circular Doubly-Linked List** in place.
You can think of the left and right pointers as synonymous to the predecessor and successor pointers in a doubly-linked list. For a circular doubly linked list, the predecessor of the first element is the last element, and the succe... | null | null | Medium | null |
895 | Loot Hello Everyone Welcome 28th President Ko Chalu And S Lord Your Honor 4 Inch And Discuss Maximum Screen System In This Question In Two Employment Of Frequency Stock And Subscribe Define More Objective Side Must Subscribe Button Was Clicked Aunty By Removing Element You And Telemedicine Element Most Frequent Servi S... | Maximum Frequency Stack | shortest-path-to-get-all-keys | Design a stack-like data structure to push elements to the stack and pop the most frequent element from the stack.
Implement the `FreqStack` class:
* `FreqStack()` constructs an empty frequency stack.
* `void push(int val)` pushes an integer `val` onto the top of the stack.
* `int pop()` removes and returns the... | null | Bit Manipulation,Breadth-First Search | Hard | null |
583 | Quiz Welcome To My Video Series Coding Is That Problem Digit Operation For Boosting Subscribe And Subscribe To Our Channel Subscribe Now To Swapn Free To Present Distic Total Pati Is What You Have To Retail Blurred Crush How To Delete To Make The World Is The character of this sunnah in redmi phone where and distance i... | Delete Operation for Two Strings | delete-operation-for-two-strings | Given two strings `word1` and `word2`, return _the minimum number of **steps** required to make_ `word1` _and_ `word2` _the same_.
In one **step**, you can delete exactly one character in either string.
**Example 1:**
**Input:** word1 = "sea ", word2 = "eat "
**Output:** 2
**Explanation:** You need one step to mak... | null | String,Dynamic Programming | Medium | 72,712,1250 |
310 | hello so today we are doing this problem called minimum hatred it's a medium type problem on lead code it's a very popular problem so let's get to it so the problem says for an undirected graph with three characteristics we can essentially suppose just remember it's an interrupted graph and we can choose any node as th... | Minimum Height Trees | minimum-height-trees | A tree is an undirected graph in which any two vertices are connected by _exactly_ one path. In other words, any connected graph without simple cycles is a tree.
Given a tree of `n` nodes labelled from `0` to `n - 1`, and an array of `n - 1` `edges` where `edges[i] = [ai, bi]` indicates that there is an undirected edg... | How many MHTs can a graph have at most? | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 207,210 |
994 | welcome to august leco challenge today's problem is writing oranges in a given grid each cell can have one of three values zero representing an empty cell one representing a fresh orange and two representing rotten orange every minute any fresh orange that is adjacent to a rotten orange becomes rotten return the minimu... | Rotting Oranges | prison-cells-after-n-days | You are given an `m x n` `grid` where each cell can have one of three values:
* `0` representing an empty cell,
* `1` representing a fresh orange, or
* `2` representing a rotten orange.
Every minute, any fresh orange that is **4-directionally adjacent** to a rotten orange becomes rotten.
Return _the minimum nu... | null | Array,Hash Table,Math,Bit Manipulation | Medium | null |
273 | okay so lead code practice time so two goals in this video the first one is to find the solution and then put some code for this uh for this problem and then the second one is to see how to solve this problem uh in the real interview so let's get started so remember the first step is always to try to understand the pro... | Integer to English Words | integer-to-english-words | Convert a non-negative integer `num` to its English words representation.
**Example 1:**
**Input:** num = 123
**Output:** "One Hundred Twenty Three "
**Example 2:**
**Input:** num = 12345
**Output:** "Twelve Thousand Three Hundred Forty Five "
**Example 3:**
**Input:** num = 1234567
**Output:** "One Million Tw... | Did you see a pattern in dividing the number into chunk of words? For example, 123 and 123000. Group the number by thousands (3 digits). You can write a helper function that takes a number less than 1000 and convert just that chunk to words. There are many edge cases. What are some good test cases? Does your code work ... | Math,String,Recursion | Hard | 12 |
545 | Hello friends welcome to my channel let's have a look at problem 545 boundary of binary tree in this video we are going to share a treatment based on traversal here we are going to use different kinds of traversals to glue the left boundary red boundary left boundary Leaf nodes and red boundary together first let's loo... | Boundary of Binary Tree | boundary-of-binary-tree | The **boundary** of a binary tree is the concatenation of the **root**, the **left boundary**, the **leaves** ordered from left-to-right, and the **reverse order** of the **right boundary**.
The **left boundary** is the set of nodes defined by the following:
* The root node's left child is in the left boundary. If ... | null | Tree,Depth-First Search,Binary Tree | Medium | 199 |
1,460 | all right so let's talk about the next two array equal by reversing sub array so you are given two integer arrays of equal length target in an array so in one step you can select any non-empty one step you can select any non-empty one step you can select any non-empty sub array of array and reverse it so you are allowe... | Make Two Arrays Equal by Reversing Subarrays | number-of-substrings-containing-all-three-characters | You are given two integer arrays of equal length `target` and `arr`. In one step, you can select any **non-empty subarray** of `arr` and reverse it. You are allowed to make any number of steps.
Return `true` _if you can make_ `arr` _equal to_ `target` _or_ `false` _otherwise_.
**Example 1:**
**Input:** target = \[1,... | For each position we simply need to find the first occurrence of a/b/c on or after this position. So we can pre-compute three link-list of indices of each a, b, and c. | Hash Table,String,Sliding Window | Medium | 2187 |
334 | hi this is truly today i will serve the problem three hundred thousand pounds their name is including three probably subsequence this description with the problem says that they're given only with all right norms and written to if their access are triple wind i said i jk sustain i is less than j and change justin k and... | Increasing Triplet Subsequence | increasing-triplet-subsequence | Given an integer array `nums`, return `true` _if there exists a triple of indices_ `(i, j, k)` _such that_ `i < j < k` _and_ `nums[i] < nums[j] < nums[k]`. If no such indices exists, return `false`.
**Example 1:**
**Input:** nums = \[1,2,3,4,5\]
**Output:** true
**Explanation:** Any triplet where i < j < k is valid.
... | null | Array,Greedy | Medium | 300,2122,2280 |
66 | hey everyone welcome back and let's write some more neat code today so today let's solve leak code 66 plus one we are given a non-empty array of decimal digits non-empty array of decimal digits non-empty array of decimal digits and so by decimal they basically mean every digit is gonna be from 0 to 9 right that's decim... | Plus One | plus-one | You are given a **large integer** represented as an integer array `digits`, where each `digits[i]` is the `ith` digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading `0`'s.
Increment the large integer by one and re... | null | Array,Math | Easy | 43,67,369,1031 |
221 | hey everyone welcome back and let's write some more neat code today let's solve one of my favorite interview questions maximal square according to elite code it's asked by a few companies including google and also including huawei so i like it because it's actually a pretty simple problem so we're given an m by n matri... | 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 |
1,036 | 10:36 escaped a large maze in a million 10:36 escaped a large maze in a million 10:36 escaped a large maze in a million by a million quid the coordinates of each grid square XY with civil is with x and y between zero and a million we started the source square and want to reach the target square each move we can walk to... | Escape a Large Maze | rotting-oranges | There is a 1 million by 1 million grid on an XY-plane, and the coordinates of each grid square are `(x, y)`.
We start at the `source = [sx, sy]` square and want to reach the `target = [tx, ty]` square. There is also an array of `blocked` squares, where each `blocked[i] = [xi, yi]` represents a blocked square with coor... | null | Array,Breadth-First Search,Matrix | Medium | 286,2206 |
1,819 | hey what's up guys uh this is chung here so uh this time let's take a look at this one okay 1819 number of different subsequencies gcds okay so you're given like an array numbers right and consists of positive integers and your task is to return basically the number of different gcds among all the empty subsequences of... | Number of Different Subsequences GCDs | construct-the-lexicographically-largest-valid-sequence | You are given an array `nums` that consists of positive integers.
The **GCD** of a sequence of numbers is defined as the greatest integer that divides **all** the numbers in the sequence evenly.
* For example, the GCD of the sequence `[4,6,16]` is `2`.
A **subsequence** of an array is a sequence that can be formed... | Heuristic algorithm may work. | Array,Backtracking | Medium | null |
349 | foreign we know that 2 repeats spicier and two repeats tires by CSU intersectional Commodore the resultant array should be unique so 2 is uh written only once here if you see 495 here okay 4 is present so 4 is intersection then 9 also present in the second array so these two other elements which are in the intersection... | Intersection of Two Arrays | intersection-of-two-arrays | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must be **unique** and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2\]
**Example 2:**
**Input:** nums1 = \[4,9,5\], nums2 = \... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 350,1149,1392,2190,2282 |
546 | hey everybody this is larry this is day 14 of the august eco daily challenge hit the like button hit the subscribe button join me in discord let me know what you think about this really tricky problem we've moved boxes so i actually really recommend um watching my video on 2x um not right now but i'll do the explanatio... | Remove Boxes | remove-boxes | You are given several `boxes` with different colors represented by different positive numbers.
You may experience several rounds to remove boxes until there is no box left. Each time you can choose some continuous boxes with the same color (i.e., composed of `k` boxes, `k >= 1`), remove them and get `k * k` points.
R... | null | Array,Dynamic Programming,Memoization | Hard | 664,2247 |
654 | foreign uh in the lead code you can go to the stack topic and sort it with the and solve all the question on the basis of uh difficulty then you will get all the 11 percent at all and you can check it out I have solved each type of question of the easy level or and every question as well so let's I'm very excited to st... | Maximum Binary Tree | maximum-binary-tree | You are given an integer array `nums` with no duplicates. A **maximum binary tree** can be built recursively from `nums` using the following algorithm:
1. Create a root node whose value is the maximum value in `nums`.
2. Recursively build the left subtree on the **subarray prefix** to the **left** of the maximum val... | null | Array,Divide and Conquer,Stack,Tree,Monotonic Stack,Binary Tree | Medium | 1040 |
925 | Ajay Ko Hello Everyone - Mysterious and today we are going to Hello Everyone - Mysterious and today we are going to Hello Everyone - Mysterious and today we are going to shoot a new topic of Level-2 shoot a new topic of Level-2 shoot a new topic of Level-2 Admission is ok so the first question of Edison screen is quali... | Long Pressed Name | construct-binary-tree-from-preorder-and-postorder-traversal | Your friend is typing his `name` into a keyboard. Sometimes, when typing a character `c`, the key might get _long pressed_, and the character will be typed 1 or more times.
You examine the `typed` characters of the keyboard. Return `True` if it is possible that it was your friends name, with some characters (possibly ... | null | Array,Hash Table,Divide and Conquer,Tree,Binary Tree | Medium | null |
376 | Everyone welcome back to the video like share and subscribe ok happy this is what I did here a while back if the video had not been for four-five minutes video had not been for four-five minutes then maybe it would have been a little less to explain so try and ok so the disclosure is over happy back. Let's come e will ... | 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 |
7 | hello everyone in this video we're going to be going through leap code problem number seven which is reverse integer this is a medium problem um and it says given in assign 32-bit integer X return x with its 32-bit integer X return x with its 32-bit integer X return x with its digits reversed if reversing X causes the ... | Reverse Integer | reverse-integer | Given a signed 32-bit integer `x`, return `x` _with its digits reversed_. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-231, 231 - 1]`, then return `0`.
**Assume the environment does not allow you to store 64-bit integers (signed or unsigned).**
**Example 1:**
**Input:** x = 123
... | null | Math | Medium | 8,190,2238 |
1,481 | hey everybody this is Larry I'm doing this problem as part of a contest so you're gonna watch me live as I go through my darts I'm coding they've been explanation near the end and for more context they'll be a link below on this actual screencast of the contest how did you do let me know you do hit the like button eith... | Least Number of Unique Integers after K Removals | students-with-invalid-departments | Given an array of integers `arr` and an integer `k`. Find the _least number of unique integers_ after removing **exactly** `k` elements**.**
**Example 1:**
**Input:** arr = \[5,5,4\], k = 1
**Output:** 1
**Explanation**: Remove the single 4, only 5 is left.
**Example 2:**
**Input:** arr = \[4,3,1,1,3,3,2\], k = 3
*... | null | Database | Easy | null |
790 | Loot Hello Everyone Welcome Back To My Channel Backward Classes Intuitive Ka Shraddha Problem Problems Domino And From Now Doing So In This Problem Will Give Two Types Of Tiles To Improve With Like This And At Rome E No Him Like This Tumor Half Hour Subscribe This Video Give In increased number of ways in proven answer... | Domino and Tromino Tiling | global-and-local-inversions | You have two types of tiles: a `2 x 1` domino shape and a tromino shape. You may rotate these shapes.
Given an integer n, return _the number of ways to tile an_ `2 x n` _board_. Since the answer may be very large, return it **modulo** `109 + 7`.
In a tiling, every square must be covered by a tile. Two tilings are dif... | Where can the 0 be placed in an ideal permutation? What about the 1? | Array,Math | Medium | null |
438 | hello guys welcome to deep codes and in today's video we will discuss liquid question 438 that says find or anagram in a string so yes this is one of the very famous question and also you can see the number of likes here it's nearly to 10K so this is one of the famous creation of a string data structure with the hash o... | Find All Anagrams in a String | find-all-anagrams-in-a-string | Given two strings `s` and `p`, return _an array of all the start indices of_ `p`_'s anagrams in_ `s`. You may return the answer in **any order**.
An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
**Example 1:**
*... | null | Hash Table,String,Sliding Window | Medium | 242,567 |
680 | what is up youtube i'm xavier and today we are going over about drum all right so valid palindrome 2. um given a non-empty string as you may um given a non-empty string as you may um given a non-empty string as you may delete at most one character judge whether you can make it a palindrome um so they just give us aba i... | Valid Palindrome II | valid-palindrome-ii | Given a string `s`, return `true` _if the_ `s` _can be palindrome after deleting **at most one** character from it_.
**Example 1:**
**Input:** s = "aba "
**Output:** true
**Example 2:**
**Input:** s = "abca "
**Output:** true
**Explanation:** You could delete the character 'c'.
**Example 3:**
**Input:** s = "a... | null | Two Pointers,String,Greedy | Easy | 125,1178 |
252 | hey everyone in this video let's go to question 252 meeting rooms on leak code this is part of a blind 75 list of questions so to speak in this problem is actually a premium problem and that's why we're doing it on this lint code website and you can see the number is different but otherwise the question and the test ca... | Meeting Rooms | meeting-rooms | Given an array of meeting time `intervals` where `intervals[i] = [starti, endi]`, determine if a person could attend all meetings.
**Example 1:**
**Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\]
**Output:** false
**Example 2:**
**Input:** intervals = \[\[7,10\],\[2,4\]\]
**Output:** true
**Constraints:**
* ... | null | Array,Sorting | Easy | 56,253 |
279 | hi everyone welcome back to the channel and today we to solve lead code daily challenge problem number 279 perfect squares so uh we'll first check out the problem statement uh and after that we'll look into the approach which you're going to use and towards the end we'll see the code uh as well so starting with the pro... | 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 |
5 | Subscribe to our channel Computer Sibble and press the bell icon so that you can get updated with all the important questions of C plus python and rice. Hello friends, today we will keep the program of long distance auctioning, so what is pan garam hota to simple hum. When you say madam, you do not go opposite to madam... | 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 |
224 | Decide for polling by banning Ajay, so today we are going to solve this question in a basic letter. In the question, we are making someone, yes, our own, we got a spray of expression and we have to tell from the same year how much of this entire Krishna Value will be created. Let's give an example. I will get you a SIM... | Basic Calculator | basic-calculator | Given a string `s` representing a valid expression, implement a basic calculator to evaluate it, and return _the result of the evaluation_.
**Note:** You are **not** allowed to use any built-in function which evaluates strings as mathematical expressions, such as `eval()`.
**Example 1:**
**Input:** s = "1 + 1 "
**O... | null | Math,String,Stack,Recursion | Hard | 150,227,241,282,785,2147,2328 |
133 | hey guys welcome back to this video now we're going to solve a coding interview problem clone a graph you are given a reference of a node in a connected undirected graph return a deep copy that means clone of the graph we are given starting index of graph is represented using adjacency list the graph is connected and a... | 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,610 | what is up guys we are back with another call problem so we're doing 16 10 maximum number of visible points you're given an array points an integer angle and your location with location in position x position y all the points also have an x y coordinate they both denote integral coordinates on the x y plane you're init... | Maximum Number of Visible Points | xor-operation-in-an-array | You are given an array `points`, an integer `angle`, and your `location`, where `location = [posx, posy]` and `points[i] = [xi, yi]` both denote **integral coordinates** on the X-Y plane.
Initially, you are facing directly east from your position. You **cannot move** from your position, but you can **rotate**. In othe... | Simulate the process, create an array nums and return the Bitwise XOR of all elements of it. | Math,Bit Manipulation | Easy | null |
338 | hey guys persistent programmer here and welcome back to my channel so in this channel we solve a lot of algorithms and go over legal questions so if you haven't subscribed already go ahead and hit the subscribe button smash that like button because that helps me create this content for you guys so without further ado l... | 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 |
465 | hey everybody this is Larry this is me doing week one of the league of July weekly challenge premium challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about this poem 465 optimal account balancing so you come in transactions from to an ml return the minimum number of t... | Optimal Account Balancing | optimal-account-balancing | You are given an array of transactions `transactions` where `transactions[i] = [fromi, toi, amounti]` indicates that the person with `ID = fromi` gave `amounti $` to the person with `ID = toi`.
Return _the minimum number of transactions required to settle the debt_.
**Example 1:**
**Input:** transactions = \[\[0,1,1... | null | Array,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask | Hard | null |
689 | hey guys how's everything going this is Jay sir who is not good at algorithms in this video I'm going to take a look at 6 8 9 maximum sum of two three non-overlapping separation we were given non-overlapping separation we were given non-overlapping separation we were given a ray of numbers of positive integers find thr... | Maximum Sum of 3 Non-Overlapping Subarrays | maximum-sum-of-3-non-overlapping-subarrays | Given an integer array `nums` and an integer `k`, find three non-overlapping subarrays of length `k` with maximum sum and return them.
Return the result as a list of indices representing the starting position of each interval (**0-indexed**). If there are multiple answers, return the lexicographically smallest one.
*... | null | Array,Dynamic Programming | Hard | 123 |
496 | in this video we're going to look at a legal problem called nest greater element one so we're given two integer array and both have unique elements numbers one is a subset of nums too so we want to try to find all the uh less greater l uh elements for nums one's elements in the corresponding places of numbers two so le... | 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 |
890 | hello everyone welcome to quartus camp we are at the 21st day of may lead code challenge and in this video we are going to cover find and replace pattern so the input given here is a list of words or the string array and string pattern and we have to return again the list of words which matches the pattern given in the... | Find and Replace Pattern | lemonade-change | Given a list of strings `words` and a string `pattern`, return _a list of_ `words[i]` _that match_ `pattern`. You may return the answer in **any order**.
A word matches the pattern if there exists a permutation of letters `p` so that after replacing every letter `x` in the pattern with `p(x)`, we get the desired word.... | null | Array,Greedy | Easy | null |
1,802 | Welcome to this Stylish Co. This is a medium level question. Inside this question we will have three positive integers N index and Max sum and we have to construct a like whose indexing will start from zero and the condition which is given below should be satisfied. Okay, so what will be the condition that the length o... | 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 |
171 | hello guys my name is Ursula and welcome back to my channel and today we are going to solve a new liquid question that is Excel sheet column number we will be solving discussion with the help of python so let's start solving this question just before starting solving this question guys do subscribe to the channel hit t... | Excel Sheet Column Number | excel-sheet-column-number | Given a string `columnTitle` that represents the column title as appears in an Excel sheet, return _its corresponding column number_.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
**Example 1:**
**Input:** columnTitle = "A "
**Output:** 1
**Example 2:**
**Input:** columnTitle = "AB "
**Ou... | null | Math,String | Easy | 168,2304 |
221 | Hello hello guys welcome back to take division in this video you will see the maximum square problem visit from list co de 2730 discarding challenge so let's look at the problem statement the problem yes-yes york this look at the problem statement the problem yes-yes york this look at the problem statement the problem ... | 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 |
1,004 | hello welcome to my channel i'm here to do my 100 lego challenge today we have the code 1004 max consecutive 1 3 so given an array a of zeros and ones we may change up to k values from zero to one and we turn the link of the longest contiguous sub array that contained only once after changing right so the example in he... | Max Consecutive Ones III | least-operators-to-express-number | Given a binary array `nums` and an integer `k`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most_ `k` `0`'s.
**Example 1:**
**Input:** nums = \[1,1,1,0,0,0,1,1,1,1,0\], k = 2
**Output:** 6
**Explanation:** \[1,1,1,0,0,**1**,1,1,1,1,**1**\]
Bolded numbers were flipped from 0 to 1.... | null | Math,Dynamic Programming | Hard | null |
41 | code 41 First missing positive how to solve hard leak code problems creatively with JavaScript I didn't look at any of the other submissions or any of the discussion I dove right in and got good performance after making a few tweaks and changing the submission a couple times I got pretty good performance out of this an... | First Missing Positive | first-missing-positive | Given an unsorted integer array `nums`, return the smallest missing positive integer.
You must implement an algorithm that runs in `O(n)` time and uses constant extra space.
**Example 1:**
**Input:** nums = \[1,2,0\]
**Output:** 3
**Explanation:** The numbers in the range \[1,2\] are all in the array.
**Example 2:*... | Think about how you would solve the problem in non-constant space. Can you apply that logic to the existing space? We don't care about duplicates or non-positive integers Remember that O(2n) = O(n) | Array,Hash Table | Hard | 268,287,448,770 |
724 | hi everyone this is Colleen Dev Tech and today we are going to solve 724 of Le code this is find pivot index and so we are given a nums array and what we want to do is find our pivot index and so for this nums array we have these three elements that equal to 11 and then these two last elements that equal to 11 and so w... | 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,837 | At this moment I have the result number of three percent real estate1 in tu adia price that plant testing version tubeless k 6585 the best with this will find out key 130 office number 66 value will divide this treatment at every step number 3 k basics and committee Plus Five Physical Document Simran Ne Effect System 1... | Sum of Digits in Base K | daily-leads-and-partners | Given an integer `n` (in base `10`) and a base `k`, return _the **sum** of the digits of_ `n` _**after** converting_ `n` _from base_ `10` _to base_ `k`.
After converting, each digit should be interpreted as a base `10` number, and the sum should be returned in base `10`.
**Example 1:**
**Input:** n = 34, k = 6
**Out... | null | Database | Easy | null |
40 | in this video we'll be going over combination sum two so given a collection of candidate numbers candidates and target number target find all unique combinations and candidates where the candidate number sum to target each number and candidates may only be used once in a combination the solution set must not contain du... | Combination Sum II | combination-sum-ii | Given a collection of candidate numbers (`candidates`) and a target number (`target`), find all unique combinations in `candidates` where the candidate numbers sum to `target`.
Each number in `candidates` may only be used **once** in the combination.
**Note:** The solution set must not contain duplicate combinations.... | null | Array,Backtracking | Medium | 39 |
219 | okay so as an example we are trying to solve the contains duplicate 2 problem now this is a very popular late core problem that has been asked in some of the popular companies like Amazon Facebook Adobe Microsoft Uber Google Bloomberg Airbnb and plenty so these are all Tech Giant companies who love asking this question... | 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 |
1,402 | Hello Friends Today I Will Discuss Your Problems From Its Core Problem Name Reduce Indexes Voice Mail Play List Only A Good Heart Problems Because She Thought My Subscribers World Heart From Some Great Quotes And Shayris For Start Posting Laut Problems All Should Know Specific Playlist Research And My channel I will ha... | Reducing Dishes | count-square-submatrices-with-all-ones | A chef has collected data on the `satisfaction` level of his `n` dishes. Chef can cook any dish in 1 unit of time.
**Like-time coefficient** of a dish is defined as the time taken to cook that dish including previous dishes multiplied by its satisfaction level i.e. `time[i] * satisfaction[i]`.
Return _the maximum sum... | Create an additive table that counts the sum of elements of submatrix with the superior corner at (0,0). Loop over all subsquares in O(n^3) and check if the sum make the whole array to be ones, if it checks then add 1 to the answer. | Array,Dynamic Programming,Matrix | Medium | 2192,2193 |
458 | hi guys welcome to tech geek so today we are back with the daily eat good challenge problem and that's four pigs this time the problem is a hard one that's leapfrog heart 4 58 so before beginning i'd like to request you all please like share and subscribe to my channel let me know if you have any queries regarding any ... | Poor Pigs | poor-pigs | There are `buckets` buckets of liquid, where **exactly one** of the buckets is poisonous. To figure out which one is poisonous, you feed some number of (poor) pigs the liquid to see whether they will die or not. Unfortunately, you only have `minutesToTest` minutes to determine which bucket is poisonous.
You can feed t... | What if you only have one shot? Eg. 4 buckets, 15 mins to die, and 15 mins to test. How many states can we generate with x pigs and T tests? Find minimum x such that (T+1)^x >= N | Math,Dynamic Programming,Combinatorics | Hard | null |
1,189 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem maximum number of balloons we're given an input string text and we want to use the characters from that string to form as many instances of the word balloon as possible of course from that input string we can use each c... | Maximum Number of Balloons | encode-number | Given a string `text`, you want to use the characters of `text` to form as many instances of the word **"balloon "** as possible.
You can use each character in `text` **at most once**. Return the maximum number of instances that can be formed.
**Example 1:**
**Input:** text = "nlaebolko "
**Output:** 1
**Example 2... | Try to find the number of binary digits returned by the function. The pattern is to start counting from zero after determining the number of binary digits. | Math,String,Bit Manipulation | Medium | 1070 |
332 | Candy Crush Channel on my phone In today's video, if we are going to Candy Crush Channel on my phone In today's video, if we are going to Candy Crush Channel on my phone In today's video, if we are going to call Reconstructed Reena Question, then we will weave this in reverse, do you have some tickets given to us broth... | Reconstruct Itinerary | reconstruct-itinerary | You are given a list of airline `tickets` where `tickets[i] = [fromi, toi]` represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it.
All of the tickets belong to a man who departs from `"JFK "`, thus, the itinerary must begin with `"JFK "`. If there are multiple... | null | Depth-First Search,Graph,Eulerian Circuit | Hard | 2051,2201 |
478 | hey everybody this is larry this is day 17 of the march decode daily challenge hit the like button hit the subscribe button join me in discord it's almost the end uh welcome uh let me know what you think about jay's farm generate random points in a circle i usually do these live it's a little bit slow let me know or fa... | Generate Random Point in a Circle | generate-random-point-in-a-circle | Given the radius and the position of the center of a circle, implement the function `randPoint` which generates a uniform random point inside the circle.
Implement the `Solution` class:
* `Solution(double radius, double x_center, double y_center)` initializes the object with the radius of the circle `radius` and th... | null | null | Medium | null |
472 | Hello gas myself Amrita welcome back to our channel technostat so in today's video we are going to discuss lead code problem number for 72 date is concatenated words so this is an hard difficulty problem but don't worry we are going to make it easy for you so nine Let's Get Started Let's First Understand the Problem Gi... | Concatenated Words | concatenated-words | Given an array of strings `words` (**without duplicates**), return _all the **concatenated words** in the given list of_ `words`.
A **concatenated word** is defined as a string that is comprised entirely of at least two shorter words (not necesssarily distinct) in the given array.
**Example 1:**
**Input:** words = \... | null | Array,String,Dynamic Programming,Depth-First Search,Trie | Hard | 140 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.