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 |
|---|---|---|---|---|---|---|---|---|
130 | hello and welcome to my channel so today let's look at the today's daily challenge question lead code 130 surrounding the regions given m times n matrix board containing x and all oh capture all regions that are four surrounded by x origin is captured by flipping all o's into x and in that surrounding the region so exa... | Surrounded Regions | surrounded-regions | Given an `m x n` matrix `board` containing `'X'` and `'O'`, _capture all regions that are 4-directionally surrounded by_ `'X'`.
A region is **captured** by flipping all `'O'`s into `'X'`s in that surrounded region.
**Example 1:**
**Input:** board = \[\[ "X ", "X ", "X ", "X "\],\[ "X ", "O ", "O ", "X "\],\[ "X ", "... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | 200,286 |
141 | hello everyone this is leak code 141 link list cycle um given head which is the head of a link list determine if the link list has a cycle in it um there's a cycle in a link list if there's some node in the list that can be reached Again by continuously foll the next pointer so um yeah we follow the next pointer for a ... | Linked List Cycle | linked-list-cycle | Given `head`, the head of a linked list, determine if the linked list has a cycle in it.
There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that tail's `next` pointer is co... | null | Hash Table,Linked List,Two Pointers | Easy | 142,202 |
1,347 | Hello everyone welcome to my channel code sir with mike so today we are going to do video number 32 of our strings playlist ok and link number 1 47 this is a question of medium easy range ok it is not very tough no g asked this question Now see what is the question, it says the name of the question is Minimum Number of... | Minimum Number of Steps to Make Two Strings Anagram | distance-to-a-cycle-in-undirected-graph | You are given two strings of the same length `s` and `t`. In one step you can choose **any character** of `t` and replace it with **another character**.
Return _the minimum number of steps_ to make `t` an anagram of `s`.
An **Anagram** of a string is a string that contains the same characters with a different (or the... | This problem can be broken down into two parts: finding the cycle, and finding the distance between each node and the cycle. How can we find the cycle? We can use DFS and keep track of the nodes we’ve seen, and the order that we see them in. Once we see a node we’ve already visited, we know that the cycle contains the ... | Depth-First Search,Breadth-First Search,Union Find,Graph | Hard | 2218 |
290 | Hello Jai Hind today we will do a question the number of lit code is 290 the name is bud pattern ok so in this question we have been given a pattern the pattern is a b a after that a string has been given me ok the string contains dog cat Cat is Dog. Okay, so we have to find out whether this string Dog Cat Dog is follo... | Word Pattern | word-pattern | Given a `pattern` and a string `s`, find if `s` follows the same pattern.
Here **follow** means a full match, such that there is a bijection between a letter in `pattern` and a **non-empty** word in `s`.
**Example 1:**
**Input:** pattern = "abba ", s = "dog cat cat dog "
**Output:** true
**Example 2:**
**Input:*... | null | Hash Table,String | Easy | 205,291 |
211 | hey guys welcome back to another video and today we're going to be solving the lead code question add and search word data structure design okay so we need to design a data structure which supports the following operations we need to be able to add a word and we need to be able to search for a word and return a boolean... | Design Add and Search Words Data Structure | design-add-and-search-words-data-structure | Design a data structure that supports adding new words and finding if a string matches any previously added string.
Implement the `WordDictionary` class:
* `WordDictionary()` Initializes the object.
* `void addWord(word)` Adds `word` to the data structure, it can be matched later.
* `bool search(word)` Returns ... | You should be familiar with how a Trie works. If not, please work on this problem: Implement Trie (Prefix Tree) first. | String,Depth-First Search,Design,Trie | Medium | 208,746 |
174 | The festival, today we will solve the question, the name of that question is Indian game, chicken animals, it is a very interesting question and very meaningful question, it is captured and imprisoned in the photo of the subscribe, so here we put it in the form of one and this position is last. Wally here the princess ... | Dungeon Game | dungeon-game | The demons had captured the princess and imprisoned her in **the bottom-right corner** of a `dungeon`. The `dungeon` consists of `m x n` rooms laid out in a 2D grid. Our valiant knight was initially positioned in **the top-left room** and must fight his way through `dungeon` to rescue the princess.
The knight has an i... | null | Array,Dynamic Programming,Matrix | Hard | 62,64,741,2354 |
1,996 | hi everyone my name is course again today i'm trying to solve the uh september liquid challenge well now the problem is number we character in the game so basically what is that you are playing a game that contain multiple character and each character has a two properties that is attack and defense so you are given the... | The Number of Weak Characters in the Game | number-of-ways-to-rearrange-sticks-with-k-sticks-visible | You are playing a game that contains multiple characters, and each of the characters has **two** main properties: **attack** and **defense**. You are given a 2D integer array `properties` where `properties[i] = [attacki, defensei]` represents the properties of the `ith` character in the game.
A character is said to be... | Is there a way to build the solution from a base case? How many ways are there if we fix the position of one stick? | Math,Dynamic Programming,Combinatorics | Hard | null |
1,851 | hey what's up guys uh this is sean here so this time uh lead code 1851 minimum interval to include each query all right so this one is another query problem right okay so you're given this time you're given like a 2d integer array intervals you know where the intervals have like has a left and right and describing the ... | Minimum Interval to Include Each Query | maximum-number-of-events-that-can-be-attended-ii | You are given a 2D integer array `intervals`, where `intervals[i] = [lefti, righti]` describes the `ith` interval starting at `lefti` and ending at `righti` **(inclusive)**. The **size** of an interval is defined as the number of integers it contains, or more formally `righti - lefti + 1`.
You are also given an intege... | Sort the events by its startTime. For every event, you can either choose it and consider the next event available, or you can ignore it. You can efficiently find the next event that is available using binary search. | Array,Binary Search,Dynamic Programming | Hard | 1478,2118,2164 |
76 | hey guys welcome today we're going to be taking a look at the minimum Windows substring question on lead code now this question consists of taking two strings one called s and one called T and trying to find the minimum window in s the minimum substring in s that contains all of the letters in t and if we can't find an... | 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 |
997 | hello guys I hope you are all doing well and this video we'll be solving the lead code problem find the town judge so let's get started so the problem is that you have a list of people in the town and the task is that you need to find out who is the judge in this town so before we solve this problem let's break this pr... | Find the Town Judge | find-the-town-judge | In a town, there are `n` people labeled from `1` to `n`. There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
1. The town judge trusts nobody.
2. Everybody (except for the town judge) trusts the town judge.
3. There is exactly one person that satisfies properties **... | null | null | Easy | null |
331 | welcome to august 26th leco challenge verify pre-order serialization of binary verify pre-order serialization of binary verify pre-order serialization of binary tree one way to sterilize bearing binary trees to use pre-order traversal when we trees to use pre-order traversal when we trees to use pre-order traversal whe... | Verify Preorder Serialization of a Binary Tree | verify-preorder-serialization-of-a-binary-tree | One way to serialize a binary tree is to use **preorder traversal**. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as `'#'`.
For example, the above binary tree can be serialized to the string `"9,3,4,#,#,1,#,#,2,#,6,#,# "`, where `'#'` repres... | null | String,Stack,Tree,Binary Tree | Medium | null |
787 | Hello everyone Welcome to my channel here I solve Lead Code problems and today an interesting task is the daily Challenge task number 787 the cheapest flight with no more than k stops average level we are given N cities connected by a certain number of planes we are given an array of flights in which Each element of th... | Cheapest Flights Within K Stops | sliding-puzzle | There are `n` cities connected by some number of flights. You are given an array `flights` where `flights[i] = [fromi, toi, pricei]` indicates that there is a flight from city `fromi` to city `toi` with cost `pricei`.
You are also given three integers `src`, `dst`, and `k`, return _**the cheapest price** from_ `src` _... | Perform a breadth-first-search, where the nodes are the puzzle boards and edges are if two puzzle boards can be transformed into one another with one move. | Array,Breadth-First Search,Matrix | Hard | null |
118 | welcome to june's lego challenge today's problem is pascal's triangle given integer num rows we turn the first num rows of pascal's triangle in pascal's triangle each number is the sum of the two numbers directly above it you can see how it looks in real time notice how the ones at the edges left and right are always g... | Pascal's Triangle | pascals-triangle | Given an integer `numRows`, return the first numRows of **Pascal's triangle**.
In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown:
**Example 1:**
**Input:** numRows = 5
**Output:** \[\[1\],\[1,1\],\[1,2,1\],\[1,3,3,1\],\[1,4,6,4,1\]\]
**Example 2:**
**Input:** numRows = ... | null | Array,Dynamic Programming | Easy | 119 |
1,964 | Hello everyone welcome, we are going to do video number 28 of my channel. Okay and I suggest you again that I am making a separate playlist. Listen very carefully in which I will have both concepts and questions related to dynamic framing. This playlist contains only questions. Ok so main 1964 it is a very good questio... | 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 |
350 | code three five zero 350 intersection of two arrays two all right so there's another version for this one we've already done it go back and check into my videos um so given two integers arrays nums one and nums to return an array of their intersection each element in the result must appear as many times as it shows in ... | Intersection of Two Arrays II | intersection-of-two-arrays-ii | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must appear as many times as it shows in both arrays and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2,2\]
**Example 2:**
**I... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 349,1044,1392,2282 |
641 | hello everyone so in this video let us talk about the problem from lead code it's a medium problem the problem name is design a circular DQ so you actually have to design a double ended queue that is a DQ you have to implement these functions so if you know about Q then it's just an extended version of a queue in queue... | Design Circular Deque | design-circular-deque | Design your implementation of the circular double-ended queue (deque).
Implement the `MyCircularDeque` class:
* `MyCircularDeque(int k)` Initializes the deque with a maximum size of `k`.
* `boolean insertFront()` Adds an item at the front of Deque. Returns `true` if the operation is successful, or `false` otherwi... | null | null | Medium | null |
322 | In this video we will compare Quoy Jumper Actions and Conference the main issue is difference and I had asked another question which was named Targets we submit, he goes to 100 in broken and got many more so we recommend him that he If the information is different from how then it is first of all if I do not speak from... | Coin Change | coin-change | You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money.
Return _the fewest number of coins that you need to make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `-1`.
You may a... | null | Array,Dynamic Programming,Breadth-First Search | Medium | 1025,1393,2345 |
313 | that paper to Ajay. In this video we will see the solution of super next number, so before that you must watch the video of next number once, it is related to this, so I have given us this knowledge to find the number of super and how to define super bheem number. Whose prime factors are not, its prime factors are okay... | Super Ugly Number | super-ugly-number | A **super ugly number** is a positive integer whose prime factors are in the array `primes`.
Given an integer `n` and an array of integers `primes`, return _the_ `nth` _**super ugly number**_.
The `nth` **super ugly number** is **guaranteed** to fit in a **32-bit** signed integer.
**Example 1:**
**Input:** n = 12, ... | null | Array,Hash Table,Math,Dynamic Programming,Heap (Priority Queue) | Medium | 264 |
380 | Hello Jise Aggarwal welcome you all channel quarters made by so let's nine days let 's call problem for today airport 's call problem for today airport 's call problem for today airport problem kya rahi hai achcha deformati whatsapp problem achcha you have understood and those who want to try it yourself see what is he... | Insert Delete GetRandom O(1) | insert-delete-getrandom-o1 | Implement the `RandomizedSet` class:
* `RandomizedSet()` Initializes the `RandomizedSet` object.
* `bool insert(int val)` Inserts an item `val` into the set if not present. Returns `true` if the item was not present, `false` otherwise.
* `bool remove(int val)` Removes an item `val` from the set if present. Retur... | null | Array,Hash Table,Math,Design,Randomized | Medium | 381 |
1,060 | hey so welcome back in this another daily code problems so today it's called missing element an assorted array so let's take a peek at this so essentially what you're given is just an array called nums as well as an integer called K and so what you want to do here is basically you want to find some missing number but w... | Missing Element in Sorted Array | longest-repeating-substring | Given an integer array `nums` which is sorted in **ascending order** and all of its elements are **unique** and given also an integer `k`, return the `kth` missing number starting from the leftmost number of the array.
**Example 1:**
**Input:** nums = \[4,7,9,10\], k = 1
**Output:** 5
**Explanation:** The first missi... | Generate all substrings in O(N^2) time with hashing. Choose those hashing of strings with the largest length. | String,Binary Search,Dynamic Programming,Rolling Hash,Suffix Array,Hash Function | Medium | null |
18 | in this video we'll be going over the question foursome so given array numbers of n integers and an integer target are there elements a b c ds and num such that the sum of the four elements is equal to target find all unique quadruplets in array which gives the sum of target notice that the solution set must not contai... | 4Sum | 4sum | Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that:
* `0 <= a, b, c, d < n`
* `a`, `b`, `c`, and `d` are **distinct**.
* `nums[a] + nums[b] + nums[c] + nums[d] == target`
You may return the answer in **any order**.
**Examp... | null | Array,Two Pointers,Sorting | Medium | 1,15,454,2122 |
1,877 | hello guys welcome back to another episode today we are going to solve L CES daily question which is minimize maximum pair sum in an array problem number is 1877 question is the pair sum of a pair a comma B is equal to a + b the maximum a comma B is equal to a + b the maximum a comma B is equal to a + b the maximum pai... | Minimize Maximum Pair Sum in Array | find-followers-count | The **pair sum** of a pair `(a,b)` is equal to `a + b`. The **maximum pair sum** is the largest **pair sum** in a list of pairs.
* For example, if we have pairs `(1,5)`, `(2,3)`, and `(4,4)`, the **maximum pair sum** would be `max(1+5, 2+3, 4+4) = max(6, 5, 8) = 8`.
Given an array `nums` of **even** length `n`, pai... | null | Database | Easy | null |
1,866 | so i was giving i was looking at the latest virtual contest and this is a hard problem number of ways to rearrange sticks with k sticks visible so you're just given one to n and you want k sticks to be visible from the left right now you can see that one three and five visible from the left over in this example one and... | Number of Ways to Rearrange Sticks With K Sticks Visible | restore-the-array-from-adjacent-pairs | There are `n` uniquely-sized sticks whose lengths are integers from `1` to `n`. You want to arrange the sticks such that **exactly** `k` sticks are **visible** from the left. A stick is **visible** from the left if there are no **longer** sticks to the **left** of it.
* For example, if the sticks are arranged `[1,3,... | Find the first element of nums - it will only appear once in adjacentPairs. The adjacent pairs are like edges of a graph. Perform a depth-first search from the first element. | Array,Hash Table | Medium | null |
142 | Hello Friends Welcome To The Video Chahiye To Code No Problem Equal Nikle Central To Change The Language Of Development Cycle Benefits Mono Cycle And You Have To Determine The Inside Adsense Problems With Sister In English Apoorva Element West Indies For Declaring His Pregnancy Director Cycle And Miss Cycle Stunt In Or... | Linked List Cycle II | linked-list-cycle-ii | Given the `head` of a linked list, return _the node where the cycle begins. If there is no cycle, return_ `null`.
There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that ta... | null | Hash Table,Linked List,Two Pointers | Medium | 141,287 |
299 | welcome to september's leeco challenge today's problem is bulls and cows you are playing the following bulls and cows game with your friend you write down a number and ask your friend to guess what the number is each time your friend makes a guess you provide a hint indicating how many digits in the guess match your se... | Bulls and Cows | bulls-and-cows | You are playing the **[Bulls and Cows](https://en.wikipedia.org/wiki/Bulls_and_Cows)** game with your friend.
You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint with the following info:
* The number of "bulls ", which are digits in the ... | null | Hash Table,String,Counting | Medium | null |
120 | cool 120 triangle given a triangle find the minimum pass some from top to bottom each step you may move to adjacent numbers on the wall below exam we're given the following triangle some number the minimum have some time talk to bottom is 11 bonus point to be able to do this using of an extra space where n is the total... | 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 |
588 | in this video we're going to take a look at a legal problem called design a memory file system so basically the goal is we want to design a data structure that implements or simulates an in-memory system or simulates an in-memory system or simulates an in-memory system file system so implement this file system class th... | Design In-Memory File System | design-in-memory-file-system | Design a data structure that simulates an in-memory file system.
Implement the FileSystem class:
* `FileSystem()` Initializes the object of the system.
* `List ls(String path)`
* If `path` is a file path, returns a list that only contains this file's name.
* If `path` is a directory path, returns... | null | Hash Table,String,Design,Trie | Hard | 146,460,635 |
373 | friends today I'm going to solve liquid problem number 373 find gay pairs with smallest sums so in this problem we are given two integer arrays nums 1 and nobster and it is sorted in ascending order and we are also given an integer k now um here what are we going to do is we are going to form pairs where U is from the ... | Find K Pairs with Smallest Sums | find-k-pairs-with-smallest-sums | You are given two integer arrays `nums1` and `nums2` sorted in **ascending order** and an integer `k`.
Define a pair `(u, v)` which consists of one element from the first array and one element from the second array.
Return _the_ `k` _pairs_ `(u1, v1), (u2, v2), ..., (uk, vk)` _with the smallest sums_.
**Example 1:**... | null | Array,Heap (Priority Queue) | Medium | 378,719,2150 |
1,559 | uh hey everybody this is larry this is q4 of the recent lego daily uh sorry lego contest from the bi-weekly the bi-weekly the bi-weekly uh detect cycles into the grid uh hit the like button hit the subscribe and join me in discord and let's go over this problem together um oh and you could watch me stop it live during ... | Detect Cycles in 2D Grid | cherry-pickup-ii | Given a 2D array of characters `grid` of size `m x n`, you need to find if there exists any cycle consisting of the **same value** in `grid`.
A cycle is a path of **length 4 or more** in the grid that starts and ends at the same cell. From a given cell, you can move to one of the cells adjacent to it - in one of the f... | Use dynammic programming, define DP[i][j][k]: The maximum cherries that both robots can take starting on the ith row, and column j and k of Robot 1 and 2 respectively. | Array,Dynamic Programming,Matrix | Hard | null |
1,981 | hey what's up guys this is sean here again so uh list code number 1981 minimize the difference between target and chosen elements okay so this one is pretty straightforward basically you're given like i'm the m by n integer matrix and the integer target so your task is to choose one number for from each row right and t... | Minimize the Difference Between Target and Chosen Elements | maximum-transaction-each-day | You are given an `m x n` integer matrix `mat` and an integer `target`.
Choose one integer from **each row** in the matrix such that the **absolute difference** between `target` and the **sum** of the chosen elements is **minimized**.
Return _the **minimum absolute difference**_.
The **absolute difference** between t... | null | Database | Medium | null |
920 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem number of music playlists this is definitely a difficult problem and I would take a couple extra minutes maybe even more than that to really understand it because I made a mistake in understanding the problem when I tri... | Number of Music Playlists | uncommon-words-from-two-sentences | Your music player contains `n` different songs. You want to listen to `goal` songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that:
* Every song is played **at least once**.
* A song can only be played again only if `k` other songs have been played.
Given `n`, `g... | null | Hash Table,String | Easy | 2190 |
214 | Have Yes Anokhe Showk The Last Question Is What Is And Given String Guess You Are Alone To Convert Into Your Pendrive Wedding Characters In Front Of Written Test For This Page You Can Perform In This Transformation Activist Arundhati Subscribe To Ajay Ko Main Successful Example Jhenna And Vihave the telegraph m&a s... | Shortest Palindrome | shortest-palindrome | You are given a string `s`. You can convert `s` to a palindrome by adding characters in front of it.
Return _the shortest palindrome you can find by performing this transformation_.
**Example 1:**
**Input:** s = "aacecaaa"
**Output:** "aaacecaaa"
**Example 2:**
**Input:** s = "abcd"
**Output:** "dcbabcd"
**Constr... | null | String,Rolling Hash,String Matching,Hash Function | Hard | 5,28,336 |
332 | hey how's it going on race so in this video discuss about this problem reconstruct I turn already given a list of airline tickets represented by pairs of departure and arrival airports reconstruct the itinerary in order all the tickets belong to a man who departs from JFK does the itinerary must begin with JFK a couple... | Reconstruct Itinerary | reconstruct-itinerary | You are given a list of airline `tickets` where `tickets[i] = [fromi, toi]` represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it.
All of the tickets belong to a man who departs from `"JFK "`, thus, the itinerary must begin with `"JFK "`. If there are multiple... | null | Depth-First Search,Graph,Eulerian Circuit | Hard | 2051,2201 |
700 | Hello Everyone Welcome Back to My Channel Suggestion or Increasing the Problem Aisa for Any Search Facility How to Do Something in Binary Search Tree Images Basic Problem and Binary Search Tree Leaves for Less Problems Where Given Root of Binary Search Tree And Stir Well Point Note In Bsp Dot S Well Suited For The Soft... | Search in a Binary Search Tree | search-in-a-binary-search-tree | You are given the `root` of a binary search tree (BST) and an integer `val`.
Find the node in the BST that the node's value equals `val` and return the subtree rooted with that node. If such a node does not exist, return `null`.
**Example 1:**
**Input:** root = \[4,2,7,1,3\], val = 2
**Output:** \[2,1,3\]
**Example... | null | null | Easy | null |
754 | hi guys welcome to algorithms made easy today we will be looking at the question reach a number so you are standing at a position zero on an infinite number line and there is a goal at a position target on each move you can either move left or right during the nth move starting from 1 you take n steps we need to return... | Reach a Number | cracking-the-safe | You are standing at position `0` on an infinite number line. There is a destination at position `target`.
You can make some number of moves `numMoves` so that:
* On each move, you can either go left or right.
* During the `ith` move (starting from `i == 1` to `i == numMoves`), you take `i` steps in the chosen dir... | We can think of this problem as the problem of finding an Euler path (a path visiting every edge exactly once) on the following graph: there are $$k^{n-1}$$ nodes with each node having $$k$$ edges. It turns out this graph always has an Eulerian circuit (path starting where it ends.)
We should visit each node in "po... | Depth-First Search,Graph,Eulerian Circuit | Hard | null |
1,171 | hello and welcome to another video in this video we're going to be working on remove Zero Sum consecutive nodes from link list and in the problem you're given the head of a link list and you want to delete consecutive elements that sum up to zero until there's no such sequences after doing so return the head of the lin... | 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 |
190 | hello everyone let's solve the lead code question 190 reverse bits so a reverse bits of a given 32 bits unsigned integer so we are given an variable n which is equal to the 32bit number and we need to reverse every element we need to just reverse this whole n such that every last element comes first that's what the rev... | 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 |
240 | um 240 search a 2d matrix let's see write an efficient algorithm that searches a value target okay um in an m by n matrix okay this matrix has following properties integer in each row rows a row are sorted in ascending left or right integer in each column are sorted in ascending top to bottom okay so two things to noti... | Search a 2D Matrix II | search-a-2d-matrix-ii | Write an efficient algorithm that searches for a value `target` in an `m x n` integer matrix `matrix`. This matrix has the following properties:
* Integers in each row are sorted in ascending from left to right.
* Integers in each column are sorted in ascending from top to bottom.
**Example 1:**
**Input:** matri... | null | Array,Binary Search,Divide and Conquer,Matrix | Medium | 74 |
253 | hey everyone how are y'all doing today we're gonna check out the lead code problem this question is very popular often has done amazon facebook and many other companies interviews and it just gives a great deal of understanding about time management problems in general so let's crack straight into it so today we're goi... | 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 |
260 | Hello everyone, welcome back to Coding Makeover, today we are going to solve another question of Let's Co, question number 260. This is a single number 3 question in which two numbers will come once and the rest are all the numbers There are only two numbers, both are unique, then that will be our result. In the first ... | 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 |
123 | Hello hello guys welcome back to decades and this video will see the best time to buy and sell staff's problem specific from digit code reliable in so it's an order to solve this problem the first world best odi debut verification plus memorization the second one will be Divided by doing technique so latest video probl... | 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 |
206 | given the singly-linked list how can you given the singly-linked list how can you given the singly-linked list how can you reverse it recursively that's today's video let's get into it hi everyone my name is Steve today we'll go through a legal problem 206 reverse linked lists the solution that we're going through toda... | Reverse Linked List | reverse-linked-list | Given the `head` of a singly linked list, reverse the list, and return _the reversed list_.
**Example 1:**
**Input:** head = \[1,2,3,4,5\]
**Output:** \[5,4,3,2,1\]
**Example 2:**
**Input:** head = \[1,2\]
**Output:** \[2,1\]
**Example 3:**
**Input:** head = \[\]
**Output:** \[\]
**Constraints:**
* The number... | null | Linked List,Recursion | Easy | 92,156,234,2196,2236 |
1,646 | 200 Hello guys and I am now going to explain the list to the dairy challenge get maximum engine rated okay to question me de rakha your given in teacher has said are the norms for age plus one is generated and the following pet ok hai kuch complication de rakha meaning Initially it seems over-whelming Initially it seem... | 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 |
169 | hey guys persistent programmer over here and today we're gonna do another really cool question majority element okay so given a size of given an array of size n find the majority element and what is this majority element well the majority element is a element that appears more than n over two times where n is the lengt... | Majority Element | majority-element | Given an array `nums` of size `n`, return _the majority element_.
The majority element is the element that appears more than `⌊n / 2⌋` times. You may assume that the majority element always exists in the array.
**Example 1:**
**Input:** nums = \[3,2,3\]
**Output:** 3
**Example 2:**
**Input:** nums = \[2,2,1,1,1,2,... | null | Array,Hash Table,Divide and Conquer,Sorting,Counting | Easy | 229,1102 |
376 | hey everybody this is larry this is day three of the july lego day challenge uh hit the like button in the subscriber and join me on discord let me know what you think about this problem uh yeah happy sunday or saturday night depending on where you are this saturday night for me and the contest is in about two hours fo... | 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 |
921 | hey guys this is you sir how's it been going in this video I'm going to take a look at nine to one minimum add to make current is valid we're given a string and a string ends of left parenthesis and right parenthesis we add the minimal numbers of parentheses and so that the represent appearances are invalid well take a... | Minimum Add to Make Parentheses Valid | spiral-matrix-iii | A parentheses string is valid if and only if:
* It is the empty string,
* It can be written as `AB` (`A` concatenated with `B`), where `A` and `B` are valid strings, or
* It can be written as `(A)`, where `A` is a valid string.
You are given a parentheses string `s`. In one move, you can insert a parenthesis at... | null | Array,Matrix,Simulation | Medium | 54,59 |
788 | Oh 780 a rotated digits X is a good number if after rotating you two should buy individually by 180 degrees we can invite number tested it's different from X each stitches must be rotated we cannot choose to leave L know a number is valid if each digit remains a digit after the rotation 0 1 & 8 will attach after th... | Rotated Digits | minimize-max-distance-to-gas-station | An integer `x` is a **good** if after rotating each digit individually by 180 degrees, we get a valid number that is different from `x`. Each digit must be rotated - we cannot choose to leave it alone.
A number is valid if each digit remains a digit after rotation. For example:
* `0`, `1`, and `8` rotate to themsel... | Use a binary search. We'll binary search the monotone function "possible(D) = can we use K or less gas stations to ensure each adjacent distance between gas stations is at most D?" | Array,Binary Search | Hard | 907 |
994 | Hello hello everybody welcome to my channel today.the problem is his writing and today.the problem is his writing and today.the problem is his writing and oranges in every cell can have one of the value sabse zor divya 1000 restaurant and welcome to lotus on every minute android 4.2 and subscribe is this is impossible ... | Rotting Oranges | prison-cells-after-n-days | You are given an `m x n` `grid` where each cell can have one of three values:
* `0` representing an empty cell,
* `1` representing a fresh orange, or
* `2` representing a rotten orange.
Every minute, any fresh orange that is **4-directionally adjacent** to a rotten orange becomes rotten.
Return _the minimum nu... | null | Array,Hash Table,Math,Bit Manipulation | Medium | null |
1,470 | so this problem here is leak code id 1470 and this is shuffle the array so given the array of nums consisting of two times n elements in the form x1 x2 and then at the midpoint it starts at one y two uh return the array in the form x one y two x two y two so we're kind of like interweaving the first half and the second... | 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 |
526 | E Agri Baby Pump Co Default Comment Wednesday Free of Cost January 1954 Channel Soft Stimulus Problem Yes-Yes Arrangement at Soft Stimulus Problem Yes-Yes Arrangement at Soft Stimulus Problem Yes-Yes Arrangement at SIDBI Question and Definition of These Leaders from Middle Arrangement for Every Side The Full Form of ID... | Beautiful Arrangement | beautiful-arrangement | Suppose you have `n` integers labeled `1` through `n`. A permutation of those `n` integers `perm` (**1-indexed**) is considered a **beautiful arrangement** if for every `i` (`1 <= i <= n`), **either** of the following is true:
* `perm[i]` is divisible by `i`.
* `i` is divisible by `perm[i]`.
Given an integer `n`,... | null | Array,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask | Medium | 667 |
864 | hey everybody this is Larry this is still me and Lisbon um yeah doing a lead copy for the fight I guess today's program is 864 shortest map to get all keys uh hopefully soon we'll return to normal schedule for a little bit uh okay so this is a problem that I haven't saw before so that's an excited exciting thing to do ... | Shortest Path to Get All Keys | image-overlap | You are given an `m x n` grid `grid` where:
* `'.'` is an empty cell.
* `'#'` is a wall.
* `'@'` is the starting point.
* Lowercase letters represent keys.
* Uppercase letters represent locks.
You start at the starting point and one move consists of walking one space in one of the four cardinal directions. ... | null | Array,Matrix | Medium | null |
81 | Hello hello friends today jasveer voot previous song setting 9th medium question hum kya hai amazon means that we who and subscribe to the channel to that sugar or us kya game banta hai an increase pregnant we have to duplicate shiv from this subject Chinese element like this element appears in the best means if you ha... | Search in Rotated Sorted Array II | search-in-rotated-sorted-array-ii | There is an integer array `nums` sorted in non-decreasing order (not necessarily with **distinct** values).
Before being passed to your function, `nums` is **rotated** at an unknown pivot index `k` (`0 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nu... | null | Array,Binary Search | Medium | 33 |
190 | hey guys persistent programmer here and welcome back to my channel so in this channel we solve a lot of algorithms and go over really quick questions so if you haven't subscribed already go ahead and hit the Subscribe button smash that like button because that helps me create this content for you guys so without furthe... | 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 |
1,184 | Hello everyone so this is the next question distance between bus stops a bus from a stops number from 0 to a small form circle not the distance between pairs of next stops distance at a i distance between the stops number i and i psv Basically, we have to return the shortest distance from the start point to the destina... | Distance Between Bus Stops | car-pooling | A bus has `n` stops numbered from `0` to `n - 1` that form a circle. We know the distance between all pairs of neighboring stops where `distance[i]` is the distance between the stops number `i` and `(i + 1) % n`.
The bus goes along both directions i.e. clockwise and counterclockwise.
Return the shortest distance betw... | Sort the pickup and dropoff events by location, then process them in order. | Array,Sorting,Heap (Priority Queue),Simulation,Prefix Sum | Medium | 253 |
229 | uh hey everybody this is larry uh so i don't usually do this but um i'm gonna do the explanation first and then you can watch myself with live later uh in general for the most part uh i know what i'm doing but this time i actually ran it um actually i still kind of did mostly what i wanted to do but i did do it way too... | Majority Element II | majority-element-ii | Given an integer array of size `n`, find all elements that appear more than `⌊ n/3 ⌋` times.
**Example 1:**
**Input:** nums = \[3,2,3\]
**Output:** \[3\]
**Example 2:**
**Input:** nums = \[1\]
**Output:** \[1\]
**Example 3:**
**Input:** nums = \[1,2\]
**Output:** \[1,2\]
**Constraints:**
* `1 <= nums.length <... | How many majority elements could it possibly have?
Do you have a better hint? Suggest it! | Array,Hash Table,Sorting,Counting | Medium | 169,1102 |
342 | hello guys my name is ursula and welcome to my youtube channel and today we are going to solve a new record question that is power of 4 so let's start so we are given an integer and return the true if it is power of 4 otherwise the term false and integer n is the power of four uh if there exists an integer x say that x... | 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 |
8 | hi guys let's do the lead code eight string to integer it's also known as a280i if you been reading your knr you would see that they talk about atoi so what is it knr is kerning an enriched c programming language so um implement the problem states that implement a t o i which converts a string to an integer now then he... | 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 |
641 | Hello friends, in this video we are going to solve this problem by designing a circular DQ. Basically, we have to implement a circular DQ and design it so that I can do all the operations in it very easily and all this. We have to do the operation, who has to implement the circular deck, not just the deck, what happene... | Design Circular Deque | design-circular-deque | Design your implementation of the circular double-ended queue (deque).
Implement the `MyCircularDeque` class:
* `MyCircularDeque(int k)` Initializes the deque with a maximum size of `k`.
* `boolean insertFront()` Adds an item at the front of Deque. Returns `true` if the operation is successful, or `false` otherwi... | null | null | Medium | null |
419 | hey what's up guys john here uh so today let's take a look at this uh this elite called problem here uh number 419 battleships in the board so okay so you're given like a 2d board and you need to count how many battleships are in it so how what does so what does the battleship means right so battleship are represented ... | Battleships in a Board | battleships-in-a-board | Given an `m x n` matrix `board` where each cell is a battleship `'X'` or empty `'.'`, return _the number of the **battleships** on_ `board`.
**Battleships** can only be placed horizontally or vertically on `board`. In other words, they can only be made of the shape `1 x k` (`1` row, `k` columns) or `k x 1` (`k` rows, ... | null | Array,Depth-First Search,Matrix | Medium | null |
917 | hello everyone even before starting today's session i would like to point you guys to the other video that i have published today do have a look at it has million dollar of valuable advice in it's by someone who was among you guys one of the subscriber of a coding decoded channel he worked really hard for it and got th... | Reverse Only Letters | boats-to-save-people | Given a string `s`, reverse the string according to the following rules:
* All the characters that are not English letters remain in the same position.
* All the English letters (lowercase or uppercase) should be reversed.
Return `s` _after reversing it_.
**Example 1:**
**Input:** s = "ab-cd"
**Output:** "dc-ba... | null | Array,Two Pointers,Greedy,Sorting | Medium | null |
165 | channel of Jhal Hello and Welcome is Asha Question is 165 Computers A Number Okay so basically we give Question Is saying and what is the question So electricity used to go to Saturday If we read this then it is given in such words number We get 1.4 it is given in such words number We get 1.4 it is given in such words ... | 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 |
380 | in this tutorial I am going to discuss a very interesting problem insert delete get random in oven so in this problem we have to design a data structure that supports all the following operation in average oven time and the operations are insert remove and get random so when this method is called insert we have to inse... | Insert Delete GetRandom O(1) | insert-delete-getrandom-o1 | Implement the `RandomizedSet` class:
* `RandomizedSet()` Initializes the `RandomizedSet` object.
* `bool insert(int val)` Inserts an item `val` into the set if not present. Returns `true` if the item was not present, `false` otherwise.
* `bool remove(int val)` Removes an item `val` from the set if present. Retur... | null | Array,Hash Table,Math,Design,Randomized | Medium | 381 |
1,859 | Hello everyone welcome back tu disrespect video and in this video we will solve sorting sentence which is the fourth problem of the string. If you want to see the complete series then I will put the link of the playlist in the description box and will also give you the link of every question. You will get the link of t... | 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 |
717 | hey everyone welcome back and today we'll be doing another lead code problem 717 one bit at 2-bit character this is 717 one bit at 2-bit character this is 717 one bit at 2-bit character this is an easy one you have two special characters the first character can be represented by one bit zero the second can character ca... | 1-bit and 2-bit Characters | 1-bit-and-2-bit-characters | We have two special characters:
* The first character can be represented by one bit `0`.
* The second character can be represented by two bits (`10` or `11`).
Given a binary array `bits` that ends with `0`, return `true` if the last character must be a one-bit character.
**Example 1:**
**Input:** bits = \[1,0,0... | Keep track of where the next character starts. At the end, you want to know if you started on the last bit. | Array | Easy | 89 |
775 | hi guys this is khushboo welcome to algorithms made easy in this video we will see the question global and local inversions we have some permutation of a that consists of numbers 0 to n minus 1 where n is the length of a number of global inversions is number of eyes less than j wherein 0 is less than i less than j whic... | Global and Local Inversions | n-ary-tree-preorder-traversal | You are given an integer array `nums` of length `n` which represents a permutation of all the integers in the range `[0, n - 1]`.
The number of **global inversions** is the number of the different pairs `(i, j)` where:
* `0 <= i < j < n`
* `nums[i] > nums[j]`
The number of **local inversions** is the number of i... | null | Stack,Tree,Depth-First Search | Easy | 144,764,776 |
1 | hello everyone welcome back to the swift academy in today's video we are going to solve another lit code issue that is so popular among the interviewers it's called twosome and also it categorized as an easy question but regarding that it is easy because simply you can find the answer for that it is so important how yo... | 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 |
342 | Hello everyone welcome tu andar video understand it is little bit not un difficult but little bit medium ok so d question is saying date given and wait and return true it is d power of adrevise return false like for example like wait n is d power of for This Exit N Wait Access Date Like N = 4 Exit N Wait Access Date Li... | 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 |
766 | it's a very basic level problem it's a topless Matrix you can say so we are given an M cruise and Matrix we have to return to if the Matrix is topless otherwise we'll return Force means topless Matrix is if uh these diagonals are same in this way so if these diagonals are same so first we have 9 then we have 5 right so... | Toeplitz Matrix | flatten-a-multilevel-doubly-linked-list | Given an `m x n` `matrix`, return _`true` if the matrix is Toeplitz. Otherwise, return `false`._
A matrix is **Toeplitz** if every diagonal from top-left to bottom-right has the same elements.
**Example 1:**
**Input:** matrix = \[\[1,2,3,4\],\[5,1,2,3\],\[9,5,1,2\]\]
**Output:** true
**Explanation:**
In the above gr... | null | Linked List,Depth-First Search,Doubly-Linked List | Medium | 114,1796 |
1,846 | hey how's it going leak code 1846 maximum element after decreasing and rearranging you're given an array of positive integers ARR perform some operations possibly non on ARR so that it satisfies these conditions the value of the first element in ARR must be one aha uh the absolute difference between any two adjacent el... | Maximum Element After Decreasing and Rearranging | maximum-element-after-decreasing-and-rearranging | You are given an array of positive integers `arr`. Perform some operations (possibly none) on `arr` so that it satisfies these conditions:
* The value of the **first** element in `arr` must be `1`.
* The absolute difference between any 2 adjacent elements must be **less than or equal to** `1`. In other words, `abs... | null | null | Medium | null |
162 | Hello everyone welcome back on the chain Anil Kapoor himself is going to discuss write there is a problem in finding the right element in July 4th so what is the problem in which my given input is fine and tell us which is the APK element in it apk Who is the file, increase your left element and bigger than your side, ... | 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 |
841 | hello and welcome today we're doing a question from Li code called keys and runes it's a medium let's get started there are n rooms and you'd start in room 0 each room has a distinct number in 0 1 2 all the way to n minus 1 and each room may have some keys to access the next room formally each room has a list of keys r... | Keys and Rooms | shortest-distance-to-a-character | There are `n` rooms labeled from `0` to `n - 1` and all the rooms are locked except for room `0`. Your goal is to visit all the rooms. However, you cannot enter a locked room without having its key.
When you visit a room, you may find a set of **distinct keys** in it. Each key has a number on it, denoting which room i... | null | Array,Two Pointers,String | Easy | null |
1,394 | hello girls total reality doing with the first really important here coal today's problem is fine lucky number a mean to you so what is all about like given another and okay number even to go to sleep and series in the or is equal to the value for example there is the value enough difference is to about food is to whic... | Find Lucky Integer in an Array | find-lucky-integer-in-an-array | Given an array of integers `arr`, a **lucky integer** is an integer that has a frequency in the array equal to its value.
Return _the largest **lucky integer** in the array_. If there is no **lucky integer** return `-1`.
**Example 1:**
**Input:** arr = \[2,2,3,4\]
**Output:** 2
**Explanation:** The only lucky number... | null | null | Easy | null |
1,769 | hey everyone uh today i'll be going over the elite code problem 1769 minimum number of operations to move all balls to each box so you have all this junk here but as always i'm just going to explain it as simply as possible and i'll do so with this test case here so given this test case we're given some string and thes... | Minimum Number of Operations to Move All Balls to Each Box | get-maximum-in-generated-array | You have `n` boxes. You are given a binary string `boxes` of length `n`, where `boxes[i]` is `'0'` if the `ith` box is **empty**, and `'1'` if it contains **one** ball.
In one operation, you can move **one** ball from a box to an adjacent box. Box `i` is adjacent to box `j` if `abs(i - j) == 1`. Note that after doing ... | Try generating the array. Make sure not to fall in the base case of 0. | Array,Dynamic Programming,Simulation | Easy | null |
199 | today we're looking at lead code 199 binary tree right side view this is a continuation of our level order traversal series in this playlist and we are going to be using the same template the same pattern to solve this as we use to solve the other problems that deal with level order traversal in this playlist that's in... | Binary Tree Right Side View | binary-tree-right-side-view | Given the `root` of a binary tree, imagine yourself standing on the **right side** of it, return _the values of the nodes you can see ordered from top to bottom_.
**Example 1:**
**Input:** root = \[1,2,3,null,5,null,4\]
**Output:** \[1,3,4\]
**Example 2:**
**Input:** root = \[1,null,3\]
**Output:** \[1,3\]
**Examp... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 116,545 |
677 | hey hello there today i want to talk about question 677 maps on pairs we want to implement a class called mapson which supports two methods uh insert and some so it's a pretty much a very simple key value of storage the insert is the right operation the sum is the read operation so the let's look at keep reading the in... | Map Sum Pairs | map-sum-pairs | Design a map that allows you to do the following:
* Maps a string key to a given value.
* Returns the sum of the values that have a key with a prefix equal to a given string.
Implement the `MapSum` class:
* `MapSum()` Initializes the `MapSum` object.
* `void insert(String key, int val)` Inserts the `key-val`... | null | Hash Table,String,Design,Trie | Medium | 1333 |
1,906 | Hello Everyone in the month of Sandeep and in this video you will show you how to solve plate problem vs problem se zameen akshikari na dheer wa nyanyat subscribe our channel subscribe a slack we examples and tried to understand what a question is singh sirf example examres 130 More than time to subscribe to that a arm... | Minimum Absolute Difference Queries | maximize-score-after-n-operations | The **minimum absolute difference** of an array `a` is defined as the **minimum value** of `|a[i] - a[j]|`, where `0 <= i < j < a.length` and `a[i] != a[j]`. If all elements of `a` are the **same**, the minimum absolute difference is `-1`.
* For example, the minimum absolute difference of the array `[5,2,3,7,2]` is ... | Find every way to split the array until n groups of 2. Brute force recursion is acceptable. Calculate the gcd of every pair and greedily multiply the largest gcds. | Array,Math,Dynamic Programming,Backtracking,Bit Manipulation,Number Theory,Bitmask | Hard | null |
976 | oh hey everybody this is Larry this is day what is it day 12 of the legal daily challenge hit the like button hit the Subscribe button drop me on Discord let me know what you think about today's qualm 976 largest perimeter of the triangle it's Wednesday or Tuesday depending on where you are hope you are having a great ... | Largest Perimeter Triangle | minimum-area-rectangle | Given an integer array `nums`, return _the largest perimeter of a triangle with a non-zero area, formed from three of these lengths_. If it is impossible to form any triangle of a non-zero area, return `0`.
**Example 1:**
**Input:** nums = \[2,1,2\]
**Output:** 5
**Explanation:** You can form a triangle with three si... | null | Array,Hash Table,Math,Geometry,Sorting | Medium | null |
152 | so what you're about to see next is me solving a leak code problem from my course JavaScript and lead code the interview boot camp where we solved the 75 most important lead toward problems using of course JavaScript and a JavaScript testing package called jest anyways the links to that course are in the description be... | Maximum Product Subarray | maximum-product-subarray | Given an integer array `nums`, find a subarray that has the largest product, and return _the product_.
The test cases are generated so that the answer will fit in a **32-bit** integer.
**Example 1:**
**Input:** nums = \[2,3,-2,4\]
**Output:** 6
**Explanation:** \[2,3\] has the largest product 6.
**Example 2:**
**I... | null | Array,Dynamic Programming | Medium | 53,198,238,628,713 |
454 | hey everybody this is larry this is day three of the february lego day challenge hit the like button to subscribe and join me on discord let me know what you think about today's farm uh hopefully everyone's doing well in general uh january has been over obviously so i'm gonna do these all month as usual uh i would say ... | 4Sum II | 4sum-ii | Given four integer arrays `nums1`, `nums2`, `nums3`, and `nums4` all of length `n`, return the number of tuples `(i, j, k, l)` such that:
* `0 <= i, j, k, l < n`
* `nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0`
**Example 1:**
**Input:** nums1 = \[1,2\], nums2 = \[-2,-1\], nums3 = \[-1,2\], nums4 = \[0,2\]
**Ou... | null | Array,Hash Table | Medium | 18 |
342 | hey everybody this is larry this is day 22nd of august hit the uh lego daily challenge hit the like button subscribe and join me on discord let me know what you think about today's form uh so power four is it easy okay that's fine um there are a couple ways you can do it uh let's see you can do it i mean you can buy ju... | 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 |
1,673 | hey folks welcome back to another video today if you're looking at question 1673 find the most competitive subsequence the way we'll be approaching the solution is by using a stack to keep a track of the indices that we'll be using from nouns to construct the resulting area in the process while you're populating the st... | 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 |
1,870 | foreign welcome back to my channel I realize I did not do the last few days of the July leap code or Juliet Code challenge recorded because I was traveling so we're starting this on Day 26 which is question number 1870 the minimum speed to arrive on time so when I submitted this would I submit this we had a rough go of... | Minimum Speed to Arrive on Time | minimum-speed-to-arrive-on-time | You are given a floating-point number `hour`, representing the amount of time you have to reach the office. To commute to the office, you must take `n` trains in sequential order. You are also given an integer array `dist` of length `n`, where `dist[i]` describes the distance (in kilometers) of the `ith` train ride.
E... | null | null | Medium | null |
1,090 | That Welcome Back Friends Vtu Solid Problem 1019 Conspiracy Values From Labels Aa Soft 1019 Conspiracy Values From Labels Aa Soft 1019 Conspiracy Values From Labels Aa Soft Human Body Knowing That You Would Create List Solution Videos In Java Applets J2 Interview Related Helpful Videos And Would Greatly Spoil Lik... | Largest Values From Labels | armstrong-number | There is a set of `n` items. You are given two integer arrays `values` and `labels` where the value and the label of the `ith` element are `values[i]` and `labels[i]` respectively. You are also given two integers `numWanted` and `useLimit`.
Choose a subset `s` of the `n` elements such that:
* The size of the subset... | Check if the given k-digit number equals the sum of the k-th power of it's digits. How to compute the sum of the k-th power of the digits of a number ? Can you divide the number into digits using division and modulus operations ? You can find the least significant digit of a number by taking it modulus 10. And you can ... | Math | Easy | null |
1,833 | Hello friends, our today's question is maximum ice cream bars. This is a medium level question of ateleed code. In this question, we will be given a variable named Eric Course, inside which we will have values, what will be the cost of ice cream and the second variable will be given to us. Coin We have so many coins, c... | 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,660 | hey everybody this is Larry this is me doing week four of the uh ni by weekly premium challenge what am I talking about but you know this problem hit the like button hit the Subscribe button join me on Discord let me know what you think about this problem 1660 correct a binary tree a problem that I have not done before... | Correct a Binary Tree | thousand-separator | You have a binary tree with a small defect. There is **exactly one** invalid node where its right child incorrectly points to another node at the **same depth** but to the **invalid node's right**.
Given the root of the binary tree with this defect, `root`, return _the root of the binary tree after **removing** this i... | Scan from the back of the integer and use dots to connect blocks with length 3 except the last block. | String | Easy | null |
147 | in this video we will see how to do insertion sort on the elements in a singly linked list so insertion sort is a very natural way of doing a sorting so you have let's say a number of cards let's say you have two four three one so first one is already sorted so you can think of them as a cards having numbers and you ha... | Insertion Sort List | insertion-sort-list | Given the `head` of a singly linked list, sort the list using **insertion sort**, and return _the sorted list's head_.
The steps of the **insertion sort** algorithm:
1. Insertion sort iterates, consuming one input element each repetition and growing a sorted output list.
2. At each iteration, insertion sort removes... | null | Linked List,Sorting | Medium | 148,850 |
297 | the hacker heap in this video we will look into this problem serialize and deserialize binary tree from lead code the problem is if given a tree we need to serialize the tree into this string and if given a string we need to create a tree and return it back so before we start please like and subscribe to the channel be... | Serialize and Deserialize Binary Tree | serialize-and-deserialize-binary-tree | Serialization is the process of 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 bi... | null | String,Tree,Depth-First Search,Breadth-First Search,Design,Binary Tree | Hard | 271,449,652,765 |
947 | Ki Sachin Questions Likh Phanda Medium Bat And Its Most Stones Remove vid0 And Column Soen Vivah Birds Play In The World With A Bunch Of Faults And Mid Point Meghvansh Newly Married Stones Problem And Here Removing The Room With Date Sheet 2018 200 Om Vipal Type Laut This The Amazing 10 Sharing Simro So They Can Move O... | Most Stones Removed with Same Row or Column | online-election | On a 2D plane, we place `n` stones at some integer coordinate points. Each coordinate point may have at most one stone.
A stone can be removed if it shares either **the same row or the same column** as another stone that has not been removed.
Given an array `stones` of length `n` where `stones[i] = [xi, yi]` represen... | null | Array,Hash Table,Binary Search,Design | Medium | 1483 |
95 | Hello friends, we are going to talk in today's video, if there is any problem, unique vansh only RTO, then one of my recommendations would be to do female tuning - part-10, female tuning - part-10, female tuning - part-10, you will get very good training, why should you take this problem, you will come to solve this pr... | Unique Binary Search Trees II | unique-binary-search-trees-ii | Given an integer `n`, return _all the structurally unique **BST'**s (binary search trees), which has exactly_ `n` _nodes of unique values from_ `1` _to_ `n`. Return the answer in **any order**.
**Example 1:**
**Input:** n = 3
**Output:** \[\[1,null,2,null,3\],\[1,null,3,2\],\[2,1,3\],\[3,1,null,null,2\],\[3,2,null,1\... | null | Dynamic Programming,Backtracking,Tree,Binary Search Tree,Binary Tree | Medium | 96,241 |
1,857 | hey everyone today we are going to solve the radical question largest color value in your directed graph which involves finding the largest number of nodes in your path with the same color in your directed graph so in this problem each node in the graph is associated with a color represented by a lowercase letter so li... | Largest Color Value in a Directed Graph | largest-color-value-in-a-directed-graph | There is a **directed graph** of `n` colored nodes and `m` edges. The nodes are numbered from `0` to `n - 1`.
You are given a string `colors` where `colors[i]` is a lowercase English letter representing the **color** of the `ith` node in this graph (**0-indexed**). You are also given a 2D array `edges` where `edges[j]... | null | null | Hard | null |
86 | welcome ladies and gentlemen boys and girls today i want to solve another problem which is partition list so basically this is the best problem it gets like from my side okay let's see what the question is saying like we given the head of a league list and a value x partition it's just that all nodes less than x comes ... | 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 |
718 | Hi gas welcome and welcome back tu my channel so today our problem is maximum length of repeated so in this problem statement what have we given here name van and namas tu de rakha hai ok what do we have to do na find the maximum length There is a submerre which is present in both, okay, so let us understand through th... | Maximum Length of Repeated Subarray | maximum-length-of-repeated-subarray | Given two integer arrays `nums1` and `nums2`, return _the maximum length of a subarray that appears in **both** arrays_.
**Example 1:**
**Input:** nums1 = \[1,2,3,2,1\], nums2 = \[3,2,1,4,7\]
**Output:** 3
**Explanation:** The repeated subarray with maximum length is \[3,2,1\].
**Example 2:**
**Input:** nums1 = \[0... | Use dynamic programming. dp[i][j] will be the answer for inputs A[i:], B[j:]. | Array,Binary Search,Dynamic Programming,Sliding Window,Rolling Hash,Hash Function | Medium | 209,2051 |
303 | Hello guys welcome to my video problem in half an hour school principal rickshaw blurred multiple quality basically office let them between the left and right in this slide as an example to one's and supporters 1234 this youth to-do list related to give till very youth to-do list related to give till very youth to-do l... | Range Sum Query - Immutable | range-sum-query-immutable | Given an integer array `nums`, handle multiple queries of the following type:
1. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`.
Implement the `NumArray` class:
* `NumArray(int[] nums)` Initializes the object with the integer array `nums`.
* ... | null | Array,Design,Prefix Sum | Easy | 304,307,325 |
35 | hi everyone today we're gonna talk about one more question on binary search so name of the question as you can see is search insert position this question is a standard question and this question is from lead code let's read the question given a sorted array of distinct integers and a Target value return the index if t... | 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 |
241 | we're going to take a look at a legal problem called different ways to add parentheses so given a string expression of numbers and operators return all possible results from computing all the different possible ways to group numbers and operators together so you might return the answer in any order so you can see here ... | Different Ways to Add Parentheses | different-ways-to-add-parentheses | Given a string `expression` of numbers and operators, return _all possible results from computing all the different possible ways to group numbers and operators_. You may return the answer in **any order**.
The test cases are generated such that the output values fit in a 32-bit integer and the number of different res... | null | Math,String,Dynamic Programming,Recursion,Memoization | Medium | 95,224,282,2147,2328 |
1,464 | hey everyone today i'll be going over lead code 1464 maximum product of two elements in an array so given an array of nums uh you want to choose i and j of that array uh return the maximum value of nums at i minus 1 times nums of j minus 1. so very confusing way to word it i'll take a test case here it's very simple to... | Maximum Product of Two Elements in an Array | reduce-array-size-to-the-half | Given the array of integers `nums`, you will choose two different indices `i` and `j` of that array. _Return the maximum value of_ `(nums[i]-1)*(nums[j]-1)`.
**Example 1:**
**Input:** nums = \[3,4,5,2\]
**Output:** 12
**Explanation:** If you choose the indices i=1 and j=2 (indexed from 0), you will get the maximum v... | Count the frequency of each integer in the array. Start with an empty set, add to the set the integer with the maximum frequency. Keep Adding the integer with the max frequency until you remove at least half of the integers. | Array,Hash Table,Greedy,Sorting,Heap (Priority Queue) | Medium | null |
6 | Hello Everyone and Welcome Back to My Channel Algorithm Why Today I am Going to Write the Code and Also Explain to You the Algorithm to Solve This Zigzag Conversion Problem Which is There in Lead Quote It is a Medium Level Problem and Has Been Asked in A Number of Companies Which Makes It Important for Interviews So le... | Zigzag Conversion | zigzag-conversion | The string `"PAYPALISHIRING "` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S I I G
Y I R
And then read line by line: `"PAHNAPLSIIGYIR "`
Write the code that will take a string and make this co... | null | String | Medium | null |
270 | okay so lead code practice time easy question closes binary search tree value um if you have um seen the previous video two goals similar as previous videos two goals the first one is to find the solution for this specific problem and put some solid code there and the other one is to see how to solve the problem proper... | Closest Binary Search Tree Value | closest-binary-search-tree-value | Given the `root` of a binary search tree and a `target` value, return _the value in the BST that is closest to the_ `target`. If there are multiple answers, print the smallest.
**Example 1:**
**Input:** root = \[4,2,5,1,3\], target = 3.714286
**Output:** 4
**Example 2:**
**Input:** root = \[1\], target = 4.428571
*... | null | Binary Search,Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | 222,272,783 |
1,594 | hey everybody this is larry this is me going over q3 of the recent weekly contest 207 uh hit the like button to subscribe and join me on discord and let me know what you think about this farm uh maximum non-negative product in the uh maximum non-negative product in the uh maximum non-negative product in the matrix uh s... | Maximum Non Negative Product in a Matrix | maximum-non-negative-product-in-a-matrix | You are given a `m x n` matrix `grid`. Initially, you are located at the top-left corner `(0, 0)`, and in each step, you can only **move right or down** in the matrix.
Among all possible paths starting from the top-left corner `(0, 0)` and ending in the bottom-right corner `(m - 1, n - 1)`, find the path with the **ma... | null | null | Medium | null |
338 | hey everyone welcome back and let's write some more neat code today so today we're going to be solving a binary question counting bits and this is one of the binary questions from the blind 75 list that we've been tracking in the spreadsheet so we will finally be adding a video solution to this binary problem i'm prett... | Counting Bits | counting-bits | Given an integer `n`, return _an array_ `ans` _of length_ `n + 1` _such that for each_ `i` (`0 <= i <= n`)_,_ `ans[i]` _is the **number of**_ `1`_**'s** in the binary representation of_ `i`.
**Example 1:**
**Input:** n = 2
**Output:** \[0,1,1\]
**Explanation:**
0 --> 0
1 --> 1
2 --> 10
**Example 2:**
**Input:** n =... | You should make use of what you have produced already. Divide the numbers in ranges like [2-3], [4-7], [8-15] and so on. And try to generate new range from previous. Or does the odd/even status of the number help you in calculating the number of 1s? | Dynamic Programming,Bit Manipulation | Easy | 191 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.