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
960
problem 962 the columns to make sorted3 okay so let's go through the problem description first we are given an array a of n lowercase letter strings all of the same length now we may choose any set of deletion indices and for each string we delete all the characters in those indices so for example if we have an array a...
Delete Columns to Make Sorted III
minimize-malware-spread
You are given an array of `n` strings `strs`, all of the same length. We may choose any deletion indices, and we delete all the characters in those indices for each string. For example, if we have `strs = [ "abcdef ", "uvwxyz "]` and deletion indices `{0, 2, 3}`, then the final array after deletions is `[ "bef ", "vy...
null
Array,Depth-First Search,Breadth-First Search,Union Find,Matrix
Hard
null
1,621
well I leave code every day never take no Hiatus this is number of sets of K non-overlapping line segments non-overlapping line segments non-overlapping line segments okay let's go ahead and get right into this problem so given endpoints on a 1D plane where the ith point from 0 to n minus 1 is at k x equals I find the ...
Number of Sets of K Non-Overlapping Line Segments
number-of-subsequences-that-satisfy-the-given-sum-condition
Given `n` points on a 1-D plane, where the `ith` point (from `0` to `n-1`) is at `x = i`, find the number of ways we can draw **exactly** `k` **non-overlapping** line segments such that each segment covers two or more points. The endpoints of each segment must have **integral coordinates**. The `k` line segments **do n...
Sort the array nums. Use two pointers approach: Given an index i (choose it as the minimum in a subsequence) find the maximum j where j ≥ i and nums[i] +nums[j] ≤ target. Count the number of subsequences.
Array,Two Pointers,Binary Search,Sorting
Medium
null
1,915
There are hello guys also in this video they go into se 10 problem numbers and wonderful subjects so what is a wonderful subscribe interesting where at most one later affairs and number of times she can see the example portion this scene which is six example water crisis in the number Of Times Series Repeated History A...
Number of Wonderful Substrings
check-if-one-string-swap-can-make-strings-equal
A **wonderful** string is a string where **at most one** letter appears an **odd** number of times. * For example, `"ccjjc "` and `"abab "` are wonderful, but `"ab "` is not. Given a string `word` that consists of the first ten lowercase English letters (`'a'` through `'j'`), return _the **number of wonderful non-e...
The answer is false if the number of nonequal positions in the strings is not equal to 0 or 2. Check that these positions have the same set of characters.
Hash Table,String,Counting
Easy
889
61
hey what's up guys think white here I do token counting stuff on twitch in YouTube I do the Premium Lee codes on patreon everything's in the description and you should join my discord thank you this problem is called rotate array a lot of likes some dislikes I saw people complaining it was too hard given an array rotat...
Rotate List
rotate-list
Given the `head` of a linked list, rotate the list to the right by `k` places. **Example 1:** **Input:** head = \[1,2,3,4,5\], k = 2 **Output:** \[4,5,1,2,3\] **Example 2:** **Input:** head = \[0,1,2\], k = 4 **Output:** \[2,0,1\] **Constraints:** * The number of nodes in the list is in the range `[0, 500]`. * ...
null
Linked List,Two Pointers
Medium
189,725
365
hi everyone this is Emma let's look at some little problems today we are going to look at 365 water and Jack problem so first let's read the problem you are given two Jacks with capacity The Jug 1 capacity and the drag 2 capacity leaders and there is infinite amount of the water supply available you need to determine i...
Water and Jug Problem
water-and-jug-problem
You are given two jugs with capacities `jug1Capacity` and `jug2Capacity` liters. There is an infinite amount of water supply available. Determine whether it is possible to measure exactly `targetCapacity` liters using these two jugs. If `targetCapacity` liters of water are measurable, you must have `targetCapacity` li...
null
Math,Depth-First Search,Breadth-First Search
Medium
null
55
hello everyone let's look at jump game the problem statement is we are giving an array of positive integers we are initially positioned at the first index of the ray each element in array represents the maximum jump we can take at that position we need to determine if we are able to reach the last index let's look at t...
Jump Game
jump-game
You are given an integer array `nums`. You are initially positioned at the array's **first index**, and each element in the array represents your maximum jump length at that position. Return `true` _if you can reach the last index, or_ `false` _otherwise_. **Example 1:** **Input:** nums = \[2,3,1,1,4\] **Output:** t...
null
Array,Dynamic Programming,Greedy
Medium
45,1428,2001
159
now let's take a look at a legal problem called longest substring with at most two distinct characters so given a string s find the length of the longest substring t that contains at most two distinct characters so at most to the same character basically means that um not no more than two distinct characters so if we h...
Longest Substring with At Most Two Distinct Characters
longest-substring-with-at-most-two-distinct-characters
Given a string `s`, return _the length of the longest_ _substring_ _that contains at most **two distinct characters**_. **Example 1:** **Input:** s = "eceba " **Output:** 3 **Explanation:** The substring is "ece " which its length is 3. **Example 2:** **Input:** s = "ccaabbb " **Output:** 5 **Explanation:** The ...
null
Hash Table,String,Sliding Window
Medium
3,239,340,1034
1,002
hello everyone today we are gonna solve find common characters problem so in this problem we have an array of strings and we have to find the common characters which are present in all string including the duplicate so in this example you can see that e double l is present in all of these three string so in this case w...
Find Common Characters
maximum-width-ramp
Given a string array `words`, return _an array of all characters that show up in all strings within the_ `words` _(including duplicates)_. You may return the answer in **any order**. **Example 1:** **Input:** words = \["bella","label","roller"\] **Output:** \["e","l","l"\] **Example 2:** **Input:** words = \["cool"...
null
Array,Stack,Monotonic Stack
Medium
null
1,603
In this video, we will discuss the problem of Design Parking System, its category is Easy. In this problem, you have to design a parking system in which you have to draw only two umpires, one is Ad and the other is Ad. These are the only two umpires which are there in your parking system. There are three types of parki...
Design Parking System
running-sum-of-1d-array
Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size. Implement the `ParkingSystem` class: * `ParkingSystem(int big, int medium, int small)` Initializes object of the `ParkingSystem` class. The number of slot...
Think about how we can calculate the i-th number in the running sum from the (i-1)-th number.
Array,Prefix Sum
Easy
null
930
hi guys good morning welcome back to a new video again a bit Rand in the beginning I see a lot of people just in sake of telling the most optimal solution they forget to tell that it is not applicable to anything so in this we'll see very deep again we'll see two questions first is sabaris some less than equal to G has...
Binary Subarrays With Sum
all-possible-full-binary-trees
Given a binary array `nums` and an integer `goal`, return _the number of non-empty **subarrays** with a sum_ `goal`. A **subarray** is a contiguous part of the array. **Example 1:** **Input:** nums = \[1,0,1,0,1\], goal = 2 **Output:** 4 **Explanation:** The 4 subarrays are bolded and underlined below: \[**1,0,1**,0...
null
Dynamic Programming,Tree,Recursion,Memoization,Binary Tree
Medium
null
42
Loot Hello Viewers Welcome Back YouTube Channel Score Today Will Be Solving Tracking And Water Before You Start Prepare YouTube Channel Subscribe And Hit Notification Force And Latest Update In This Question In The Given Away With Certain Parts Example 06 2012 Total Arm Hole Example Subscribe Liquid water contains two ...
Trapping Rain Water
trapping-rain-water
Given `n` non-negative integers representing an elevation map where the width of each bar is `1`, compute how much water it can trap after raining. **Example 1:** **Input:** height = \[0,1,0,2,1,0,1,3,2,1,2,1\] **Output:** 6 **Explanation:** The above elevation map (black section) is represented by array \[0,1,0,2,1,...
null
Array,Two Pointers,Dynamic Programming,Stack,Monotonic Stack
Hard
11,238,407,756
234
That welcome too much expressed in the chair and going to explain about fundamental list superman tourist places contract employee in english playlist begum elements humble subject vision spelling and notes the fair will create unrest north to turn the M.Ed value turn the M.Ed value turn the M.Ed value het the fifth mo...
Palindrome Linked List
palindrome-linked-list
Given the `head` of a singly linked list, return `true` _if it is a_ _palindrome_ _or_ `false` _otherwise_. **Example 1:** **Input:** head = \[1,2,2,1\] **Output:** true **Example 2:** **Input:** head = \[1,2\] **Output:** false **Constraints:** * The number of nodes in the list is in the range `[1, 105]`. * ...
null
Linked List,Two Pointers,Stack,Recursion
Easy
9,125,206,2236
91
hi everyone welcome back to lead coding i am your host faraz so let us continue solving some more questions on dynamic programming so this question decode ways is a really famous interview question it has come so many times in interviews and this question is going to teach you something really important it will teach u...
Decode Ways
decode-ways
A message containing letters from `A-Z` can be **encoded** into numbers using the following mapping: 'A' -> "1 " 'B' -> "2 " ... 'Z' -> "26 " To **decode** an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For examp...
null
String,Dynamic Programming
Medium
639,2091
1,743
hey everyone today i'll be going over leak code problem 1743 you restore the array from adjacent pairs so we have all this junk but it's actually really simple so basically we're given some adjacent pairs array like this and it's really just edges so node two is connected to node one uh node three is connected to node ...
Restore the Array From Adjacent Pairs
count-substrings-that-differ-by-one-character
There is an integer array `nums` that consists of `n` **unique** elements, but you have forgotten it. However, you do remember every pair of adjacent elements in `nums`. You are given a 2D integer array `adjacentPairs` of size `n - 1` where each `adjacentPairs[i] = [ui, vi]` indicates that the elements `ui` and `vi` a...
Take every substring of s, change a character, and see how many substrings of t match that substring. Use a Trie to store all substrings of t as a dictionary.
Hash Table,String,Dynamic Programming
Medium
2256
199
going to show you how to solve this legal question 199 binary tree right side view and it's a median legal question so given root of a binary tree imagine yourself standing on the right side of it return the value of the node you can see ordered or from top to bottom so a tree look like this in example one what the res...
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
657
yes I'll be solving found six five seven called robot returned to origin I promise it's that the robots are the in position 0 the origin on 2d plane given a sequence of moves judge if the robot ends up at 0 after its moves so the move sequence is represented by a string and the character moves I represents the eyes mov...
Robot Return to Origin
robot-return-to-origin
There is a robot starting at the position `(0, 0)`, the origin, on a 2D plane. Given a sequence of its moves, judge if this robot **ends up at** `(0, 0)` after it completes its moves. You are given a string `moves` that represents the move sequence of the robot where `moves[i]` represents its `ith` move. Valid moves a...
null
String,Simulation
Easy
547,2239
1,914
hey everybody this is larry this is me going with q2 of the weekly contest 247 uh cynically rotating uh grid uh hit the like button hit the subscribe button join me on discord and we'll chat about this or other contest problems in general right after the contest anyway so for this problem i think this is actually strai...
Cyclically Rotating a Grid
find-the-subtasks-that-did-not-execute
You are given an `m x n` integer matrix `grid`​​​, where `m` and `n` are both **even** integers, and an integer `k`. The matrix is composed of several layers, which is shown in the below image, where each color is its own layer: A cyclic rotation of the matrix is done by cyclically rotating **each layer** in the matr...
null
Database
Hard
null
1,962
hey everybody this is Larry this is day 28 I believe of the liko day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about this problem and this thing my assume is a little bit big but yeah uh hit the like button hit a subscribe I always say that oh man I am just hav...
Remove Stones to Minimize the Total
single-threaded-cpu
You are given a **0-indexed** integer array `piles`, where `piles[i]` represents the number of stones in the `ith` pile, and an integer `k`. You should apply the following operation **exactly** `k` times: * Choose any `piles[i]` and **remove** `floor(piles[i] / 2)` stones from it. **Notice** that you can apply the ...
To simulate the problem we first need to note that if at any point in time there are no enqueued tasks we need to wait to the smallest enqueue time of a non-processed element We need a data structure like a min-heap to support choosing the task with the smallest processing time from all the enqueued tasks
Array,Sorting,Heap (Priority Queue)
Medium
2176
1,758
And listen hello everyone welcome to my channel also in this video you will be cleaning this problem minimal changes to make an alternating by ministry of mines videos winters problem entertainment and print and you think absolutely taste selection most of the problems yes-yes that muni selection most of the problems y...
Minimum Changes To Make Alternating Binary String
distribute-repeating-integers
You are given a string `s` consisting only of the characters `'0'` and `'1'`. In one operation, you can change any `'0'` to `'1'` or vice versa. The string is called alternating if no two adjacent characters are equal. For example, the string `"010 "` is alternating, while the string `"0100 "` is not. Return _the **m...
Count the frequencies of each number. For example, if nums = [4,4,5,5,5], frequencies = [2,3]. Each customer wants all of their numbers to be the same. This means that each customer will be assigned to one number. Use dynamic programming. Iterate through the numbers' frequencies, and choose some subset of customers to ...
Array,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask
Hard
null
1,710
welcome to june's leeco challenge today's problem is maximum units on a truck you are assigned to put some amount of boxes onto one truck you are given a 2d array box types where box types i contains the number of boxes and the number of units per box now the number of boxes is the number of boxes of this type and the ...
Maximum Units on a Truck
find-servers-that-handled-most-number-of-requests
You are assigned to put some amount of boxes onto **one truck**. You are given a 2D array `boxTypes`, where `boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]`: * `numberOfBoxesi` is the number of boxes of type `i`. * `numberOfUnitsPerBoxi` is the number of units in each box of the type `i`. You are also given...
To speed up the next available server search, keep track of the available servers in a sorted structure such as an ordered set. To determine if a server is available, keep track of the end times for each task in a heap and add the server to the available set once the soonest task ending time is less than or equal to th...
Array,Greedy,Heap (Priority Queue),Ordered Set
Hard
null
96
hello and welcome to my channel so let's uh today let's look at the litco 96 unique binary search tree given integer and return the number of unique psts which has exactly n nodes of unique values from 1 to n so the first example is a 1 n is 3. the number of unique binary is five second example is one n is one the numb...
Unique Binary Search Trees
unique-binary-search-trees
Given an integer `n`, return _the number of structurally unique **BST'**s (binary search trees) which has exactly_ `n` _nodes of unique values from_ `1` _to_ `n`. **Example 1:** **Input:** n = 3 **Output:** 5 **Example 2:** **Input:** n = 1 **Output:** 1 **Constraints:** * `1 <= n <= 19`
null
Math,Dynamic Programming,Tree,Binary Search Tree,Binary Tree
Medium
95
382
Hai Everyone So Today I Will Like To Share The Problem Ka The Daily Cheat Code Challenge Linked List You Can Read The Problem Statement From Her The Problem Statement You Can Take D Screenshot Of D C Plus Solution To This Problem Date Ise Ki Humane Reverse Kya Link It is ok, note using other express then the time compl...
Linked List Random Node
linked-list-random-node
Given a singly linked list, return a random node's value from the linked list. Each node must have the **same probability** of being chosen. Implement the `Solution` class: * `Solution(ListNode head)` Initializes the object with the head of the singly-linked list `head`. * `int getRandom()` Chooses a node randoml...
null
Linked List,Math,Reservoir Sampling,Randomized
Medium
398
994
hello guys welcome to algorithms made easy today we will go through the day 9 problem from august lead coding challenge rotting oranges please like the video and if you are new don't forget to subscribe to our channel so that you never miss any update in a given grid each cell can have one of the three values the value...
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
455
hello guys and welcome back to lead Logics this is the sign cookies problem from lead code this is a lead code easy and the number for this is 455 and before starting with the question I want to wish you all a very happy New Year and may you all succeed in your career paths so let's start with the question so in the qu...
Assign Cookies
assign-cookies
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child `i` has a greed factor `g[i]`, which is the minimum size of a cookie that the child will be content with; and each cookie `j` has a size `s[j]`. If `s[j] >= g[i]`, we can assign ...
null
Array,Greedy,Sorting
Easy
null
111
hey guys welcome back to this video in this video we're going to work through the intuition to find the minimum depth of a binary tree for example if you're given this binary tree we have to return to because the minimum depth of this binary tree is two and this path okay now how we can find minimum depth of a binary t...
Minimum Depth of Binary Tree
minimum-depth-of-binary-tree
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. **Note:** A leaf is a node with no children. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** 2 **Example 2:** **Input:** root = \[2...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
102,104
684
welcome to june's leeco challenge today's problem is redundant connection in this problem a tree is an undirected graph that is connected and has no cycles you are given a graph that started as a tree with n nodes labeled from 1 to n with one additional edge added the added edge has two different vertices chosen from o...
Redundant Connection
redundant-connection
In this problem, a tree is an **undirected graph** that is connected and has no cycles. You are given a graph that started as a tree with `n` nodes labeled from `1` to `n`, with one additional edge added. The added edge has two **different** vertices chosen from `1` to `n`, and was not an edge that already existed. Th...
null
Depth-First Search,Breadth-First Search,Union Find,Graph
Medium
685,721,2246
825
In this video, we friends shop appropriate agency are going to solve this question, we have a question which is quite fantastic, brother-in-law are people on social fantastic, brother-in-law are people on social fantastic, brother-in-law are people on social media website, you are living and waiting, error is where the...
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
37
hello everyone welcome to coding culture this channel will contain those programs whose explanation is either not present on youtube or the explanation is present but not up to the mark so without wasting time let's get started so today's question is the sudoku solver so which is also the daily question of 21 of august...
Sudoku Solver
sudoku-solver
Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy **all of the following rules**: 1. Each of the digits `1-9` must occur exactly once in each row. 2. Each of the digits `1-9` must occur exactly once in each column. 3. Each of the digits `1-9` must occur exactly onc...
null
Array,Backtracking,Matrix
Hard
36,1022
1,268
Hello everyone, welcome to 10 off DSL practice and as promised, I will practice this week too, whether it is New Year or whatever, I will not leave you, I have to practice for 5 days, is it okay, so the question you asked today. The question that has been asked is the search suggestion system. What is the question insi...
Search Suggestions System
market-analysis-i
You are given an array of strings `products` and a string `searchWord`. Design a system that suggests at most three product names from `products` after each character of `searchWord` is typed. Suggested products should have common prefix with `searchWord`. If there are more than three products with a common prefix ret...
null
Database
Medium
null
349
this is the question 349 intersection of two arrays what it has is that you have two arrays and you want to find the intersection of them and the output should not be any element that is repeated like it should be all unique values so let's do this so i want to use a set high step equals to set and then i'm looking i'm...
Intersection of Two Arrays
intersection-of-two-arrays
Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must be **unique** and you may return the result in **any order**. **Example 1:** **Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\] **Output:** \[2\] **Example 2:** **Input:** nums1 = \[4,9,5\], nums2 = \...
null
Array,Hash Table,Two Pointers,Binary Search,Sorting
Easy
350,1149,1392,2190,2282
218
Do it In this video channel today's video, we solve the skyline problem that the suicide problem asks something in such a way that on one side it seems that the girls have that their start point and end point is given by the nutrition channel which is required from rectangle 1 2 80 for 3 minutes Next rectangle is 327 F...
The Skyline Problem
the-skyline-problem
A city's **skyline** is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of all the buildings, return _the **skyline** formed by these buildings collectively_. The geometric information of each building is given in the array `buil...
null
Array,Divide and Conquer,Binary Indexed Tree,Segment Tree,Line Sweep,Heap (Priority Queue),Ordered Set
Hard
699
350
this question is question number 350 intersection of two arrays two given two integer arrays numbers one and numbers two 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 so uh let's say we have something like...
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
35
this is the 35th leeco Challenge and it is called search insert position give an assorted 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 olog and runtime complexity so if you ge...
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,653
hello all right let's uh code minimum deletions to make string balance done this before but don't think i've made a video about it you're given a string s consisting only of characters a and b you can delete any number of characters in s to make s balance s is balanced if there is no pair of indices i j such that i is ...
Minimum Deletions to Make String Balanced
number-of-good-leaf-nodes-pairs
You are given a string `s` consisting only of characters `'a'` and `'b'`​​​​. You can delete any number of characters in `s` to make `s` **balanced**. `s` is **balanced** if there is no pair of indices `(i,j)` such that `i < j` and `s[i] = 'b'` and `s[j]= 'a'`. Return _the **minimum** number of deletions needed to ma...
Start DFS from each leaf node. stop the DFS when the number of steps done > distance. If you reach another leaf node within distance steps, add 1 to the answer. Note that all pairs will be counted twice so divide the answer by 2.
Tree,Depth-First Search,Binary Tree
Medium
null
1,962
Hi gas welcome and welcome back to my channel so today our problem is remove stones you minimize the total so this is the problem statement what have they given us here they have given us a wait called Piles where your Piles I represent. Here is the number of stones Hindi rectangle file ok and here we have given you a ...
Remove Stones to Minimize the Total
single-threaded-cpu
You are given a **0-indexed** integer array `piles`, where `piles[i]` represents the number of stones in the `ith` pile, and an integer `k`. You should apply the following operation **exactly** `k` times: * Choose any `piles[i]` and **remove** `floor(piles[i] / 2)` stones from it. **Notice** that you can apply the ...
To simulate the problem we first need to note that if at any point in time there are no enqueued tasks we need to wait to the smallest enqueue time of a non-processed element We need a data structure like a min-heap to support choosing the task with the smallest processing time from all the enqueued tasks
Array,Sorting,Heap (Priority Queue)
Medium
2176
1,675
welcome to Pomodoro Joe for Friday February 24th 2023 today we're looking at lead code problem 1675 minimize deviation in Array this is a hard one you're given an array nums of n positive integers you can perform two types of operations on any element in the array any number of times if the element is even you can divi...
Minimize Deviation in Array
magnetic-force-between-two-balls
You are given an array `nums` of `n` positive integers. You can perform two types of operations on any element of the array any number of times: * If the element is **even**, **divide** it by `2`. * For example, if the array is `[1,2,3,4]`, then you can do this operation on the last element, and the array wil...
If you can place balls such that the answer is x then you can do it for y where y < x. Similarly if you cannot place balls such that the answer is x then you can do it for y where y > x. Binary search on the answer and greedily see if it is possible.
Array,Binary Search,Sorting
Medium
2188
43
foreign problem number 43 in this we multiply two strings welcome to the video let us begin we are given two non-empty begin we are given two non-empty begin we are given two non-empty non-negative strings consisting of non-negative strings consisting of non-negative strings consisting of digits only they don't have an...
Multiply Strings
multiply-strings
Given two non-negative integers `num1` and `num2` represented as strings, return the product of `num1` and `num2`, also represented as a string. **Note:** You must not use any built-in BigInteger library or convert the inputs to integer directly. **Example 1:** **Input:** num1 = "2", num2 = "3" **Output:** "6" **Ex...
null
Math,String,Simulation
Medium
2,66,67,415
100
Hello everyone, Evgeniy Sulima nov is with you and today we are looking at solving the problem easily from number 100 cm3, according to the conditions of this problem, I was given two binary trees and I must implement a method that checks whether these two trees are at peace with themselves or not, that is, for example...
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
1
Hello hello everybody welcome to my channel it's all the very famous problem tourism delinquent problem number 520 this problem given energy of India has written in basis of two numbers given to specific target that they have one solution and you may not use this element sorry for example 1327 1115 That's Not Every Ele...
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,844
all right howdy guys this is uh Josh here with another Elite code question so today we're doing leak code uh question number 1844 replace all digits with characters you are given a zero index string s that has lowercase English letters and it's even indices and digits and it's odd indices there's a function shift c x w...
Replace All Digits with Characters
maximum-number-of-balls-in-a-box
You are given a **0-indexed** string `s` that has lowercase English letters in its **even** indices and digits in its **odd** indices. There is a function `shift(c, x)`, where `c` is a character and `x` is a digit, that returns the `xth` character after `c`. * For example, `shift('a', 5) = 'f'` and `shift('x', 0) =...
Note that both lowLimit and highLimit are of small constraints so you can iterate on all nubmer between them You can simulate the boxes by counting for each box the number of balls with digit sum equal to that box number
Hash Table,Math,Counting
Easy
null
290
Hello friends uh very happy New Year so in this video we will solve lead code daily challenge problem one that is the first day of January and the problem named is word pattern so we are given a pattern and a string s and we need to find if string as follows the same pattern so here follows means a full match and there...
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
1,721
hello friends welcome to coding interviews channel hope you are doing great if you haven't subscribed to my channel yet please go ahead and subscribe i have created bunch of playlists to cover various categories of problems such as bfs dfs dynamic programming and so on please check them out i have uploaded the code for...
Swapping Nodes in a Linked List
maximum-profit-of-operating-a-centennial-wheel
You are given the `head` of a linked list, and an integer `k`. Return _the head of the linked list after **swapping** the values of the_ `kth` _node from the beginning and the_ `kth` _node from the end (the list is **1-indexed**)._ **Example 1:** **Input:** head = \[1,2,3,4,5\], k = 2 **Output:** \[1,4,3,2,5\] **Ex...
Think simulation Note that the number of turns will never be more than 50 / 4 * n
Array,Simulation
Medium
null
1,590
Hello everyone so today we will be discussing question number 15908 code which is make sum divisible by p so in this question what is told to us that c have you remove sach date d sum of remaining element is divisible by p means we have to make a smaller sub Hey, if we have to remove as little as is possible from this ...
Make Sum Divisible by P
make-sum-divisible-by-p
Given an array of positive integers `nums`, remove the **smallest** subarray (possibly **empty**) such that the **sum** of the remaining elements is divisible by `p`. It is **not** allowed to remove the whole array. Return _the length of the smallest subarray that you need to remove, or_ `-1` _if it's impossible_. A ...
null
null
Medium
null
1,679
alright guys welcome back to make challenge 2022 the default so max number of k sub pairs we are giving an integer array numbers and an integer k in one operation you can pick two numbers from the array whose sum equals k and remove them from the array return the maximum number of operation you can perform on array so ...
Max Number of K-Sum Pairs
shortest-subarray-to-be-removed-to-make-array-sorted
You are given an integer array `nums` and an integer `k`. In one operation, you can pick two numbers from the array whose sum equals `k` and remove them from the array. Return _the maximum number of operations you can perform on the array_. **Example 1:** **Input:** nums = \[1,2,3,4\], k = 5 **Output:** 2 **Explana...
The key is to find the longest non-decreasing subarray starting with the first element or ending with the last element, respectively. After removing some subarray, the result is the concatenation of a sorted prefix and a sorted suffix, where the last element of the prefix is smaller than the first element of the suffix...
Array,Two Pointers,Binary Search,Stack,Monotonic Stack
Medium
null
528
hey everybody this is Larry this is 2/5 tear to chew in the coach and let's 2/5 tear to chew in the coach and let's 2/5 tear to chew in the coach and let's get started hit the like button hit the subscribe button let me know what you think random pick with weight giving it a way of a weight W a positive integers where ...
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
476
back to helgi karina and today we are back with another very interesting problem on lead code which is the number complement now if you see that this problem has been tagged as an easy problem and i do agree with it because it has a very easy and a very simple kind of a solution along with it so why i want to touch thi...
Number Complement
number-complement
The **complement** of an integer is the integer you get when you flip all the `0`'s to `1`'s and all the `1`'s to `0`'s in its binary representation. * For example, The integer `5` is `"101 "` in binary and its **complement** is `"010 "` which is the integer `2`. Given an integer `num`, return _its complement_. **...
null
Bit Manipulation
Easy
null
232
hi guys welcome back to the channel eat cod and sleep and today's Le code problem will be Implement Q using stack so let us see what are the companies ask this question here and we can see all the Fang companies have asked this question so this is a very important question we need to solve here and we need to understan...
Implement Queue using Stacks
implement-queue-using-stacks
Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (`push`, `peek`, `pop`, and `empty`). Implement the `MyQueue` class: * `void push(int x)` Pushes element x to the back of the queue. * `int pop()` Removes the element from th...
null
Stack,Design,Queue
Easy
225
1,624
hey guys welcome to a new video in today's video we're going to look at a lead code problem and the problem's name is largest substring between two equal characters so in this question we given a string s we have to return the length of the longest substring between two equal characters excluding the two characters if ...
Largest Substring Between Two Equal Characters
clone-binary-tree-with-random-pointer
Given a string `s`, return _the length of the longest substring between two equal characters, excluding the two characters._ If there is no such substring return `-1`. A **substring** is a contiguous sequence of characters within a string. **Example 1:** **Input:** s = "aa " **Output:** 0 **Explanation:** The optim...
Traverse the tree, keep a hashtable with you and create a nodecopy for each node in the tree. Start traversing the original tree again and connect the left, right and random pointers in the cloned tree the same way as the original tree with the help of the hashtable.
Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
133,138,1634
1,763
hey guys so welcome back to another video in this video we are going to see a problem called longest nice substring given that a string s is nice if for every letter of the alphabet that contains that s contains it appears both in upper and lower case so for example a b is nice because capital a and small a appear and ...
Longest Nice Substring
all-valid-triplets-that-can-represent-a-country
A string `s` is **nice** if, for every letter of the alphabet that `s` contains, it appears **both** in uppercase and lowercase. For example, `"abABB "` is nice because `'A'` and `'a'` appear, and `'B'` and `'b'` appear. However, `"abA "` is not because `'b'` appears, but `'B'` does not. Given a string `s`, return _th...
null
Database
Easy
null
1,802
hello guys welcome back today we are going to understand to delete your question okay so let's see the today question so today we have given 1802 uh maximum value at a given index we have given in a bounded array right so let's continue to understand this question right so this is a lead code 1802 question so it is say...
Maximum Value at a Given Index in a Bounded Array
number-of-students-unable-to-eat-lunch
You are given three positive integers: `n`, `index`, and `maxSum`. You want to construct an array `nums` (**0-indexed**) that satisfies the following conditions: * `nums.length == n` * `nums[i]` is a **positive** integer where `0 <= i < n`. * `abs(nums[i] - nums[i+1]) <= 1` where `0 <= i < n-1`. * The sum of a...
Simulate the given in the statement Calculate those who will eat instead of those who will not.
Array,Stack,Queue,Simulation
Easy
2195
1,286
Hello guys welcome back devotion in this video will see the editor for combination problem system August challenge and incredible third node to solve this problem solve latest video problem statement in this problem Thursday subscribe this Video not here in this Video give the giver function Function The Combination Le...
Iterator for Combination
constrained-subsequence-sum
Design the `CombinationIterator` class: * `CombinationIterator(string characters, int combinationLength)` Initializes the object with a string `characters` of **sorted distinct** lowercase English letters and a number `combinationLength` as arguments. * `next()` Returns the next combination of length `combinationL...
Use dynamic programming. Let dp[i] be the solution for the prefix of the array that ends at index i, if the element at index i is in the subsequence. dp[i] = nums[i] + max(0, dp[i-k], dp[i-k+1], ..., dp[i-1]) Use a heap with the sliding window technique to optimize the dp.
Array,Dynamic Programming,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue
Hard
null
1,235
Hi gas welcome and welcome back to my channel so today our problem is maximum profit in job scheduling so what have you given us in this problem statement here we have given you a n jobs here we have given you a start time like this Time has been given and a profit end has been given. Okay, what you have to do is to sc...
Maximum Profit in Job Scheduling
maximum-profit-in-job-scheduling
We have `n` jobs, where every job is scheduled to be done from `startTime[i]` to `endTime[i]`, obtaining a profit of `profit[i]`. You're given the `startTime`, `endTime` and `profit` arrays, return the maximum profit you can take such that there are no two jobs in the subset with overlapping time range. If you choose...
null
null
Hard
null
506
hello everybody and welcome back to the DC AC channel where we saw at least for this series lead code questions to kind of prepare for technical interviews and just learn programming software Shan's non-patent learn to think I guess I hope non-patent learn to think I guess I hope non-patent learn to think I guess I hop...
Relative Ranks
relative-ranks
You are given an integer array `score` of size `n`, where `score[i]` is the score of the `ith` athlete in a competition. All the scores are guaranteed to be **unique**. The athletes are **placed** based on their scores, where the `1st` place athlete has the highest score, the `2nd` place athlete has the `2nd` highest ...
null
Array,Sorting,Heap (Priority Queue)
Easy
null
1,015
Hello hello friends welcome to my YouTube channel subscribe subscribe to [ subscribe to [ subscribe to 210 cigarette gutkha tujhe 30th september ko hua tha loot lo woh to desh bech open na small different or divisible by that the looters created the earth under the British regional enter end Exit age no Sachin treatmen...
Smallest Integer Divisible by K
smallest-integer-divisible-by-k
Given a positive integer `k`, you need to find the **length** of the **smallest** positive integer `n` such that `n` is divisible by `k`, and `n` only contains the digit `1`. Return _the **length** of_ `n`. If there is no such `n`, return -1. **Note:** `n` may not fit in a 64-bit signed integer. **Example 1:** **In...
null
null
Medium
null
1,774
so hello everyone in this video i will be explaining the problem closest desert cost so this problem is not that difficult but it can be a little bit confusing uh because of this part lower one so anyway let's briefly discuss the problem so what the problem is saying that you have to make a desert and for a desert you ...
Closest Dessert Cost
add-two-polynomials-represented-as-linked-lists
You would like to make dessert and are preparing to buy the ingredients. You have `n` ice cream base flavors and `m` types of toppings to choose from. You must follow these rules when making your dessert: * There must be **exactly one** ice cream base. * You can add **one or more** types of topping or have no topp...
Process both linked lists at the same time If the current power of the two heads is equal, add this power with the sum of the coefficients to the answer list. If one head has a larger power, add this power to the answer list and move only this head.
Linked List,Math,Two Pointers
Medium
2,21,445
17
hey everybody this is larry this is day nine of the lego daily challenge hit the like button the subscribe button join me on discord let me know what you're thinking and what you're feeling and all that good stuff uh happy mother's day for those of you uh in the country that celebrated i guess um to all your mothers ou...
Letter Combinations of a Phone Number
letter-combinations-of-a-phone-number
Given a string containing digits from `2-9` inclusive, return all possible letter combinations that the number could represent. Return the answer in **any order**. A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters. **Example 1:** **Input:** di...
null
Hash Table,String,Backtracking
Medium
22,39,401
1,639
easy question another hard question you're kidding probably another dp question okay up to a thousand words each string is a thousand as well it's definitely dp but what would this sub problem be i guess would be on the target word so dp of i could be i guess a number of ways to get prefix target um 0 to i and then wha...
Number of Ways to Form a Target String Given a Dictionary
friendly-movies-streamed-last-month
You are given a list of strings of the **same length** `words` and a string `target`. Your task is to form `target` using the given `words` under the following rules: * `target` should be formed from left to right. * To form the `ith` character (**0-indexed**) of `target`, you can choose the `kth` character of th...
null
Database
Easy
null
7
foreign so today we are going to talk about this problem it is called a reverse integer so let us in the description so given a signed uh 32-bit integer x i written x signed uh 32-bit integer x i written x signed uh 32-bit integer x i written x with its TZ reversed okay if reversing X causes the value to go outside the...
Reverse Integer
reverse-integer
Given a signed 32-bit integer `x`, return `x` _with its digits reversed_. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-231, 231 - 1]`, then return `0`. **Assume the environment does not allow you to store 64-bit integers (signed or unsigned).** **Example 1:** **Input:** x = 123 ...
null
Math
Medium
8,190,2238
1,450
What will this suggestion do or going to the question number of student wing Shiromani female homework on prime time student now we started listening to Ek Cup Suji Hai because of this and end student is front time subscribe this recipe and subscribe our channel Do that if we look at the second example, this one, in th...
Number of Students Doing Homework at a Given Time
delete-leaves-with-a-given-value
Given two integer arrays `startTime` and `endTime` and given an integer `queryTime`. The `ith` student started doing their homework at the time `startTime[i]` and finished it at time `endTime[i]`. Return _the number of students_ doing their homework at time `queryTime`. More formally, return the number of students wh...
Use the DFS to reconstruct the tree such that no leaf node is equal to the target. If the leaf node is equal to the target, return an empty object instead.
Tree,Depth-First Search,Binary Tree
Medium
null
373
Hello everyone welcome to my channel, a very easy question, actually it is a very standard question, this type of question always comes in hip and it is a standard question, this is fine, find pairs with smallest sons is fine and Google asked this question. The most important thing is science, I told that if it is stan...
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
347
Yes, hello, I am one of the developer children, Gary Ni. The problem to be solved today is number 347 kp quant elements. A pure number array is given, and an integer k is given. Sort the elements that appear a lot, cut them as much as the top k pop k, and retan them. What is the order? It doesn't matter. 1233 This arra...
Top K Frequent Elements
top-k-frequent-elements
Given an integer array `nums` and an integer `k`, return _the_ `k` _most frequent elements_. You may return the answer in **any order**. **Example 1:** **Input:** nums = \[1,1,1,2,2,3\], k = 2 **Output:** \[1,2\] **Example 2:** **Input:** nums = \[1\], k = 1 **Output:** \[1\] **Constraints:** * `1 <= nums.lengt...
null
Array,Hash Table,Divide and Conquer,Sorting,Heap (Priority Queue),Bucket Sort,Counting,Quickselect
Medium
192,215,451,659,692,1014,1919
119
welcome back everyone to another video here in the uncle YouTube channel today we're taking a look at problem 119 askal's Triangle 2. now this one is going to be very similar to the first one except slightly different this time around we're going to be given some row index and we want to go ahead and return that actual...
Pascal's Triangle II
pascals-triangle-ii
Given an integer `rowIndex`, return the `rowIndexth` (**0-indexed**) row of the **Pascal's triangle**. In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown: **Example 1:** **Input:** rowIndex = 3 **Output:** \[1,3,3,1\] **Example 2:** **Input:** rowIndex = 0 **Output:** \[...
null
Array,Dynamic Programming
Easy
118,2324
701
Jhaal Hello Hi Guys Welcome to Kodiasar Today's question is insert into binary search tree in this question also Aryan root node of binary search tree and value to be interested in the trees were buried under root mode of the best ifton shown it is a rented a new Value did not exist in the original BSP noticed that whe...
Insert into a Binary Search Tree
insert-into-a-binary-search-tree
You are given the `root` node of a binary search tree (BST) and a `value` to insert into the tree. Return _the root node of the BST after the insertion_. It is **guaranteed** that the new value does not exist in the original BST. **Notice** that there may exist multiple valid ways for the insertion, as long as the tre...
null
null
Medium
null
399
hello everyone welcome to date 30th of april challenge today is the last day of the month and after solving today's question all of us will get the april batch this will be the 12th batch over the last one year and yes we have solved each and every question from past 365 days without fail my name is sanchez to introduc...
Evaluate Division
evaluate-division
You are given an array of variable pairs `equations` and an array of real numbers `values`, where `equations[i] = [Ai, Bi]` and `values[i]` represent the equation `Ai / Bi = values[i]`. Each `Ai` or `Bi` is a string that represents a single variable. You are also given some `queries`, where `queries[j] = [Cj, Dj]` rep...
Do you recognize this as a graph problem?
Array,Depth-First Search,Breadth-First Search,Union Find,Graph,Shortest Path
Medium
null
1,442
hey everybody this is Larry I'm doing this problem as part of a contest so you're gonna watch me live as I go through my daughter's I'm coding they've been explanation near the end and for more context they'll be a link below on this actual screen cats of the contest how did you do let me know you do hit the like butto...
Count Triplets That Can Form Two Arrays of Equal XOR
number-of-operations-to-make-network-connected
Given an array of integers `arr`. We want to select three indices `i`, `j` and `k` where `(0 <= i < j <= k < arr.length)`. Let's define `a` and `b` as follows: * `a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]` * `b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]` Note that **^** denotes the **bitwise-xor** operation. Return...
As long as there are at least (n - 1) connections, there is definitely a way to connect all computers. Use DFS to determine the number of isolated computer clusters.
Depth-First Search,Breadth-First Search,Union Find,Graph
Medium
null
1,801
so hello everyone welcome to this new video and i will be explaining the problem number of orders in the backlog so this problem is a little bit tougher than medium because this problem is pretty long okay and as humans we avoid doing long things so but you know what if you read this problem if you read this statement ...
Number of Orders in the Backlog
average-time-of-process-per-machine
You are given a 2D integer array `orders`, where each `orders[i] = [pricei, amounti, orderTypei]` denotes that `amounti` orders have been placed of type `orderTypei` at the price `pricei`. The `orderTypei` is: * `0` if it is a batch of `buy` orders, or * `1` if it is a batch of `sell` orders. Note that `orders[i]...
null
Database
Easy
null
474
hey everyone welcome back and let's write some more neat code today so today let's solve the problem ones and zeros we're given an array of binary strings and two integers M and N it's gonna be fun saying those two because they sound so similar so suppose these are the binary strings that were given there's five of the...
Ones and Zeroes
ones-and-zeroes
You are given an array of binary strings `strs` and two integers `m` and `n`. Return _the size of the largest subset of `strs` such that there are **at most**_ `m` `0`_'s and_ `n` `1`_'s in the subset_. A set `x` is a **subset** of a set `y` if all elements of `x` are also elements of `y`. **Example 1:** **Input:**...
null
Array,String,Dynamic Programming
Medium
510,600,2261
1,344
hello and welcome back to the cracking fang youtube channel today we're going to be solving leap code problem 1344 angle between hands of a clock before we get into the problem i would just like to ask you to subscribe i have a goal of reaching 1 000 subscribers on my channel before the end of may and i need your help ...
Angle Between Hands of a Clock
maximum-equal-frequency
Given two numbers, `hour` and `minutes`, return _the smaller angle (in degrees) formed between the_ `hour` _and the_ `minute` _hand_. Answers within `10-5` of the actual value will be accepted as correct. **Example 1:** **Input:** hour = 12, minutes = 30 **Output:** 165 **Example 2:** **Input:** hour = 3, minutes ...
Keep track of the min and max frequencies. The number to be eliminated must have a frequency of 1, same as the others or the same +1.
Array,Hash Table
Hard
null
303
today we're going to be solving lead code problem 303 range sum query and this one is immutable so given an integer array nums handle multiple queries of the following type so we have to calculate the sum of the elements of nums between indices left and right inclusive where we have left is less than equal to right so ...
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
874
hey everybody this is Larry this is November 28th in New York anyway uh I'm gonna do an extra problem just to give myself a little bit more of an exercise that I think I didn't um I think I didn't click on to do so I think I've done that one okay let's see and hopefully not a premium question so uh paid for premium if ...
Walking Robot Simulation
backspace-string-compare
A robot on an infinite XY-plane starts at point `(0, 0)` facing north. The robot can receive a sequence of these three possible types of `commands`: * `-2`: Turn left `90` degrees. * `-1`: Turn right `90` degrees. * `1 <= k <= 9`: Move forward `k` units, one unit at a time. Some of the grid squares are `obstacl...
null
Two Pointers,String,Stack,Simulation
Easy
1720
205
hey everyone today we'll be doing another leaked code 205 isomorphic strings and easy one given two strings essentially determine if they are isomorphic two string s and t are isomorphic if the character in s can be replaced to get t all occurrences of a character must be replaced with another character while preservin...
Isomorphic Strings
isomorphic-strings
Given two strings `s` and `t`, _determine if they are isomorphic_. Two strings `s` and `t` are isomorphic if the characters in `s` can be replaced to get `t`. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same characte...
null
Hash Table,String
Easy
290
103
hello and welcome to another one of my lead code videos in this one we'll do lead code 103 binary tree zigzag level order traversal this is today's daily challenge so basically we're given the root of a binary tree and we need to return the zigzag level order traversal so that means that we go first from left to right ...
Binary Tree Zigzag Level Order Traversal
binary-tree-zigzag-level-order-traversal
Given the `root` of a binary tree, return _the zigzag level order traversal of its nodes' values_. (i.e., from left to right, then right to left for the next level and alternate between). **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** \[\[3\],\[20,9\],\[15,7\]\] **Example 2:** **Input:** roo...
null
Tree,Breadth-First Search,Binary Tree
Medium
102
169
if you're Jeff starting your journey towards Tech interviews trust me this problem is really important at it is one of the facial is that it navigates beautifully how you start to understand the problem and then make your way all the way towards an efficient approach why is that true let us try to find it out Hello fri...
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
1,207
hello friends today we gonne discuss this question founded code one 2:07 this question founded code one 2:07 this question founded code one 2:07 unique number of occurrences this is an easy question instead start you're given an array of integers ARR I have to write a function that returns true if and only if the numbe...
Unique Number of Occurrences
delete-nodes-and-return-forest
Given an array of integers `arr`, return `true` _if the number of occurrences of each value in the array is **unique** or_ `false` _otherwise_. **Example 1:** **Input:** arr = \[1,2,2,1,1,3\] **Output:** true **Explanation:** The value 1 has 3 occurrences, 2 has 2 and 3 has 1. No two values have the same number of oc...
null
Tree,Depth-First Search,Binary Tree
Medium
2175
140
Hai Hello Guys Welcome Back There Devotion In This Video Will See The Vote Back To Problem Swiss Roll Absolutely Number One 409 The Requested For Watching This Problem Is To Watch Videos One Is The Problem And Explain The Cockroach Video Solving Problems Unit-2 Such Remedy Unit-2 Such Remedy Unit-2 Such Remedy Try Play...
Word Break II
word-break-ii
Given a string `s` and a dictionary of strings `wordDict`, add spaces in `s` to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in **any order**. **Note** that the same word in the dictionary may be reused multiple times in the segmentation. **Example 1:** **Input:...
null
Hash Table,String,Dynamic Programming,Backtracking,Trie,Memoization
Hard
139,472
48
yo what is up youtubers today i'm going to be going over rotate image it's a medium leak code problem has to do with arrays it's been asked by microsoft apple and amazon please check out my channel and subscribe if you haven't already i post videos basically every day about recode so now let's get to it teaches you a l...
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
21
all right so today we are going to look at how we sort or merge two sorted lists now Alyss is an abstraction I can have a linked list I could have an array so the question on lis code is with linked lists or walkthrough will be with a linked list so I can show you how it's done and how we can like avoid some work at th...
Merge Two Sorted Lists
merge-two-sorted-lists
You are given the heads of two sorted linked lists `list1` and `list2`. Merge the two lists in a one **sorted** list. The list should be made by splicing together the nodes of the first two lists. Return _the head of the merged linked list_. **Example 1:** **Input:** list1 = \[1,2,4\], list2 = \[1,3,4\] **Output:**...
null
Linked List,Recursion
Easy
23,88,148,244,1774,2071
86
hey everyone today I'll be doing another delete code problem 86 partition list this is the medium one given the head of the link list add a value X partition it such that all the node less than x comes before nodes greater or equal to X so you should preserve the original order relative order of the node in these two p...
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
354
Hello Guys Welcome To Know The Video The Series According Dhb Blood Circulation Lakshya Studio Painters Of Is Difficult To Win The Inside Of An Appointed To Another Indian Live With 1.138 Appointed To Another Indian Live With 1.138 Appointed To Another Indian Live With 1.138 Volts And Short Term Interest Rate And Which...
Russian Doll Envelopes
russian-doll-envelopes
You are given a 2D array of integers `envelopes` where `envelopes[i] = [wi, hi]` represents the width and the height of an envelope. One envelope can fit into another if and only if both the width and height of one envelope are greater than the other envelope's width and height. Return _the maximum number of envelope...
null
Array,Binary Search,Dynamic Programming,Sorting
Hard
300,2123
151
welcome back everyone we're gonna be solving Lee Code 151 reverse Awards in a string so we're given an input string s we need to reverse the order of the words and a word is defined as a sequence of non-space characters the sequence of non-space characters the sequence of non-space characters the words in s will be sep...
Reverse Words in a String
reverse-words-in-a-string
Given an input string `s`, reverse the order of the **words**. A **word** is defined as a sequence of non-space characters. The **words** in `s` will be separated by at least one space. Return _a string of the words in reverse order concatenated by a single space._ **Note** that `s` may contain leading or trailing s...
null
Two Pointers,String
Medium
186
373
Hello gas welcome you me YouTube channel so today we are going to solve problem 373 fine pairs with small further problem what is doing this is medium level problem you are life you interior are name one and you sorted in ascending order and Consists of one element from d second between waiting if it has to be returned...
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
745
hey everybody this is larry this is day 18 of the rico day challenge hit the like button here to subscribe and join me on discord let me know what you think about today's farms i'm back in new york i went to wedding actually it was a beautiful wedding it was a beautiful day uh and now i'm back home where i probably sho...
Prefix and Suffix Search
find-smallest-letter-greater-than-target
Design a special dictionary that searches the words in it by a prefix and a suffix. Implement the `WordFilter` class: * `WordFilter(string[] words)` Initializes the object with the `words` in the dictionary. * `f(string pref, string suff)` Returns _the index of the word in the dictionary,_ which has the prefix `p...
Try to find whether each of 26 next letters are in the given string array.
Array,Binary Search
Easy
2269
1,732
hello so it is uh 19 June 2023 is lead code uh daily challenge it's a easy level question is find the highest attitude yeah so what's the question stated there is a biker going on a road trip the rotor consists of n plus one points at different altitudes the biker starts his trip on point zero with altitude equals to z...
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
328
okay hi everyone so today we're going to swaminate code problem number and 3D challenge problem number three to eight on demanding list so in this uh what we have to do is we have to just uh basically grow all the elements or all the nodes at uh odd indexes and all the notes of uh even indexes together and one more key...
Odd Even Linked List
odd-even-linked-list
Given the `head` of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return _the reordered list_. The **first** node is considered **odd**, and the **second** node is **even**, and so on. Note that the relative order inside both the even and odd groups s...
null
Linked List
Medium
725
169
foreign from lead code and then solve it so I am picking a problem number 169 majority element so this problem is actually asked in Google Facebook and Amazon so let's go to lead code and see what exactly the problem States so if I take you to lead code majority element the problem says given an array of size n given a...
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
118
hey friends welcome back to my channel i'm here to do a hundred lethal challenge today's we have 118 pascal's triangle so for this question like this triangle demo looks giving a non negative integers num rows generates the first num rows of pascal's triangle and it starts on one and then later you another one and one ...
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
240
240 search a 2d matrix number two from liquid let's jump to the question and write an efficient algorithm that searches for a value target in an m by n integer matrix this matrix has the following properties so first in first each row are sorted in ascending from left to right and each column are sorted in ascending fr...
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
261
today we are looking at lead code number 261 it's called graph valid tree all right so let's take a look at the prompt here given n nodes labeled from 0 to n minus 1 and a list of undirected edges each edge is a pair of nodes write a function to check whether these edges make up a valid tree okay so we have example one...
Graph Valid Tree
graph-valid-tree
You have a graph of `n` nodes labeled from `0` to `n - 1`. You are given an integer n and a list of `edges` where `edges[i] = [ai, bi]` indicates that there is an undirected edge between nodes `ai` and `bi` in the graph. Return `true` _if the edges of the given graph make up a valid tree, and_ `false` _otherwise_. **...
Given n = 5 and edges = [[0, 1], [1, 2], [3, 4]], what should your return? Is this case a valid tree? According to the definition of tree on Wikipedia: “a tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles is a tree.”
Depth-First Search,Breadth-First Search,Union Find,Graph
Medium
207,323,871
567
everyone welcome back and let's write some more neat code today so today let's solve the problem permutation in a string and there's actually two solutions to this problem one is the 26 times n solution and there's another solution that's actually just big o of n now we know that a constant number here doesn't actually...
Permutation in String
permutation-in-string
Given two strings `s1` and `s2`, return `true` _if_ `s2` _contains a permutation of_ `s1`_, or_ `false` _otherwise_. In other words, return `true` if one of `s1`'s permutations is the substring of `s2`. **Example 1:** **Input:** s1 = "ab ", s2 = "eidbaooo " **Output:** true **Explanation:** s2 contains one permuta...
Obviously, brute force will result in TLE. Think of something else. How will you check whether one string is a permutation of another string? One way is to sort the string and then compare. But, Is there a better way? If one string is a permutation of another string then they must one common metric. What is that? Both ...
Hash Table,Two Pointers,String,Sliding Window
Medium
76,438
247
okay so lead code practice time so there are two goals in this video the first one is to see how to solve this problem uh find the solution then you're going to do some coding work and the second one is to see how we should behave in a real interview so let's get started so remember the first thing is to always try to ...
Strobogrammatic Number II
strobogrammatic-number-ii
Given an integer `n`, return all the **strobogrammatic numbers** that are of length `n`. You may return the answer in **any order**. A **strobogrammatic number** is a number that looks the same when rotated `180` degrees (looked at upside down). **Example 1:** **Input:** n = 2 **Output:** \["11","69","88","96"\] **...
Try to use recursion and notice that it should recurse with n - 2 instead of n - 1.
Array,String,Recursion
Medium
246,248,2202
83
hey what's going on everybody so today we are going to solve one of the coolest problem remove duplicates from socialist so this problem is quite good so if you see the like and dislike they show this problem is quite good all right so what we have to do is basically simply like if you remember the last problem which w...
Remove Duplicates from Sorted List
remove-duplicates-from-sorted-list
Given the `head` of a sorted linked list, _delete all duplicates such that each element appears only once_. Return _the linked list **sorted** as well_. **Example 1:** **Input:** head = \[1,1,2\] **Output:** \[1,2\] **Example 2:** **Input:** head = \[1,1,2,3,3\] **Output:** \[1,2,3\] **Constraints:** * The numb...
null
Linked List
Easy
82,1982
916
hey everybody this is Larry this is day 30th of the July leco day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's problem word subsets hmm cool uh yeah hit the like button and subscribe man I am up shape and mentally I think I reset that but yeah one th...
Word Subsets
decoded-string-at-index
You are given two string arrays `words1` and `words2`. A string `b` is a **subset** of string `a` if every letter in `b` occurs in `a` including multiplicity. * For example, `"wrr "` is a subset of `"warrior "` but is not a subset of `"world "`. A string `a` from `words1` is **universal** if for every string `b` i...
null
String,Stack
Medium
null
450
hey guys in this tip in this video i'll be going over delete node in a binary search tree so basically this problem gives you a binary search tree um and uh it wants you to delete a node with a target value so um if the value here is three they want you to delete it and you can either move two up into its place or four...
Delete Node in a BST
delete-node-in-a-bst
Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return _the **root node reference** (possibly updated) of the BST_. Basically, the deletion can be divided into two stages: 1. Search for a node to remove. 2. If the node is found, delete the node. **Example 1:** **Inpu...
null
Tree,Binary Search Tree,Binary Tree
Medium
791
39
hello friends today less of their combination some problem lessees diamond first given set of candidate numbers Kinder's without duplicates and their target number target find all unique combinations intended where the candidate numbers sums to target the same repeated number may be chosen from candidates unlimited num...
Combination Sum
combination-sum
Given an array of **distinct** integers `candidates` and a target integer `target`, return _a list of all **unique combinations** of_ `candidates` _where the chosen numbers sum to_ `target`_._ You may return the combinations in **any order**. The **same** number may be chosen from `candidates` an **unlimited number of...
null
Array,Backtracking
Medium
17,40,77,216,254,377
136
hey welcome to this video we're going to solve the code problem 136 single number which is pretty easy to solve it'll give you an array of numbers and you have to return which number appears just once so in this second example 4 is the only number that appears just once so we return the number 4. now even though this p...
Single Number
single-number
Given a **non-empty** array of integers `nums`, every element appears _twice_ except for one. Find that single one. You must implement a solution with a linear runtime complexity and use only constant extra space. **Example 1:** **Input:** nums = \[2,2,1\] **Output:** 1 **Example 2:** **Input:** nums = \[4,1,2,1,2...
null
Array,Bit Manipulation
Easy
137,260,268,287,389
380
hey hello there today we're looking at this lead coding challenge questions insert delete get Rendon in constant time we need to design a data structure that supports the following operations in average constant time the suite different operations are insert we try to insert a value into the set if it's not already in ...
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
684
Hello hello guys welcome brother video daily follow problem in it online correction tree which aims and objective of this content does not fit for as a result of written test for example it is connected to two to 9 tree nov23 that which No More Words Related To No More Difficult Note Such Cycle In This Case Vanshu Conn...
Redundant Connection
redundant-connection
In this problem, a tree is an **undirected graph** that is connected and has no cycles. You are given a graph that started as a tree with `n` nodes labeled from `1` to `n`, with one additional edge added. The added edge has two **different** vertices chosen from `1` to `n`, and was not an edge that already existed. Th...
null
Depth-First Search,Breadth-First Search,Union Find,Graph
Medium
685,721,2246
155
Hello Everybody Welcome To My Channel It's All The Problem Ministry Platform No.1 500 Design Effects Upon Receiving No.1 500 Design Effects Upon Receiving No.1 500 Design Effects Upon Receiving Minimum Element In Time For This Post Is Limited To Remove Element On Top Element Minimum Elements In The Recent Example Subsc...
Min Stack
min-stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the `MinStack` class: * `MinStack()` initializes the stack object. * `void push(int val)` pushes the element `val` onto the stack. * `void pop()` removes the element on the top of the stack. * `int top(...
Consider each node in the stack having a minimum value. (Credits to @aakarshmadhavan)
Stack,Design
Easy
239,716
1,817
Hello hi friends welcome back today we are going to year record problem is 30 finding viewers active minutes on ka surya mandir lock for users actions only good and teacher's lock represented by today end year people where is a lock come is having id and time indicate Set user with ID is performed and action add them i...
Finding the Users Active Minutes
calculate-money-in-leetcode-bank
You are given the logs for users' actions on LeetCode, and an integer `k`. The logs are represented by a 2D integer array `logs` where each `logs[i] = [IDi, timei]` indicates that the user with `IDi` performed an action at the minute `timei`. **Multiple users** can perform actions simultaneously, and a single user can...
Simulate the process by keeping track of how much money John is putting in and which day of the week it is, and use this information to deduce how much money John will put in the next day.
Math
Easy
null
1,361
hey everybody this is Larry this is me doing an extra prom on December 1st about 2022 I don't know if I have to think about the year but um all right let's do a medium one today because I'm kind of just warming up for the Advent of code let me know if you're doing the admin of code if you don't know what it is just Goo...
Validate Binary Tree Nodes
tiling-a-rectangle-with-the-fewest-squares
You have `n` binary tree nodes numbered from `0` to `n - 1` where node `i` has two children `leftChild[i]` and `rightChild[i]`, return `true` if and only if **all** the given nodes form **exactly one** valid binary tree. If node `i` has no left child then `leftChild[i]` will equal `-1`, similarly for the right child. ...
Can you use backtracking to solve this problem ?. Suppose you've placed a bunch of squares. Where is the natural spot to place the next square ?. The maximum number of squares to be placed will be ≤ max(n,m).
Dynamic Programming,Backtracking
Hard
null