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,616 | hi everyone welcome back to the channel today let's solve the contest question split two strings to make palindrome and as i know this is a phone interview question asked by google so let's take a closer look the question statement so we are given two strings a and b of the same length and we can choose an index and sp... | Split Two Strings to Make Palindrome | minimum-difference-between-largest-and-smallest-value-in-three-moves | You are given two strings `a` and `b` of the same length. Choose an index and split both strings **at the same index**, splitting `a` into two strings: `aprefix` and `asuffix` where `a = aprefix + asuffix`, and splitting `b` into two strings: `bprefix` and `bsuffix` where `b = bprefix + bsuffix`. Check if `aprefix + bs... | The minimum difference possible is is obtained by removing 3 elements between the 3 smallest and 3 largest values in the array. | Array,Greedy,Sorting | Medium | null |
1,870 | hi everyone in today challenge we are going to solve this problem the program name is minimum speed to arrive on time and the problem number is 1870 only so first of all we are going to clearly understand the problem statement after understanding the problem statement then we will move to the logic part and in the logi... | 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 |
104 | hi welcome back to another ease of leaker question today we're going to solve the max depth of binary tree this question is quite similar to the diameter of binary tree question that i just sold a few days ago so if you could go watch that video after watching this that'll be amazing so to solve this question we're goi... | Maximum Depth of Binary Tree | maximum-depth-of-binary-tree | Given the `root` of a binary tree, return _its maximum depth_.
A binary tree's **maximum depth** is the number of nodes along the longest path from the root node down to the farthest leaf node.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 3
**Example 2:**
**Input:** root = \[1,null,2\]
**... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 110,111,774,1492 |
134 | hi all welcome to learn code repeat so today we'll be looking at day 23rd of the september lead code challenge the name of the problem is gas station and it has been asked in amazon facebook and google so let's look into the so the problem says that there are n gas station along a circular route where the amount of gas... | Gas Station | gas-station | There are `n` gas stations along a circular route, where the amount of gas at the `ith` station is `gas[i]`.
You have a car with an unlimited gas tank and it costs `cost[i]` of gas to travel from the `ith` station to its next `(i + 1)th` station. You begin the journey with an empty tank at one of the gas stations.
Gi... | null | Array,Greedy | Medium | 1346 |
846 | so hey guys what's up and in this video i'm going to see about another lead code problem that is handoff sheets right so let's get started and this is what the problem basically says that allies has a hand of cards that is given as an array of integers right so basically this is an integer and we need to find a group t... | Hand of Straights | hand-of-straights | Alice has some number of cards and she wants to rearrange the cards into groups so that each group is of size `groupSize`, and consists of `groupSize` consecutive cards.
Given an integer array `hand` where `hand[i]` is the value written on the `ith` card and an integer `groupSize`, return `true` if she can rearrange t... | null | null | Medium | null |
380 | Hello guys welcome back to record net entries problems in the married to overseen of one India YouTube Channel Please subscribe this sequence to complete your problem love starts with the problems solve problems design latest updates of course all the following operations in every form 110 support operations Give instr... | 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 |
40 | in this video we're going to take a look at three legal problems combination sum number one and number two and number three so these are all really popular uh backtracking problems so let's take a look at them start by combination number one so for this problem we're given a array of distinct integer values right and t... | Combination Sum II | combination-sum-ii | Given a collection of candidate numbers (`candidates`) and a target number (`target`), find all unique combinations in `candidates` where the candidate numbers sum to `target`.
Each number in `candidates` may only be used **once** in the combination.
**Note:** The solution set must not contain duplicate combinations.... | null | Array,Backtracking | Medium | 39 |
315 | hey guys today we are going to talk about binary index 3 application we will look at this with the help of a google interview question now a big disclaimer here this video assumes that the viewer is already familiar with the concept of binary index tree now this tutorial is not an introduction of binary index tree but ... | Count of Smaller Numbers After Self | count-of-smaller-numbers-after-self | Given an integer array `nums`, return _an integer array_ `counts` _where_ `counts[i]` _is the number of smaller elements to the right of_ `nums[i]`.
**Example 1:**
**Input:** nums = \[5,2,6,1\]
**Output:** \[2,1,1,0\]
**Explanation:**
To the right of 5 there are **2** smaller elements (2 and 1).
To the right of 2 the... | null | Array,Binary Search,Divide and Conquer,Binary Indexed Tree,Segment Tree,Merge Sort,Ordered Set | Hard | 327,406,493,1482,2280 |
36 | hey what's up you guys new idea ready tech encoding stuff on twitch and YouTube check the description for all my information join the discord I got a bunch of few stuffs going on in there dude to get some interesting perks of joining so we're doing valid sukkot Sudoku today as problem number thirty six medium problem d... | 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 |
4 | hey everyone welcome back to the channel i hope you guys are doing extremely well so today we will be discussing the problem find the median of two sorted arrays now this is elite code hard problem yes so you need to understand it really well in order to solve this so what is the question stating the question is statin... | 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 |
200 | hello welcome to my channel for 100 lego challenge today we have medium nico 200 numbers of items so this one is really classic dfs uh questions so let's take a look at it given an m time and 2d grid map of ones which is island and zeros water return numbers of islands so what is island so island here is one is a land ... | Number of Islands | number-of-islands | Given an `m x n` 2D binary grid `grid` which represents a map of `'1'`s (land) and `'0'`s (water), return _the number of islands_.
An **island** is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
**Exampl... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | 130,286,305,323,694,695,2035,2103 |
215 | welcome to january's lego challenge today's problem is kth largest element in an array find the kth largest element in an unsorted array note that it is the kth largest element in sorted order not the kth distinct element so that's helpful basically we have a unsorted list and we want to return the second largest one i... | Kth Largest Element in an Array | kth-largest-element-in-an-array | Given an integer array `nums` and an integer `k`, return _the_ `kth` _largest element in the array_.
Note that it is the `kth` largest element in the sorted order, not the `kth` distinct element.
You must solve it in `O(n)` time complexity.
**Example 1:**
**Input:** nums = \[3,2,1,5,6,4\], k = 2
**Output:** 5
**Ex... | null | Array,Divide and Conquer,Sorting,Heap (Priority Queue),Quickselect | Medium | 324,347,414,789,1014,2113,2204,2250 |
1,332 | Hello Hi Guys Welcome to make video in a series of coding Khade Bhi Hi Dard Problem If Near Challenge Problem Of Today With S Manya States On Only Good Friday Remove First Mixer Sequence Is Yagya Na Spread Consisting Only Of Letters In This Verse Line The Best Border Line Will Help to Learn Per Problems OA Give Inside ... | Remove Palindromic Subsequences | count-vowels-permutation | You are given a string `s` consisting **only** of letters `'a'` and `'b'`. In a single step you can remove one **palindromic subsequence** from `s`.
Return _the **minimum** number of steps to make the given string empty_.
A string is a **subsequence** of a given string if it is generated by deleting some characters o... | Use dynamic programming. Let dp[i][j] be the number of strings of length i that ends with the j-th vowel. Deduce the recurrence from the given relations between vowels. | Dynamic Programming | Hard | null |
146 | alright so in this video today we are going to talk about an apparent Microsoft question I don't know if other companies ask this but implement and LRU cache so first off let's get started with terminology what is LRU and what is a cache LRU stands for at least recently used it is a cache eviction policy when we have a... | LRU Cache | lru-cache | Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**.
Implement the `LRUCache` class:
* `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`.
* `int get(int key)` Return the valu... | null | Hash Table,Linked List,Design,Doubly-Linked List | Medium | 460,588,604,1903 |
203 | Jai Hind is the problem now to remove Samudra Notes from a single East West which does not indicate severe mode on words which has the value of two Souls with a result a very simple but want to give a great subscribe and subscribe the Video then subscribe to the Page as given to white to return new head it also possibl... | 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 |
905 | Hello hello Abhi badi welcome to my channel let's all the problem sort of my priority to Hindus problem Governor J of negative in teachers and be happy return Ajay consisting of all divine elements of a god-fearing all the elements of a god-fearing all the elements of a god-fearing all the elements of you my return ans... | Sort Array By Parity | length-of-longest-fibonacci-subsequence | Given an integer array `nums`, move all the even integers at the beginning of the array followed by all the odd integers.
Return _**any array** that satisfies this condition_.
**Example 1:**
**Input:** nums = \[3,1,2,4\]
**Output:** \[2,4,3,1\]
**Explanation:** The outputs \[4,2,3,1\], \[2,4,1,3\], and \[4,2,1,3\] w... | null | Array,Hash Table,Dynamic Programming | Medium | 1013 |
509 | hello now let's try another lead code problem number 509 Fibonacci numbers so this is a similar to the record problem number 70 climbing stairs yeah so for the first position F0 it is zero the second population F1 is 1. so for the next value it is f and minus 1 plus F and minus two and for this n model one yeah so it i... | Fibonacci Number | inorder-successor-in-bst-ii | The **Fibonacci numbers**, commonly denoted `F(n)` form a sequence, called the **Fibonacci sequence**, such that each number is the sum of the two preceding ones, starting from `0` and `1`. That is,
F(0) = 0, F(1) = 1
F(n) = F(n - 1) + F(n - 2), for n > 1.
Given `n`, calculate `F(n)`.
**Example 1:**
**Input:** n = ... | null | Tree,Binary Search Tree,Binary Tree | Medium | 285 |
179 | A fan welcome to learn to repeat studio is exactly date 25th September light change the name of the problems largest number gas cylinder from sada problem statements given a list of negatives an arranged times a day for the largest number blind returns with results also they Release That You Need To Return Nursing Staf... | Largest Number | largest-number | Given a list of non-negative integers `nums`, arrange them such that they form the largest number and return it.
Since the result may be very large, so you need to return a string instead of an integer.
**Example 1:**
**Input:** nums = \[10,2\]
**Output:** "210 "
**Example 2:**
**Input:** nums = \[3,30,34,5,9\]
*... | null | String,Greedy,Sorting | Medium | 2284 |
905 | hey what's up guys it's Nick white here I do tech encoding stuff on twitch and YouTube I playlist with all the hacker ink and Lee code solutions and we're doing the code sword array by parody basically what we do is we're given an array of integers and we want to put all the even numbers at the front in odd numbers at ... | Sort Array By Parity | length-of-longest-fibonacci-subsequence | Given an integer array `nums`, move all the even integers at the beginning of the array followed by all the odd integers.
Return _**any array** that satisfies this condition_.
**Example 1:**
**Input:** nums = \[3,1,2,4\]
**Output:** \[2,4,3,1\]
**Explanation:** The outputs \[4,2,3,1\], \[2,4,1,3\], and \[4,2,1,3\] w... | null | Array,Hash Table,Dynamic Programming | Medium | 1013 |
1,041 | Solution of welcome to line ko dp today will be looking at the 17th september 4 inch dignity problems robert appointed in circle that electric power member problem statement and internet play arrow button she stands at 0 and a not-for-profit can deceive stands at 0 and a not-for-profit can deceive stands at 0 and a not... | Robot Bounded In Circle | available-captures-for-rook | On an infinite plane, a robot initially stands at `(0, 0)` and faces north. Note that:
* The **north direction** is the positive direction of the y-axis.
* The **south direction** is the negative direction of the y-axis.
* The **east direction** is the positive direction of the x-axis.
* The **west direction**... | null | Array,Matrix,Simulation | Easy | null |
35 | Hi everyone my name is Rahul and today the lead code problem we are going to solve is to search the insert position of the element in an array. We are given an array and we have to find out if a target element is present in that array. Does it exist or not? If it exists then its position has to be returned. If it does ... | Search Insert Position | search-insert-position | Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[1,3,5,6\], target = 5
**Output:** 2
**Exa... | null | Array,Binary Search | Easy | 278 |
1,332 | hello guys welcome to algorithms made easy today we will be discussing the question remove palindroming subsequences in this question we are given a string s consisting only of letters a and b in a single step we can remove one palindromic subsequence from s we need to return the minimum number of steps to make the giv... | Remove Palindromic Subsequences | count-vowels-permutation | You are given a string `s` consisting **only** of letters `'a'` and `'b'`. In a single step you can remove one **palindromic subsequence** from `s`.
Return _the **minimum** number of steps to make the given string empty_.
A string is a **subsequence** of a given string if it is generated by deleting some characters o... | Use dynamic programming. Let dp[i][j] be the number of strings of length i that ends with the j-th vowel. Deduce the recurrence from the given relations between vowels. | Dynamic Programming | Hard | null |
134 | hello everyone let's look at gas station the problem statement is there are un-gas stations un-gas stations un-gas stations along a circular route where the amount of gas at station i is guess i we have a car with an unlimited gas tank and it used cost i of gas travel from station i to its next station i plus one we st... | Gas Station | gas-station | There are `n` gas stations along a circular route, where the amount of gas at the `ith` station is `gas[i]`.
You have a car with an unlimited gas tank and it costs `cost[i]` of gas to travel from the `ith` station to its next `(i + 1)th` station. You begin the journey with an empty tank at one of the gas stations.
Gi... | null | Array,Greedy | Medium | 1346 |
133 | Jhaal Hello Guys Welcome To Your Sons Delhi Today Financing Village Problem Statement Seervi Appointed Tax Return Adheen Kar Do Note Hai Day Give To Write Note Withdraw In Vwe Raw Ko Adjust End For Everyone He Binttu Again Call The Key Cloning Write Method Over Two years old at particular value hai loot day graph a lar... | Clone Graph | clone-graph | Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph.
Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph.
Each node in the graph contains a value (`int`) and a list (`List[Node]`)... | null | Hash Table,Depth-First Search,Breadth-First Search,Graph | Medium | 138,1624,1634 |
279 | in this problem we have to find what is the minimum number of perfect squares who whose sum is equal to a given number for example if we have a value of 20 this is our input then we can break it into 16 and 4. 16 is the square of 4 and 4 is the square of 2 so both of these are perfect squares so here the answer should ... | Perfect Squares | perfect-squares | Given an integer `n`, return _the least number of perfect square numbers that sum to_ `n`.
A **perfect square** is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, `1`, `4`, `9`, and `16` are perfect squares while `3` and `11` are not.
**Example ... | null | Math,Dynamic Programming,Breadth-First Search | Medium | 204,264 |
835 | Jhaal Hello Hi Guys Welcome To Code Virus Today's Question Is Image Overlap In This Question B312 Images And Being Replaced The Same Size Translate The Images Left Right Up And Down Is Number Of Time And Placid On The Top Of The Tree Of Life Is Translation Number Opposition In bodhi images to return to find mention in ... | Image Overlap | linked-list-components | You are given two images, `img1` and `img2`, represented as binary, square matrices of size `n x n`. A binary matrix has only `0`s and `1`s as values.
We **translate** one image however we choose by sliding all the `1` bits left, right, up, and/or down any number of units. We then place it on top of the other image. W... | null | Hash Table,Linked List | Medium | 2299 |
1,046 | give us a collection of rocks each Rock contains and positive integer value as its weight each time we take the two heaviest the rocks and smash them and only the remaining weight stays returned the last value in this array after we smashing all of the possible rocks how would you do that's about today's video last I m... | Last Stone Weight | max-consecutive-ones-iii | You are given an array of integers `stones` where `stones[i]` is the weight of the `ith` stone.
We are playing a game with the stones. On each turn, we choose the **heaviest two stones** and smash them together. Suppose the heaviest two stones have weights `x` and `y` with `x <= y`. The result of this smash is:
* I... | One thing's for sure, we will only flip a zero if it extends an existing window of 1s. Otherwise, there's no point in doing it, right? Think Sliding Window! Since we know this problem can be solved using the sliding window construct, we might as well focus in that direction for hints. Basically, in a given window, we c... | Array,Binary Search,Sliding Window,Prefix Sum | Medium | 340,424,485,487,2134 |
520 | um hello so today we are going to continue on January daily challenge so this problem detects Capital um so what the problem says is we get a string word um here and what we want is we have a definition of um a usage of capitals being right and it's right when all the letters in the words are capital for example USA or... | 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 |
393 | all right so hello and welcome howdy i had an issue just a moment ago where uh oh no can't forget i'm so annoyed i don't know i'm kind of distracted right now but my mind is all over the place but uh i'm already irritated i have to get irritated uh that's all right um okay so it's a great way to start i had already had... | UTF-8 Validation | utf-8-validation | Given an integer array `data` representing the data, return whether it is a valid **UTF-8** encoding (i.e. it translates to a sequence of valid UTF-8 encoded characters).
A character in **UTF8** can be from **1 to 4 bytes** long, subjected to the following rules:
1. For a **1-byte** character, the first bit is a `0`... | All you have to do is follow the rules. For a given integer, obtain its binary representation in the string form and work with the rules given in the problem. An integer can either represent the start of a UTF-8 character, or a part of an existing UTF-8 character. There are two separate rules for these two scenarios in... | Array,Bit Manipulation | Medium | null |
100 | hi everybody this is Fisher Koda here as I have a lot of queries from YouTube people asking me to go through questions about trees especially binary trees or binary search trees or different sorts of trees so today I'm going through the code problem 100 very basic question but it's good to brush up on the very basics b... | Same Tree | same-tree | Given the roots of two binary trees `p` and `q`, write a function to check if they are the same or not.
Two binary trees are considered the same if they are structurally identical, and the nodes have the same value.
**Example 1:**
**Input:** p = \[1,2,3\], q = \[1,2,3\]
**Output:** true
**Example 2:**
**Input:** p... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
659 | hello everyone welcome to coding decoded my name is sansa deja i'm working as technical architect at adobe and here i present a 19th of august liquid challenge and for your surprise after so many days i'm witnessing a question that i haven't solved in the past the problem statement is a very interesting problem and you... | Split Array into Consecutive Subsequences | split-array-into-consecutive-subsequences | You are given an integer array `nums` that is **sorted in non-decreasing order**.
Determine if it is possible to split `nums` into **one or more subsequences** such that **both** of the following conditions are true:
* Each subsequence is a **consecutive increasing sequence** (i.e. each integer is **exactly one** m... | null | Array,Hash Table,Greedy,Heap (Priority Queue) | Medium | 347,1422 |
27 | in this video we'll go over lead code question number 27 remove element given an array called nums and an integer called Val our goal is to remove all occurrences of Val in the nums array and we must do it in place but there's also a Twist let's say that there are K elements in the array that are not equal to Val then ... | 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 |
528 | Yo Welcome to Record History of Net YouTube Channel Please subscribe Solar Light of Computer Problems Create Problems of Random Pick with Weight Some Problems Its and Prohibition W Positivity Saver W Fight Script Belt Join Aankh Sahitya Front Function Fix Vidya Randomly Picks and Jokes in The proposed into it's best to... | 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 |
1,439 | hello guys welcome back to the channel so guys in this video we will be solving lead code problem number 1439 find the kth smallest sum of a matrix with sorted rows so let's first understand the problem statement the problem is saying you are given a matrix of size m cross n and then integer k which has its row sorted ... | Find the Kth Smallest Sum of a Matrix With Sorted Rows | running-total-for-different-genders | You are given an `m x n` matrix `mat` that has its rows sorted in non-decreasing order and an integer `k`.
You are allowed to choose **exactly one element** from each row to form an array.
Return _the_ `kth` _smallest array sum among all possible arrays_.
**Example 1:**
**Input:** mat = \[\[1,3,11\],\[2,4,6\]\], k ... | null | Database | Medium | 1327 |
910 | hello guys so today i am going to explain lead for problem number 910 the smallest range we are given an array of integers and we can do either of the two operations that is decrease the analysis of the array by k or increase the element by k we cannot do anything other than this and we can do this operation only once ... | Smallest Range II | nth-magical-number | You are given an integer array `nums` and an integer `k`.
For each index `i` where `0 <= i < nums.length`, change `nums[i]` to be either `nums[i] + k` or `nums[i] - k`.
The **score** of `nums` is the difference between the maximum and minimum elements in `nums`.
Return _the minimum **score** of_ `nums` _after changi... | null | Math,Binary Search | Hard | null |
435 | Hello hello guys welcome back to take division in this video you will see the noble shopping intervals problem which is established as dog is challenge and this will be dongri algorithm so let's read problem solve this problem we have collection of rare to find the number of units which are in Order to make the no veer... | Non-overlapping Intervals | non-overlapping-intervals | Given an array of intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping_.
**Example 1:**
**Input:** intervals = \[\[1,2\],\[2,3\],\[3,4\],\[1,3\]\]
**Output:** 1
**Explanation:** \[1,3\] can be removed ... | null | Array,Dynamic Programming,Greedy,Sorting | Medium | 452 |
1,048 | hey everyone today we are going to serve the editable question longest string chain so you are given array of words where each word consists of lowest case English letters so what a is a predecessor of word b if and only if we can insert exactly one letter anywhere in word way without changing the order of the other ch... | Longest String Chain | clumsy-factorial | You are given an array of `words` where each word consists of lowercase English letters.
`wordA` is a **predecessor** of `wordB` if and only if we can insert **exactly one** letter anywhere in `wordA` **without changing the order of the other characters** to make it equal to `wordB`.
* For example, `"abc "` is a **... | null | Math,Stack,Simulation | Medium | null |
1,614 | hi welcome guys so that song is very simple question called maximum listing that's or the parenthesis so string is valid uh parenthesis string of vps if the mid following uh empty so empty is uh string or single uh character not equals to this or this and you can be written as a b so basically it's the valid parenthesi... | Maximum Nesting Depth of the Parentheses | maximum-nesting-depth-of-the-parentheses | A string is a **valid parentheses string** (denoted **VPS**) if it meets one of the following:
* It is an empty string `" "`, or a single character not equal to `"( "` or `") "`,
* It can be written as `AB` (`A` concatenated with `B`), where `A` and `B` are **VPS**'s, or
* It can be written as `(A)`, where `A` i... | null | null | Easy | null |
357 | welcome guys welcome to my little song in section 357 uh so uh right so this problem is basically it looks like a high school i mean high school mathematics right it should not be on should not be only code right but we can still solve it uh just for fun so given integer n return the count of all numbers with the unit ... | Count Numbers with Unique Digits | count-numbers-with-unique-digits | Given an integer `n`, return the count of all numbers with unique digits, `x`, where `0 <= x < 10n`.
**Example 1:**
**Input:** n = 2
**Output:** 91
**Explanation:** The answer should be the total numbers in the range of 0 <= x < 100, excluding 11,22,33,44,55,66,77,88,99
**Example 2:**
**Input:** n = 0
**Output:** 1... | A direct way is to use the backtracking approach. Backtracking should contains three states which are (the current number, number of steps to get that number and a bitmask which represent which number is marked as visited so far in the current number). Start with state (0,0,0) and count all valid number till we reach n... | Math,Dynamic Programming,Backtracking | Medium | null |
825 | hey guys how's everything going this is chaser in this video I'm going to take a look at a two five friends of appropriate ages some people will make friends request the list of the ages is given that ages array and the HSI is the age of Earth person a will not make friends request way the person B okay B is not equal ... | Friends Of Appropriate Ages | max-increase-to-keep-city-skyline | There are `n` persons on a social media website. You are given an integer array `ages` where `ages[i]` is the age of the `ith` person.
A Person `x` will not send a friend request to a person `y` (`x != y`) if any of the following conditions is true:
* `age[y] <= 0.5 * age[x] + 7`
* `age[y] > age[x]`
* `age[y] >... | null | Array,Greedy,Matrix | Medium | null |
80 | hello everyone in this video we will be solving problem 80. remove duplicates from a sorted array level 2. the problem statement is we are given an integer error in nums which is sorted in a bond decreasing order which means increasing or ascending we need to remove the duplicates in place such that each unique element... | Remove Duplicates from Sorted Array II | remove-duplicates-from-sorted-array-ii | Given an integer array `nums` sorted in **non-decreasing order**, remove some duplicates [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm) such that each unique element appears **at most twice**. The **relative order** of the elements should be kept the **same**.
Since it is impossible to change the len... | null | Array,Two Pointers | Medium | 26 |
1,573 | hey what's up guys john here again so today let's take a look at uh this week's uh bi-weekly contest problem this week's uh bi-weekly contest problem this week's uh bi-weekly contest problem one of the problem here number 1573 oh my god it's over 1500 okay number of ways to split a string okay and okay so you're given ... | Number of Ways to Split a String | find-two-non-overlapping-sub-arrays-each-with-target-sum | Given a binary string `s`, you can split `s` into 3 **non-empty** strings `s1`, `s2`, and `s3` where `s1 + s2 + s3 = s`.
Return the number of ways `s` can be split such that the number of ones is the same in `s1`, `s2`, and `s3`. Since the answer may be too large, return it **modulo** `109 + 7`.
**Example 1:**
**Inp... | Let's create two arrays prefix and suffix where prefix[i] is the minimum length of sub-array ends before i and has sum = k, suffix[i] is the minimum length of sub-array starting at or after i and has sum = k. The answer we are searching for is min(prefix[i] + suffix[i]) for all values of i from 0 to n-1 where n == arr.... | Array,Hash Table,Binary Search,Dynamic Programming,Sliding Window | Medium | null |
1,751 | Hello friends welcome to code Sutra let's all lead code problem number 1751 maximum number of events that can be attended and this is the second version of the problem in this problem we are given an events array and what does this indicate this indicates that one of the event starts on day one and on day two it will e... | Maximum Number of Events That Can Be Attended II | slowest-key | You are given an array of `events` where `events[i] = [startDayi, endDayi, valuei]`. The `ith` event starts at `startDayi` and ends at `endDayi`, and if you attend this event, you will receive a value of `valuei`. You are also given an integer `k` which represents the maximum number of events you can attend.
You can o... | Get for each press its key and amount of time taken. Iterate on the presses, maintaining the answer so far. The current press will change the answer if and only if its amount of time taken is longer than that of the previous answer, or they are equal but the key is larger than that of the previous answer. | Array,String | Easy | null |
1,004 | So hey professional maximum consecutive errors and wait k return d maximum number of consecutive advances make it 3 ok so I started from here only k time can be present means if I started from here then zero came k value was three Meaning, you can consider three times 0 as half van, which means you can convert this zer... | Max Consecutive Ones III | least-operators-to-express-number | Given a binary array `nums` and an integer `k`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most_ `k` `0`'s.
**Example 1:**
**Input:** nums = \[1,1,1,0,0,0,1,1,1,1,0\], k = 2
**Output:** 6
**Explanation:** \[1,1,1,0,0,**1**,1,1,1,1,**1**\]
Bolded numbers were flipped from 0 to 1.... | null | Math,Dynamic Programming | Hard | null |
513 | hey everyone today we are going to solve theal question find bottom left three value okay so let me explain with this example so typically there are two ways to tr three right breast F such and death suchar so in this case which trasor is better from my perspective I think breast f sarch is better than death F suchar w... | Find Bottom Left Tree Value | find-bottom-left-tree-value | Given the `root` of a binary tree, return the leftmost value in the last row of the tree.
**Example 1:**
**Input:** root = \[2,1,3\]
**Output:** 1
**Example 2:**
**Input:** root = \[1,2,3,4,null,5,6,null,null,7\]
**Output:** 7
**Constraints:**
* The number of nodes in the tree is in the range `[1, 104]`.
* `-... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
220 | hey what's up guys john here again so today uh let's take a look at this uh lethal problem here number 220 contains duplicate number three so this one gets a lot of like downloads i'm going to give it my own uploads okay so you're given like an array of integers okay and then you need to find out whether there are two ... | 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,213 | this is Widow to question number 1213 intersection of three sorry Dori this is eg question let's get into given three integer arrays or a1 or a2 and a3 sorted in strictly increasing order the Eternals or array of only the integer death of peered in all three array okay let's check the reason for one in this case one tw... | Intersection of Three Sorted Arrays | handshakes-that-dont-cross | Given three integer arrays `arr1`, `arr2` and `arr3` **sorted** in **strictly increasing** order, return a sorted array of **only** the integers that appeared in **all** three arrays.
**Example 1:**
**Input:** arr1 = \[1,2,3,4,5\], arr2 = \[1,2,5,7,9\], arr3 = \[1,3,4,5,8\]
**Output:** \[1,5\]
**Explanation:** Only 1... | Use dynamic programming. Let dp[n] be the number of ways that n people can handshake. Then fix a person as a pivot and turn for every other person who will have a handshake, the answer is the sum of the products of the new two subproblems. | Math,Dynamic Programming | Hard | null |
818 | hey everyone uh welcome back to such recorder uh this is Ravina and today we are gonna look at problem 8 18 which is race car this is uh the most frequently Asked Google question in 22. uh now let's start by reading the problem says your car starts at position 0 and speed plus 1 on an infinite number line you can your ... | Race Car | similar-rgb-color | Your car starts at position `0` and speed `+1` on an infinite number line. Your car can go into negative positions. Your car drives automatically according to a sequence of instructions `'A'` (accelerate) and `'R'` (reverse):
* When you get an instruction `'A'`, your car does the following:
* `position += spee... | null | Math,String,Enumeration | Easy | null |
47 | let's do the thirty-seventh problem let's do the thirty-seventh problem let's do the thirty-seventh problem illegal abomination to given a collection of numbers that might contain duplicate return all possible unique combinations so and this is a bit tricky problem okay you know none of our previous work finish the way... | Permutations II | permutations-ii | Given a collection of numbers, `nums`, that might contain duplicates, return _all possible unique permutations **in any order**._
**Example 1:**
**Input:** nums = \[1,1,2\]
**Output:**
\[\[1,1,2\],
\[1,2,1\],
\[2,1,1\]\]
**Example 2:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,... | null | Array,Backtracking | Medium | 31,46,267,1038 |
115 | welcome to september's leeco challenge today's problem is distinct subsequences given two strings s and t return the number of distinct subsequences of s which equal t a string subsequence is a new string formed from the original string by deleting some can be none of the characters without disturbing the remaining cha... | Distinct Subsequences | distinct-subsequences | Given two strings `s` and `t`, return _the number of distinct_ **_subsequences_** _of_ `s` _which equals_ `t`.
The test cases are generated so that the answer fits on a 32-bit signed integer.
**Example 1:**
**Input:** s = "rabbbit ", t = "rabbit "
**Output:** 3
**Explanation:**
As shown below, there are 3 ways you... | null | String,Dynamic Programming | Hard | 2115 |
7 | so hey guys welcome back so in this video we are going to solve the problem named as reverse integer so basically we are given a signed 32-bit integer X so are given a signed 32-bit integer X so are given a signed 32-bit integer X so we have to return x with its digits reversed right so if reversing X causes the value ... | Reverse Integer | reverse-integer | Given a signed 32-bit integer `x`, return `x` _with its digits reversed_. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-231, 231 - 1]`, then return `0`.
**Assume the environment does not allow you to store 64-bit integers (signed or unsigned).**
**Example 1:**
**Input:** x = 123
... | null | Math | Medium | 8,190,2238 |
287 | Yes, hello developer. Today's Prole problem, which has been migrated to Children's Gaebing, is how the finder tipple ended at number 287. The integer multiplier is given. Now, it is an integer array that increases sequentially from 1 to n. So there is only one duplicate number. This is a problem of implementing a funct... | 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 |
149 | and welcome to my channel so in this video i'm going to try to solve this problem and also do some live coding work at the same time i'm going to try to follow the general steps we should follow including interview so before we start the coding question i would really appreciate that if you can help us go on this chann... | Max Points on a Line | max-points-on-a-line | Given an array of `points` where `points[i] = [xi, yi]` represents a point on the **X-Y** plane, return _the maximum number of points that lie on the same straight line_.
**Example 1:**
**Input:** points = \[\[1,1\],\[2,2\],\[3,3\]\]
**Output:** 3
**Example 2:**
**Input:** points = \[\[1,1\],\[3,2\],\[5,3\],\[4,1\]... | null | Array,Hash Table,Math,Geometry | Hard | 356,2287 |
1,298 | hello so continuing on with code contest weekly contest 168 this is the last problem maximum candies you can get from boxes problem number one thousand two hundred ninety eight so the problem says we have n boxes and each box is given in the format status candies keys and content boxes such that status at position I co... | Maximum Candies You Can Get from Boxes | reverse-substrings-between-each-pair-of-parentheses | You have `n` boxes labeled from `0` to `n - 1`. You are given four arrays: `status`, `candies`, `keys`, and `containedBoxes` where:
* `status[i]` is `1` if the `ith` box is open and `0` if the `ith` box is closed,
* `candies[i]` is the number of candies in the `ith` box,
* `keys[i]` is a list of the labels of th... | Find all brackets in the string. Does the order of the reverse matter ? The order does not matter. | String,Stack | Medium | null |
260 | hey everybody this is larry this is day 5 day 6 of the leco daily challenge uh day 6 of the legal daily challenge hit the like button hit the subscribe and join me on discord let me know what you think about today's prom also just want to say happy diwali to people who celebrate it uh yeah anyway today's problem is sin... | Single Number III | single-number-iii | Given an integer array `nums`, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in **any order**.
You must write an algorithm that runs in linear runtime complexity and uses only constant extra space.
... | null | Array,Bit Manipulation | Medium | 136,137 |
49 | all right let's do Lee code 49 group anagrams uh in JavaScript this is a medium problem uh they want you to group all of uh the words in here that are anagrams together so for the output example um Nat and Tanner anagrams of each other so group those together put them in Array and do the same thing for any other words ... | Group Anagrams | group-anagrams | Given an array of strings `strs`, group **the anagrams** together. You can 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:**
**Input:** strs = \["eat","tea","tan... | null | Hash Table,String,Sorting | Medium | 242,249 |
823 | hey what's up guys uh this is juan here so this time let's take a look at today's daily challenge problem uh number 823 binary trees which factors so you're given like an array of unique integers right and where each integers is strictly greater than one and we need to make uh you can make a binary tree uh using these ... | Binary Trees With Factors | split-array-with-same-average | Given an array of unique integers, `arr`, where each integer `arr[i]` is strictly greater than `1`.
We make a binary tree using these integers, and each number may be used for any number of times. Each non-leaf node's value should be equal to the product of the values of its children.
Return _the number of binary tre... | null | Array,Math,Dynamic Programming,Bit Manipulation,Bitmask | Hard | 2162 |
191 | hey everybody let's Sol today's lead Cod Challenge which is number of one bits so in this problem we are given an integer number and what we have to return is the number of set bit in its binary representation so let's say for n = to representation so let's say for n = to representation so let's say for n = to 11 what ... | Number of 1 Bits | number-of-1-bits | Write a function that takes the binary representation of an unsigned integer and returns the number of '1' bits it has (also known as the [Hamming weight](http://en.wikipedia.org/wiki/Hamming_weight)).
**Note:**
* Note that in some languages, such as Java, there is no unsigned integer type. In this case, the input ... | null | Bit Manipulation | Easy | 190,231,338,401,461,693,767 |
1,041 | hi everyone today we are going to discuss about the problem of robot bounded in circle this is little bit tricky problem but it's very easy try i'll try my best to explain this in a very easy manner so let's start it so this is the problem statement what it was written that on a infinite plane a robot initially stand a... | Robot Bounded In Circle | available-captures-for-rook | On an infinite plane, a robot initially stands at `(0, 0)` and faces north. Note that:
* The **north direction** is the positive direction of the y-axis.
* The **south direction** is the negative direction of the y-axis.
* The **east direction** is the positive direction of the x-axis.
* The **west direction**... | null | Array,Matrix,Simulation | Easy | null |
1 | let's all leak code one to some the most popular leak code question so we're given an input array and some target in this case 9 and we want to find the two values in this input array that sum to 9 so in this case it's 2 & 7 now we want so in this case it's 2 & 7 now we want so in this case it's 2 & 7 now w... | 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 |
1,765 | hey there everyone i'm your host faraz we are solving the contest by weekly contest 46 and this is the problem number three so let us go through the problem statement once we are given a matrix m cross n and each cell is either zero or one zero represent land and one represents water now we have to return a matrix of s... | Map of Highest Peak | merge-in-between-linked-lists | You are given an integer matrix `isWater` of size `m x n` that represents a map of **land** and **water** cells.
* If `isWater[i][j] == 0`, cell `(i, j)` is a **land** cell.
* If `isWater[i][j] == 1`, cell `(i, j)` is a **water** cell.
You must assign each cell a height in a way that follows these rules:
* The... | Check which edges need to be changed. Let the next node of the (a-1)th node of list1 be the 0-th node in list 2. Let the next node of the last node of list2 be the (b+1)-th node in list 1. | Linked List | Medium | null |
1,008 | Scientist A I Video I Hop Alia Doing Good Welcome to the Land Co DEA and Today Khavan Equations Construct Binary Search Tree From Preorder Traversal Edit This October Challenge October Liquid Challenge Questions and Cities Given in This You Have a Preorder Traversal Are Like This One and you have constructed last from ... | 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 |
811 | hi this is ike so today we're just on lead code i think i'll just pick a random easy problem and try to solve it so let's there's a whole bunch of problems here i'm just going to click pick one uh we might get a problem that's not easy but we can always just keep trying again all right so we finally got an easy problem... | Subdomain Visit Count | number-of-subarrays-with-bounded-maximum | A website domain `"discuss.leetcode.com "` consists of various subdomains. At the top level, we have `"com "`, at the next level, we have `"leetcode.com "` and at the lowest level, `"discuss.leetcode.com "`. When we visit a domain like `"discuss.leetcode.com "`, we will also visit the parent domains `"leetcode.com "` a... | null | Array,Two Pointers | Medium | null |
1,704 | hey YouTube welcome back today we have this problem it's called determine if string helvis are alike uh halves are alike you are given a string s of even length uh split this string into two halves of equal lengths and let a be the first and half and B be the first half two strings are alike if they have the same numbe... | 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 |
190 | in this problem we have to reverse the bits of an unsigned integer and it's very clear from this title that we have to reverse the bits so let's say our integer is represented in just 3 bits i cannot draw 32 bits here so what we have to do this least significant bit should become most significant bit so this comes here... | 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 |
289 | welcome to december's lee code challenge this problem is called game of life according to the wikipedia's article the game of life also known simply as life is a cellular automation device by the british mathematician john horton conway in 1970. now the board is made up of m times n grid of cells where each cell has an... | Game of Life | game-of-life | According to [Wikipedia's article](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life): "The **Game of Life**, also known simply as **Life**, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. "
The board is made up of an `m x n` grid of cells, where each cell has an initial st... | null | Array,Matrix,Simulation | Medium | 73 |
94 | Hello Hi Guys Welcome Back To My Channel Short Wave And Discuss About The Amazing That They Are Here I Am Linking In The Eye Button For You First Go Watch The Video Of Free Mode On Opposite Reversal And Come After Watching Migratory Key And Henry Kiwi. That if you have seen that then it is for you it's not given a guys... | Binary Tree Inorder Traversal | binary-tree-inorder-traversal | Given the `root` of a binary tree, return _the inorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[1,3,2\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of nodes i... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 98,144,145,173,230,272,285,758,799 |
146 | hey guys welcome back today we're going to solve lru cash problem number 146 on Lee code so the problem statement says to design a data structure that follows the constraints of a least recently used cache first we'll talk about what an lru cache is and then we'll jump into the code okay let's get started a great way t... | LRU Cache | lru-cache | Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**.
Implement the `LRUCache` class:
* `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`.
* `int get(int key)` Return the valu... | null | Hash Table,Linked List,Design,Doubly-Linked List | Medium | 460,588,604,1903 |
165 | Jhaal Hello Everyone 123 Question is compare version numbers question sir state will give one to two a view to zoom two version settings on mp and contain any digit give one different 2.5 is not two and half mitthu one different 2.5 is not two and half mitthu one different 2.5 is not two and half mitthu version is The ... | Compare Version Numbers | compare-version-numbers | Given two version numbers, `version1` and `version2`, compare them.
Version numbers consist of **one or more revisions** joined by a dot `'.'`. Each revision consists of **digits** and may contain leading **zeros**. Every revision contains **at least one character**. Revisions are **0-indexed from left to right**, wit... | null | Two Pointers,String | Medium | null |
48 | given an n-by-n 2d matrix representing given an n-by-n 2d matrix representing given an n-by-n 2d matrix representing an image you are asked to rotate this image 90 degrees clockwise how can you do that in place that's about today's video let's get into it hi everyone this is Steve here today we're going through a legal... | 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 |
188 | hi guys hope you're doing great our today's question is person to buy and sell stop for so the question says here you're given an array for which the ayat element is surprise the for given stock one day I design little want them to find the maximum profit you may complete at Milewski transactions you may not engage in ... | Best Time to Buy and Sell Stock IV | best-time-to-buy-and-sell-stock-iv | You are given an integer array `prices` where `prices[i]` is the price of a given stock on the `ith` day, and an integer `k`.
Find the maximum profit you can achieve. You may complete at most `k` transactions: i.e. you may buy at most `k` times and sell at most `k` times.
**Note:** You may not engage in multiple tran... | null | Array,Dynamic Programming | Hard | 121,122,123 |
1,673 | welcome to january's leeco challenge today's problem is find the most competitive subsequence given an integer array nums and a positive integer k we turn the most competitive subsequence of nums of size k now an array's subsequence is a resulting sequence obtained by erasing some elements from the array now we define ... | Find the Most Competitive Subsequence | find-the-most-competitive-subsequence | Given an integer array `nums` and a positive integer `k`, return _the most **competitive** subsequence of_ `nums` _of size_ `k`.
An array's subsequence is a resulting sequence obtained by erasing some (possibly zero) elements from the array.
We define that a subsequence `a` is more **competitive** than a subsequence ... | null | null | Medium | null |
8 | Hello everyone, today we do daily properties, problem number one student teacher is that keep that stick straight and we have to wait and whatever stain was taken was between zero to 200 and whatever system you have in that. In that or you can go back, you can go to the positive side and on it, any other base invalid s... | String to Integer (atoi) | string-to-integer-atoi | Implement the `myAtoi(string s)` function, which converts a string to a 32-bit signed integer (similar to C/C++'s `atoi` function).
The algorithm for `myAtoi(string s)` is as follows:
1. Read in and ignore any leading whitespace.
2. Check if the next character (if not already at the end of the string) is `'-'` or `... | null | String | Medium | 7,65,2168 |
1,406 | hello everyone in this video I am going to cover the concept of dynamic programming using the problem stone game 3 so I'm going to tell you the step by step procedure how to approach a problem starting from the most easy recursive solution the most optimized dynamic programming solution so please go to the entire video... | Stone Game III | subtract-the-product-and-sum-of-digits-of-an-integer | Alice and Bob continue their games with piles of stones. There are several stones **arranged in a row**, and each stone has an associated value which is an integer given in the array `stoneValue`.
Alice and Bob take turns, with Alice starting first. On each player's turn, that player can take `1`, `2`, or `3` stones f... | How to compute all digits of the number ? Use modulus operator (%) to compute the last digit. Generalise modulus operator idea to compute all digits. | Math | Easy | null |
983 | hi today i'm talking about leak code problem 983 minimum cost for tickets this problem asks you to write a function that will take a list of days and a list of costs and so days works by having a number of days that you're going to want to have a train ticket for so in this example you want to have a train ticket that ... | Minimum Cost For Tickets | validate-stack-sequences | You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array `days`. Each day is an integer from `1` to `365`.
Train tickets are sold in **three different ways**:
* a **1-day** pass is sold for `costs[0]` dollars,
* a **7-day** pass is sold... | null | Array,Stack,Simulation | Medium | null |
337 | hi all today we'll be talking about a lead code problem house robber 3. let us go through the problem statement first the thief has found himself a new place for his thievery again there is only one entrance to this area called route besides the route each house has one and only one parent house after a tour the smart ... | 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 |
107 | everyone welcome to another one of my league code videos and in this video you talk about number 107 which is binary tree level order traversal 2 so if you haven't seen the video on the binary tree level order traversal 102 I recommend watching that first because that gives an example of what in level order traversal i... | Binary Tree Level Order Traversal II | binary-tree-level-order-traversal-ii | Given the `root` of a binary tree, return _the bottom-up level order traversal of its nodes' values_. (i.e., from left to right, level by level from leaf to root).
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[15,7\],\[9,20\],\[3\]\]
**Example 2:**
**Input:** root = \[1\]
**Output:** \[... | null | Tree,Breadth-First Search,Binary Tree | Medium | 102,637 |
92 | hello everyone welcome back here is van damson and today we are diving deep into fascinating data structure problem reversing a service within a linked list so you would be surprised how often this question like this come up in technical interview so uh let's get started but before we jump in if you are new here hit th... | Reverse Linked List II | reverse-linked-list-ii | Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], left = 2, right = 4
**Output:** \[1,4,3,2,5\]
**Example 2:**
**I... | null | Linked List | Medium | 206 |
834 | hey what's up guys this is chung here so it's lit called time again and today let's take a look at number 834 sum of distances in three this one is a really tricky problem and it's a hard one it's really it's kind of hard and the solution is hard it's really hard to come up with all right anyway let's take a look so yo... | Sum of Distances in Tree | ambiguous-coordinates | There is an undirected connected tree with `n` nodes labeled from `0` to `n - 1` and `n - 1` edges.
You are given the integer `n` and the array `edges` where `edges[i] = [ai, bi]` indicates that there is an edge between nodes `ai` and `bi` in the tree.
Return an array `answer` of length `n` where `answer[i]` is the s... | null | String,Backtracking | Medium | null |
1,833 | all right let's talk about the maximum ice cream bars so basically you have an ice cream and then you have you are giving the arrow of course and then for every single class i represent the i ice cream and you have a number of coins and you have to return the maximum number of the ice cream uh four coins so uh the boy ... | Maximum Ice Cream Bars | find-the-highest-altitude | It is a sweltering summer day, and a boy wants to buy some ice cream bars.
At the store, there are `n` ice cream bars. You are given an array `costs` of length `n`, where `costs[i]` is the price of the `ith` ice cream bar in coins. The boy initially has `coins` coins to spend, and he wants to buy as many ice cream bar... | Let's note that the altitude of an element is the sum of gains of all the elements behind it Getting the altitudes can be done by getting the prefix sum array of the given array | Array,Prefix Sum | Easy | null |
1,189 | welcome back guys today we are going to solve it for problem 1189 maximum number of balloons given string text you want to use the characters of text to form as many instances of the word balloon as possible you can use each character index at most once return maximum number of instances of word balloon that can be for... | Maximum Number of Balloons | encode-number | Given a string `text`, you want to use the characters of `text` to form as many instances of the word **"balloon "** as possible.
You can use each character in `text` **at most once**. Return the maximum number of instances that can be formed.
**Example 1:**
**Input:** text = "nlaebolko "
**Output:** 1
**Example 2... | Try to find the number of binary digits returned by the function. The pattern is to start counting from zero after determining the number of binary digits. | Math,String,Bit Manipulation | Medium | 1070 |
284 | hello everyone so in this video let us talk about one more medium level problem from lead code the problem name is speaking iterator so the problem statement goes like this that you have to design an iterator that's supposed to Peak operation on an existing iterator in addition to the has next and next operation so you... | Peeking Iterator | peeking-iterator | Design an iterator that supports the `peek` operation on an existing iterator in addition to the `hasNext` and the `next` operations.
Implement the `PeekingIterator` class:
* `PeekingIterator(Iterator nums)` Initializes the object with the given integer iterator `iterator`.
* `int next()` Returns the next element... | Think of "looking ahead". You want to cache the next element. Is one variable sufficient? Why or why not? Test your design with call order of peek() before next() vs next() before peek(). For a clean implementation, check out Google's guava library source code. | Array,Design,Iterator | Medium | 173,251,281 |
135 | well today's problem is candy and this is the lead code heart problem but actually this is very easy problem so we'll see the problem now so there are n children standing in a line each child is assigned a rating value given in the array ratings okay means like uh there's the array within size n and that array contains... | 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 |
528 | welcome to June's legal challenge today's problem is random pick with weight given an array W of positive integers where each element describes the weight of index I write a function pick index which randomly picks an index in proportion to its weight this problem is poorly worded but here's what they mean say we're gi... | 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 |
680 | okay welcome back to algojs today's question is leak code 680 of valid palindrome 2. so given a string return true if the string can be a palindrome after deleting at most one character from it you do have the option to remove exactly one character from the string so in this question you have the option of removing one... | Valid Palindrome II | valid-palindrome-ii | Given a string `s`, return `true` _if the_ `s` _can be palindrome after deleting **at most one** character from it_.
**Example 1:**
**Input:** s = "aba "
**Output:** true
**Example 2:**
**Input:** s = "abca "
**Output:** true
**Explanation:** You could delete the character 'c'.
**Example 3:**
**Input:** s = "a... | null | Two Pointers,String,Greedy | Easy | 125,1178 |
1,646 | hello guys I'm anit in this video we shall see another problem on lead code get maximum in generated array so you given an integer n a zero index integer array of length n+ 1 is generated in the array of length n+ 1 is generated in the array of length n+ 1 is generated in the following way okay so they given an integer... | Get Maximum in Generated Array | kth-missing-positive-number | You are given an integer `n`. A **0-indexed** integer array `nums` of length `n + 1` is generated in the following way:
* `nums[0] = 0`
* `nums[1] = 1`
* `nums[2 * i] = nums[i]` when `2 <= 2 * i <= n`
* `nums[2 * i + 1] = nums[i] + nums[i + 1]` when `2 <= 2 * i + 1 <= n`
Return _the **maximum** integer in the... | Keep track of how many positive numbers are missing as you scan the array. | Array,Binary Search | Easy | 2305 |
1,171 | hey everybody this is Larry it's November 9th uh 2022. this is the second bonus question I put today just because the other one was like a minute question so let's uh let's kind of take a look in another medium one or maybe all medium ones I kind of like that maybe I'm just you know I haven't done medium ones for a ran... | 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 |
60 | hey guys how-how's is everything going hey guys how-how's is everything going hey guys how-how's is everything going to say that's a critical number 60 least updates codes permutation sequence we are getting a set 1 to n we will we need to find the cave permutation sequence like 1 2 3 1 3 2 1 and this is the restrictio... | 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,059 | hey everybody this is Larry this is uh January 26th of 2023 and I'm doing a bonus question uh for y'all uh hopefully a premium one or I don't even care if it's premium or not just what it's going to be one that I haven't done regardless so let's do it um and of course we get a SQL question I'll probably do an asking a ... | All Paths from Source Lead to Destination | missing-element-in-sorted-array | Given the `edges` of a directed graph where `edges[i] = [ai, bi]` indicates there is an edge between nodes `ai` and `bi`, and two nodes `source` and `destination` of this graph, determine whether or not all paths starting from `source` eventually, end at `destination`, that is:
* At least one path exists from the `s... | First define a function f(x) that counts the number of missing elements until x. Then use binary search with the given function f(x) to find the kth missing element. | Array,Binary Search | Medium | null |
844 | hello everyone welcome or welcome back to my channel so today we are going to discuss another problem is backspace string compare it's very easy problem as i have stated it's easy so see what the problem is that we are given two strings s and d and we need to return true if they are equal when both are typed into empty... | Backspace String Compare | backspace-string-compare | Given two strings `s` and `t`, return `true` _if they are equal when both are typed into empty text editors_. `'#'` means a backspace character.
Note that after backspacing an empty text, the text will continue empty.
**Example 1:**
**Input:** s = "ab#c ", t = "ad#c "
**Output:** true
**Explanation:** Both s and t... | null | null | Easy | null |
202 | all right it's the second day of quarantine recoding challenge the today's question is happy number we need a ride our algorithm to determine if the number is happy or not so you're happy number is defined as the following process we start with a possible positive integer which I guess is the input number we replace th... | Happy Number | happy-number | Write an algorithm to determine if a number `n` is happy.
A **happy number** is a number defined by the following process:
* Starting with any positive integer, replace the number by the sum of the squares of its digits.
* Repeat the process until the number equals 1 (where it will stay), or it **loops endlessly ... | null | Hash Table,Math,Two Pointers | Easy | 141,258,263,2076 |
368 | welcome to the daily challenge today is February n and it's New Year's Eve so I have a lot of time to record this video and this time I try to using different ways to display I wrote down the solution idea first and then it hope it will be more clear let's started this problem is largest divisible subset it's kind of i... | Largest Divisible Subset | largest-divisible-subset | Given a set of **distinct** positive integers `nums`, return the largest subset `answer` such that every pair `(answer[i], answer[j])` of elements in this subset satisfies:
* `answer[i] % answer[j] == 0`, or
* `answer[j] % answer[i] == 0`
If there are multiple solutions, return any of them.
**Example 1:**
**Inp... | null | Array,Math,Dynamic Programming,Sorting | Medium | null |
896 | foreign let's take a now we run the follow or in I equal to 1. from here till the end of the y i equal to will compare I with I minus 1 that's what I equal to 1. I lesser than uh num start length and I plus by any time let's take for the ascending Arena ascending order so by any time if we get like terms of I is less t... | Monotonic Array | smallest-subtree-with-all-the-deepest-nodes | An array is **monotonic** if it is either monotone increasing or monotone decreasing.
An array `nums` is monotone increasing if for all `i <= j`, `nums[i] <= nums[j]`. An array `nums` is monotone decreasing if for all `i <= j`, `nums[i] >= nums[j]`.
Given an integer array `nums`, return `true` _if the given array is ... | null | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
1,425 | hey what's up guys chung here again so today i want to talk about this like uh let's call the problem here uh 1425 uh constrained subsequence sum yeah this is like a hard problem and this one this problem like actually consists of few sub problems so let's take a look at this uh description first so you're given like a... | Constrained Subsequence Sum | weather-type-in-each-country | Given an integer array `nums` and an integer `k`, return the maximum sum of a **non-empty** subsequence of that array such that for every two **consecutive** integers in the subsequence, `nums[i]` and `nums[j]`, where `i < j`, the condition `j - i <= k` is satisfied.
A _subsequence_ of an array is obtained by deleting... | null | Database | Easy | null |
12 | welcome to march's leeco challenge today's problem is integer to roman now i'm not going to read the problem because it's fairly simple we want to convert an integer to roman numerals here we have the symbols and values that the roman numerals represent if these were the only ones that exist it would be easy but the pr... | Integer to Roman | integer-to-roman | Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`.
**Symbol** **Value**
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, `2` is written as `II` in Roman numeral, just two one's adde... | null | Hash Table,Math,String | Medium | 13,273 |
1,197 | That welcome back to much of satyam 10 video latest white python code to return dhund number of steps needed from modi night in this point to destination 2518 possible for the right to in shakti left right top and bottom and moon can be defined in such indefinable The first to strictly indicate movement in the bottom d... | 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 |
724 | hello everyone and welcome back to another video so today we're going to be looking at the question fine pivot index and we'll be going through two solutions so first the brute force and then a way more optimized solution in constant time okay so real quickly we're going to be given an integer area called nums and the ... | Find Pivot Index | find-pivot-index | Given an array of integers `nums`, calculate the **pivot index** of this array.
The **pivot index** is the index where the sum of all the numbers **strictly** to the left of the index is equal to the sum of all the numbers **strictly** to the index's right.
If the index is on the left edge of the array, then the left... | We can precompute prefix sums P[i] = nums[0] + nums[1] + ... + nums[i-1].
Then for each index, the left sum is P[i], and the right sum is P[P.length - 1] - P[i] - nums[i]. | Array,Prefix Sum | Easy | 560,2102,2369 |
1,732 | right hello guys so the today's challenge of finding the highest altitude is the interesting problem and we can solve this problem in a very you know different many different ways I have already posted the video for you know solving this problem and you know it's just that you know when you solve an interesting problem... | Find the Highest Altitude | minimum-one-bit-operations-to-make-integers-zero | There is a biker going on a road trip. The road trip consists of `n + 1` points at different altitudes. The biker starts his trip on point `0` with altitude equal `0`.
You are given an integer array `gain` of length `n` where `gain[i]` is the **net gain in altitude** between points `i` and `i + 1` for all (`0 <=... | The fastest way to convert n to zero is to remove all set bits starting from the leftmost one. Try some simple examples to learn the rule of how many steps are needed to remove one set bit. consider n=2^k case first, then solve for all n. | Dynamic Programming,Bit Manipulation,Memoization | Hard | 2119 |
1,625 | hello everyone next unsolved question uh is 1625 lexicographically smallest string after applying operations k so let's go to the question it's taking time to load it second yeah so many disliked it so it must be pretty easy question still it's medium so i'm going to solve it you are given a string s of even length con... | Lexicographically Smallest String After Applying Operations | group-sold-products-by-the-date | You are given a string `s` of **even length** consisting of digits from `0` to `9`, and two integers `a` and `b`.
You can apply either of the following two operations any number of times and in any order on `s`:
* Add `a` to all odd indices of `s` **(0-indexed)**. Digits post `9` are cycled back to `0`. For example... | null | Database | Easy | 2335 |
676 | hi everyone it's albert here and today is a special episode of solving the code question so last week i have a senior engineer friend helped me to do a mock interview and we were solving this question together and he really gave me a lot of good uh feedback and suggestions how to approach and solve coding questions in ... | Implement Magic Dictionary | implement-magic-dictionary | Design a data structure that is initialized with a list of **different** words. Provided a string, you should determine if you can change exactly one character in this string to match any word in the data structure.
Implement the `MagicDictionary` class:
* `MagicDictionary()` Initializes the object.
* `void build... | null | Hash Table,String,Design,Trie | Medium | 208,720 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.