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
468
Loot Hello Everybody Welcome To My Channel Today Is The 69 Jun Recording And Problems Validate IP Address To Write The Function Which Is Very Important In This Way Before It Special Dress On The To Fry Also Folder Condition Se 1000K Not Represented S E No Tension Which Consists of Decimal Number Running From 25 subscri...
Validate IP Address
validate-ip-address
Given a string `queryIP`, return `"IPv4 "` if IP is a valid IPv4 address, `"IPv6 "` if IP is a valid IPv6 address or `"Neither "` if IP is not a correct IP of any type. **A valid IPv4** address is an IP in the form `"x1.x2.x3.x4 "` where `0 <= xi <= 255` and `xi` **cannot contain** leading zeros. For example, `"192.16...
null
String
Medium
752
1,357
today we're gonna look at li code 1357 apply discounts every n orders so this is a novel to read through and it's not the best English but we'll work through it so let's start with the description there is a sale and a supermarket there will be a discount every n customers there are some products in the supermarket whe...
Apply Discount Every n Orders
report-contiguous-dates
There is a supermarket that is frequented by many customers. The products sold at the supermarket are represented as two parallel integer arrays `products` and `prices`, where the `ith` product has an ID of `products[i]` and a price of `prices[i]`. When a customer is paying, their bill is represented as two parallel i...
null
Database
Hard
1420,1759
301
hello friends today let's also remove invalid parentheses problem this is a very nice classic problem the reason i want to explain it is that i want to introduce a very useful website i think it will help you to understand the function calling and the operation order in java which is the java visualization visualizer i...
Remove Invalid Parentheses
remove-invalid-parentheses
Given a string `s` that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid. Return _a list of **unique strings** that are valid with the minimum number of removals_. You may return the answer in **any order**. **Example 1:** **Input:** s = "()())() " **...
Since we don't know which of the brackets can possibly be removed, we try out all the options! We can use recursion to try out all possibilities for the given expression. For each of the brackets, we have 2 options: We keep the bracket and add it to the expression that we are building on the fly during recursion....
String,Backtracking,Breadth-First Search
Hard
20,2095
507
so we're looking at question 507 uh perfect number um so let's just go through the question we define the perfect number as a positive integer that is equal to the sum of all of its positive divisors except itself now give it an integer and write a function that returns true when it is per i mean it is a perfect number...
Perfect Number
perfect-number
A [**perfect number**](https://en.wikipedia.org/wiki/Perfect_number) is a **positive integer** that is equal to the sum of its **positive divisors**, excluding the number itself. A **divisor** of an integer `x` is an integer that can divide `x` evenly. Given an integer `n`, return `true` _if_ `n` _is a perfect number,...
null
Math
Easy
728
117
to look at a legal problem called populating nests right pointers in each node so i did the first question liko 116 in the beginner's bfs video in that video i basically talked about how to solve that problem using breadth first search or a level or traversal this question basically is a little different compared to th...
Populating Next Right Pointers in Each Node II
populating-next-right-pointers-in-each-node-ii
Given a binary tree struct Node { int val; Node \*left; Node \*right; Node \*next; } Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to `NULL`. Initially, all next pointers are set to `NULL`. **Example 1:** **Input:** root = \[1,2,3...
null
Linked List,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
116
354
okay 354 Russian doll emblems you have a number of emblems with Griffin Heights given as pair of integers wh-wha number of can fill into another wh-wha number of can fill into another wh-wha number of can fill into another if and only if both the width and height of one ever loop is created anywhere for my general what...
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
1,727
hi everyone welcome back to a new video today's lead code daily challenges largest submatrix with rearrangement this is a medium level question in this question we have been given a matrix of size M byn which is a binary Matrix which means it will only contain zeros and ones right so now they have told that we need to ...
Largest Submatrix With Rearrangements
cat-and-mouse-ii
You are given a binary matrix `matrix` of size `m x n`, and you are allowed to rearrange the **columns** of the `matrix` in any order. Return _the area of the largest submatrix within_ `matrix` _where **every** element of the submatrix is_ `1` _after reordering the columns optimally._ **Example 1:** **Input:** matri...
Try working backward: consider all trivial states you know to be winning or losing, and work backward to determine which other states can be labeled as winning or losing.
Math,Dynamic Programming,Breadth-First Search,Graph,Memoization,Game Theory
Hard
805,949
167
this is question 167 to some 2 input array is sorted so the question is asking us given a list of numbers an array of numbers what are the indexes and also we have to note that the index is starts with one it's a one indexed array which is strange but that's just the question return the index values of the two numbers ...
Two Sum II - Input Array Is Sorted
two-sum-ii-input-array-is-sorted
Given a **1-indexed** array of integers `numbers` that is already **_sorted in non-decreasing order_**, find two numbers such that they add up to a specific `target` number. Let these two numbers be `numbers[index1]` and `numbers[index2]` where `1 <= index1 < index2 <= numbers.length`. Return _the indices of the two n...
null
Array,Two Pointers,Binary Search
Medium
1,653,1083
436
welcome to august leco challenge today's problem is find right interval given a set of intervals for each interval i check if there exists an interval j whose start point is bigger than or equal to the endpoint of interval i so we'll take our interval i's end and we'll find the minimum interval for the star point of an...
Find Right Interval
find-right-interval
You are given an array of `intervals`, where `intervals[i] = [starti, endi]` and each `starti` is **unique**. The **right interval** for an interval `i` is an interval `j` such that `startj >= endi` and `startj` is **minimized**. Note that `i` may equal `j`. Return _an array of **right interval** indices for each int...
null
Array,Binary Search,Sorting
Medium
352
653
hey everybody this is Larry this is day eight uh or day nine alternate day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's Farm to some four input is a BST I mean you don't have to be that descriptive on the title but okay um so what are we doing here s...
Two Sum IV - Input is a BST
two-sum-iv-input-is-a-bst
Given the `root` of a binary search tree and an integer `k`, return `true` _if there exist two elements in the BST such that their sum is equal to_ `k`, _or_ `false` _otherwise_. **Example 1:** **Input:** root = \[5,3,6,2,4,null,7\], k = 9 **Output:** true **Example 2:** **Input:** root = \[5,3,6,2,4,null,7\], k = ...
null
Hash Table,Two Pointers,Tree,Depth-First Search,Breadth-First Search,Binary Search Tree,Binary Tree
Easy
1,167,170,1150
505
hey everybody this is Larry this is me doing week two of the Le code weekly challenge uh and apparently I have some code cash hit the like button hit the Subscribe but join me on Discord let me know what you think about this premium problem and it's a little bit sad that we uh kind of have one that I've done before bec...
The Maze II
the-maze-ii
There is a ball in a `maze` with empty spaces (represented as `0`) and walls (represented as `1`). The ball can go through the empty spaces by rolling **up, down, left or right**, but it won't stop rolling until hitting a wall. When the ball stops, it could choose the next direction. Given the `m x n` `maze`, the ball...
null
Depth-First Search,Breadth-First Search,Graph,Heap (Priority Queue),Shortest Path
Medium
490,499
83
So the name of the question is Remove Duplicates from Sorted Linked List. You will find this question in the late code. Question number is 83. I will put this question in the description in the link. You can solve it by going there. So in the problem statement it is said that you have a sorted list. Link list is ok so ...
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
121
this is leak code 121 best time to buy and sell stock you're given an array of prices where the indices represent days and you have to figure out the maximum profit you can make from buying on a single day and selling on a different day in the future so in this example the most you can make is five and you can do that ...
Best Time to Buy and Sell Stock
best-time-to-buy-and-sell-stock
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day. You want to maximize your profit by choosing a **single day** to buy one stock and choosing a **different day in the future** to sell that stock. Return _the maximum profit you can achieve from this transaction_. If you ...
null
Array,Dynamic Programming
Easy
53,122,123,188,309,2138,2144
106
hello everyone welcome back to coding intuition today we are going to soil construct binary from in order and post order traversal question on lead code so in this question we are given in order and postolar traversal of a binary query and we need to construct a binary tree using that in order and post order so to unde...
Construct Binary Tree from Inorder and Postorder Traversal
construct-binary-tree-from-inorder-and-postorder-traversal
Given two integer arrays `inorder` and `postorder` where `inorder` is the inorder traversal of a binary tree and `postorder` is the postorder traversal of the same tree, construct and return _the binary tree_. **Example 1:** **Input:** inorder = \[9,3,15,20,7\], postorder = \[9,15,7,20,3\] **Output:** \[3,9,20,null,n...
null
Array,Hash Table,Divide and Conquer,Tree,Binary Tree
Medium
105
509
hello everyone welcome to my channel i am shankar dhyan a final student of computer science and i usually make coding videos and placement related videos so that you can do good in your interviews and like without wasting any time let's get started so today like this is like this week i'll be uploading the dynamic prog...
Fibonacci Number
inorder-successor-in-bst-ii
The **Fibonacci numbers**, commonly denoted `F(n)` form a sequence, called the **Fibonacci sequence**, such that each number is the sum of the two preceding ones, starting from `0` and `1`. That is, F(0) = 0, F(1) = 1 F(n) = F(n - 1) + F(n - 2), for n > 1. Given `n`, calculate `F(n)`. **Example 1:** **Input:** n = ...
null
Tree,Binary Search Tree,Binary Tree
Medium
285
77
hello welcome back to my Channel today let's solve another lead called problem number 77 combinations actually this is a daily challenge from the list code so I'm trying to solve this first the problem is switch forward getting to integer NK return all possible combinations of K numbers to learn from the release of 1 t...
Combinations
combinations
Given two integers `n` and `k`, return _all possible combinations of_ `k` _numbers chosen from the range_ `[1, n]`. You may return the answer in **any order**. **Example 1:** **Input:** n = 4, k = 2 **Output:** \[\[1,2\],\[1,3\],\[1,4\],\[2,3\],\[2,4\],\[3,4\]\] **Explanation:** There are 4 choose 2 = 6 total combin...
null
Backtracking
Medium
39,46
662
hello everyone welcome or welcome back to my channel today we are going to discuss another problem but before going forward if you not like the video please like it subscribe to my channel and hit the bell icon so that you get notified when i post a new video so without any further ado let's get started problem is maxi...
Maximum Width of Binary Tree
maximum-width-of-binary-tree
Given the `root` of a binary tree, return _the **maximum width** of the given tree_. The **maximum width** of a tree is the maximum **width** among all levels. The **width** of one level is defined as the length between the end-nodes (the leftmost and rightmost non-null nodes), where the null nodes between the end-no...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
35
welcome everyone today we're going to solve the number 35 lead code question considered easy called search insert position as you can tell there are a lot of likes meaning that it was indeed very easy question but let's break it down given a sorted array of distinct integers and a target value return the index if the 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
871
Hello guys welcome gardens medicine maine mirwaiz baby discussion question minimum number of refueling stop this question more position destination with subscribe must subscribe button - subscribe button adhik hai button - subscribe button adhik hai button - subscribe button adhik hai to bhi return - 110 thodi pimple n...
Minimum Number of Refueling Stops
keys-and-rooms
A car travels from a starting position to a destination which is `target` miles east of the starting position. There are gas stations along the way. The gas stations are represented as an array `stations` where `stations[i] = [positioni, fueli]` indicates that the `ith` gas station is `positioni` miles east of the sta...
null
Depth-First Search,Breadth-First Search,Graph
Medium
261
45
hello everyone let's all jump game 2 from lead code let's understand the problem statement you will be given array of elements where each element represents the maximum jump you can make from current index it is always guaranteed that if you are starting from index 0 you can reach last index we need to figure out minim...
Jump Game II
jump-game-ii
You are given a **0-indexed** array of integers `nums` of length `n`. You are initially positioned at `nums[0]`. Each element `nums[i]` represents the maximum length of a forward jump from index `i`. In other words, if you are at `nums[i]`, you can jump to any `nums[i + j]` where: * `0 <= j <= nums[i]` and * `i +...
null
Array,Dynamic Programming,Greedy
Medium
55,1428,2001
1,836
Hello everyone, today we will solve the next problem on structures using this algorithm as part of the preparation for a technical interview task number 1836 we need to remove all repeating notes from the unordered link sheet the task is marked as average, it is given a link list and asks to remove all notes that appea...
Remove Duplicates From an Unsorted Linked List
count-ways-to-make-array-with-product
Given the `head` of a linked list, find all the values that appear **more than once** in the list and delete the nodes that have any of those values. Return _the linked list after the deletions._ **Example 1:** **Input:** head = \[1,2,3,2\] **Output:** \[1,3\] **Explanation:** 2 appears twice in the linked list, so ...
Prime-factorize ki and count how many ways you can distribute the primes among the ni positions. After prime factorizing ki, suppose there are x amount of prime factor. There are (x + n - 1) choose (n - 1) ways to distribute the x prime factors into k positions, allowing repetitions.
Array,Math,Dynamic Programming
Hard
null
789
hey what's good guys it's illa bella here i recorded stuff on youtube chat description for all my information i do all liquid problems uh make sure you subscribe to this channel give me a big thumbs up to support it and this is called escape the ghost you're playing a simplified pacman game you start at the point of ze...
Escape The Ghosts
kth-largest-element-in-a-stream
You are playing a simplified PAC-MAN game on an infinite 2-D grid. You start at the point `[0, 0]`, and you are given a destination point `target = [xtarget, ytarget]` that you are trying to get to. There are several ghosts on the map with their starting positions given as a 2D array `ghosts`, where `ghosts[i] = [xi, y...
null
Tree,Design,Binary Search Tree,Heap (Priority Queue),Binary Tree,Data Stream
Easy
215,1953,2207
961
hello everyone and welcome back to another video so today we're going to be solving the lego question and repeated elements in a size 2 and area all right so we're going to be given an integer area called nums and we have these following properties so the length of it is going to be 2 times n now the number of unique e...
N-Repeated Element in Size 2N Array
long-pressed-name
You are given an integer array `nums` with the following properties: * `nums.length == 2 * n`. * `nums` contains `n + 1` **unique** elements. * Exactly one element of `nums` is repeated `n` times. Return _the element that is repeated_ `n` _times_. **Example 1:** **Input:** nums = \[1,2,3,3\] **Output:** 3 **...
null
Two Pointers,String
Easy
null
64
hello in this video I'm gonna go over Lee code number 64 which is also called a minimum pad sum and the problem statement is that given an M times n grid filled with non-negative numbers we grid filled with non-negative numbers we grid filled with non-negative numbers we want to find a path from the top left to bottom ...
Minimum Path Sum
minimum-path-sum
Given a `m x n` `grid` filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path. **Note:** You can only move either down or right at any point in time. **Example 1:** **Input:** grid = \[\[1,3,1\],\[1,5,1\],\[4,2,1\]\] **Output:** 7 **Explanat...
null
Array,Dynamic Programming,Matrix
Medium
62,174,741,2067,2192
84
I hope you're doing great our today's question is largest rectangle and histogram so the question says given n non-negative integers representing the non-negative integers representing the non-negative integers representing the histograms bar height where the width of each bar is 1 find the area of largest rectangle in...
Largest Rectangle in Histogram
largest-rectangle-in-histogram
Given an array of integers `heights` representing the histogram's bar height where the width of each bar is `1`, return _the area of the largest rectangle in the histogram_. **Example 1:** **Input:** heights = \[2,1,5,6,2,3\] **Output:** 10 **Explanation:** The above is a histogram where width of each bar is 1. The l...
null
Array,Stack,Monotonic Stack
Hard
85,1918
1,689
Hello hello everyone in this particular video music problem number one to zinta minimum number of decimal numbers problem statement this time number is this disciplinary effigy of its age it is here co and that without needing to solve 10851 300 ML number will give number to this number of Meaning this page number 90 a...
Partitioning Into Minimum Number Of Deci-Binary Numbers
detect-pattern-of-length-m-repeated-k-or-more-times
A decimal number is called **deci-binary** if each of its digits is either `0` or `1` without any leading zeros. For example, `101` and `1100` are **deci-binary**, while `112` and `3001` are not. Given a string `n` that represents a positive decimal integer, return _the **minimum** number of positive **deci-binary** n...
Use a three-layer loop to check all possible patterns by iterating through all possible starting positions, all indexes less than m, and if the character at the index is repeated k times.
Array,Enumeration
Easy
1764
741
cool in an N by n grid representing of field cherries each cell is one of three possible integers zero which in you can pass through one means the cell contains a cherry that you can pick up and pass for or negative one means this now contains a door that blocks away your task is to collect maximum number of cherries p...
Cherry Pickup
cherry-pickup
You are given an `n x n` `grid` representing a field of cherries, each cell is one of three possible integers. * `0` means the cell is empty, so you can pass through, * `1` means the cell contains a cherry that you can pick up and pass through, or * `-1` means the cell contains a thorn that blocks your way. Ret...
null
Array,Dynamic Programming,Matrix
Hard
64,174,2189
1,941
welcome back for another video we are going to do another deco question the question is 1941 check if all characters have equal number of occurrences given a string as return to if s is a good string or force otherwise a string s is good if all the characters that appear in s have the same number of occurrences the sam...
Check if All Characters Have Equal Number of Occurrences
minimum-number-of-operations-to-make-string-sorted
Given a string `s`, return `true` _if_ `s` _is a **good** string, or_ `false` _otherwise_. A string `s` is **good** if **all** the characters that appear in `s` have the **same** number of occurrences (i.e., the same frequency). **Example 1:** **Input:** s = "abacbc " **Output:** true **Explanation:** The character...
Note that the operations given describe getting the previous permutation of s To solve this problem you need to solve every suffix separately
Math,String,Combinatorics
Hard
null
1,353
hello guys welcome back to the channel today we are solving another lead code problem that is one three five three maximum number of event that can be attended before jumping into the solution you should read the problem statement on your own and give at least 15 to 30 minutes before this solution so what problem is as...
Maximum Number of Events That Can Be Attended
maximum-number-of-events-that-can-be-attended
You are given an array of `events` where `events[i] = [startDayi, endDayi]`. Every event `i` starts at `startDayi` and ends at `endDayi`. You can attend an event `i` at any day `d` where `startTimei <= d <= endTimei`. You can only attend one event at any time `d`. Return _the maximum number of events you can attend_....
null
null
Medium
null
929
that's internet Islam Oh new question interface when you edit it okay let's see every email address has a local name and a domain name separated by the @ sign for example is le carré by the @ sign for example is le carré by the @ sign for example is le carré mr. Logan name we call that commerce domain name beside lower...
Unique Email Addresses
groups-of-special-equivalent-strings
Every **valid email** consists of a **local name** and a **domain name**, separated by the `'@'` sign. Besides lowercase letters, the email may contain one or more `'.'` or `'+'`. * For example, in `"alice@leetcode.com "`, `"alice "` is the **local name**, and `"leetcode.com "` is the **domain name**. If you add pe...
null
Array,Hash Table,String
Medium
null
1,029
hey guys how's everything going this is Jay sir who is not good at all goodness I'm making these videos to prepare my future interview this video I'm going to take a look at 102 9 2 cities scheduling okay there are two end people and the company is planning to interview the cost of flying I person to a is the first num...
Two City Scheduling
vertical-order-traversal-of-a-binary-tree
A company is planning to interview `2n` people. Given the array `costs` where `costs[i] = [aCosti, bCosti]`, the cost of flying the `ith` person to city `a` is `aCosti`, and the cost of flying the `ith` person to city `b` is `bCosti`. Return _the minimum cost to fly every person to a city_ such that exactly `n` people...
null
Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Hard
null
461
Hello Hi Guys How Are You I Am Positive Doing Good Welcome To Calendar Co DC Show Today Score And Skimming Distance And This Vegetable Question Is What Does Sunrise And Happy Return President Of The Number Of Egg Positions Pandit Vishal Different Sunidhi Chauhan Defiant Facility Solution is pet this udayveer vikram 59 ...
Hamming Distance
hamming-distance
The [Hamming distance](https://en.wikipedia.org/wiki/Hamming_distance) between two integers is the number of positions at which the corresponding bits are different. Given two integers `x` and `y`, return _the **Hamming distance** between them_. **Example 1:** **Input:** x = 1, y = 4 **Output:** 2 **Explanation:** 1...
null
Bit Manipulation
Easy
191,477
949
hey what's up guys juan here again and so this time let's take a look at this lead called problem uh number 949 largest time for given digits i mean someone might have may have been surprised oh why you are where you are doing like easy problem you know because i think this problem is very interesting i think it should...
Largest Time for Given Digits
cat-and-mouse
Given an array `arr` of 4 digits, find the latest 24-hour time that can be made using each digit **exactly once**. 24-hour times are formatted as `"HH:MM "`, where `HH` is between `00` and `23`, and `MM` is between `00` and `59`. The earliest 24-hour time is `00:00`, and the latest is `23:59`. Return _the latest 24-h...
null
Math,Dynamic Programming,Breadth-First Search,Graph,Memoization,Game Theory
Hard
1727
1,074
Hello Everyone Welcome To Our Channel Code With Sunny Today I Am Going To Talk About The Problem Number Form Entries Dasham To Target Index Numbers 107 To End Problems Of Ur Heart Problem Sub Delete Good Looking So Let's Discuss The Problem Of Android 2.3 Best Solution For This Android 2.3 Best Solution For This Androi...
Number of Submatrices That Sum to Target
high-five
Given a `matrix` and a `target`, return the number of non-empty submatrices that sum to target. A submatrix `x1, y1, x2, y2` is the set of all cells `matrix[x][y]` with `x1 <= x <= x2` and `y1 <= y <= y2`. Two submatrices `(x1, y1, x2, y2)` and `(x1', y1', x2', y2')` are different if they have some coordinate that is...
How can we solve the problem if we have just one student? Given an student sort their grades and get the top 5 average. Generalize the idea to do it for many students.
Array,Hash Table,Sorting
Easy
null
131
lead code problem number 131 Pol Drome partitioning so this problem gives us a string and we have to partition it so that every substring of the partition is a palindrome and we to return all the possible par androme partitioning of the string s so what it means by that is let's say this example so we have to partition...
Palindrome Partitioning
palindrome-partitioning
Given a string `s`, partition `s` such that every substring of the partition is a **palindrome**. Return _all possible palindrome partitioning of_ `s`. **Example 1:** **Input:** s = "aab" **Output:** \[\["a","a","b"\],\["aa","b"\]\] **Example 2:** **Input:** s = "a" **Output:** \[\["a"\]\] **Constraints:** * `1...
null
String,Dynamic Programming,Backtracking
Medium
132,1871
135
and the challenge name is Randy so the challenge statement goes like this there are n children standing in a line each child is assigned a rating value given in a integer array ratings this rating survey will be given to you so each of the element of this ratings array indicates a rating given to a particular child so ...
Candy
candy
There are `n` children standing in a line. Each child is assigned a rating value given in the integer array `ratings`. You are giving candies to these children subjected to the following requirements: * Each child must have at least one candy. * Children with a higher rating get more candies than their neighbors....
null
Array,Greedy
Hard
null
554
hello everyone welcome to coderscam so we are at the 22nd day of april code challenge and the problem we are going to cover today is brick wall so here the input given is list of list and we have to return the minimum number of bricks we crossed by drawing a line so here the problem statement said if your line go throu...
Brick Wall
brick-wall
There is a rectangular brick wall in front of you with `n` rows of bricks. The `ith` row has some number of bricks each of the same height (i.e., one unit) but they can be of different widths. The total width of each row is the same. Draw a vertical line from the top to the bottom and cross the least bricks. If your l...
null
Array,Hash Table
Medium
2322
835
Hello hello everyone welcome to my channel it's all the problem image overlap sotu image and where given represented a pyun from it geometry only 10 end values ​​which left geometry only 10 end values ​​which left geometry only 10 end values ​​which left side now them number of units play list on top of the end of the ...
Image Overlap
linked-list-components
You are given two images, `img1` and `img2`, represented as binary, square matrices of size `n x n`. A binary matrix has only `0`s and `1`s as values. We **translate** one image however we choose by sliding all the `1` bits left, right, up, and/or down any number of units. We then place it on top of the other image. W...
null
Hash Table,Linked List
Medium
2299
3
Hello, welcome to another video on my channel, I'm Cassiano And today we're going to solve another challenge of it Could you she challenge number 3 or hide long This type of Federal I prefer to fill up to the largest substring' without the largest substring' without the largest substring' without the meal of characters...
Longest Substring Without Repeating Characters
longest-substring-without-repeating-characters
Given a string `s`, find the length of the **longest** **substring** without repeating characters. **Example 1:** **Input:** s = "abcabcbb " **Output:** 3 **Explanation:** The answer is "abc ", with the length of 3. **Example 2:** **Input:** s = "bbbbb " **Output:** 1 **Explanation:** The answer is "b ", with t...
null
Hash Table,String,Sliding Window
Medium
159,340,1034,1813,2209
374
welcome back to algorgeous today's question is leak code 374 guest number higher or lower so we're playing the guess game the game is as follows I pick a number from 1 to n you have to guess which number I picked every time you guess wrong I'll tell you whether the number I picked is higher or lower than your guess you...
Guess Number Higher or Lower
guess-number-higher-or-lower
We are playing the Guess Game. The game is as follows: I pick a number from `1` to `n`. You have to guess which number I picked. Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess. You call a pre-defined API `int guess(int num)`, which returns three possible re...
null
Binary Search,Interactive
Easy
278,375,658
1,595
hey what is up guys this is just a disclaimer uh i'm sorry that this explanation wasn't that great i think it still works i think you'll understand the problem by the end of it but um it wasn't as quick and as clear and straightforward as i wanted it to be but i don't have the time to re-record re-record re-record it u...
Minimum Cost to Connect Two Groups of Points
minimum-cost-to-connect-two-groups-of-points
You are given two groups of points where the first group has `size1` points, the second group has `size2` points, and `size1 >= size2`. The `cost` of the connection between any two points are given in an `size1 x size2` matrix where `cost[i][j]` is the cost of connecting point `i` of the first group and point `j` of t...
null
null
Hard
null
752
hey what's up guys uh this is juan here so today uh today's daily challenge problem uh number 752 open the lock um so you have a lock and with four circular wheels right so each wheel has 10 slots from number zero to nine and the wheels can rotate freely and wrap around so which means that you know if you're like at ni...
Open the Lock
ip-to-cidr
You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: `'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'`. The wheels can rotate freely and wrap around: for example we can turn `'9'` to be `'0'`, or `'0'` to be `'9'`. Each move consists of turning one wheel one slot. The lock initially starts...
Convert the ip addresses to and from (long) integers. You want to know what is the most addresses you can put in this block starting from the "start" ip, up to n. It is the smallest between the lowest bit of start and the highest bit of n. Then, repeat this process with a new start and n.
String,Bit Manipulation
Medium
93,468
576
hey what's up guys this is chung here so today uh number 576 out of boundary path okay so there is like uh m by n to the grid with the ball and the ball is initially at the position start at the column and start row and start column you're allowed to move the bar in four directions right and then you can only move at m...
Out of Boundary Paths
out-of-boundary-paths
There is an `m x n` grid with a ball. The ball is initially at the position `[startRow, startColumn]`. You are allowed to move the ball to one of the four adjacent cells in the grid (possibly out of the grid crossing the grid boundary). You can apply **at most** `maxMove` moves to the ball. Given the five integers `m`...
Is traversing every path feasible? There are many possible paths for a small matrix. Try to optimize it. Can we use some space to store the number of paths and update them after every move? One obvious thing: the ball will go out of the boundary only by crossing it. Also, there is only one possible way the ball can go ...
Dynamic Programming
Medium
688,2239
387
hello guys welcome back to take those and in this video we will see how to find the first non-repeating character find the first non-repeating character find the first non-repeating character in a stream of characters so let us look at the problem statement let us assume that we are given a stream of characters that is...
First Unique Character in a String
first-unique-character-in-a-string
Given a string `s`, _find the first non-repeating character in it and return its index_. If it does not exist, return `-1`. **Example 1:** **Input:** s = "leetcode" **Output:** 0 **Example 2:** **Input:** s = "loveleetcode" **Output:** 2 **Example 3:** **Input:** s = "aabb" **Output:** -1 **Constraints:** * `...
null
Hash Table,String,Queue,Counting
Easy
451
104
hello everyone welcome back and today we are looking at question 104 which is maximum depth of a binary tree so we are given the root of a binary tree and want to return the maximum depth of that tree now they are saying that the maximum depth is the number of nodes along the longest path from the root node down to the...
Maximum Depth of Binary Tree
maximum-depth-of-binary-tree
Given the `root` of a binary tree, return _its maximum depth_. A binary tree's **maximum depth** is the number of nodes along the longest path from the root node down to the farthest leaf node. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** 3 **Example 2:** **Input:** root = \[1,null,2\] **...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
110,111,774,1492
35
foreign approach so if you remember we covered up to 28 problem today we're gonna go to the next one which is 35th so this is the problem statement says like it says search insert position given an assorted array of distinct integers and a Target value return the index if the target is found not return the index where ...
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
57
Hello hi gas welcome back tu de 7 of DSL practice and which is our question today insert interval now this question is not at all as simple as it seemed to me and there are two approaches to it, I will tell you the second approach I thought very much. Date it what it expected so look here what is the question saying yo...
Insert Interval
insert-interval
You are given an array of non-overlapping intervals `intervals` where `intervals[i] = [starti, endi]` represent the start and the end of the `ith` interval and `intervals` is sorted in ascending order by `starti`. You are also given an interval `newInterval = [start, end]` that represents the start and end of another i...
null
Array
Medium
56,715
39
hey guys how's it going in this video i'm going to walk through this decode number 39 combination sum this question was asked by facebook for 17 times for the last six months and other big companies so this question let's take a look at it given an array of distinct integers it's called candidate and target integer uh ...
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
42
4:42 trapping rainwater we're given 4:42 trapping rainwater we're given 4:42 trapping rainwater we're given another negative integers or visiting an elevation map where the width of each parts one computer how much water it is able to trap after raining so here one we can trap water here and here these elevation map is...
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
44
hello hey guys Welcome to our daily DSA practice and shares this site and today question which I have picked is wild card matching so this question uh is very important question uh as per the top 100 interview questions it's coming on the top uh very much frequently asked so let's see the question it's given an input s...
Wildcard Matching
wildcard-matching
Given an input string (`s`) and a pattern (`p`), implement wildcard pattern matching with support for `'?'` and `'*'` where: * `'?'` Matches any single character. * `'*'` Matches any sequence of characters (including the empty sequence). The matching should cover the **entire** input string (not partial). **Exam...
null
String,Dynamic Programming,Greedy,Recursion
Hard
10
279
Hello and welcome to the channel again this morning and today we will talk about the medium level problem of lead quote which is perfect square, what is it basically in this we are given an input i.e. we have to tell how many input i.e. we have to tell how many input i.e. we have to tell how many numbers of perfect squ...
Perfect Squares
perfect-squares
Given an integer `n`, return _the least number of perfect square numbers that sum to_ `n`. A **perfect square** is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, `1`, `4`, `9`, and `16` are perfect squares while `3` and `11` are not. **Example ...
null
Math,Dynamic Programming,Breadth-First Search
Medium
204,264
3
hello guys this is code in code and this is video editorial for the problem longest substring without repeating characters taken from lead code so let's see what the problem says so the problem statement is you are given a string then find the longest substring without repeating characters for example if the input was ...
Longest Substring Without Repeating Characters
longest-substring-without-repeating-characters
Given a string `s`, find the length of the **longest** **substring** without repeating characters. **Example 1:** **Input:** s = "abcabcbb " **Output:** 3 **Explanation:** The answer is "abc ", with the length of 3. **Example 2:** **Input:** s = "bbbbb " **Output:** 1 **Explanation:** The answer is "b ", with t...
null
Hash Table,String,Sliding Window
Medium
159,340,1034,1813,2209
394
hello everyone welcome back myself rahul so today we are going to solve a problem related to strings so the problem name is decode string it's a very famous problem and a medium level one so let's go through the problem given an encoded string return its decoded string the encoding rule is k encoded string where the en...
Decode String
decode-string
Given an encoded string, return its decoded string. The encoding rule is: `k[encoded_string]`, where the `encoded_string` inside the square brackets is being repeated exactly `k` times. Note that `k` is guaranteed to be a positive integer. You may assume that the input string is always valid; there are no extra white...
null
String,Stack,Recursion
Medium
471,726,1076
1,974
hey everybody this is larry this is me going with q1 of the biweekly contest 59 minimum no time to type word using special typewriter so hit the like button in the subscribe button join me on discord especially if you came in right after the contest come hang out and talk about problems i've been talking problems that'...
Minimum Time to Type Word Using Special Typewriter
find-customers-with-positive-revenue-this-year
There is a special typewriter with lowercase English letters `'a'` to `'z'` arranged in a **circle** with a **pointer**. A character can **only** be typed if the pointer is pointing to that character. The pointer is **initially** pointing to the character `'a'`. Each second, you may perform one of the following operat...
null
Database
Easy
null
309
learned a lot I'm no longer a fool now this is best time to buy and sell stock with cooldown okay so if you're familiar with this class of problems there's several lead code problems that deal with timing the market right trying to determine what is the best time to buy and the best time to sell maybe you can sell and ...
Best Time to Buy and Sell Stock with Cooldown
best-time-to-buy-and-sell-stock-with-cooldown
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day. Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the following restrictions: * After you sell your stock, yo...
null
Array,Dynamic Programming
Medium
121,122
1,877
hello and welcome to another video in this video we're going to be working on minimize maximum pair sum in an array and in this problem the pair sum of a pair is equal to a plus b and the maximum pair is the largest pair of all the elements of all the list of pairs and you're trying to basically minimize the maximum pa...
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
242
hello guys myself Amrita welcome back to our channel technosage in today's video we are going to solve lead code question number 242 that is valid anagram so let's get started let's first understand the problem given two strings s and t return true if T is anagram of s and false otherwise so basically you will be given...
Valid Anagram
valid-anagram
Given two strings `s` and `t`, return `true` _if_ `t` _is an anagram of_ `s`_, and_ `false` _otherwise_. An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. **Example 1:** **Input:** s = "anagram", t = "nagaram" **...
null
Hash Table,String,Sorting
Easy
49,266,438
264
okay so we have ugly number two write a program to find the nth ugly number ugly numbers are positive numbers whose prime factors only include two three and five so this is a continuation of ugly number i just did a video on this i'm gonna link it up here if you guys haven't already watch it we're actually going to reu...
Ugly Number II
ugly-number-ii
An **ugly number** is a positive integer whose prime factors are limited to `2`, `3`, and `5`. Given an integer `n`, return _the_ `nth` _**ugly number**_. **Example 1:** **Input:** n = 10 **Output:** 12 **Explanation:** \[1, 2, 3, 4, 5, 6, 8, 9, 10, 12\] is the sequence of the first 10 ugly numbers. **Example 2:** ...
The naive approach is to call isUgly for every number until you reach the nth one. Most numbers are not ugly. Try to focus your effort on generating only the ugly ones. An ugly number must be multiplied by either 2, 3, or 5 from a smaller ugly number. The key is how to maintain the order of the ugly numbers. Try a simi...
Hash Table,Math,Dynamic Programming,Heap (Priority Queue)
Medium
23,204,263,279,313,1307
1,025
welcome back do you have this problem it's called the officer game it's been asked by Adobe and Bloomberg and Amazon um the problem is and pop tick turns and play in turns playing a game with Alice starting first initially there is a number called in on the uh chalkboard on each player's turn the player makes a move co...
Divisor Game
minimum-cost-for-tickets
Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a number `n` on the chalkboard. On each player's turn, that player makes a move consisting of: * Choosing any `x` with `0 < x < n` and `n % x == 0`. * Replacing the number `n` on the chalkboard with `n - x`. Also, if a player...
null
Array,Dynamic Programming
Medium
322
129
hi everyone today we are going to serve the critical question some route to leave numbers so you are given root of binary tree containing digits from 0 to 9 only each roof root to leave pass in the tree represents a number for example and the route to leave pass one two three representing the number of 123 so return th...
Sum Root to Leaf Numbers
sum-root-to-leaf-numbers
You are given the `root` of a binary tree containing digits from `0` to `9` only. Each root-to-leaf path in the tree represents a number. * For example, the root-to-leaf path `1 -> 2 -> 3` represents the number `123`. Return _the total sum of all root-to-leaf numbers_. Test cases are generated so that the answer w...
null
Tree,Depth-First Search,Binary Tree
Medium
112,124,1030
350
welcome to september's lee code challenge today's problem is intersection of two arrays two given two integer arrays nums one and nums 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 results in any order here we can see the...
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
5
hello and welcome to the fifth video in the Sleek Creed and C sharp Series in this video we're going to be looking at the challenge called longest palindromic substring so let's switch over to our web browser here and let's get started so the challenge is given a string s return the longest palindromic substring so str...
Longest Palindromic Substring
longest-palindromic-substring
Given a string `s`, return _the longest_ _palindromic_ _substring_ in `s`. **Example 1:** **Input:** s = "babad " **Output:** "bab " **Explanation:** "aba " is also a valid answer. **Example 2:** **Input:** s = "cbbd " **Output:** "bb " **Constraints:** * `1 <= s.length <= 1000` * `s` consist of only dig...
How can we reuse a previously computed palindrome to compute a larger palindrome? If “aba” is a palindrome, is “xabax” a palindrome? Similarly is “xabay” a palindrome? Complexity based hint: If we use brute-force and check whether for every start and end position a substring is a palindrome we have O(n^2) start - end ...
String,Dynamic Programming
Medium
214,266,336,516,647
121
hello and welcome back to the cracking pain youtube channel today we're going to be solving another question for the beginners lead code question number 121 best time to buy and sell stock before we get into the video two things the first please like the video and subscribe to the channel the engagement really helps me...
Best Time to Buy and Sell Stock
best-time-to-buy-and-sell-stock
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day. You want to maximize your profit by choosing a **single day** to buy one stock and choosing a **different day in the future** to sell that stock. Return _the maximum profit you can achieve from this transaction_. If you ...
null
Array,Dynamic Programming
Easy
53,122,123,188,309,2138,2144
237
hey everyone in today's video we're going to be solving the problem delete node in a linked list so the question says there's a single linked list head and we want to delete a node in it you're given a node to deleted node and you will not be given access to the first node of head all the values of the link list are un...
Delete Node in a Linked List
delete-node-in-a-linked-list
There is a singly-linked list `head` and we want to delete a node `node` in it. You are given the node to be deleted `node`. You will **not be given access** to the first node of `head`. All the values of the linked list are **unique**, and it is guaranteed that the given node `node` is not the last node in the linke...
null
Linked List
Easy
203
1,750
simulation problems you're ever going to see my friends this is 1750 minimum length of string after deleting similar ends okay so this problem is just a direct simulation I don't know really I don't fully understand why it's classified as a medium um it's more so an easy but I suppose it does really showcase your abili...
Minimum Length of String After Deleting Similar Ends
check-if-two-expression-trees-are-equivalent
Given a string `s` consisting only of characters `'a'`, `'b'`, and `'c'`. You are asked to apply the following algorithm on the string any number of times: 1. Pick a **non-empty** prefix from the string `s` where all the characters in the prefix are equal. 2. Pick a **non-empty** suffix from the string `s` where all...
Count for each variable how many times it appeared in the first tree. Do the same for the second tree and check if the count is the same for both tree.
Tree,Depth-First Search,Binary Tree
Medium
1736
100
in this problem we are given two binary trees and we have to return whether they are equal or not and by equal we mean they should be structurally equal and here if you see these two trees they are structurally same this one has left and right and this one has left right so they have exact same structure but that is no...
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
69
Those who were at that time those who in software to solve police problems cut off marks to isko gas piped water heart brush noise compound give the information middle aged person subscribe 251 subscription for the great khali vve subscribe time complexity to isko not good bye subscribe Like a few lines on different da...
Sqrt(x)
sqrtx
Given a non-negative integer `x`, return _the square root of_ `x` _rounded down to the nearest integer_. The returned integer should be **non-negative** as well. You **must not use** any built-in exponent function or operator. * For example, do not use `pow(x, 0.5)` in c++ or `x ** 0.5` in python. **Example 1:** ...
Try exploring all integers. (Credits: @annujoshi) Use the sorted property of integers to reduced the search space. (Credits: @annujoshi)
Math,Binary Search
Easy
50,367
1,313
we took over number 13 the compression run length encoding list the question says we are given a list of numbers of integers representing a list compress with run length encoding so we have a list of numbers which is composed of integers consider each a decent pair or they set meaning they're next to each other of elem...
Decompress Run-Length Encoded List
count-ways-to-build-rooms-in-an-ant-colony
We are given a list `nums` of integers representing a list compressed with run-length encoding. Consider each adjacent pair of elements `[freq, val] = [nums[2*i], nums[2*i+1]]` (with `i >= 0`). For each such pair, there are `freq` elements with value `val` concatenated in a sublist. Concatenate all the sublists from l...
Use dynamic programming. Let dp[i] be the number of ways to solve the problem for the subtree of node i. Imagine you are trying to fill an array with the order of traversal, dp[i] equals the multiplications of the number of ways to distribute the subtrees of the children of i on the array using combinatorics, multiplie...
Math,Dynamic Programming,Tree,Graph,Topological Sort,Combinatorics
Hard
null
141
hey everyone welcome back and let's write some more neat code today so today let's solve linked list cycle i know that we solved a problem that's pretty much a harder version of this exact problem but in this explanation i'm going to explain why the tortoise and hair algorithm on a linkedlist cycle why exactly it works...
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,921
hey everybody this is Larry this is day seven of the Leo d challenge in November hit the like button hit the Subscribe button join me on Discord let me know what you think about this far and explanation and my background right now um yeah I am actually in a covered more in Hiroshima and just got in today uh just walkin...
Eliminate Maximum Number of Monsters
eliminate-maximum-number-of-monsters
You are playing a video game where you are defending your city from a group of `n` monsters. You are given a **0-indexed** integer array `dist` of size `n`, where `dist[i]` is the **initial distance** in kilometers of the `ith` monster from the city. The monsters walk toward the city at a **constant** speed. The speed...
null
null
Medium
null
1,732
hello everyone here is vanamsen in today's video we will tackle an interesting problem about finding the highest altitude and we are given an array that represents the net gain in altitude between points and our job is to find maximum altitude the biker can reach so let's start coding so first initialize the maximum al...
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
492
hey everybody this is Larry this is f 26 I guess maybe well 26 but uh hit the like button hit the Subscribe but join me on Discord let me know what you think about today's extra prom I'm going to do an extra prom today on algo uh Ong with couple of days from leap day hope you're doing something leapy and crazy and what...
Construct the Rectangle
construct-the-rectangle
A web developer needs to know how to design a web page's size. So, given a specific rectangular web page's area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements: 1. The area of the rectangular web page you designed must equal to the given target area....
The W is always less than or equal to the square root of the area, so we start searching at sqrt(area) till we find the result.
Math
Easy
null
292
hello guys my name is Ursula and welcome back to my channel and today we are going to follow a new lead code question that is name game so we will be solving this question with the help of JavaScript so just before starting solving this question guys do subscribe to the channel hit the like button press the Bell icon b...
Nim Game
nim-game
You are playing the following Nim Game with your friend: * Initially, there is a heap of stones on the table. * You and your friend will alternate taking turns, and **you go first**. * On each turn, the person whose turn it is will remove 1 to 3 stones from the heap. * The one who removes the last stone is the...
If there are 5 stones in the heap, could you figure out a way to remove the stones such that you will always be the winner?
Math,Brainteaser,Game Theory
Easy
294
399
Hello Everyone and Welcome Back to my Channel Algorithm Hk Today I am going to write the code and also explain to you the algorithm to solve this evaluate division problem ch is there in lead code it is a medium level problem and belongs to the graph So let's start the section by taking the name of Shri Krishna, in thi...
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
88
Hello everyone, we are solving the change world 4 number 8, it means let's move on to the description, we are given 2 arrays One and two numbers to these arrays that represent the actual numbers that we will work with in our task, that is, 3 here means that from the beginning We take the first three elements that we ne...
Merge Sorted Array
merge-sorted-array
You are given two integer arrays `nums1` and `nums2`, sorted in **non-decreasing order**, and two integers `m` and `n`, representing the number of elements in `nums1` and `nums2` respectively. **Merge** `nums1` and `nums2` into a single array sorted in **non-decreasing order**. The final sorted array should not be re...
You can easily solve this problem if you simply think about two elements at a time rather than two arrays. We know that each of the individual arrays is sorted. What we don't know is how they will intertwine. Can we take a local decision and arrive at an optimal solution? If you simply consider one element each at a ti...
Array,Two Pointers,Sorting
Easy
21,1019,1028
117
hey everybody this is larry this is me going over day 12 of the madeliko daily challenge hit the like button hit the subscribe button join me on discord let me know what uh day 13 maybe i can't do math anymore oh i can't look at the calendar uh anyway hit the like button hit the subscriber and drama and discord let me ...
Populating Next Right Pointers in Each Node II
populating-next-right-pointers-in-each-node-ii
Given a binary tree struct Node { int val; Node \*left; Node \*right; Node \*next; } Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to `NULL`. Initially, all next pointers are set to `NULL`. **Example 1:** **Input:** root = \[1,2,3...
null
Linked List,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
116
1,268
hey what's up guys uh this is chung here again so this time uh today's daily challenge problem uh number 1268 search suggestions system right so given like an array of strings products and a string search word so we want to design a system that suggests at most three product names from the products after each character...
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
1,761
hey what's up guys this is sean here so today uh number 1761 minimum degree of a connected trio in a graph so you're given like an undirected graph right and then you have an integer n and uh and the list of edges for the graph and you need to find uh all the connected trail which is a set of three nodes where each nod...
Minimum Degree of a Connected Trio in a Graph
count-sorted-vowel-strings
You are given an undirected graph. You are given an integer `n` which is the number of nodes in the graph and an array `edges`, where each `edges[i] = [ui, vi]` indicates that there is an undirected edge between `ui` and `vi`. A **connected trio** is a set of **three** nodes where there is an edge between **every** pa...
For each character, its possible values will depend on the value of its previous character, because it needs to be not smaller than it. Think backtracking. Build a recursive function count(n, last_character) that counts the number of valid strings of length n and whose first characters are not less than last_character....
Dynamic Programming
Medium
null
96
present in jhala and how many unique binary search trees that we can form from andhra stupid and numbers so let's see how the algorithms are so let's see for example also have for numbers 1234 and make to how in how C1 is the source next nlin right is Two three and four bluetooth setting case 2011 is left hands free po...
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
283
hello and welcome back to the cracking fan YouTube channel today we're doing an easy problem for some of those people that may just be starting out on their lead code Journey we're solving 283 move zeros given an integer array nums move all the zeros to the end of it while maintaining the relative order of the nonzero ...
Move Zeroes
move-zeroes
Given an integer array `nums`, move all `0`'s to the end of it while maintaining the relative order of the non-zero elements. **Note** that you must do this in-place without making a copy of the array. **Example 1:** **Input:** nums = \[0,1,0,3,12\] **Output:** \[1,3,12,0,0\] **Example 2:** **Input:** nums = \[0\]...
In-place means we should not be allocating any space for extra array. But we are allowed to modify the existing array. However, as a first step, try coming up with a solution that makes use of additional space. For this problem as well, first apply the idea discussed using an additional array and the in-place solution ...
Array,Two Pointers
Easy
27
724
Hello, welcome to the channel, you are doing 90 days ac prep with me, this is the question lead code 724 find pivot index, question number 19 or lead code 75, so what the question says is that you have to return the pivot index. What does it mean, the sum of its left sides should be equal to its right sides 13656 We ha...
Find Pivot Index
find-pivot-index
Given an array of integers `nums`, calculate the **pivot index** of this array. The **pivot index** is the index where the sum of all the numbers **strictly** to the left of the index is equal to the sum of all the numbers **strictly** to the index's right. If the index is on the left edge of the array, then the left...
We can precompute prefix sums P[i] = nums[0] + nums[1] + ... + nums[i-1]. Then for each index, the left sum is P[i], and the right sum is P[P.length - 1] - P[i] - nums[i].
Array,Prefix Sum
Easy
560,2102,2369
787
okay any thoughts on this problem first of all i want to make sure everyone understands that you know you need to return the cheapest flight from source to destination that has at most k stops right so if k is equal to zero that means that you're looking for direct flights right if k is equal to one you're looking for ...
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
354
Same simple bollywood style number pregnancy 40 list subscribe and subscribe the channel loot subscribe to and jyoti grover satish question is what is the number of you can do but mostly subscribe to tomorrow college rotation is Not lost you can not be seen its problematic play list lutab school subscribe now to receiv...
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
1,969
hey everybody this is larry this is me going with q3 of the weekly contest 254 minimum non-zero product of the 254 minimum non-zero product of the 254 minimum non-zero product of the array elements hit the like button hit the subscribe button join me on discord especially if you like contest problems and you like to ki...
Minimum Non-Zero Product of the Array Elements
maximum-number-of-accepted-invitations
You are given a positive integer `p`. Consider an array `nums` (**1-indexed**) that consists of the integers in the **inclusive** range `[1, 2p - 1]` in their binary representations. You are allowed to do the following operation **any** number of times: * Choose two elements `x` and `y` from `nums`. * Choose a bit...
We can see that the problem can be represented as a directed graph with an edge from each boy to the girl he invited. We need to choose a set of edges such that no to source points in the graph (i.e., boys) have an edge with the same endpoint (i.e., the same girl). The problem is maximum bipartite matching in the graph...
Array,Backtracking,Matrix
Medium
null
110
hello everyone and welcome to another video today we're doing a little easy question about trees and this time we have to determine if a tree is height balanced so as for the definition a tree is defined as height balance with the left and right subtrees of every node differ in height by no more than one so let's take ...
Balanced Binary Tree
balanced-binary-tree
Given a binary tree, determine if it is **height-balanced**. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** true **Example 2:** **Input:** root = \[1,2,2,3,3,null,null,4,4\] **Output:** false **Example 3:** **Input:** root = \[\] **Output:** true **Constraints:** * The number of nodes ...
null
Tree,Depth-First Search,Binary Tree
Easy
104
1,636
welcome back for another video we are going to do another legal question the question is 1 6 3 6 sort away by increasing frequency given a array of integers nonce sort the away in increasing order based on the frequency of the values if multiple values have the same frequency sort them in decreasing order return the so...
Sort Array by Increasing Frequency
number-of-substrings-with-only-1s
Given an array of integers `nums`, sort the array in **increasing** order based on the frequency of the values. If multiple values have the same frequency, sort them in **decreasing** order. Return the _sorted array_. **Example 1:** **Input:** nums = \[1,1,2,2,2,3\] **Output:** \[3,1,1,2,2,2\] **Explanation:** '3' h...
Count number of 1s in each consecutive-1 group. For a group with n consecutive 1s, the total contribution of it to the final answer is (n + 1) * n // 2.
Math,String
Medium
1885,2186
64
hello guys so let's understand today question that we have this is expert Panda and you're watching on YouTube for the sum and we have given uh what we've given M cross and grid we have given and it is filled with non-negative numbers it is filled with non-negative numbers it is filled with non-negative numbers Now fin...
Minimum Path Sum
minimum-path-sum
Given a `m x n` `grid` filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path. **Note:** You can only move either down or right at any point in time. **Example 1:** **Input:** grid = \[\[1,3,1\],\[1,5,1\],\[4,2,1\]\] **Output:** 7 **Explanat...
null
Array,Dynamic Programming,Matrix
Medium
62,174,741,2067,2192
1,977
hey what's up guys uh this is chung here so this time bit code number 1977 number of ways to separate numbers okay so this one it's a it's another very hard problem okay but idea of the problem is not that hard you know the difficulty for this problem is how to improve the performance or how to reduce the time complexi...
Number of Ways to Separate Numbers
minimum-interval-to-include-each-query
You wrote down many **positive** integers in a string called `num`. However, you realized that you forgot to add commas to seperate the different numbers. You remember that the list of integers was **non-decreasing** and that **no** integer had leading zeros. Return _the **number of possible lists of integers** that y...
Is there a way to order the intervals and queries such that it takes less time to query? Is there a way to add and remove intervals by going from the smallest query to the largest query to find the minimum size?
Array,Binary Search,Line Sweep,Sorting,Heap (Priority Queue)
Hard
null
347
video when you look at a league problem called top k frequent elements so given a integer array and an integer k return the k most frequent elements and the answer can be in any order so you can see here we have an example of this right so this integer array and then we can and we want to return the top two frequent el...
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
951
951 flip equivalent binary trees for binary treaty we can define a flip operation as follows choose any note swap the left and right subtrees a binary tree X is equivalent to a binary y tree if Y and to binary Y if and only if we can make X you go to Y add to some numbers of some number of operation where the function ...
Flip Equivalent Binary Trees
partition-array-into-disjoint-intervals
For a binary tree **T**, we can define a **flip operation** as follows: choose any node, and swap the left and right child subtrees. A binary tree **X** is _flip equivalent_ to a binary tree **Y** if and only if we can make **X** equal to **Y** after some number of flip operations. Given the roots of two binary trees...
null
Array
Medium
2138
36
Hello friends, welcome to the new video, question number 36 loot code is a valid sudoku medium level question, the question is Singh's question, you guys will get internet, it has been asked in Google amazon, let's start by voting for a nine to noida sudo. If there are some cells in it, your body is frill, then tell us...
Valid Sudoku
valid-sudoku
Determine if a `9 x 9` Sudoku board is valid. Only the filled cells need to be validated **according to the following rules**: 1. Each row must contain the digits `1-9` without repetition. 2. Each column must contain the digits `1-9` without repetition. 3. Each of the nine `3 x 3` sub-boxes of the grid must contain...
null
Array,Hash Table,Matrix
Medium
37,2254
521
okay so this problem is about longest and common subsequence right so um it is trying to let us find out what is how long is the longest uh uncommon subsequence between two strings so for example like uh string a is a b and a and string b a c d c all right so the longest uncommon subsequence so is of the length of thre...
Longest Uncommon Subsequence I
longest-uncommon-subsequence-i
Given two strings `a` and `b`, return _the length of the **longest uncommon subsequence** between_ `a` _and_ `b`. If the longest uncommon subsequence does not exist, return `-1`. An **uncommon subsequence** between two strings is a string that is a **subsequence of one but not the other**. A **subsequence** of a stri...
null
String
Easy
522
112
hey guys in this video i'll be showing you how to solve late code question 112 path sum um so for this question we're given a binary tree and a target sum and all we have to do is return true if there is a path from the root to leaf where all of the numbers add up to our target sum and a leaf is considered a node with ...
Path Sum
path-sum
Given the `root` of a binary tree and an integer `targetSum`, return `true` if the tree has a **root-to-leaf** path such that adding up all the values along the path equals `targetSum`. A **leaf** is a node with no children. **Example 1:** **Input:** root = \[5,4,8,11,null,13,4,7,2,null,null,null,1\], targetSum = 22...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
113,124,129,437,666
1,663
hey guys what's up this is steve today let's go through legal problem 1663 smallest string with the given numeric value let's take a look the numeric value of a lowercase character is defined as this position one indexed so it's starting from one instead of zero in the alphabet which makes sense because it's in the alp...
Smallest String With A Given Numeric Value
detect-cycles-in-2d-grid
The **numeric value** of a **lowercase character** is defined as its position `(1-indexed)` in the alphabet, so the numeric value of `a` is `1`, the numeric value of `b` is `2`, the numeric value of `c` is `3`, and so on. The **numeric value** of a **string** consisting of lowercase characters is defined as the sum of...
Keep track of the parent (previous position) to avoid considering an invalid path. Use DFS or BFS and keep track of visited cells to see if there is a cycle.
Array,Depth-First Search,Breadth-First Search,Union Find,Matrix
Medium
null
1,187
hey everybody this is larry this is try two for trying to get a problem we haven't done before uh earlier we did get an sql problem and i did solve it but you know obviously it's a little bit awkward oh okay so let's look at this one 1187 make away strictly increasing hit the like button hit the subscriber and join me ...
Make Array Strictly Increasing
print-foobar-alternately
Given two integer arrays `arr1` and `arr2`, return the minimum number of operations (possibly zero) needed to make `arr1` strictly increasing. In one operation, you can choose two indices `0 <= i < arr1.length` and `0 <= j < arr2.length` and do the assignment `arr1[i] = arr2[j]`. If there is no way to make `arr1` str...
null
Concurrency
Medium
1203,1216
1,376
Hello Hi Friends Welcome Back To Yaar Go Into Solitude Problem 3176 Time Needed To Inform All Employees Were Willing To Android Discuss Problem And Solution Details Of Joint Commissioner My Channel Is Focus To Aa People Were Preparing For Coding Interviews And Job Interviews And All My Channel Late and Over 200 Should ...
Time Needed to Inform All Employees
time-needed-to-inform-all-employees
A company has `n` employees with a unique ID for each employee from `0` to `n - 1`. The head of the company is the one with `headID`. Each employee has one direct manager given in the `manager` array where `manager[i]` is the direct manager of the `i-th` employee, `manager[headID] = -1`. Also, it is guaranteed that th...
null
null
Medium
null
1,799
welcome to Pomodoro Joe for Sunday May 14 2023. today we're looking at the code problem 1799 maximize score after n operations this is a hard problem so you are given nums an array of positive integers of size 2 times n you must perform n operations on this array in the ith operation one indexed you will choose two ele...
Maximize Score After N Operations
minimum-incompatibility
You are given `nums`, an array of positive integers of size `2 * n`. You must perform `n` operations on this array. In the `ith` operation **(1-indexed)**, you will: * Choose two elements, `x` and `y`. * Receive a score of `i * gcd(x, y)`. * Remove `x` and `y` from `nums`. Return _the maximum score you can rec...
The constraints are small enough for a backtrack solution but not any backtrack solution If we use a naive n^k don't you think it can be optimized
Array,Dynamic Programming,Bit Manipulation,Bitmask
Hard
null
1,897
hello and welcome to another video in this video we're going to be working on redistribute characters to make all strings equal and in the problem you're given an array of strings and in one operation you can pick two distinct indices I and J where words I is in on empty string and move any character from words I to an...
Redistribute Characters to Make All Strings Equal
maximize-palindrome-length-from-subsequences
You are given an array of strings `words` (**0-indexed**). In one operation, pick two **distinct** indices `i` and `j`, where `words[i]` is a non-empty string, and move **any** character from `words[i]` to **any** position in `words[j]`. Return `true` _if you can make **every** string in_ `words` _**equal** using **a...
Let's ignore the non-empty subsequence constraint. We can concatenate the two strings and find the largest palindromic subsequence with dynamic programming. Iterate through every pair of characters word1[i] and word2[j], and see if some palindrome begins with word1[i] and ends with word2[j]. This ensures that the subse...
String,Dynamic Programming
Hard
516
858
hello everyone welcome to coding decoded my name is sanchez i'm working as technical architect at adobe and here i present the fourth of august sleek code challenge the problem that we have in today's mirror reflection this problem is a medium level question on late code and is based on the concept of geometry and geom...
Mirror Reflection
masking-personal-information
There is a special square room with mirrors on each of the four walls. Except for the southwest corner, there are receptors on each of the remaining corners, numbered `0`, `1`, and `2`. The square room has walls of length `p` and a laser ray from the southwest corner first meets the east wall at a distance `q` from th...
null
String
Medium
null
673
in this video we're going to take a look at a legal problem called number of longest increasing subsequence so this question is very similar to the bitco 300 longest increasing subsequence so highly recommend to check out that video that i did longest increasing subsequence before this video so in the longest increasin...
Number of Longest Increasing Subsequence
number-of-longest-increasing-subsequence
Given an integer array `nums`, return _the number of longest increasing subsequences._ **Notice** that the sequence has to be **strictly** increasing. **Example 1:** **Input:** nums = \[1,3,5,4,7\] **Output:** 2 **Explanation:** The two longest increasing subsequences are \[1, 3, 4, 7\] and \[1, 3, 5, 7\]. **Exampl...
null
Array,Dynamic Programming,Binary Indexed Tree,Segment Tree
Medium
300,674