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,502 | Hello Hi Everyone Welcome To My Channel Life Events Subscribe Please Subscribe My Channel And Solve The Problem Can Make Arithmetic Progression From Sequence Sudhir And Sequence Number Scotland Arithmetic Progression Difference Between Any Two Consecutive Element Is The Same Truth Can We Rearrange To From The Progressi... | Can Make Arithmetic Progression From Sequence | construct-k-palindrome-strings | A sequence of numbers is called an **arithmetic progression** if the difference between any two consecutive elements is the same.
Given an array of numbers `arr`, return `true` _if the array can be rearranged to form an **arithmetic progression**. Otherwise, return_ `false`.
**Example 1:**
**Input:** arr = \[3,5,1\]... | If the s.length < k we cannot construct k strings from s and answer is false. If the number of characters that have odd counts is > k then the minimum number of palindrome strings we can construct is > k and answer is false. Otherwise you can construct exactly k palindrome strings and answer is true (why ?). | Hash Table,String,Greedy,Counting | Medium | null |
227 | hey what's up guys in this video we're going to solve this problem basic calculator 2. we have to implement a basic calculator to evaluate a simple expression string the expression string contains only non-negative integers addition to only non-negative integers addition to only non-negative integers addition to obstru... | Basic Calculator II | basic-calculator-ii | Given a string `s` which represents an expression, _evaluate this expression and return its value_.
The integer division should truncate toward zero.
You may assume that the given expression is always valid. All intermediate results will be in the range of `[-231, 231 - 1]`.
**Note:** You are not allowed to use any ... | null | Math,String,Stack | Medium | 224,282,785 |
219 | hello everyone welcome to learn overflow in this video we'll discuss another L problem that is the contains duplicate 2 this is a easy type problem and we'll understand how we can solve this problem and how we can think of finding a solution to this kind of equations so first of all the question says uh given an intege... | 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 |
449 | Hua Tha Hua Hai Ya Welcome To Learn For Defeat Tubelight Engaged In Order To Play List Challenge Dinesh Mahato Problems In Our Lives And Discharge All Tasty Cylinder Follow Swasthya Asking A Given At Not Being Able To See You Release That No Interest In The Ninth From The Thing Which Should Also Be Built During 1128 Sa... | Serialize and Deserialize BST | serialize-and-deserialize-bst | Serialization is converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment.
Design an algorithm to serialize and deserialize a **binary search t... | null | String,Tree,Depth-First Search,Breadth-First Search,Design,Binary Search Tree,Binary Tree | Medium | 297,652,765 |
725 | hello everyone welcome back here is vanam and today we got a fascinating problem in our hands we are going to dissect solve and understand a medium level problem on linkcest list from uh lead code daily challenge so if you uh someone looking to dive deep into words of data structure uh particularly Link at list uh you ... | Split Linked List in Parts | split-linked-list-in-parts | Given the `head` of a singly linked list and an integer `k`, split the linked list into `k` consecutive linked list parts.
The length of each part should be as equal as possible: no two parts should have a size differing by more than one. This may lead to some parts being null.
The parts should be in the order of occ... | If there are N nodes in the list, and k parts, then every part has N/k elements, except the first N%k parts have an extra one. | Linked List | Medium | 61,328 |
1,930 | hi friends uh welcome to followup let's have a look at problem 1930 unique lens 3 pic subsequences uh in this video we're going to share two formats of solutions the first one is based on dictionary so we are going to focus on the middle character well for the second one we're going to use index and the red index and w... | Unique Length-3 Palindromic Subsequences | maximum-number-of-consecutive-values-you-can-make | Given a string `s`, return _the number of **unique palindromes of length three** that are a **subsequence** of_ `s`.
Note that even if there are multiple ways to obtain the same subsequence, it is still only counted **once**.
A **palindrome** is a string that reads the same forwards and backwards.
A **subsequence** ... | If you can make the first x values and you have a value v, then you can make all the values ≤ v + x Sort the array of coins. You can always make the value 0 so you can start with x = 0. Process the values starting from the smallest and stop when there is a value that cannot be achieved with the current x. | Array,Greedy | Medium | 330 |
1,762 | hey folks welcome back to another video today we're looking at question 1762 but links with an ocean view the way we are uh solving this problem is by actually uh traversing the area that's given to us from right so if you look at this particular area we know that the ocean is to the right so to be able to view some th... | Buildings With an Ocean View | furthest-building-you-can-reach | There are `n` buildings in a line. You are given an integer array `heights` of size `n` that represents the heights of the buildings in the line.
The ocean is to the right of the buildings. A building has an ocean view if the building can see the ocean without obstructions. Formally, a building has an ocean view if al... | Assume the problem is to check whether you can reach the last building or not. You'll have to do a set of jumps, and choose for each one whether to do it using a ladder or bricks. It's always optimal to use ladders in the largest jumps. Iterate on the buildings, maintaining the largest r jumps and the sum of the remain... | Array,Greedy,Heap (Priority Queue) | Medium | null |
65 | Ki A Hello Everyone Welcome 2016 Saunf Electronics Questions Page Number in Question Veer A Hunger Strike at Present Slide Show Lemon Juice Stick Pan Now in Brief Introduction to Avoid Giving One Number here in this Video then subscribe to the Page if you liked The Video then subscribe to the greatest artist that a num... | Valid Number | valid-number | A **valid number** can be split up into these components (in order):
1. A **decimal number** or an **integer**.
2. (Optional) An `'e'` or `'E'`, followed by an **integer**.
A **decimal number** can be split up into these components (in order):
1. (Optional) A sign character (either `'+'` or `'-'`).
2. One of the... | null | String | Hard | 8 |
442 | today we are looking at lead code number 442 it's a question called find all duplicates in an array and here we're given an integer array nums of length n where all the integers of nums are in the range of 1 to n and each integer appears once or twice we got to return all the array we got to return an array of all the ... | 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 |
688 | uh in this problem firstly if you want to get the intuition please skip this part of 5-10 minutes I speak so part of 5-10 minutes I speak so part of 5-10 minutes I speak so basically whenever the problem comes up for property I was the one who was the most scared of out of all so that's how I will teach you that how to... | Knight Probability in Chessboard | knight-probability-in-chessboard | On an `n x n` chessboard, a knight starts at the cell `(row, column)` and attempts to make exactly `k` moves. The rows and columns are **0-indexed**, so the top-left cell is `(0, 0)`, and the bottom-right cell is `(n - 1, n - 1)`.
A chess knight has eight possible moves it can make, as illustrated below. Each move is ... | null | Dynamic Programming | Medium | 576 |
1,381 | hello in this video i'm gonna solve lead codes problem 1381 which is design a stack with increment operation it's a custom implementation of stack in general in programming when we have a stack it's a pile that we fill so i have push and pop operations and push i just add to my stack so let's say i received push 2 i pu... | Design a Stack With Increment Operation | maximum-score-words-formed-by-letters | Design a stack that supports increment operations on its elements.
Implement the `CustomStack` class:
* `CustomStack(int maxSize)` Initializes the object with `maxSize` which is the maximum number of elements in the stack.
* `void push(int x)` Adds `x` to the top of the stack if the stack has not reached the `max... | Note that words.length is small. This means you can iterate over every subset of words (2^N). | Array,String,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask | Hard | 2272 |
1,721 | okay so today we're looking at question 1721 swapping notes in a linked list i don't know if it's swap or what yeah but here given please excuse me if i pronounce it wrong uh you're given the head of a linked list and an integer k return the head of the linked list after swapping the values of the k note from the begin... | Swapping Nodes in a Linked List | maximum-profit-of-operating-a-centennial-wheel | You are given the `head` of a linked list, and an integer `k`.
Return _the head of the linked list after **swapping** the values of the_ `kth` _node from the beginning and the_ `kth` _node from the end (the list is **1-indexed**)._
**Example 1:**
**Input:** head = \[1,2,3,4,5\], k = 2
**Output:** \[1,4,3,2,5\]
**Ex... | Think simulation Note that the number of turns will never be more than 50 / 4 * n | Array,Simulation | Medium | null |
10 | Hello Guys Welcome To My YouTube Channel And Pleasure From Thank You Good Discuss About S Regular Expression Matching It's Hard Category Problem Combine Sub Scan Back Solution Dynamic Programming In This A Problem Statement Given String And Pattern Basically Ne Jab Bigg Boss Pattern President Not Three Do It Means subs... | Regular Expression Matching | regular-expression-matching | Given an input string `s` and a pattern `p`, implement regular expression matching with support for `'.'` and `'*'` where:
* `'.'` Matches any single character.
* `'*'` Matches zero or more of the preceding element.
The matching should cover the **entire** input string (not partial).
**Example 1:**
**Input:... | null | String,Dynamic Programming,Recursion | Hard | 44 |
797 | Hello hello everyone welcome to twenty match apne bilkul channel hai follow great time subscribe after node from 0 to avoid all subscribe - 1800 214 0232 subscribe 13023 must subscribe to-do list taraf pimples and if e must subscribe to-do list taraf pimples and if e must subscribe to-do list taraf pimples and if e exp... | All Paths From Source to Target | rabbits-in-forest | Given a directed acyclic graph (**DAG**) of `n` nodes labeled from `0` to `n - 1`, find all possible paths from node `0` to node `n - 1` and return them in **any order**.
The graph is given as follows: `graph[i]` is a list of all nodes you can visit from node `i` (i.e., there is a directed edge from node `i` to node `... | null | Array,Hash Table,Math,Greedy | Medium | null |
342 | hey this is Topher with a lonely Dash and today we're going over lead code question 342 power of four which states given an integer n return true if it is a power of four otherwise return false an integer N is a power of four if there exists an integer X such that n = 4 to exists an integer X such that n = 4 to exists ... | Power of Four | power-of-four | Given an integer `n`, return _`true` if it is a power of four. Otherwise, return `false`_.
An integer `n` is a power of four, if there exists an integer `x` such that `n == 4x`.
**Example 1:**
**Input:** n = 16
**Output:** true
**Example 2:**
**Input:** n = 5
**Output:** false
**Example 3:**
**Input:** n = 1
**O... | null | Math,Bit Manipulation,Recursion | Easy | 231,326 |
212 | hello everybody and welcome back in this video solution let's dive into the problem word surge2 i'm going to explain the solution in detail because it is a complicated one there are multiple different components that we need to figure out before we can write the solution let's get started the first thing you want to no... | 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 |
1,859 | Jhaal Hello Bhai - Friends Welcome to my Jhaal Hello Bhai - Friends Welcome to my Jhaal Hello Bhai - Friends Welcome to my YouTube channel Radhe-Radhe YouTube channel Radhe-Radhe YouTube channel Radhe-Radhe Loot Subscribe To Ki Bhaad If you will be able to convert the setting then for example you will see the input her... | Sorting the Sentence | change-minimum-characters-to-satisfy-one-of-three-conditions | A **sentence** is a list of words that are separated by a single space with no leading or trailing spaces. Each word consists of lowercase and uppercase English letters.
A sentence can be **shuffled** by appending the **1-indexed word position** to each word then rearranging the words in the sentence.
* For example... | Iterate on each letter in the alphabet, and check the smallest number of operations needed to make it one of the following: the largest letter in a and smaller than the smallest one in b, vice versa, or let a and b consist only of this letter. For the first 2 conditions, take care that you can only change characters to... | Hash Table,String,Counting,Prefix Sum | Medium | null |
120 | hey everyone welcome back and let's write some more neat code today so let's solve this question triangle pretty simple but you definitely need an iq of at least 130 if you want to be able to solve this problem just kidding with enough practice an iq of 90 is more than enough and don't forget to like the video it suppo... | Triangle | triangle | Given a `triangle` array, return _the minimum path sum from top to bottom_.
For each step, you may move to an adjacent number of the row below. More formally, if you are on index `i` on the current row, you may move to either index `i` or index `i + 1` on the next row.
**Example 1:**
**Input:** triangle = \[\[2\],\[... | null | Array,Dynamic Programming | Medium | null |
1,197 | what is going on everybody it's your boy average leader here coming at you with another video today we're tackling minimum night moves number 1197 on leak code uh it's commonly asked by mathworks facebook doordash amazon google and a few other companies so without further ado let's get right into it uh in an infinite c... | Minimum Knight Moves | parsing-a-boolean-expression | In an **infinite** chess board with coordinates from `-infinity` to `+infinity`, you have a **knight** at square `[0, 0]`.
A knight has 8 possible moves it can make, as illustrated below. Each move is two squares in a cardinal direction, then one square in an orthogonal direction.
Return _the minimum number of steps ... | Write a function "parse" which calls helper functions "parse_or", "parse_and", "parse_not". | String,Stack,Recursion | Hard | null |
1,792 | hello everyone let's take a look at this local problem next maximum average pass ratio so this problem is third problem in the context and um this contest um like this week it's not very hard context okay let's take a look so the problem uh just as follow the following is if you haven't read it you can take some time t... | Maximum Average Pass Ratio | find-the-most-competitive-subsequence | There is a school that has classes of students and each class will be having a final exam. You are given a 2D integer array `classes`, where `classes[i] = [passi, totali]`. You know beforehand that in the `ith` class, there are `totali` total students, but only `passi` number of students will pass the exam.
You are al... | In lexicographical order, the elements to the left have higher priority than those that come after. Can you think of a strategy that incrementally builds the answer from left to right? | Array,Stack,Greedy,Monotonic Stack | Medium | 402,1159 |
250 | hello and welcome to another Alico problem we're going to be doing count uni Valley subtrees and it's a premium problem of the week for this week so in this problem given the root of a binary tree return the number of uni value subtrees a uni Valley subtree means that all nodes of the subtree have the same value so for... | Count Univalue Subtrees | count-univalue-subtrees | Given the `root` of a binary tree, return _the number of **uni-value**_ _subtrees_.
A **uni-value subtree** means all nodes of the subtree have the same value.
**Example 1:**
**Input:** root = \[5,1,5,5,5,null,5\]
**Output:** 4
**Example 2:**
**Input:** root = \[\]
**Output:** 0
**Example 3:**
**Input:** root = ... | null | Tree,Depth-First Search,Binary Tree | Medium | 572,687 |
1,920 | hello everyone so in this video we will solve liquid problem number 1920 that is Bill Danny from permutation so I have already solved this problem using order of and space and this time I will solve it using order of one space so for knowing more about the problem description and solving it in order of and space please... | Build Array from Permutation | determine-color-of-a-chessboard-square | Given a **zero-based permutation** `nums` (**0-indexed**), build an array `ans` of the **same length** where `ans[i] = nums[nums[i]]` for each `0 <= i < nums.length` and return it.
A **zero-based permutation** `nums` is an array of **distinct** integers from `0` to `nums.length - 1` (**inclusive**).
**Example 1:**
*... | Convert the coordinates to (x, y) - that is, "a1" is (1, 1), "d7" is (4, 7). Try add the numbers together and look for a pattern. | Math,String | Easy | null |
732 | 732 which is a hard question so we are given events with a start and an end value and timestamp the event and time stamp is not inclusive which means that the event ended before this time stamp and we need to figure out the total maximum number of events that can that are that can like occur at the same time so which t... | My Calendar III | my-calendar-iii | A `k`\-booking happens when `k` events have some non-empty intersection (i.e., there is some time that is common to all `k` events.)
You are given some events `[startTime, endTime)`, after each given event, return an integer `k` representing the maximum `k`\-booking between all the previous events.
Implement the `MyC... | Treat each interval [start, end) as two events "start" and "end", and process them in sorted order. | Design,Segment Tree,Ordered Set | Hard | 729,731 |
1,250 | hello so continuing this week's contest 161 this is the last problem it's problem number 1250 and the problem says to check if it is a good array that's a title now let's look at it what the problem says so we have an array of positive integers and we want to select a subset of that array and then take each element mul... | Check If It Is a Good Array | longest-common-subsequence | Given an array `nums` of positive integers. Your task is to select some subset of `nums`, multiply each element by an integer and add all these numbers. The array is said to be **good** if you can obtain a sum of `1` from the array by any possible subset and multiplicand.
Return `True` if the array is **good** otherwi... | Try dynamic programming.
DP[i][j] represents the longest common subsequence of text1[0 ... i] & text2[0 ... j]. DP[i][j] = DP[i - 1][j - 1] + 1 , if text1[i] == text2[j]
DP[i][j] = max(DP[i - 1][j], DP[i][j - 1]) , otherwise | String,Dynamic Programming | Medium | 516,583,1170,2309 |
1,964 | welcome to Pomodoro doe for Sunday May 7th 2023. today we're looking at the code problem 1964. find the longest valid obstacle course at each position this is a hard problem so you want to build some obstacle courses you are given a zero indexed integer array obstacles of length n where obstacles index I describes the ... | Find the Longest Valid Obstacle Course at Each Position | find-interview-candidates | You want to build some obstacle courses. You are given a **0-indexed** integer array `obstacles` of length `n`, where `obstacles[i]` describes the height of the `ith` obstacle.
For every index `i` between `0` and `n - 1` (**inclusive**), find the length of the **longest obstacle course** in `obstacles` such that:
* ... | null | Database | Medium | null |
438 | Hello friends today I'm going to solve liquid problem number 438 find all anagrams in a string so in this problem we are given two strings S and P and we need to return an array of always start in this case where we could find the anagrams of p in s so what's an anagram it's basically a permutation of the string p in s... | 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 |
410 | everyone welcome back and let's write some more neat code today so today let's solve the problem split array largest sum this is a hard problem now there is a solution to this problem that's kind of intuitive but it doesn't really get accepted on leak code and then there is a solution that's a lot harder so i would say... | Split Array Largest Sum | split-array-largest-sum | Given an integer array `nums` and an integer `k`, split `nums` into `k` non-empty subarrays such that the largest sum of any subarray is **minimized**.
Return _the minimized largest sum of the split_.
A **subarray** is a contiguous part of the array.
**Example 1:**
**Input:** nums = \[7,2,5,10,8\], k = 2
**Output:*... | null | Array,Binary Search,Dynamic Programming,Greedy | Hard | 1056,1192,2242,2330 |
795 | welcome to june's lego challenge today's problem is number of sub arrays with bounded maximum you are given an array numbers of positive integers and two positive integers left and right left is less or equal to right return the number of contiguous non-empty subarrays such that the value non-empty subarrays such that ... | Number of Subarrays with Bounded Maximum | k-th-symbol-in-grammar | Given an integer array `nums` and two integers `left` and `right`, return _the number of contiguous non-empty **subarrays** such that the value of the maximum array element in that subarray is in the range_ `[left, right]`.
The test cases are generated so that the answer will fit in a **32-bit** integer.
**Example 1:... | Try to represent the current (N, K) in terms of some (N-1, prevK). What is prevK ? | Math,Bit Manipulation,Recursion | Medium | null |
451 | hello guys welcome to the chord man produce problem is sort characters by frequency so we have a given input string we have to short it based on the occurrence or frequency of the each character so let's say if a given string 3 the output should be ERT let's understand with the example so we have T only having occurren... | Sort Characters By Frequency | sort-characters-by-frequency | Given a string `s`, sort it in **decreasing order** based on the **frequency** of the characters. The **frequency** of a character is the number of times it appears in the string.
Return _the sorted string_. If there are multiple answers, return _any of them_.
**Example 1:**
**Input:** s = "tree "
**Output:** "eer... | null | Hash Table,String,Sorting,Heap (Priority Queue),Bucket Sort,Counting | Medium | 347,387,1741 |
36 | hi everybody how's it going so today we're going to solve leak code 36 valued sudoku now this is a very famous uh interview question it's also a medium question and it's a fun one so this question gives you a 2d board a sudoku board a 9x9 grid containing 81 cells and you should determine whether that sudoku board is va... | Valid Sudoku | valid-sudoku | Determine if a `9 x 9` Sudoku board is valid. Only the filled cells need to be validated **according to the following rules**:
1. Each row must contain the digits `1-9` without repetition.
2. Each column must contain the digits `1-9` without repetition.
3. Each of the nine `3 x 3` sub-boxes of the grid must contain... | null | Array,Hash Table,Matrix | Medium | 37,2254 |
234 | hi in this video I'm going to talk about Le 234 pandrum Ling list so what's a pandrum there's a definition here so a palindrome is a sequence that reads the same forward and backward for example for this one if you read it Forward you'll be two one right and if you read it backward it will also be one two one so this i... | 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,822 | hey guys myself Ankita so we shall send the problem so it's a very simple problem of what is daily challenge there is a function sine function of X that returns 1 if x is positive minus 1 is an X is negative and 0 of X is equal to zero so given a array we have to find the product of all the elements in Array and then w... | Sign of the Product of an Array | longest-palindromic-subsequence-ii | There is a function `signFunc(x)` that returns:
* `1` if `x` is positive.
* `-1` if `x` is negative.
* `0` if `x` is equal to `0`.
You are given an integer array `nums`. Let `product` be the product of all values in the array `nums`.
Return `signFunc(product)`.
**Example 1:**
**Input:** nums = \[-1,-2,-3,-4,... | As with any good dp problem that uses palindromes, try building the palindrome from the edges The prime point is to check that no two adjacent characters are equal, so save the past character while building the palindrome. | String,Dynamic Programming | Medium | 516 |
862 | hey welcome back we just finished to talk about 239 sliding window maximum and we're going to continue our journey to lead code we're going to talk about the very similar problem with the 239 shortest sub array with the sub that is k and let's go ahead and read the question so we're going to return the length of the sh... | Shortest Subarray with Sum at Least K | find-and-replace-in-string | Given an integer array `nums` and an integer `k`, return _the length of the shortest non-empty **subarray** of_ `nums` _with a sum of at least_ `k`. If there is no such **subarray**, return `-1`.
A **subarray** is a **contiguous** part of an array.
**Example 1:**
**Input:** nums = \[1\], k = 1
**Output:** 1
**Examp... | null | Array,String,Sorting | Medium | null |
86 | hello everyone in today's video we are going to solve one more lead code question that is question number 86 partition list so in this question we are given a head of linked list and a value X and we have to partition this linked list and such a way that all the nodes less than x comes before the nodes greater than or ... | Partition List | partition-list | Given the `head` of a linked list and a value `x`, partition it such that all nodes **less than** `x` come before nodes **greater than or equal** to `x`.
You should **preserve** the original relative order of the nodes in each of the two partitions.
**Example 1:**
**Input:** head = \[1,4,3,2,5,2\], x = 3
**Output:**... | null | Linked List,Two Pointers | Medium | 2265 |
278 | okay nothing high energy today so let's stop one simple question 278 first a bad version so the question is quite long basically the gist of it is that just imagine that we have a versioning of our code that's a linear sequencing versioning 1 to N and in some of the point in some version there is a bug that are introdu... | First Bad Version | first-bad-version | You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.
Suppose you have `n` versions `[1, 2, ..., n]` an... | null | Binary Search,Interactive | Easy | 34,35,374 |
265 | foreign problem 265 paid house number two so this is my code for solving the pith house number one yeah because in pit house number one we only have three different colors the only difference is here for the problem 2 we have three different colors yes so the cost of paintings house with a certain color is represented ... | Paint House II | paint-house-ii | There are a row of `n` houses, each house can be painted with one of the `k` colors. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color.
The cost of painting each house with a certain color is represented by an `n x k... | null | Array,Dynamic Programming | Hard | 238,239,256,276 |
5 | hi guys this is Vanina from I deserve today I am going to talk about longest palindromic substring so given a string like bananas we want to find out the longest palindromic substring here so you have a na n as palindromes here you also have a and a which is the longest palindrome we want to find this up so there is a ... | 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 |
55 | Hello Hi Guys Welcome To Drama Video Desi Bf Coding And School JumpGames Surya Gives Energy After Negative Integers Comes And Bare Initially Setting On The First Indian Wisely Limit Naridra Maximum Complaint And The Question Return Of Rebel To The Last Intact So Let's Take Two Examples From To-Do List This Examples Fro... | Jump Game | jump-game | You are given an integer array `nums`. You are initially positioned at the array's **first index**, and each element in the array represents your maximum jump length at that position.
Return `true` _if you can reach the last index, or_ `false` _otherwise_.
**Example 1:**
**Input:** nums = \[2,3,1,1,4\]
**Output:** t... | null | Array,Dynamic Programming,Greedy | Medium | 45,1428,2001 |
38 | in this video we'll be going over count and say the count and say sequence is a sequence of digit strings defined by the recursive formula so in our base case we have count and say one which is a string one and then for countless a n is the way you would say the digits from count and say n minus one so we'll define the... | Count and Say | count-and-say | The **count-and-say** sequence is a sequence of digit strings defined by the recursive formula:
* `countAndSay(1) = "1 "`
* `countAndSay(n)` is the way you would "say " the digit string from `countAndSay(n-1)`, which is then converted into a different digit string.
To determine how you "say " a digit string, spli... | The following are the terms from n=1 to n=10 of the count-and-say sequence:
1. 1
2. 11
3. 21
4. 1211
5. 111221
6. 312211
7. 13112221
8. 1113213211
9. 31131211131221
10. 13211311123113112211 To generate the nth term, just count and say the n-1th term. | String | Medium | 271,443 |
1,415 | hello everyone welcome to clashing order so in this video we will see the question 140 1415 that is the kth lexus graphical string of all happy strings of length n so let's see what is a happy string first of all a happy string is a string that there are two rules you can see consists of only the letters of set a b c s... | The k-th Lexicographical String of All Happy Strings of Length n | students-and-examinations | A **happy string** is a string that:
* consists only of letters of the set `['a', 'b', 'c']`.
* `s[i] != s[i + 1]` for all values of `i` from `1` to `s.length - 1` (string is 1-indexed).
For example, strings **"abc ", "ac ", "b "** and **"abcbabcbcb "** are all happy strings and strings **"aa ", "baa "** and **"a... | null | Database | Easy | null |
123 | welcome back guys hope you guys are having a great day today we're going to be doing something a little bit different we're going to be talking about a leeco question that I really like it's called best time to buy and sell stock three so there's actually three versions of this question and it progressively gets harder... | Best Time to Buy and Sell Stock III | best-time-to-buy-and-sell-stock-iii | You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
Find the maximum profit you can achieve. You may complete **at most two transactions**.
**Note:** You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).
**Exampl... | null | Array,Dynamic Programming | Hard | 121,122,188,689 |
902 | hey everybody this is larry this is day 18 of the lego day challenge hit the like button hit the subscribe button join me on this card let me know what you think only two more weeks to the end of the year uh how did you do this year let me know in the comments below or comment this go just hang out chat about it whatev... | Numbers At Most N Given Digit Set | minimum-number-of-refueling-stops | Given an array of `digits` which is sorted in **non-decreasing** order. You can write numbers using each `digits[i]` as many times as we want. For example, if `digits = ['1','3','5']`, we may write numbers such as `'13'`, `'551'`, and `'1351315'`.
Return _the number of positive integers that can be generated_ that are... | null | Array,Dynamic Programming,Greedy,Heap (Priority Queue) | Hard | null |
144 | hello and welcome today we are doing a question from Li code called binary tree preorder traversal it is a medium let's get started given a binary tree return the preorder traversal of its nodes as values example given the tree one with no left child 2 for its fried child and then 3 none we output 1 2 3 and why do we d... | Binary Tree Preorder Traversal | binary-tree-preorder-traversal | Given the `root` of a binary tree, return _the preorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[1,2,3\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of nodes ... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 94,255,775 |
123 | hello everyone welcome to tic this is khushal and today we will be looking at the third question of the series best time to buy and sell stock so how is this question different than the previous two questions in the first question we were allowed to do only one transaction and get the maximum profit and the second ques... | Best Time to Buy and Sell Stock III | best-time-to-buy-and-sell-stock-iii | You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
Find the maximum profit you can achieve. You may complete **at most two transactions**.
**Note:** You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).
**Exampl... | null | Array,Dynamic Programming | Hard | 121,122,188,689 |
1,491 | hey how you doing guys it's illa bella here i recorded stuff on youtube chat description for all my information i do all legal problems uh make sure you subscribe to this channel give me big thumbs up to support it and this is called average salary excluding the minimum and maximum salary get an array of unique integer... | Average Salary Excluding the Minimum and Maximum Salary | number-of-times-binary-string-is-prefix-aligned | You are given an array of **unique** integers `salary` where `salary[i]` is the salary of the `ith` employee.
Return _the average salary of employees excluding the minimum and maximum salary_. Answers within `10-5` of the actual answer will be accepted.
**Example 1:**
**Input:** salary = \[4000,3000,1000,2000\]
**Ou... | If in the step x all bulb shines then bulbs 1,2,3,..,x should shines too. | Array | Medium | 319,672 |
1,647 | Hello everyone welcome to my channel, we are going to do video number 17 of our greedy playlist, lead code number is 1647, there is not much to do, it is very simple, this question is going to be minimum delicious, you make character frequency equal, do you understand, question what to say, it is six. He has given you ... | Minimum Deletions to Make Character Frequencies Unique | can-convert-string-in-k-moves | A string `s` is called **good** if there are no two different characters in `s` that have the same **frequency**.
Given a string `s`, return _the **minimum** number of characters you need to delete to make_ `s` _**good**._
The **frequency** of a character in a string is the number of times it appears in the string. F... | Observe that shifting a letter x times has the same effect of shifting the letter x + 26 times. You need to check whether k is large enough to cover all shifts with the same remainder after modulo 26. | Hash Table,String | Medium | null |
230 | what's going on guys today we're doing leak code problem 230 K smallest element in a BST this is a medium problem given the root of a binary search tree and an integer K return the K smallest value one index of all the values of the nodes in the tree okay so first things first um we got to make sure we understand the p... | Kth Smallest Element in a BST | kth-smallest-element-in-a-bst | Given the `root` of a binary search tree, and an integer `k`, return _the_ `kth` _smallest value (**1-indexed**) of all the values of the nodes in the tree_.
**Example 1:**
**Input:** root = \[3,1,4,null,2\], k = 1
**Output:** 1
**Example 2:**
**Input:** root = \[5,3,6,2,4,null,null,1\], k = 3
**Output:** 3
**Cons... | Try to utilize the property of a BST. Try in-order traversal. (Credits to @chan13) What if you could modify the BST node's structure? The optimal runtime complexity is O(height of BST). | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | 94,671 |
767 | because 767 reorganized string um asked by many companies tops like fang companies especially um question is given a string s check if letters can be arranged that so that two characters are adjacent that are adjacent to each other are not the same if possible i'll put any possible result if not possible return to empt... | Reorganize String | prime-number-of-set-bits-in-binary-representation | Given a string `s`, rearrange the characters of `s` so that any two adjacent characters are not the same.
Return _any possible rearrangement of_ `s` _or return_ `" "` _if not possible_.
**Example 1:**
**Input:** s = "aab"
**Output:** "aba"
**Example 2:**
**Input:** s = "aaab"
**Output:** ""
**Constraints:**
* ... | Write a helper function to count the number of set bits in a number, then check whether the number of set bits is 2, 3, 5, 7, 11, 13, 17 or 19. | Math,Bit Manipulation | Easy | 191 |
1,601 | hey everyone today we are going to start with a little question maximum number of achievable transformities so you are given RI request and this is a transfer request from like a building from to building I so index 0 is uh from building and the index I is a two building so all building are full so a list of requests i... | Maximum Number of Achievable Transfer Requests | maximum-number-of-achievable-transfer-requests | We have `n` buildings numbered from `0` to `n - 1`. Each building has a number of employees. It's transfer season, and some employees want to change the building they reside in.
You are given an array `requests` where `requests[i] = [fromi, toi]` represents an employee's request to transfer from building `fromi` to bu... | null | null | Hard | null |
890 | Loot Hello Guys Welcome Garden Kashmir They Will Discuss Please Like This Question More Thursday Subscribe This Video Please subscribe And subscribe The Amazing spider-man And Subscribe Health And See What Is The Question Have A Doubt That 92 Pattern Women And Will Be Checking Apps for every vote counts but subscribe n... | 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 |
213 | welcome to october's leeco challenge today's problem is house robert two you are a robber planning to rob houses along the street each house has a certain amount of money stashed all houses at this place are arranged in a circle so that's going to be the difference between house robber one and two so that means the fir... | House Robber II | house-robber-ii | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are **arranged in a circle.** That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have a security system connected, and **it will automatical... | Since House[1] and House[n] are adjacent, they cannot be robbed together. Therefore, the problem becomes to rob either House[1]-House[n-1] or House[2]-House[n], depending on which choice offers more money. Now the problem has degenerated to the House Robber, which is already been solved. | Array,Dynamic Programming | Medium | 198,256,276,337,600,656 |
162 | hello everyone and welcome back to another video so today we're going to be following the leeco question find peak element all right so in this question a peak element is an element that is strictly greater than its neighbors so we're going to be given an integer area called nums and our goal is to find a peak element ... | Find Peak Element | find-peak-element | A peak element is an element that is strictly greater than its neighbors.
Given a **0-indexed** integer array `nums`, find a peak element, and return its index. If the array contains multiple peaks, return the index to **any of the peaks**.
You may imagine that `nums[-1] = nums[n] = -∞`. In other words, an element is... | null | Array,Binary Search | Medium | 882,2047,2273,2316 |
1,930 | hello guys today we are going to see another daily lead code problem 1930 which is unique lead unit length three palindromic subsequence problem right so let's understand the problem first so what it is saying over here is like we are given a string yes right and we have to return the number of unique paling Drums of L... | Unique Length-3 Palindromic Subsequences | maximum-number-of-consecutive-values-you-can-make | Given a string `s`, return _the number of **unique palindromes of length three** that are a **subsequence** of_ `s`.
Note that even if there are multiple ways to obtain the same subsequence, it is still only counted **once**.
A **palindrome** is a string that reads the same forwards and backwards.
A **subsequence** ... | If you can make the first x values and you have a value v, then you can make all the values ≤ v + x Sort the array of coins. You can always make the value 0 so you can start with x = 0. Process the values starting from the smallest and stop when there is a value that cannot be achieved with the current x. | Array,Greedy | Medium | 330 |
132 | hello everyone in this video we will be solving palindrome partitioning number two problem it is a hard problem number 132 let's look at the problem statement given a string s partition s in such a way that each substring of the partition is a palindrome if you look at the example here a b if you partition it at the in... | Palindrome Partitioning II | palindrome-partitioning-ii | Given a string `s`, partition `s` such that every substring of the partition is a palindrome.
Return _the **minimum** cuts needed for a palindrome partitioning of_ `s`.
**Example 1:**
**Input:** s = "aab "
**Output:** 1
**Explanation:** The palindrome partitioning \[ "aa ", "b "\] could be produced using 1 cut.
**... | null | String,Dynamic Programming | Hard | 131,1871 |
683 | hello friends now let's of the KMT slots problem there is a garden with unloads in each slot there is a flower the unplowed will bloom one by one in ten days in each day there will be exactly one flower blooming and even will be in the stators of blooming since then given array flowers consists of number from 1 to n ea... | K Empty Slots | k-empty-slots | You have `n` bulbs in a row numbered from `1` to `n`. Initially, all the bulbs are turned off. We turn on **exactly one** bulb every day until all bulbs are on after `n` days.
You are given an array `bulbs` of length `n` where `bulbs[i] = x` means that on the `(i+1)th` day, we will turn on the bulb at position `x` whe... | null | Array,Binary Indexed Tree,Sliding Window,Ordered Set | Hard | null |
1,220 | Ajay Ko Hello Everyone Welcome To Date 4th July List Ko 409 Plus Question Account Top Formation In This Question Wear Dresses And The Art Artist Account Home Ministry Of Length In This Form Using The Given Rules Under Rule Clear In That Used Cars Industry Flood China More Me To The Volume To Do Subscribe To Hai Account... | 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 |
1,470 | Hello everyone, Evgeniy Sulima nov is with you and today we will look at the solutions to the problem years code number 1470 shuffling arrays and so we are given an array of integers consisting of 2 multiplied by n elements and having the following form x1 x2 and so on dxn and y1 and y2 and so on long y en that is, we ... | 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 |
155 | hi everyone so today we're going to solve lead code problem number 155 minimum stack so uh in this problem we have to basically complete these few functions first one being the init function for minstack class where we'll initialize the stack objects second one being the push where we'll push our element onto the Star ... | Min Stack | min-stack | Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
Implement the `MinStack` class:
* `MinStack()` initializes the stack object.
* `void push(int val)` pushes the element `val` onto the stack.
* `void pop()` removes the element on the top of the stack.
* `int top(... | Consider each node in the stack having a minimum value. (Credits to @aakarshmadhavan) | Stack,Design | Easy | 239,716 |
1,020 | hello everyone so today let us look at the problem called number of enclaves so we have been given an M into n binary Matrix grid where 0 represents a C cell and one represents a land cell a move consists of walking from one land cell to another adjacent four directionally land cell or walking off the boundary of the g... | Number of Enclaves | longest-turbulent-subarray | You are given an `m x n` binary matrix `grid`, where `0` represents a sea cell and `1` represents a land cell.
A **move** consists of walking from one land cell to another adjacent (**4-directionally**) land cell or walking off the boundary of the `grid`.
Return _the number of land cells in_ `grid` _for which we cann... | null | Array,Dynamic Programming,Sliding Window | Medium | 53 |
572 | in this video we'll go over Le code question number 572 sub tree of another tree now if you haven't already I'd highly recommend you first watch my video on lead code number 100 same tree this is because we actually use the solution in same tree to solve this sub tree problem with just a little bit of extra logic so yo... | Subtree of Another Tree | subtree-of-another-tree | Given the roots of two binary trees `root` and `subRoot`, return `true` if there is a subtree of `root` with the same structure and node values of `subRoot` and `false` otherwise.
A subtree of a binary tree `tree` is a tree that consists of a node in `tree` and all of this node's descendants. The tree `tree` could als... | Which approach is better here- recursive or iterative? If recursive approach is better, can you write recursive function with its parameters? Two trees s and t are said to be identical if their root values are same and their left and right subtrees are identical. Can you write this in form of recursive formulae? Recurs... | Tree,Depth-First Search,String Matching,Binary Tree,Hash Function | Easy | 250,508 |
1,626 | In only WhatsApp everyone welcome back injury coding in the video cassette recorder problem back team which you can check the problem treatment is Ayodhya I found possible team problem in 1231 research team MLA Saurabh car 's dacoits' fastest off course for 's dacoits' fastest off course for 's dacoits' fastest off cou... | Best Team With No Conflicts | can-make-arithmetic-progression-from-sequence | You are the manager of a basketball team. For the upcoming tournament, you want to choose the team with the highest overall score. The score of the team is the **sum** of scores of all the players in the team.
However, the basketball team is not allowed to have **conflicts**. A **conflict** exists if a younger player ... | Consider that any valid arithmetic progression will be in sorted order. Sort the array, then check if the differences of all consecutive elements are equal. | Array,Sorting | Easy | 1752 |
70 | hello everyone and welcome to python programming practice in this episode we're going to be covering elite code number 70 climbing stairs this is classified as an easy problem so we'll start by reading the problem set up here you are climbing a staircase it takes n steps to reach the top each time you can either climb ... | Climbing Stairs | climbing-stairs | You are climbing a staircase. It takes `n` steps to reach the top.
Each time you can either climb `1` or `2` steps. In how many distinct ways can you climb to the top?
**Example 1:**
**Input:** n = 2
**Output:** 2
**Explanation:** There are two ways to climb to the top.
1. 1 step + 1 step
2. 2 steps
**Example 2:**
... | To reach nth step, what could have been your previous steps? (Think about the step sizes) | Math,Dynamic Programming,Memoization | Easy | 747,1013,1236 |
1,197 | okay we are live today is the 15 days of may and we yeah because this is the first day of the third week three so again we have two questions and again because of today's weekend so unfortunately we have one median question and one hard question so um well anyways for the hard question i probably won't be able to finis... | Minimum Knight Moves | parsing-a-boolean-expression | In an **infinite** chess board with coordinates from `-infinity` to `+infinity`, you have a **knight** at square `[0, 0]`.
A knight has 8 possible moves it can make, as illustrated below. Each move is two squares in a cardinal direction, then one square in an orthogonal direction.
Return _the minimum number of steps ... | Write a function "parse" which calls helper functions "parse_or", "parse_and", "parse_not". | String,Stack,Recursion | Hard | null |
336 | Hello friends, once again welcome all of you to my YouTube channel for free, so friend in today's video we have taken very interesting questions about palindrome purse and friend, if you are not watching the video for two-three days before starting the video, then not watching the video for two-three days before starti... | 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 |
48 | hello everyone welcome to tic this is khushal and today we will be going through this question rotate image so let's see what the question says you're given an n cross n 2d matrix representing an image so uh we will be given a 2d square matrix where the number of rows and number of columns will be same and we are suppo... | Rotate Image | rotate-image | You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise).
You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati... | null | Array,Math,Matrix | Medium | 2015 |
283 | hey guys welcome to a new video in today's video we're going to look at the lead code problem and the problem's name is move zeros in this question we're given an integer array called nums and we have to move all the zeros present inside that array nums to the end of it while maintaining the relative order of the non-z... | 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 |
1,482 | foreign welcome back to the DSA classes so we were noticing in the previous couple of programs that though a question at the first site may not seem like a binary search based questions whenever contiguous allocation has to be performed right you can use binary search to find the optimal solution now to prove that once... | Minimum Number of Days to Make m Bouquets | how-many-numbers-are-smaller-than-the-current-number | You are given an integer array `bloomDay`, an integer `m` and an integer `k`.
You want to make `m` bouquets. To make a bouquet, you need to use `k` **adjacent flowers** from the garden.
The garden consists of `n` flowers, the `ith` flower will bloom in the `bloomDay[i]` and then can be used in **exactly one** bouquet... | Brute force for each array element. In order to improve the time complexity, we can sort the array and get the answer for each array element. | Array,Hash Table,Sorting,Counting | Easy | 315 |
1,073 | we cool 1073 adding to our net megabind every numbers I don't it's a mega man I cannot read mega binary numbers come in two numbers we mice in a no way oh it's a no way but all rights still a bad grammar name okay give me two numbers away one in a way to and page negative two we turn to be self adding them together eac... | Adding Two Negabinary Numbers | number-of-enclaves | Given two numbers `arr1` and `arr2` in base **\-2**, return the result of adding them together.
Each number is given in _array format_: as an array of 0s and 1s, from most significant bit to least significant bit. For example, `arr = [1,1,0,1]` represents the number `(-2)^3 + (-2)^2 + (-2)^0 = -3`. A number `arr` in _... | Can you model this problem as a graph problem? Create n * m + 1 nodes where n * m nodes represents each cell of the map and one extra node to represent the exterior of the map. In the map add edges between neighbors on land cells. And add edges between the exterior and land nodes which are in the boundary.
Return as ... | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | null |
237 | hi everyone it's sorin today we are going to solve lead code 237 the lead note in a link list problem the problem is we are given a link at list and we need to return a node in it we are not given access to the head of the linked list and also the all values in linked list are unique and we have four requirements here ... | Delete Node in a Linked List | delete-node-in-a-linked-list | There is a singly-linked list `head` and we want to delete a node `node` in it.
You are given the node to be deleted `node`. You will **not be given access** to the first node of `head`.
All the values of the linked list are **unique**, and it is guaranteed that the given node `node` is not the last node in the linke... | null | Linked List | Easy | 203 |
1,095 | hello guys welcome back to the channel so in this video we are going to solve the problem which is today's daily lead code problem lead code daily challenge so I haven't solved this problem yet and I have just tried this problem on 26th of July I think so let's just read the problem statement and try we will just try t... | Find in Mountain Array | two-city-scheduling | _(This problem is an **interactive problem**.)_
You may recall that an array `arr` is a **mountain array** if and only if:
* `arr.length >= 3`
* There exists some `i` with `0 < i < arr.length - 1` such that:
* `arr[0] < arr[1] < ... < arr[i - 1] < arr[i]`
* `arr[i] > arr[i + 1] > ... > arr[arr.length ... | null | Array,Greedy,Sorting | Medium | null |
63 | so in this video we are going to understand the unique path second right so we have already seen uh the I think in the first part of this uh playlist the unique path right so this is the third part third video of this uh you can say playlist right the 63 unique path second so what we have to find here let us understand... | Unique Paths II | unique-paths-ii | You are given an `m x n` integer array `grid`. There is a robot initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time.
An obstacle and space are marked as ... | The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be
if obstacleGrid[i][j] is not an obstacle
... | Array,Dynamic Programming,Matrix | Medium | 62,1022 |
4 | hello my friends my name is Alexander barmin and this is my new YouTube show lead code with me where we solve lead code challenges don't forget to subscribe to my channel give me a like and write a comment so what's in the agenda for today we're going to have our first hard level challenge and we will solve it graceful... | Median of Two Sorted Arrays | median-of-two-sorted-arrays | Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays.
The overall run time complexity should be `O(log (m+n))`.
**Example 1:**
**Input:** nums1 = \[1,3\], nums2 = \[2\]
**Output:** 2.00000
**Explanation:** merged array = \[1,2,3\] and median is ... | null | Array,Binary Search,Divide and Conquer | Hard | null |
1,029 | hey everyone nitish aside hope you're doing well so let's start with your question so the question is two city scheduling okay so a company is planning to interview two n people and given the array cost so where cost i equal to eighth cost and b cost the basically the cost of flying the ith person to city a is at cost ... | Two City Scheduling | vertical-order-traversal-of-a-binary-tree | A company is planning to interview `2n` people. Given the array `costs` where `costs[i] = [aCosti, bCosti]`, the cost of flying the `ith` person to city `a` is `aCosti`, and the cost of flying the `ith` person to city `b` is `bCosti`.
Return _the minimum cost to fly every person to a city_ such that exactly `n` people... | null | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Hard | null |
376 | welcome to june thursday code challenge wiggle subsequence a wiggle seek sequence is a sequence where differences between successive numbers strictly alternate between positive and negative numbers the first difference if one exists may be positive or negative a sequence with one element and a sequence with non two non... | 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 |
1,192 | welcome to april's eco challenge this problem is called critical connections in a network and you can see i missed it uh what are you gonna do there are n servers numbered from zero to n minus one connected by undirected server to server connections forming a network where connections i which is going to be a list of t... | Critical Connections in a Network | divide-chocolate | There are `n` servers numbered from `0` to `n - 1` connected by undirected server-to-server `connections` forming a network where `connections[i] = [ai, bi]` represents a connection between servers `ai` and `bi`. Any server can reach other servers directly or indirectly through the network.
A _critical connection_ is ... | After dividing the array into K+1 sub-arrays, you will pick the sub-array with the minimum sum. Divide the sub-array into K+1 sub-arrays such that the minimum sub-array sum is as maximum as possible. Use binary search with greedy check. | Array,Binary Search | Hard | 410,1056 |
17 | foreign question number 17 there are combinations of a phone number so first let's read the question given a string containing digits from 2 to 9 inclusive written all possible letter combinations that number could represent the answer in any order a mapping of digits two letters just like on the telephone buttons is g... | Letter Combinations of a Phone Number | letter-combinations-of-a-phone-number | Given a string containing digits from `2-9` inclusive, return all possible letter combinations that the number could represent. Return the answer in **any order**.
A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.
**Example 1:**
**Input:** di... | null | Hash Table,String,Backtracking | Medium | 22,39,401 |
112 | what's up everyone today we're going to go over lee code 112 valid path sum first we'll look at the input and the output then we'll look at the diagrams and finally we're going to look at the code and complexity the input is going to be a binary tree and an integer called sum and the output needs to be boolean true or ... | Path Sum | path-sum | Given the `root` of a binary tree and an integer `targetSum`, return `true` if the tree has a **root-to-leaf** path such that adding up all the values along the path equals `targetSum`.
A **leaf** is a node with no children.
**Example 1:**
**Input:** root = \[5,4,8,11,null,13,4,7,2,null,null,null,1\], targetSum = 22... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 113,124,129,437,666 |
218 | Hi gas welcome and welcome back to my channel so in today's video we are going to solve the line problem of the country ok so what has been given to us in this problem statement we will understand all that through examples ok now what to do na Read the entire statement once, understand the problem, what is given, what ... | The Skyline Problem | the-skyline-problem | A city's **skyline** is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of all the buildings, return _the **skyline** formed by these buildings collectively_.
The geometric information of each building is given in the array `buil... | null | Array,Divide and Conquer,Binary Indexed Tree,Segment Tree,Line Sweep,Heap (Priority Queue),Ordered Set | Hard | 699 |
1,880 | hi guys today we are solving this problem called check if word equals submission of two words this was asked in today's contest and this was the easiest thumb there so let's try to solve this the problem says the letter value of a letter is its position in the alphabet starting from zero that means a equals to numerica... | Check if Word Equals Summation of Two Words | largest-merge-of-two-strings | The **letter value** of a letter is its position in the alphabet **starting from 0** (i.e. `'a' -> 0`, `'b' -> 1`, `'c' -> 2`, etc.).
The **numerical value** of some string of lowercase English letters `s` is the **concatenation** of the **letter values** of each letter in `s`, which is then **converted** into an inte... | Build the result character by character. At each step, you choose a character from one of the two strings. If the next character of the first string is larger than that of the second string, or vice versa, it's optimal to use the larger one. If both are equal, think of a criteria that lets you decide which string to co... | Two Pointers,String,Greedy | Medium | null |
1,560 | hey everybody this is larry this is me going over most visited sector in a circular track the recent easy problems of the lego contest um yeah so for this problem it's just a simulation problem uh knowing that and the biggest thing to notice with easy part especially is pay attention to the constraints and for this one... | Most Visited Sector in a Circular Track | number-of-students-doing-homework-at-a-given-time | Given an integer `n` and an integer array `rounds`. We have a circular track which consists of `n` sectors labeled from `1` to `n`. A marathon will be held on this track, the marathon consists of `m` rounds. The `ith` round starts at sector `rounds[i - 1]` and ends at sector `rounds[i]`. For example, round 1 starts at ... | Imagine that startTime[i] and endTime[i] form an interval (i.e. [startTime[i], endTime[i]]). The answer is how many times the queryTime laid in those mentioned intervals. | Array | Easy | null |
749 | go arrivals are spreading rapidly and your task is to quarantine the infected areas by installing was this is 749 contained virus the world's monomer has 2d arrays of cells where zero can represents unexpected selves and one represents cells contaminated drivers of war and only one war can be installed between any two ... | Contain Virus | shortest-completing-word | A virus is spreading rapidly, and your task is to quarantine the infected area by installing walls.
The world is modeled as an `m x n` binary grid `isInfected`, where `isInfected[i][j] == 0` represents uninfected cells, and `isInfected[i][j] == 1` represents cells contaminated with the virus. A wall (and only one wall... | Count only the letters (possibly converted to lowercase) of each word. If a word is shorter and the count of each letter is at least the count of that letter in the licensePlate, it is the best answer we've seen yet. | Array,Hash Table,String | Easy | null |
1,629 | hello everyone and welcome back to another video so today we're going to be starting the leeco question slowest key all right so in this question we have a newly designed keypad which was tested where a tester pressed a sequence of n keys at one at a time you are given a string key pressed of length n where key pressed... | Slowest Key | minimum-possible-integer-after-at-most-k-adjacent-swaps-on-digits | A newly designed keypad was tested, where a tester pressed a sequence of `n` keys, one at a time.
You are given a string `keysPressed` of length `n`, where `keysPressed[i]` was the `ith` key pressed in the testing sequence, and a sorted list `releaseTimes`, where `releaseTimes[i]` was the time the `ith` key was releas... | We want to make the smaller digits the most significant digits in the number. For each index i, check the smallest digit in a window of size k and append it to the answer. Update the indices of all digits in this range accordingly. | String,Greedy,Binary Indexed Tree,Segment Tree | Hard | null |
224 | hey friends welcome back to my channel today let's do leave code number 224 basic calculator this problem is to implement a basic calculator to evaluate a simple expression string so the input is going to be a string the expression stream may contain open parenthesis and closing parentheses plus sign minus I and now ne... | 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 |
154 | Hello Everyone Welcome Department Productive Liquid Subscribe to Channel and Drown Skimming Do Subscribe Video subscribe and subscribe this Video Please subscribe and subscribe the Channel subscribe Question in the Presentation Swift Message to liked The Video then 25 Minimum Do Liquid 150 Subscribe 0 Video Subscribe L... | Find Minimum in Rotated Sorted Array II | find-minimum-in-rotated-sorted-array-ii | Suppose an array of length `n` sorted in ascending order is **rotated** between `1` and `n` times. For example, the array `nums = [0,1,4,4,5,6,7]` might become:
* `[4,5,6,7,0,1,4]` if it was rotated `4` times.
* `[0,1,4,4,5,6,7]` if it was rotated `7` times.
Notice that **rotating** an array `[a[0], a[1], a[2], .... | null | Array,Binary Search | Hard | 153 |
1,822 | Hello gas I am Lalita Agarwal welcome to on your on coding channel conference made by you made on you so late na start tu days late tomorrow problem today's date ko ki problem kya bol rahi hai achha before de problem na 1 minute discussion par dost jinko This problem is good, if you have understood then try anything, s... | Sign of the Product of an Array | longest-palindromic-subsequence-ii | There is a function `signFunc(x)` that returns:
* `1` if `x` is positive.
* `-1` if `x` is negative.
* `0` if `x` is equal to `0`.
You are given an integer array `nums`. Let `product` be the product of all values in the array `nums`.
Return `signFunc(product)`.
**Example 1:**
**Input:** nums = \[-1,-2,-3,-4,... | As with any good dp problem that uses palindromes, try building the palindrome from the edges The prime point is to check that no two adjacent characters are equal, so save the past character while building the palindrome. | String,Dynamic Programming | Medium | 516 |
301 | hi everyone today I will talk about lead codes three CLO one I move in parallel parenthesis and this is a hard problem so look crunching is to remove the minimal number of invalid appearances to make it valid so like this case what we want to do is to remove one right appearances so we can add or remove the second one ... | Remove Invalid Parentheses | remove-invalid-parentheses | Given a string `s` that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.
Return _a list of **unique strings** that are valid with the minimum number of removals_. You may return the answer in **any order**.
**Example 1:**
**Input:** s = "()())() "
**... | Since we don't know which of the brackets can possibly be removed, we try out all the options! We can use recursion to try out all possibilities for the given expression. For each of the brackets, we have 2 options:
We keep the bracket and add it to the expression that we are building on the fly during recursion.... | String,Backtracking,Breadth-First Search | Hard | 20,2095 |
28 | Hello Gas Myself Amrita Welcome Number 28 Date Is Tu Find D Index Of First Occurrence Of Needle In A String So Lets First Understand D Problem Given Tu Strings Needle And Has Tax Return D Index Of First Occurrence Of Needle In His And Mines Van If Needle Is Not Part Of are there are you strings when this is stack and a... | Find the Index of the First Occurrence in a String | implement-strstr | Given two strings `needle` and `haystack`, return the index of the first occurrence of `needle` in `haystack`, or `-1` if `needle` is not part of `haystack`.
**Example 1:**
**Input:** haystack = "sadbutsad ", needle = "sad "
**Output:** 0
**Explanation:** "sad " occurs at index 0 and 6.
The first occurrence is at ... | null | Two Pointers,String,String Matching | Easy | 214,459 |
520 | finally it's good number 520 detect Capital it's actually the lead code problem of the day and it's easy so the problem simply says that we should just uh tell or they give us a word and we return true or false depending on if it's a uh Capital right and we Define the use of capitals in a world to be right when one of ... | Detect Capital | detect-capital | We define the usage of capitals in a word to be right when one of the following cases holds:
* All letters in this word are capitals, like `"USA "`.
* All letters in this word are not capitals, like `"leetcode "`.
* Only the first letter in this word is capital, like `"Google "`.
Given a string `word`, return `... | null | String | Easy | 2235 |
298 | welcome back to the cracking fang youtube channel today we're going to be doing a quick video on lead code problem 298 binary tree longest consecutive sequence given the root of a binary tree return the length of the longest consecutive sequence path the path refers to any sequence of nodes from some starting node to a... | Binary Tree Longest Consecutive Sequence | binary-tree-longest-consecutive-sequence | Given the `root` of a binary tree, return _the length of the longest **consecutive sequence path**_.
A **consecutive sequence path** is a path where the values **increase by one** along the path.
Note that the path can start **at any node** in the tree, and you cannot go from a node to its parent in the path.
**Exam... | null | Tree,Depth-First Search,Binary Tree | Medium | 128,549,1416 |
253 | hey everyone today we're going over leode problem 253 meeting rooms 2 this is another problem off the blind 75 list which is a list of problems commonly asked during technical interviews this problem is very similar to meeting rooms one which is another problem I solved in my channel in this problem we are given an arr... | Meeting Rooms II | meeting-rooms-ii | Given an array of meeting time intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of conference rooms required_.
**Example 1:**
**Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\]
**Output:** 2
**Example 2:**
**Input:** intervals = \[\[7,10\],\[2,4\]\]
**Output:** 1
**Constr... | Think about how we would approach this problem in a very simplistic way. We will allocate rooms to meetings that occur earlier in the day v/s the ones that occur later on, right? If you've figured out that we have to sort the meetings by their start time, the next thing to think about is how do we do the allocation? Th... | Array,Two Pointers,Greedy,Sorting,Heap (Priority Queue) | Medium | 56,252,452,1184 |
208 | hey guys how's it going in this video i want to go through eco number 208 implement try uh it's also called prefix tree um so if this question was asked by this company google amazon twitter pinterest and microsoft prefix tree is one of the is a tree data structure and used to efficiently store and retrieve keys in a d... | 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 |
309 | everyone welcome back and let's write some more neat code today so today let's solve best time to buy and sell a stock with a cool down and this is actually a very interesting problem and a very challenging problem but honestly i'm gonna make this problem look like a joke today and that's not because i'm really smart i... | 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 |
1,870 | welcome to Pomodoro Joe for Wednesday July 26 2023 today we're looking at leapkid problem 1870 minimum speed to arrive on time this is a medium problem 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 or... | 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 |
143 | hi everyone let's do lead code 143 reorder list so we're given the head of a singly link list and we want to reorder this list following this form here so this can be a bit confusing so let's look at an example so given this input list this is the output we are looking for so the first position of the output we got the... | Reorder List | reorder-list | You are given the head of a singly linked-list. The list can be represented as:
L0 -> L1 -> ... -> Ln - 1 -> Ln
_Reorder the list to be on the following form:_
L0 -> Ln -> L1 -> Ln - 1 -> L2 -> Ln - 2 -> ...
You may not modify the values in the list's nodes. Only nodes themselves may be changed.
**Example 1:**
**... | null | Linked List,Two Pointers,Stack,Recursion | Medium | 2216 |
836 | hey guys welcome back to hippo function in this video we will discuss another interview problem rectangles overlap so the problem statement says that we are given with 2 rectangles and we need to determine if they overlap or not now for the representation of rectangles we have been given two coordinates when is the bot... | Rectangle Overlap | race-car | An axis-aligned rectangle is represented as a list `[x1, y1, x2, y2]`, where `(x1, y1)` is the coordinate of its bottom-left corner, and `(x2, y2)` is the coordinate of its top-right corner. Its top and bottom edges are parallel to the X-axis, and its left and right edges are parallel to the Y-axis.
Two rectangles ove... | null | Dynamic Programming | Hard | null |
1,680 | Hello Hi Everyone Welcome To My Channel It's All The Problems And Definition Of Positive Energy Number Most Zor Distic For Consideration Of 2nd In Order To Power In The World Number One To Three Selection In This Will Have To Subscribe Button * Number 0001 Number 90 After The Will Convert Decimal To Have Converted Into... | Concatenation of Consecutive Binary Numbers | count-all-possible-routes | Given an integer `n`, return _the **decimal value** of the binary string formed by concatenating the binary representations of_ `1` _to_ `n` _in order, **modulo**_ `109 + 7`.
**Example 1:**
**Input:** n = 1
**Output:** 1
**Explanation: ** "1 " in binary corresponds to the decimal value 1.
**Example 2:**
**Input:**... | Use dynamic programming to solve this problem with each state defined by the city index and fuel left. Since the array contains distinct integers fuel will always be spent in each move and so there can be no cycles. | Array,Dynamic Programming,Memoization | Hard | null |
989 | The values are, if I The values are, if I The values are, if I write them in the form of interior, it is okay and if I add them with k, then our result will be returned to us in the form of vector, okay, so I will not be a little clear here, I will give you an example. I understand that here the example number is... | Add to Array-Form of Integer | largest-component-size-by-common-factor | The **array-form** of an integer `num` is an array representing its digits in left to right order.
* For example, for `num = 1321`, the array form is `[1,3,2,1]`.
Given `num`, the **array-form** of an integer, and an integer `k`, return _the **array-form** of the integer_ `num + k`.
**Example 1:**
**Input:** num ... | null | Array,Math,Union Find | Hard | 2276 |
76 | so uh let's read the problem statement so we are given two strings as NT of length M and N respectively so we have to return the minimum window substring of s such that every character in t including duplicates also is included in the window if there is no each such substring we have to return the empty string so a suc... | 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 |
232 | hey everybody this is Larry this is day 16 of the legal daily challenge hit the like button hit the Subscribe button join me on Discord let me apparently I've done this week I don't know if my uh Firefox or whatever is just having a good memory but yeah today's problem is Implement cues using Stacks 232 easy prom hit t... | Implement Queue using Stacks | implement-queue-using-stacks | Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (`push`, `peek`, `pop`, and `empty`).
Implement the `MyQueue` class:
* `void push(int x)` Pushes element x to the back of the queue.
* `int pop()` Removes the element from th... | null | Stack,Design,Queue | Easy | 225 |
438 | Hello Guys Welcome Back To Decades And This Video Will See The Find All And Grass In Spring Problem Specific Click Code Se Yadav Challenged So Let's Not Look At The Problem Statement Before Looking And The Problem Latest June 2012 From Thursday Can They Arrange Is The Most Frequent Flyer Important and subscribe the Cha... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.