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,903 | foreign representing a large integer return the largest value or integer as a string that is a non-empty substring of noun or that is a non-empty substring of noun or that is a non-empty substring of noun or an MD string if no or integer exists so our substring is a continuous sequence of characters between the strip w... | Largest Odd Number in String | design-most-recently-used-queue | You are given a string `num`, representing a large integer. Return _the **largest-valued odd** integer (as a string) that is a **non-empty substring** of_ `num`_, or an empty string_ `" "` _if no odd integer exists_.
A **substring** is a contiguous sequence of characters within a string.
**Example 1:**
**Input:** nu... | You can store the data in an array and apply each fetch by moving the ith element to the end of the array (i.e, O(n) per operation). A better way is to use the square root decomposition technique. You can build chunks of size sqrt(n). For each fetch operation, You can search for the chunk which has the ith element and ... | Array,Hash Table,Stack,Design,Binary Indexed Tree,Ordered Set | Medium | 146 |
309 | hey everybody this is larry this is day 15 of the october eco day challenge you have right there yeah give yourself a pause uh yeah hit the like button the subscribe button join me on discord i think i thought i clicked on it but apparently i didn't uh let me know what you think about today's problem so i usually um yo... | Best Time to Buy and Sell Stock with Cooldown | best-time-to-buy-and-sell-stock-with-cooldown | You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the following restrictions:
* After you sell your stock, yo... | null | Array,Dynamic Programming | Medium | 121,122 |
912 | hey everybody this is Larry I hit the like button hit the subscribe button let me know how you're doing this farm I'm gonna stop alive right about now okay cool 9:12 sword in a way given in a way of 9:12 sword in a way given in a way of 9:12 sword in a way given in a way of interest nums sword away in ascending order k... | Sort an Array | random-pick-with-weight | Given an array of integers `nums`, sort the array in ascending order and return it.
You must solve the problem **without using any built-in** functions in `O(nlog(n))` time complexity and with the smallest space complexity possible.
**Example 1:**
**Input:** nums = \[5,2,3,1\]
**Output:** \[1,2,3,5\]
**Explanation:*... | null | Math,Binary Search,Prefix Sum,Randomized | Medium | 398,894,914 |
209 | hi guys welcome to algorithms Made Easy my name is khushboo and in this video we are going to see the question minimum size sabare sum given an array of positive integers nums and a positive integer Target return the minimal length of a sub array whose sum is greater than or equal to Target if there is no such sub arra... | 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 |
849 | hey everybody this is larry this is day 29 of the october lego daily challenge uh almost to the end hit the like button hit the subscribe button join me on discord let me know what you find scary uh on today's prom maximize distance to close this person okay you're giving away with or like it's like social distancing o... | Maximize Distance to Closest Person | maximize-distance-to-closest-person | You are given an array representing a row of `seats` where `seats[i] = 1` represents a person sitting in the `ith` seat, and `seats[i] = 0` represents that the `ith` seat is empty **(0-indexed)**.
There is at least one empty seat, and at least one person sitting.
Alex wants to sit in the seat such that the distance b... | null | null | Medium | null |
1,704 | okay so let's talk about the different extreme half our life so you are going to give it a string with even then and you have to split the string into the half and you want to count the number of miles uh only uh do they have equal an amount of the vowels and if so and then you can just basically return to else through... | Determine if String Halves Are Alike | special-positions-in-a-binary-matrix | You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half.
Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppe... | Keep track of 1s in each row and in each column. Then while iterating over matrix, if the current position is 1 and current row as well as current column contains exactly one occurrence of 1. | Array,Matrix | Easy | null |
316 | hey everyone it is site first of all happy holiday and hope you are doing well so let's start with the question so the question is remove duplicate letters okay so you are given a string as and you have to remove duplicate return so that every letter appears once okay and only once okay you must make sure uh your resul... | Remove Duplicate Letters | remove-duplicate-letters | Given a string `s`, remove duplicate letters so that every letter appears once and only once. You must make sure your result is **the smallest in lexicographical order** among all possible results.
**Example 1:**
**Input:** s = "bcabc "
**Output:** "abc "
**Example 2:**
**Input:** s = "cbacdcbc "
**Output:** "a... | Greedily try to add one missing character. How to check if adding some character will not cause problems ? Use bit-masks to check whether you will be able to complete the sub-sequence if you add the character at some index i. | String,Stack,Greedy,Monotonic Stack | Medium | 2157 |
336 | Hello everyone, the question is 336 palindrome pairs, so the question is hard. Or if I combine these two, then my resulting word is Palam. As an example, let's read the question first. You are given zero. Index array of y stream is ok a bram pair i a pair of inger size is zero to wa w length is in between i ever bring ... | Palindrome Pairs | palindrome-pairs | You are given a **0-indexed** array of **unique** strings `words`.
A **palindrome pair** is a pair of integers `(i, j)` such that:
* `0 <= i, j < words.length`,
* `i != j`, and
* `words[i] + words[j]` (the concatenation of the two strings) is a palindrome.
Return _an array of all the **palindrome pairs** of_ `... | null | Array,Hash Table,String,Trie | Hard | 5,214,2237 |
487 | Jhaal Hello friends welcome to what is life today way cricketer minimum level problems from doctor problem number 127 effective work number Steve Jobs in Haryana due to maximum number one officer subscribe now to what is the longest born on December 13 2010 subscribe and subscribe Side of Changes in 1051 Best Result Fr... | Max Consecutive Ones II | max-consecutive-ones-ii | Given a binary array `nums`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most one_ `0`.
**Example 1:**
**Input:** nums = \[1,0,1,1,0\]
**Output:** 4
**Explanation:**
- If we flip the first zero, nums becomes \[1,1,1,1,0\] and we have 4 consecutive ones.
- If we flip the second z... | null | Array,Dynamic Programming,Sliding Window | Medium | 485,1046,2261 |
50 | and welcome back to the cracking fang youtube channel today we're going to be solving leap code problem number 50 pal x n implement pow x n which calculates x raised to the power n i e x to the n so what does this mean so what if we're given x equals two and n equals five essentially what we wanna do is calculate two t... | 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 |
121 | hey everyone welcome to Tech quiet in this video we are going to solve problem number one to one best time to buy and sell stock first we will see the explanation of the problem statement then the logic and the code now let's dive into the solution so here I've taken the first example from the liquid website so we are ... | Best Time to Buy and Sell Stock | best-time-to-buy-and-sell-stock | You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
You want to maximize your profit by choosing a **single day** to buy one stock and choosing a **different day in the future** to sell that stock.
Return _the maximum profit you can achieve from this transaction_. If you ... | null | Array,Dynamic Programming | Easy | 53,122,123,188,309,2138,2144 |
135 | hey everyone today we are going to sort of delete about the question candy so there are any children standing in a line each child is assigned a latent value given in the integer array ratings so you are given you are giving the candies to these children subjected to the following requirements each child must have at l... | 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 |
775 | hello everyone welcome to my channel code with sunny and today i'm going to discuss the problem global and local inversions index number 775 and the problem is of medium type of lead code okay so let's jump over to the problem statement we have been given some permutation of a uh that is permutation which is going to s... | Global and Local Inversions | n-ary-tree-preorder-traversal | You are given an integer array `nums` of length `n` which represents a permutation of all the integers in the range `[0, n - 1]`.
The number of **global inversions** is the number of the different pairs `(i, j)` where:
* `0 <= i < j < n`
* `nums[i] > nums[j]`
The number of **local inversions** is the number of i... | null | Stack,Tree,Depth-First Search | Easy | 144,764,776 |
1,837 | hey everybody this is larry this is me going over q1 of the leak code contest recently uh 238 uh some of the digits in base k so this one uh it's a little bit awkward uh so hit the like button to subscribe and join me in discord and yeah did i say that already i don't know i my brain juice is gone but yeah for this one... | 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 |
6 | hello everyone welcome to code for placement uh in today's video we will see zigzag conversion we will be having string this string need to be converted into the zigzag manner means we are having Pay Pal is hiring so this PayPal is basically in this order if you can see Pay Pal is hiring so this is zigzag matter this i... | Zigzag Conversion | zigzag-conversion | The string `"PAYPALISHIRING "` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S I I G
Y I R
And then read line by line: `"PAHNAPLSIIGYIR "`
Write the code that will take a string and make this co... | null | String | Medium | null |
999 | yeahyeah Hi everyone, I'm a programmer. Today I'll introduce to you a problem with the following title: Chess pieces can be captured by rooks that following title: Chess pieces can be captured by rooks that violate our rules. Going into the details of the problem requirements for a chessboard measuring 8x8 with only on... | Available Captures for Rook | regions-cut-by-slashes | On an `8 x 8` chessboard, there is **exactly one** white rook `'R'` and some number of white bishops `'B'`, black pawns `'p'`, and empty squares `'.'`.
When the rook moves, it chooses one of four cardinal directions (north, east, south, or west), then moves in that direction until it chooses to stop, reaches the edge ... | null | Depth-First Search,Breadth-First Search,Union Find,Graph | Medium | null |
27 | everyone welcome back and let's write some more neat code today so today let's solve the problem remove element we're given an integer array of nums and a particular value a second parameter value and we want to remove all occurrences of this value that we're given as the second parameter we want to remove all occurren... | Remove Element | remove-element | Given an integer array `nums` and an integer `val`, remove all occurrences of `val` in `nums` [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm). The order of the elements may be changed. Then return _the number of elements in_ `nums` _which are not equal to_ `val`.
Consider the number of elements in `nu... | The problem statement clearly asks us to modify the array in-place and it also says that the element beyond the new length of the array can be anything. Given an element, we need to remove all the occurrences of it from the array. We don't technically need to remove that element per-say, right? We can move all the occu... | Array,Two Pointers | Easy | 26,203,283 |
217 | So the name of the question is Content Duplicate, you will get it in the lead code. Lead code is question number 217. Well, this is the problem statement, there will be some numbers in it, so as you can see, none of these three numbers are repeating, all are unique. So we will say that there is no duplicate in it and w... | 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 |
66 | welcome to July's LICO challenge today's problem is plus one given a non-empty problem is plus one given a non-empty problem is plus one given a non-empty array of digits representing a non-negative integer +1 to the integer non-negative integer +1 to the integer non-negative integer +1 to the integer the digits are st... | 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 |
735 | hey guys welcome back to another video and today we're going to be following the leakout question asteroid collision all right so in this question we're given an array asteroids of integers representing asteroids in a single row for each asteroid the absolute value represents its size and the sine represents the direct... | Asteroid Collision | asteroid-collision | We are given an array `asteroids` of integers representing asteroids in a row.
For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed.
Find out the state of the asteroids after all collisio... | Say a row of asteroids is stable. What happens when a new asteroid is added on the right? | Array,Stack | Medium | 605,2245,2317 |
287 | Hello everyone so today bill b discussing question number 87 of lead code which is find duplicate number so let's see in it what is the input is given to us and in that we just have to find which is the duplicate number like in this the duplicate number is Okay, and the size that we need in this is N + 1. Okay, this is... | Find the Duplicate Number | find-the-duplicate-number | Given an array of integers `nums` containing `n + 1` integers where each integer is in the range `[1, n]` inclusive.
There is only **one repeated number** in `nums`, return _this repeated number_.
You must solve the problem **without** modifying the array `nums` and uses only constant extra space.
**Example 1:**
**... | null | Array,Two Pointers,Binary Search,Bit Manipulation | Medium | 41,136,142,268,645 |
399 | That game traffic is harmful or Animal Harrison has been there to Ajay That Anirudh Interesting solution like Jamun Roy Okay good night so they move into the next question Is railway division and information given with a Now we have values like It information given with a Now we have values like It information give... | 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 |
1,974 | hello and welcome in this new episode of my let god uh problem solving series in this new episode we are going to try to solve the problem entitled minimum time to type word using special type writing this problem figured within the 59 bi-weekly bi-weekly bi-weekly let god contest and today i'm wanting to share with yo... | Minimum Time to Type Word Using Special Typewriter | find-customers-with-positive-revenue-this-year | There is a special typewriter with lowercase English letters `'a'` to `'z'` arranged in a **circle** with a **pointer**. A character can **only** be typed if the pointer is pointing to that character. The pointer is **initially** pointing to the character `'a'`.
Each second, you may perform one of the following operat... | null | Database | Easy | null |
1,985 | um hello so today we are going to try to solve uh this problem find the kth largest integer in the array so what this problem says is that we get an array numbers and we get an integer k each string in nums represent an integer without leading zeros okay so we have something like so an example of that would be somethin... | Find the Kth Largest Integer in the Array | maximum-subarray-min-product | You are given an array of strings `nums` and an integer `k`. Each string in `nums` represents an integer without leading zeros.
Return _the string that represents the_ `kth` _**largest integer** in_ `nums`.
**Note**: Duplicate numbers should be counted distinctly. For example, if `nums` is `[ "1 ", "2 ", "2 "]`, `"2 ... | Is there a way we can sort the elements to simplify the problem? Can we find the maximum min-product for every value in the array? | Array,Stack,Monotonic Stack,Prefix Sum | Medium | null |
1,006 | O gas ho are you doing solve will date is cleansing factorial so d solution is long and ho are you going to solve so let's first discuss about d question description where it is given date c have factories so c have factorial 4321 but us who its between We also have to perform some operations, so the first operation is... | Clumsy Factorial | vowel-spellchecker | The **factorial** of a positive integer `n` is the product of all positive integers less than or equal to `n`.
* For example, `factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1`.
We make a **clumsy factorial** using the integers in decreasing order by swapping out the multiply operations for a fixed rotation o... | null | Array,Hash Table,String | Medium | null |
198 | Hello and Welcome to Disrespect Video Ne Series for Adding This Time of Problems Called the House Road and Problems Let's Get Started Your Professional Boxer Planning to Rock House Along the Street Light House at a Number of Money Standards to Records and Stop You from Being the This pendant houses have security system... | House Robber | house-robber | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and **it will automatically contact the police if two adjacent houses were broken into... | null | Array,Dynamic Programming | Medium | 152,213,256,276,337,600,656,740,2262 |
337 | Hello friends, today's volume discussion list starts problem, Sarovar Part 3, before this I would like to request you all, please go to the house and the lesson and its very best auditorium is written, it is very good, I have seen its total in it before. In the question, teach us dynamic programming in the first place ... | House Robber III | house-robber-iii | The thief has found himself a new place for his thievery again. There is only one entrance to this area, called `root`.
Besides the `root`, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will automatically contact the police if ... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Medium | 198,213 |
332 | lead code problem number 332 reconstruct itinary so this problem gives us a list of Aline tickets where each tickets represent the from and to of each destination all right so the goal is to reconstruct the itinary in order and we have to return as a vector so here it says that all the tickets we are starting from JFK ... | 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 |
198 | all right this leap code question is called house Robert it says you're a professional robber planning to rob houses along a street each house has a certain amount of money stashed the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automaticall... | House Robber | house-robber | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and **it will automatically contact the police if two adjacent houses were broken into... | null | Array,Dynamic Programming | Medium | 152,213,256,276,337,600,656,740,2262 |
219 | 21st of October lead Cod Challenge I know I'm a lot late but solving a question is more important I hope most of my subscribers would be able to solve this question by themselves if you are new to coding decoded then I'm there to help you and this video specifically for those who are new to the channel the problem says... | 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,044 | hey what's up guys this is sean here so today decode number 1044 longest duplicate substring okay so you're given like a string s right and then you need to consider all the duplicated substrings okay so substrings is a string that occurs two or more times and the currencies may overlap right and then return any duplic... | Longest Duplicate Substring | find-common-characters | Given a string `s`, consider all _duplicated substrings_: (contiguous) substrings of s that occur 2 or more times. The occurrences may overlap.
Return **any** duplicated substring that has the longest possible length. If `s` does not have a duplicated substring, the answer is `" "`.
**Example 1:**
**Input:** s = "ba... | null | Array,Hash Table,String | Easy | 350 |
19 | That Everyone Welcome Back To Channel Iodine Extremely Well Software Ko Install Ki Problem Remove The Notification Playlist Adhik Problem Seat Vriddhi How To Play List Any To Remove The Office And Dealing Christ And After That You Can Read In The Head Of The Link List Na 512 Considered in this least for this meanwhile ... | Remove Nth Node From End of List | remove-nth-node-from-end-of-list | Given the `head` of a linked list, remove the `nth` node from the end of the list and return its head.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], n = 2
**Output:** \[1,2,3,5\]
**Example 2:**
**Input:** head = \[1\], n = 1
**Output:** \[\]
**Example 3:**
**Input:** head = \[1,2\], n = 1
**Output:** \[1\]
**C... | Maintain two pointers and update one with a delay of n steps. | Linked List,Two Pointers | Medium | 528,1618,2216 |
1,191 | So in hyperacidity, we will question that international, this question is rich that in the dance album, correction had been done in the last few times, what happens in dancer, you get this BC difficult has to be told all those whose sub is maximum, whose battery is It is morning, its inches are about 1020 in it, all of... | K-Concatenation Maximum Sum | synonymous-sentences | Given an integer array `arr` and an integer `k`, modify the array by repeating it `k` times.
For example, if `arr = [1, 2]` and `k = 3` then the modified array will be `[1, 2, 1, 2, 1, 2]`.
Return the maximum sub-array sum in the modified array. Note that the length of the sub-array can be `0` and its sum in that cas... | Find all synonymous groups of words. Use union-find data structure. By backtracking, generate all possible statements. | Array,Hash Table,String,Backtracking,Union Find | Medium | null |
792 | hey there today i will solve one of the problem online number of matching subsequences so this is medium level problem and the problem statement says so you will be given a string and the array of words and you need to find how many matching subsequence can be formed okay from this input abcde you can see a can be form... | Number of Matching Subsequences | binary-search | Given a string `s` and an array of strings `words`, return _the number of_ `words[i]` _that is a subsequence of_ `s`.
A **subsequence** of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.
* For exa... | null | Array,Binary Search | Easy | 786 |
380 | hey guys how's everything going this is jayster who is not good at organs in this video i'm going to take a look at number 380 insert deleted get random one we need to design data structure that supports all of following operations in average constant time so insert an item valve to see if it's not already if not alrea... | 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 |
151 | hello guys myself amrita welcome back to our channel tecnosage so in today's video we are going to discuss late 4 problem number 151 that is reverse words in a string so let's get started it is one of the very important interval question let's first understand the problem given an input string s reverse the order of th... | Reverse Words in a String | reverse-words-in-a-string | Given an input string `s`, reverse the order of the **words**.
A **word** is defined as a sequence of non-space characters. The **words** in `s` will be separated by at least one space.
Return _a string of the words in reverse order concatenated by a single space._
**Note** that `s` may contain leading or trailing s... | null | Two Pointers,String | Medium | 186 |
409 | Sitting Comeback Mein Jam Lagna Aam Baat Gandhari Leadership Quality Education Video 2009 Subscribe to this video channel Subscribe to my channel Must subscribe Subscribe for latest videos Subscribe to my device Food Build a gallant from its characters Viradari How long Radhe- Radhe- Radhe- Radhe Remove from Last 9 sub... | Longest Palindrome | longest-palindrome | Given a string `s` which consists of lowercase or uppercase letters, return _the length of the **longest palindrome**_ that can be built with those letters.
Letters are **case sensitive**, for example, `"Aa "` is not considered a palindrome here.
**Example 1:**
**Input:** s = "abccccdd "
**Output:** 7
**Explanation... | null | Hash Table,String,Greedy | Easy | 266,2237 |
491 | Hello friends in this video I will be discussing about lead code problem number 491 non-decreasing subsequence number 491 non-decreasing subsequence number 491 non-decreasing subsequence first of all what is the sub segment a subsequence can be formed by deleting one or more elements of the given array so for this exam... | Non-decreasing Subsequences | increasing-subsequences | Given an integer array `nums`, return _all the different possible non-decreasing subsequences of the given array with at least two elements_. You may return the answer in **any order**.
**Example 1:**
**Input:** nums = \[4,6,7,7\]
**Output:** \[\[4,6\],\[4,6,7\],\[4,6,7,7\],\[4,7\],\[4,7,7\],\[6,7\],\[6,7,7\],\[7,7\]... | null | Array,Hash Table,Backtracking,Bit Manipulation | Medium | 646 |
958 | welcome back to the cracking fan youtube channel today we're going to be solving lead code problem 958 check completeness of a binary tree before we get into it you guys know the drill please subscribe to the channel it really helps me grow all right let's read the question prompt given the root of a binary tree determ... | Check Completeness of a Binary Tree | sort-array-by-parity-ii | Given the `root` of a binary tree, determine if it is a _complete binary tree_.
In a **[complete binary tree](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between ... | null | Array,Two Pointers,Sorting | Easy | 2271,2283,2327 |
1,008 | hello everyone welcome to date hunting of october lead code challenge and in case system design interviews give you nightmares here's the solution for you recently today itself i published a new video based on scaling for dummies i challenge even a student studying in class 10th will be able to understand the concept o... | Construct Binary Search Tree from Preorder Traversal | binary-tree-cameras | Given an array of integers preorder, which represents the **preorder traversal** of a BST (i.e., **binary search tree**), construct the tree and return _its root_.
It is **guaranteed** that there is always possible to find a binary search tree with the given requirements for the given test cases.
A **binary search tr... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Hard | 1021 |
495 | hello everyone welcome to my channel today we'll solve lead code problem number 495 it's demo attacking the problem statement is given in lol world there is a hero called timo and his attacking can make his enemy ash be in poisoned condition now given the team was attacking ascending time series towards ash and the poi... | Teemo Attacking | teemo-attacking | Our hero Teemo is attacking an enemy Ashe with poison attacks! When Teemo attacks Ashe, Ashe gets poisoned for a exactly `duration` seconds. More formally, an attack at second `t` will mean Ashe is poisoned during the **inclusive** time interval `[t, t + duration - 1]`. If Teemo attacks again **before** the poison effe... | null | Array,Simulation | Easy | 56,605,649 |
203 | hello welcome to my channel i'm here to do my 100 lego challenge okay and today we have leeco 203 remove linked list element so we remove all the elements from the linked list of integers that have the value val so the example in here is input of linked list one two six three four five six and we remove all the element... | 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 |
220 | Solution of Welcome to Learn Search Repeat Today Will Be Looking Date of Chapter Complete Challenge Clarification Quick Question Exam Final Stupid Free That Under Government Teachers Are Not Well as of Distant Places of Interest Difference Between the Namo Speed Decision Interest Difference Between the Namo Speed D... | Contains Duplicate III | contains-duplicate-iii | You are given an integer array `nums` and two integers `indexDiff` and `valueDiff`.
Find a pair of indices `(i, j)` such that:
* `i != j`,
* `abs(i - j) <= indexDiff`.
* `abs(nums[i] - nums[j]) <= valueDiff`, and
Return `true` _if such pair exists or_ `false` _otherwise_.
**Example 1:**
**Input:** nums = \[1... | Time complexity O(n logk) - This will give an indication that sorting is involved for k elements. Use already existing state to evaluate next state - Like, a set of k sorted numbers are only needed to be tracked. When we are processing the next number in array, then we can utilize the existing sorted state and it is... | Array,Sliding Window,Sorting,Bucket Sort,Ordered Set | Medium | 217,219 |
1,838 | today we are solving frequency of the most frequent element this problem statement is not straightforward let's try to break it down the frequency of an element is the number of time it occurs in an array you're given an integer array nums and an integer K in one operation we can choose any element in nums and incremen... | 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 |
1,642 | hi guys this is khushboo and welcome to algorithms made easy in this video we'll see the question farthest building you can reach you are given an integer array heights representing the height of building some bricks and some ladders you start your journey from building zero and move towards the next building by possib... | Furthest Building You Can Reach | water-bottles | You are given an integer array `heights` representing the heights of buildings, some `bricks`, and some `ladders`.
You start your journey from building `0` and move to the next building by possibly using bricks or ladders.
While moving from building `i` to building `i+1` (**0-indexed**),
* If the current building'... | Simulate the process until there are not enough empty bottles for even one full bottle of water. | Math,Simulation | Easy | null |
528 | in this video we're going to be looking at this problem random pick with weight we're given an array of integers w where w i is the weight of the ith index so we need to implement the function pick index which randomly picks an index i and the probability of picking i is w i over sum w which is the sum of all the eleme... | Random Pick with Weight | swapping-nodes-in-a-linked-list | You are given a **0-indexed** array of positive integers `w` where `w[i]` describes the **weight** of the `ith` index.
You need to implement the function `pickIndex()`, which **randomly** picks an index in the range `[0, w.length - 1]` (**inclusive**) and returns it. The **probability** of picking an index `i` is `w[i... | We can transform the linked list to an array this should ease things up After transforming the linked list to an array it becomes as easy as swapping two integers in an array then rebuilding the linked list | Linked List,Two Pointers | Medium | 19,24,25 |
106 | in this video we're going to take a look at a legal problem called construct binary tree from inorder and post order traversal so on my channel i did uh i recently did a legal problem called 105 which is construct binder tree from in order and pre-order traversal so if you haven't pre-order traversal so if you haven't ... | 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 |
190 | yeah under there let's talk about today's li coding challenge question it is called reverse bits so we have a 32-bit unsigned integer and we want to 32-bit unsigned integer and we want to 32-bit unsigned integer and we want to write a function to reverse the bits so if we go about and write out to the binary representa... | Reverse Bits | reverse-bits | Reverse bits of a given 32 bits unsigned integer.
**Note:**
* Note that in some languages, such as Java, there is no unsigned integer type. In this case, both input and output will be given as a signed integer type. They should not affect your implementation, as the integer's internal binary representation is the s... | null | Divide and Conquer,Bit Manipulation | Easy | 7,191,2238 |
938 | Hello Hi Everyone Welcome To My Channel It's All The Problem Ransomware Steve Root Mode Of - Return Form After Values Of Node The - Return Form After Values Of Node The - Return Form After Values Of Node The Value Hindi Range Low To High Including Low And High So Give It A Tree And Law And These 715 So Will Check... | Range Sum of BST | numbers-at-most-n-given-digit-set | Given the `root` node of a binary search tree and two integers `low` and `high`, return _the sum of values of all nodes with a value in the **inclusive** range_ `[low, high]`.
**Example 1:**
**Input:** root = \[10,5,15,3,7,null,18\], low = 7, high = 15
**Output:** 32
**Explanation:** Nodes 7, 10, and 15 are in the ra... | null | Array,Math,Binary Search,Dynamic Programming | Hard | null |
575 | hi everyone let's solve the problem distribute candies so alice has hand candies where the ith candy is of type candy type i alice noticed that she started to gain weight so she visited a doctor the doctor has write alice to only eat ny2 of the candies she has and is always even and alice likes her candies very much an... | Distribute Candies | distribute-candies | Alice has `n` candies, where the `ith` candy is of type `candyType[i]`. Alice noticed that she started to gain weight, so she visited a doctor.
The doctor advised Alice to only eat `n / 2` of the candies she has (`n` is always even). Alice likes her candies very much, and she wants to eat the maximum number of differe... | To maximize the number of kinds of candies, we should try to distribute candies such that sister will gain all kinds. What is the upper limit of the number of kinds of candies sister will gain? Remember candies are to distributed equally. Which data structure is the most suitable for finding the number of kinds of cand... | Array,Hash Table | Easy | null |
1,227 | hey everybody this is Larry this is me trying to do a random prom that haven't done before an algo prom anyway maybe one day I'll crch out but uh but yeah let's do an RNG one let's see we have 1227 airplane seat assignment probability another problem with there's a lot of negative downloads but uh yeah I hope everyone'... | Airplane Seat Assignment Probability | number-of-equivalent-domino-pairs | `n` passengers board an airplane with exactly `n` seats. The first passenger has lost the ticket and picks a seat randomly. But after that, the rest of the passengers will:
* Take their own seat if it is still available, and
* Pick other seats randomly when they find their seat occupied
Return _the probability th... | For each domino j, find the number of dominoes you've already seen (dominoes i with i < j) that are equivalent. You can keep track of what you've seen using a hashmap. | Array,Hash Table,Counting | Easy | null |
970 | Yes, hello. I am a developer child. I understand the ring. The problem to be solved today is called 907, a powerful integer in 10 minutes. In it, two positive numbers x and y are given with a strong score. Integers are powerful. For example, the child of x. Squared plus and this j squared is now a strong integer. So th... | Powerful Integers | powerful-integers | Given three integers `x`, `y`, and `bound`, return _a list of all the **powerful integers** that have a value less than or equal to_ `bound`.
An integer is **powerful** if it can be represented as `xi + yj` for some integers `i >= 0` and `j >= 0`.
You may return the answer in **any order**. In your answer, each value... | null | null | Medium | null |
203 | We all should prepare for it, but at the same time, if you have some good impressive resume in your resume, then your chances of getting shortlisted in the make a list increases a lot. Okay, that's why its development schemes like this platform code me. Reaching the office, this video, where very good programs are avai... | 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 |
934 | everyone welcome back and let's write some more neat code today so today let's solve the problem shortest bridge we're given an n by n matrix so that's a square matrix and one is going to represent land and zero is going to represent water an island in this case is a four directionally connected group of ones that's ki... | Shortest Bridge | bitwise-ors-of-subarrays | You are given an `n x n` binary matrix `grid` where `1` represents land and `0` represents water.
An **island** is a 4-directionally connected group of `1`'s not connected to any other `1`'s. There are **exactly two islands** in `grid`.
You may change `0`'s to `1`'s to connect the two islands to form **one island**.
... | null | Array,Dynamic Programming,Bit Manipulation | Medium | null |
60 | Hello Guys Welcome To Present Time Disney Today We Will Go Through The Ghanti Problem Competition Sequence Please Like This Video Fuel forget to subscribe our Channel Surya Never Miss Any Update Reset 120 Contains A Total Of Industrial Unit Politicians Belt Including All Politicians In Order To Avoid Falling Sequence f... | Permutation Sequence | permutation-sequence | The set `[1, 2, 3, ..., n]` contains a total of `n!` unique permutations.
By listing and labeling all of the permutations in order, we get the following sequence for `n = 3`:
1. `"123 "`
2. `"132 "`
3. `"213 "`
4. `"231 "`
5. `"312 "`
6. `"321 "`
Given `n` and `k`, return the `kth` permutation sequence.
**Exa... | null | Math,Recursion | Hard | 31,46 |
1,358 | so for this problem and you can see here we have the string and then the one to um us to calculate on the substring it contains occurrence of ibc so ibc here is a one car so ibci also need to be cut and this one also need to be count so as explanation we can have this ibc ibci ipcib and this one also besides that we al... | Number of Substrings Containing All Three Characters | find-positive-integer-solution-for-a-given-equation | Given a string `s` consisting only of characters _a_, _b_ and _c_.
Return the number of substrings containing **at least** one occurrence of all these characters _a_, _b_ and _c_.
**Example 1:**
**Input:** s = "abcabc "
**Output:** 10
**Explanation:** The substrings containing at least one occurrence of the charact... | Loop over 1 ≤ x,y ≤ 1000 and check if f(x,y) == z. | Math,Two Pointers,Binary Search,Interactive | Medium | null |
240 | IT IS PREGNANT QUESTION 247 STUDIO MATRIX PART 2 ASS UP SID QUESTION AND RELEASE subscribe to subscribe Video subscribe de villiers and du preez and roelof van lutta du subscribe my channel question half like this much better and much more brave subscribe button more problem ka Solution Take 101 Valid Today I Am Are Su... | 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 |
522 | hello everyone welcome to day 27 of august lead to challenge today's question is longest uncommon subsequence second in this question we are given an array of strings and we need to tell that particular string which happens to be the longest uncommon subsequence of all the other strings that are there in the input arra... | Longest Uncommon Subsequence II | longest-uncommon-subsequence-ii | Given an array of strings `strs`, return _the length of the **longest uncommon subsequence** between them_. If the longest uncommon subsequence does not exist, return `-1`.
An **uncommon subsequence** between an array of strings is a string that is a **subsequence of one string but not the others**.
A **subsequence**... | null | Array,Hash Table,Two Pointers,String,Sorting | Medium | 521 |
371 | hey guys it's offline one here and today we're going to be solving some of two integers so in this problem we're given two integers A and B and they want us to return the sum of the two integers but we cannot use the plus or minus signs so all you have to do is return sum of a and b and that's pretty much it the video ... | Sum of Two Integers | sum-of-two-integers | Given two integers `a` and `b`, return _the sum of the two integers without using the operators_ `+` _and_ `-`.
**Example 1:**
**Input:** a = 1, b = 2
**Output:** 3
**Example 2:**
**Input:** a = 2, b = 3
**Output:** 5
**Constraints:**
* `-1000 <= a, b <= 1000` | null | Math,Bit Manipulation | Medium | 2 |
928 | That A This is the next question Minimize Malviya Road Two We had spread Malviya that if you haven't seen this video, then some story that we have to network represented in the matrix where if you go as quickly as possible between these two If infection and do both means one of the notes is infected with the other and ... | Minimize Malware Spread II | surface-area-of-3d-shapes | You are given a network of `n` nodes represented as an `n x n` adjacency matrix `graph`, where the `ith` node is directly connected to the `jth` node if `graph[i][j] == 1`.
Some nodes `initial` are initially infected by malware. Whenever two nodes are directly connected, and at least one of those two nodes is infected... | null | Array,Math,Geometry,Matrix | Easy | null |
306 | in this problem we will check whether a given number is additive or not and you will be given a number in the form of a string so it will have digits from 0 to 9 and the definition of additive number is that the previous two numbers it can be one digit two digit or more digits so you should group this given string into... | Additive Number | additive-number | An **additive number** is a string whose digits can form an **additive sequence**.
A valid **additive sequence** should contain **at least** three numbers. Except for the first two numbers, each subsequent number in the sequence must be the sum of the preceding two.
Given a string containing only digits, return `true... | null | String,Backtracking | Medium | 872 |
930 | hello everyone I am Ali and I welcome you all to code with me one question a day and today's you code problem is binary subarrays with some so uh in this problem we are given a binary array numbes and we have to find all the subarrays whose sum is equal to the integer goal okay so now let's look at the example as you c... | Binary Subarrays With Sum | all-possible-full-binary-trees | Given a binary array `nums` and an integer `goal`, return _the number of non-empty **subarrays** with a sum_ `goal`.
A **subarray** is a contiguous part of the array.
**Example 1:**
**Input:** nums = \[1,0,1,0,1\], goal = 2
**Output:** 4
**Explanation:** The 4 subarrays are bolded and underlined below:
\[**1,0,1**,0... | null | Dynamic Programming,Tree,Recursion,Memoization,Binary Tree | Medium | null |
787 | hey hello there today's liquid in challenge question is called the chiefest of lights with encase stops so it's quite a nice department it's a quite real life for relatable and it also has a lot of different ways of solving this problem so yeah I'm going to talk about two solutions yeah let's see the problem we have so... | Cheapest Flights Within K Stops | sliding-puzzle | There are `n` cities connected by some number of flights. You are given an array `flights` where `flights[i] = [fromi, toi, pricei]` indicates that there is a flight from city `fromi` to city `toi` with cost `pricei`.
You are also given three integers `src`, `dst`, and `k`, return _**the cheapest price** from_ `src` _... | Perform a breadth-first-search, where the nodes are the puzzle boards and edges are if two puzzle boards can be transformed into one another with one move. | Array,Breadth-First Search,Matrix | Hard | null |
1,860 | 1860 incremental memory leak yeah so for this problem this is a simulation problem we have to understand the question otherwise we cannot solve it so the problem is that we are giving memory one and memory two representing the available memory in base yeah if we see something like base maybe we are confused is that bin... | Incremental Memory Leak | find-kth-largest-xor-coordinate-value | You are given two integers `memory1` and `memory2` representing the available memory in bits on two memory sticks. There is currently a faulty program running that consumes an increasing amount of memory every second.
At the `ith` second (starting from 1), `i` bits of memory are allocated to the stick with **more avai... | Use a 2D prefix sum to precalculate the xor-sum of the upper left submatrix. | Array,Divide and Conquer,Bit Manipulation,Heap (Priority Queue),Matrix,Prefix Sum,Quickselect | Medium | null |
1,354 | hello everyone welcome to coding decoded my name is sanchez i'm working as technical architect sd4 at adobe and here i present day 24th of june lead code challenge the problem that we have in today's construct target array with multiple sum it's a hard level question on lead good however all the subscribers of coding d... | Construct Target Array With Multiple Sums | find-players-with-zero-or-one-losses | You are given an array `target` of n integers. From a starting array `arr` consisting of `n` 1's, you may perform the following procedure :
* let `x` be the sum of all elements currently in your array.
* choose index `i`, such that `0 <= i < n` and set the value of `arr` at index `i` to `x`.
* You may repeat thi... | Count the number of times a player loses while iterating through the matches. | Array,Hash Table,Sorting,Counting | Medium | 236 |
1,027 | hello guys let's solve a long list arithmetic subsequence today so in this question we are given an array nums containing integers and we need to return the length of the longest arithmetic subsequence so what is an arithmetic subsequence so uh an alphabetic sequence is basically a sequence of numbers where the differe... | Longest Arithmetic Subsequence | sum-of-even-numbers-after-queries | Given an array `nums` of integers, return _the length of the longest arithmetic subsequence in_ `nums`.
**Note** that:
* A **subsequence** is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.
* A sequence `seq` is arithmetic if `s... | null | Array,Simulation | Medium | null |
1,870 | friends today I'm going to solve liquid problem number 1870 minimum speed to arrive on time so here we are given a floating Point number hour which represents the amount of time you have to reach office okay so which means that we are going to office and to commute to office you must take and trains in sequential order... | Minimum Speed to Arrive on Time | minimum-speed-to-arrive-on-time | You are given a floating-point number `hour`, representing the amount of time you have to reach the office. To commute to the office, you must take `n` trains in sequential order. You are also given an integer array `dist` of length `n`, where `dist[i]` describes the distance (in kilometers) of the `ith` train ride.
E... | null | null | Medium | null |
1,100 | so we have this question find k length of string with no repeated characters and what it actually means is uh we are provided with the string okay this is the string and we are provided with a number for example here k with integer basically and we have to find non-repeating string non-repeating means non-repeating str... | Find K-Length Substrings With No Repeated Characters | connecting-cities-with-minimum-cost | Given a string `s` and an integer `k`, return _the number of substrings in_ `s` _of length_ `k` _with no repeated characters_.
**Example 1:**
**Input:** s = "havefunonleetcode ", k = 5
**Output:** 6
**Explanation:** There are 6 substrings they are: 'havef','avefu','vefun','efuno','etcod','tcode'.
**Example 2:**
**... | What if we model the cities as a graph? Build a graph of cities and find the minimum spanning tree. You can use a variation of the Kruskal's algorithm for that. Sort the edges by their cost and use a union-find data structure. How to check all cities are connected? At the beginning we have n connected components, each ... | Union Find,Graph,Heap (Priority Queue),Minimum Spanning Tree | Medium | 2230 |
1,897 | Hello friends, welcome, today is our day 50 in the TKO challenge, so let's start the question of today on the screen. Okay, so what is today's question saying? Let's understand today's question number, which is 187 A Question. The name of this is ' Question. The name of this is ' Question. The name of this is ' Distrib... | Redistribute Characters to Make All Strings Equal | maximize-palindrome-length-from-subsequences | You are given an array of strings `words` (**0-indexed**).
In one operation, pick two **distinct** indices `i` and `j`, where `words[i]` is a non-empty string, and move **any** character from `words[i]` to **any** position in `words[j]`.
Return `true` _if you can make **every** string in_ `words` _**equal** using **a... | Let's ignore the non-empty subsequence constraint. We can concatenate the two strings and find the largest palindromic subsequence with dynamic programming. Iterate through every pair of characters word1[i] and word2[j], and see if some palindrome begins with word1[i] and ends with word2[j]. This ensures that the subse... | String,Dynamic Programming | Hard | 516 |
1,658 | Hello hello guys welcome back two years in this video will see the maximum operations to reduce and giver number This is the future of the number of Subscribe Otherwise possible to return - 1929 Subscribe Which - 1929 Subscribe Which - 1929 Subscribe Which is the giver 9 We want to reduce this Are the country elements ... | Minimum Operations to Reduce X to Zero | minimum-swaps-to-arrange-a-binary-grid | You are given an integer array `nums` and an integer `x`. In one operation, you can either remove the leftmost or the rightmost element from the array `nums` and subtract its value from `x`. Note that this **modifies** the array for future operations.
Return _the **minimum number** of operations to reduce_ `x` _to **e... | For each row of the grid calculate the most right 1 in the grid in the array maxRight. To check if there exist answer, sort maxRight and check if maxRight[i] ≤ i for all possible i's. If there exist an answer, simulate the swaps. | Array,Greedy,Matrix | Medium | null |
1 | hello welcome guys in this particular episode we're gonna go over a solution for LICO problem number one so the problem is given an array of integers return the indices of two numbers that add up to a specific target where target is a particular number right so for instance there's an example here but before we get int... | Two Sum | two-sum | Given an array of integers `nums` and an integer `target`, return _indices of the two numbers such that they add up to `target`_.
You may assume that each input would have **_exactly_ one solution**, and you may not use the _same_ element twice.
You can return the answer in any order.
**Example 1:**
**Input:** nums... | A really brute force way would be to search for all possible pairs of numbers but that would be too slow. Again, it's best to try out brute force solutions for just for completeness. It is from these brute force solutions that you can come up with optimizations. So, if we fix one of the numbers, say x, we have to scan ... | Array,Hash Table | Easy | 15,18,167,170,560,653,1083,1798,1830,2116,2133,2320 |
231 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem power of two we're given an integer n we want to return true if it's a power of two otherwise we want to return false and a power of two is just basically two raised to any power and so two to the power of zero by the w... | Power of Two | power-of-two | Given an integer `n`, return _`true` if it is a power of two. Otherwise, return `false`_.
An integer `n` is a power of two, if there exists an integer `x` such that `n == 2x`.
**Example 1:**
**Input:** n = 1
**Output:** true
**Explanation:** 20 = 1
**Example 2:**
**Input:** n = 16
**Output:** true
**Explanation:**... | null | Math,Bit Manipulation,Recursion | Easy | 191,326,342 |
77 | um hello so today we are going to do this problem which is part of let's go daily challenge combinations so we get n and K in order to return all possible combinations of K numbers that we choose from the range one to n and this answer we can return it in any order so it doesn't have to be it is specific order so if we... | Combinations | combinations | Given two integers `n` and `k`, return _all possible combinations of_ `k` _numbers chosen from the range_ `[1, n]`.
You may return the answer in **any order**.
**Example 1:**
**Input:** n = 4, k = 2
**Output:** \[\[1,2\],\[1,3\],\[1,4\],\[2,3\],\[2,4\],\[3,4\]\]
**Explanation:** There are 4 choose 2 = 6 total combin... | null | Backtracking | Medium | 39,46 |
501 | hello this is fine mode in PST so you're giving a tree no and then you want to return all the frequently word uh frequently number uh in the answer so there are two kind of Solution One is using the H first space the other one doesn't so I can basically Traverse the entire tree and then store into the map and then keep... | Find Mode in Binary Search Tree | find-mode-in-binary-search-tree | Given the `root` of a binary search tree (BST) with duplicates, return _all the [mode(s)](https://en.wikipedia.org/wiki/Mode_(statistics)) (i.e., the most frequently occurred element) in it_.
If the tree has more than one mode, return them in **any order**.
Assume a BST is defined as follows:
* The left subtree of... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | 98 |
1,035 | hello there so today's liquid in challenge question it's called uncross the lines it's pretty much a similar to the pretty much the same question as the very classic longest common subsequence question which is a DP question and yeah so let's look at the discussion we have to sequence of integer numbers a and B we want... | 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 |
34 | Hai Hello Guys Welcome Gautam Samay DEC - Rajat Hai Hello Guys Welcome Gautam Samay DEC - Rajat Hai Hello Guys Welcome Gautam Samay DEC - Rajat And Will Be Discussing Subscribe Element In This Question Appointed On Thursday - Verb - Provident Fund Straight Appointed On Thursday - Verb - Provident Fund Straight Appointe... | 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 |
240 | hi guys welcome to algorithms made easy in this video we will see the question search in a 2d matrix part 2. as you can see there are many likes on this question and so this is one of the most liked questions from lead code so let's just go ahead and see what this question means and how to solve this particular problem... | 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 |
258 | hey this is tover with a lonely Dash and today we're going over leap code question 258 add digits which says given an integer num repeatedly add all its digits until the result has only one digit and return it for example if you're given a number 38 we know that the output is going to be 2 because 3 + the output is goi... | Add Digits | add-digits | Given an integer `num`, repeatedly add all its digits until the result has only one digit, and return it.
**Example 1:**
**Input:** num = 38
**Output:** 2
**Explanation:** The process is
38 --> 3 + 8 --> 11
11 --> 1 + 1 --> 2
Since 2 has only one digit, return it.
**Example 2:**
**Input:** num = 0
**Output:** 0
*... | A naive implementation of the above process is trivial. Could you come up with other methods? What are all the possible results? How do they occur, periodically or randomly? You may find this Wikipedia article useful. | Math,Simulation,Number Theory | Easy | 202,1082,2076,2264 |
208 | today we are going to solve a design problem so we need to create a try data structure which is going to support functionality such as fast retrieval that is searching fast insertion and searching on the base of prefix so let's look for our problem statement a try or prefix tree is a tree data structure used to efficie... | Implement Trie (Prefix Tree) | implement-trie-prefix-tree | A [**trie**](https://en.wikipedia.org/wiki/Trie) (pronounced as "try ") or **prefix tree** is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker.
Implement the Trie class:
* `Trie()` ... | null | Hash Table,String,Design,Trie | Medium | 211,642,648,676,1433,1949 |
139 | hello welcome back to my Channel today we are going to solve this code problem 139 word break so we are giving ours string and then we also have a word date so the string for example this one is lead code and word depth is lead and code with responder tag if this is 3 can be combined by any element inside the word dete... | Word Break | word-break | Given a string `s` and a dictionary of strings `wordDict`, return `true` if `s` can be segmented into a space-separated sequence of one or more dictionary words.
**Note** that the same word in the dictionary may be reused multiple times in the segmentation.
**Example 1:**
**Input:** s = "leetcode ", wordDict = \[ "... | null | Hash Table,String,Dynamic Programming,Trie,Memoization | Medium | 140 |
453 | hello everyone welcome back to my channel so today we'll be solving the question number one two three one minimum moves to equal array elements so if you can see like given a non-empty so if you can see like given a non-empty so if you can see like given a non-empty integer out of size n find the minimum number of move... | Minimum Moves to Equal Array Elements | minimum-moves-to-equal-array-elements | Given an integer array `nums` of size `n`, return _the minimum number of moves required to make all array elements equal_.
In one move, you can increment `n - 1` elements of the array by `1`.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** 3
**Explanation:** Only three moves are needed (remember each move inc... | null | Array,Math | Medium | 462,2263,2273 |
58 | Jai Hind In This Video Let's All Unite Problem Number-15 It Laptop Last Word Problem Number-15 It Laptop Last Word Problem Number-15 It Laptop Last Word Physical Activity Problem Electronic Bulb Scalp Early Scheduled Tribes And Empty Space Character Loot Subscribe To Me Amla Ke Beech Kewal And Take Off But This World I... | Length of Last Word | length-of-last-word | Given a string `s` consisting of words and spaces, return _the length of the **last** word in the string._
A **word** is a maximal substring consisting of non-space characters only.
**Example 1:**
**Input:** s = "Hello World "
**Output:** 5
**Explanation:** The last word is "World " with length 5.
**Example 2:**
... | null | String | Easy | null |
314 | okay so today we are looking at two tree traversal question one is 714 binary tree vertical order traversal the other one that's 987 vertical order traversal of a binary tree they are pretty much the same question just looking at the title you can know that just move the binary tree from the end towards the beginning y... | Binary Tree Vertical Order Traversal | binary-tree-vertical-order-traversal | Given the `root` of a binary tree, return _**the vertical order traversal** of its nodes' values_. (i.e., from top to bottom, column by column).
If two nodes are in the same row and column, the order should be from **left to right**.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[9\],\[3,... | null | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 102 |
1,608 | Hello friends, this is a question, isn't that special? Are with There are the same numbers, there should be more butter on my plate, as if people have done their test 395, so what is happening here, what we are doing here is that we have to tell that first of all we have to tell that number Tell me, after this, tell me... | Special Array With X Elements Greater Than or Equal X | calculate-salaries | You are given an array `nums` of non-negative integers. `nums` is considered **special** if there exists a number `x` such that there are **exactly** `x` numbers in `nums` that are **greater than or equal to** `x`.
Notice that `x` **does not** have to be an element in `nums`.
Return `x` _if the array is **special**, ... | null | Database | Medium | null |
207 | the other there so today's li coding challenge crusting is called causes schedule we have a total of n courses we need to take and they are labeled from 0 to n minus 1 some courses may have some prerequisites meaning that we have to first take certain cost before we can take some other courses so like you know first I ... | Course Schedule | course-schedule | There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`.
* For example, the pair `[0, 1]`, indicates that to take cou... | This problem is equivalent to finding if a cycle exists in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topologica... | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 210,261,310,630 |
1,220 | Hello everyone welcome to my channel Quote Sorry with Mike So today we are going to do video number 73 of our dynamic spring playlist. Do n't worry question will not be explained directly from DP, it will be explained from the very basic core and after that you will understand yourself why this DP. Okay, so the lead co... | Count Vowels Permutation | smallest-sufficient-team | Given an integer `n`, your task is to count how many strings of length `n` can be formed under the following rules:
* Each character is a lower case vowel (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`)
* Each vowel `'a'` may only be followed by an `'e'`.
* Each vowel `'e'` may only be followed by an `'a'` or an `'i'`.
* ... | Do a bitmask DP. For each person, for each set of skills, we can update our understanding of a minimum set of people needed to perform this set of skills. | Array,Dynamic Programming,Bit Manipulation,Bitmask | Hard | 2105,2114 |
383 | hey everyone welcome back and today we'll be doing another lead code 383 ransom not an easy one given two strings ransom note and magazine return true if the ransom note can be constructed by using the letters from the magazine and false otherwise so the magazine should have all the letters from the ransom note so we'l... | Ransom Note | ransom-note | Given two strings `ransomNote` and `magazine`, return `true` _if_ `ransomNote` _can be constructed by using the letters from_ `magazine` _and_ `false` _otherwise_.
Each letter in `magazine` can only be used once in `ransomNote`.
**Example 1:**
**Input:** ransomNote = "a", magazine = "b"
**Output:** false
**Example ... | null | Hash Table,String,Counting | Easy | 691 |
473 | hey what's up guys uh this is sean here so today uh today's daily challenge problem uh number 473 match sticks to square okay so given like an integer array a matchsticks where uh each element is the length of that a matchstick and we want to use all the matchsticks to make a square okay and so there are some rules bas... | Matchsticks to Square | matchsticks-to-square | You are given an integer array `matchsticks` where `matchsticks[i]` is the length of the `ith` matchstick. You want to use **all the matchsticks** to make one square. You **should not break** any stick, but you can link them up, and each matchstick must be used **exactly one time**.
Return `true` if you can make this ... | Treat the matchsticks as an array. Can we split the array into 4 equal halves? Every matchstick can belong to either of the 4 sides. We don't know which one. Maybe try out all options! For every matchstick, we have to try out each of the 4 options i.e. which side it can belong to. We can make use of recursion for this.... | Array,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask | Medium | null |
1,672 | Work in this field Ajay Ko That [ That [ That Hello Everyone Welcome to New Video English Lutab School Number One Officer Appointed Centigrade Account Se Zee Amount of Money in More Return Customers Kashmir and Mandsaur Come Problem What Said That Youth Subscribe collection of means every day that how many will be the ... | Richest Customer Wealth | find-the-index-of-the-large-integer | You are given an `m x n` integer grid `accounts` where `accounts[i][j]` is the amount of money the `ith` customer has in the `jth` bank. Return _the **wealth** that the richest customer has._
A customer's **wealth** is the amount of money they have in all their bank accounts. The richest ... | Do a binary search over the array, exclude the half of the array that doesn't contain the largest number. Keep shrinking the search space till it reaches the size of 2 where you can easily determine which one has the largest integer. | Array,Binary Search,Interactive | Medium | 786 |
458 | Loot today we are looking at the former pick for rapid question number and take it from WhatsApp in eight categories because thinking in it is art. Let's see then how to do it. I am in this that we have some particular number kids in which the former made one above. From the bucket visioner and the rest is fine and I h... | 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 |
287 | High Enigma so let's for lead code 287 today satisfying the duplicate number okay so in this question we are given an array integer sums and it contains n plus 1 integer where each integer is in the range 1 to n okay and there is only one integer that is repeated that only one integer its occurrence can be more than on... | Find the Duplicate Number | find-the-duplicate-number | Given an array of integers `nums` containing `n + 1` integers where each integer is in the range `[1, n]` inclusive.
There is only **one repeated number** in `nums`, return _this repeated number_.
You must solve the problem **without** modifying the array `nums` and uses only constant extra space.
**Example 1:**
**... | null | Array,Two Pointers,Binary Search,Bit Manipulation | Medium | 41,136,142,268,645 |
1,657 | Hello everyone, so today we are going to do question number nine of our strings play list, the question number is liquid number 1657, medium level question, the name of the question is determine sir close ok so this question is good a little bit just mind you It will become clear to you that look at the input and outpu... | Determine if Two Strings Are Close | find-the-winner-of-an-array-game | Two strings are considered **close** if you can attain one from the other using the following operations:
* Operation 1: Swap any two **existing** characters.
* For example, `abcde -> aecdb`
* Operation 2: Transform **every** occurrence of one **existing** character into another **existing** character, and d... | If k ≥ arr.length return the max element of the array. If k < arr.length simulate the game until a number wins k consecutive games. | Array,Simulation | Medium | null |
373 | hello so today's question is a fine k-pass with smaller sums is a fine k-pass with smaller sums is a fine k-pass with smaller sums uh it's a medium level question we'll see what the question States we are given it uh two integer arrays numsual and nums two sorted in ascending order 180 k Define a pair UV which consists... | Find K Pairs with Smallest Sums | find-k-pairs-with-smallest-sums | You are given two integer arrays `nums1` and `nums2` sorted in **ascending order** and an integer `k`.
Define a pair `(u, v)` which consists of one element from the first array and one element from the second array.
Return _the_ `k` _pairs_ `(u1, v1), (u2, v2), ..., (uk, vk)` _with the smallest sums_.
**Example 1:**... | null | Array,Heap (Priority Queue) | Medium | 378,719,2150 |
1,657 | hello guys and welcome back to lead Logics this is the determine if two strings are closed problem from lead code this is a lead code medium and the number for this is 1657 so in the given problem we are given with two strings and uh we are given the definition of what a closed string is so two strings are considered c... | Determine if Two Strings Are Close | find-the-winner-of-an-array-game | Two strings are considered **close** if you can attain one from the other using the following operations:
* Operation 1: Swap any two **existing** characters.
* For example, `abcde -> aecdb`
* Operation 2: Transform **every** occurrence of one **existing** character into another **existing** character, and d... | If k ≥ arr.length return the max element of the array. If k < arr.length simulate the game until a number wins k consecutive games. | Array,Simulation | Medium | null |
976 | Largest parameter triangle so this question's vector is given and we have to return largest parameter of d triangle with non zero area and if it is impossible then you form other triangle of non zero area return zero ok so basically first what we have to do The largest parameter of D triangle of a triangle has to be fo... | Largest Perimeter Triangle | minimum-area-rectangle | Given an integer array `nums`, return _the largest perimeter of a triangle with a non-zero area, formed from three of these lengths_. If it is impossible to form any triangle of a non-zero area, return `0`.
**Example 1:**
**Input:** nums = \[2,1,2\]
**Output:** 5
**Explanation:** You can form a triangle with three si... | null | Array,Hash Table,Math,Geometry,Sorting | Medium | null |
791 | hey everybody this is Larry this is day 11 of the Le Cod daily challenge hit the like button prob my teeth hit the like button hit subscribe button join me on Discord let me know what you think about this F as soon as it loads today's f is 791 custom sword string so you get in two orders and unique okay uh return any p... | Custom Sort String | split-bst | You are given two strings order and s. All the characters of `order` are **unique** and were sorted in some custom order previously.
Permute the characters of `s` so that they match the order that `order` was sorted. More specifically, if a character `x` occurs before a character `y` in `order`, then `x` should occur ... | Use recursion. If root.val <= V, you split root.right into two halves, then join it's left half back on root.right. | Tree,Binary Search Tree,Recursion,Binary Tree | Medium | 450 |
109 | hello welcome to my channel coding together my name is vikas soja today we will see another lead code problem number 109 convert sorted list to binary search tree so let's see the problem statement we are given with a head of a singly linked list and where the elements are sorted in ascending order we have to convert i... | Convert Sorted List to Binary Search Tree | convert-sorted-list-to-binary-search-tree | Given the `head` of a singly linked list where elements are sorted in **ascending order**, convert _it to a_ **_height-balanced_** _binary search tree_.
**Example 1:**
**Input:** head = \[-10,-3,0,5,9\]
**Output:** \[0,-3,9,-10,null,5\]
**Explanation:** One possible answer is \[0,-3,9,-10,null,5\], which represents t... | null | Linked List,Divide and Conquer,Tree,Binary Search Tree,Binary Tree | Medium | 108,2306 |
1,171 | hey guys welcome back to my Channel today we'll solve the March 12th daily lead code problem it's a medium problem let's see the question is to remove zero some consecutive notes from the link list so given head of the link list we repeatedly direct consecutive sequence of notes that sum up to zero after doing so retur... | Remove Zero Sum Consecutive Nodes from Linked List | shortest-path-in-binary-matrix | Given the `head` of a linked list, we repeatedly delete consecutive sequences of nodes that sum to `0` until there are no such sequences.
After doing so, return the head of the final linked list. You may return any such answer.
(Note that in the examples below, all sequences are serializations of `ListNode` objects.)... | Do a breadth first search to find the shortest path. | Array,Breadth-First Search,Matrix | Medium | null |
1,090 | hey guys what's up this is steve today let's go through another legal problem largest values from labels let's take a look at the problem first we have a set of items the i item has value values i and labeled labels i so two arrays then we choose a subset s of these items such that s is less than or equal to num wanted... | Largest Values From Labels | armstrong-number | There is a set of `n` items. You are given two integer arrays `values` and `labels` where the value and the label of the `ith` element are `values[i]` and `labels[i]` respectively. You are also given two integers `numWanted` and `useLimit`.
Choose a subset `s` of the `n` elements such that:
* The size of the subset... | Check if the given k-digit number equals the sum of the k-th power of it's digits. How to compute the sum of the k-th power of the digits of a number ? Can you divide the number into digits using division and modulus operations ? You can find the least significant digit of a number by taking it modulus 10. And you can ... | Math | Easy | null |
1,921 | hi everyone let's solve the today's dat code challenge which is element maximum number of monsters that we can so in this problem we are uh given two integer array the first one is distance and second one is speed so uh let's say we are having n cities so let's draw the cities these are the n city cities from index 0 1... | Eliminate Maximum Number of Monsters | eliminate-maximum-number-of-monsters | You are playing a video game where you are defending your city from a group of `n` monsters. You are given a **0-indexed** integer array `dist` of size `n`, where `dist[i]` is the **initial distance** in kilometers of the `ith` monster from the city.
The monsters walk toward the city at a **constant** speed. The speed... | null | null | Medium | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.