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
500
hello everyone so let us solve one the problem from lead code the problem name is what you can say uh yeah keyboard rows so let us go the problem statement first you are given an array of strings words return the words that can be typed using the letters of the alphabets on only one row of the american keyboard like gi...
Keyboard Row
keyboard-row
Given an array of strings `words`, return _the words that can be typed using letters of the alphabet on only one row of American keyboard like the image below_. In the **American keyboard**: * the first row consists of the characters `"qwertyuiop "`, * the second row consists of the characters `"asdfghjkl "`, and...
null
Array,Hash Table,String
Easy
null
107
you know they're today's liquid in challenge process called binary tree love order traversal - so we have a love order traversal - so we have a love order traversal - so we have a binary tree and we want to return the botton upper level order traversal of its newest values since we're looking at the level order travers...
Binary Tree Level Order Traversal II
binary-tree-level-order-traversal-ii
Given the `root` of a binary tree, return _the bottom-up level order traversal of its nodes' values_. (i.e., from left to right, level by level from leaf to root). **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** \[\[15,7\],\[9,20\],\[3\]\] **Example 2:** **Input:** root = \[1\] **Output:** \[...
null
Tree,Breadth-First Search,Binary Tree
Medium
102,637
265
hey everybody this is Larry this is me trying to do the weekly premium question I don't know why it moves for week three hit the like button hit the Subscribe and join me on Discord let me know what you think about today's problem or this week's plan I'm still in Athens very tired walks so much uh yeah that's all I hav...
Paint House II
paint-house-ii
There are a row of `n` houses, each house can be painted with one of the `k` colors. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color. The cost of painting each house with a certain color is represented by an `n x k...
null
Array,Dynamic Programming
Hard
238,239,256,276
783
hi everyone so let's do the problem for today which is a minimum distance between BSD nodes uh to be honest this is supposed to be the minimum difference in the BSD node because I think this title may not be correct so given the root of a binary search we return the minimum difference between the values of any two diff...
Minimum Distance Between BST Nodes
search-in-a-binary-search-tree
Given the `root` of a Binary Search Tree (BST), return _the minimum difference between the values of any two different nodes in the tree_. **Example 1:** **Input:** root = \[4,2,6,1,3\] **Output:** 1 **Example 2:** **Input:** root = \[1,0,48,null,null,12,49\] **Output:** 1 **Constraints:** * The number of nodes...
null
Tree,Binary Search Tree,Binary Tree
Easy
270,784
1,992
um hi friends uh welcome to my channel let's have a look at problem 1992 thanks all groups of farmland uh in this video we're going to present two methods or two formats of method so the first one is the standard depth first traversal and the second one is a traversal algorithm along two directions so this problem asks...
Find All Groups of Farmland
sort-linked-list-already-sorted-using-absolute-values
You are given a **0-indexed** `m x n` binary matrix `land` where a `0` represents a hectare of forested land and a `1` represents a hectare of farmland. To keep the land organized, there are designated rectangular areas of hectares that consist **entirely** of farmland. These rectangular areas are called **groups**. N...
The nodes with positive values are already in the correct order. Nodes with negative values need to be moved to the front. Nodes with negative values are in reversed order.
Linked List,Two Pointers,Sorting
Medium
148
1,026
hello everyone welcome to let way coding today welcome to soft problem 1026 max difference between node and ancestor and we can see this is a really commonly asked questions by Facebook so let's see the problem given a tree we need to find the max value for which there exists a difference between node a and B and note ...
Maximum Difference Between Node and Ancestor
string-without-aaa-or-bbb
Given the `root` of a binary tree, find the maximum value `v` for which there exist **different** nodes `a` and `b` where `v = |a.val - b.val|` and `a` is an ancestor of `b`. A node `a` is an ancestor of `b` if either: any child of `a` is equal to `b` or any child of `a` is an ancestor of `b`. **Example 1:** **Input...
null
String,Greedy
Medium
null
279
Hello 12210 Adherent Drama Hai A Question On The Real Question Have Given Figure In Teacher In A Bid To Delete Number Office Padh 600 Ki Shopping Yeh To Return Minimum Account Of Ko Ye Number Dial Per Number Thursday 333 Number Four 3232 Number 9 The 15-minute doing this question to answer this The 15-minute doing this...
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
240
welcome to february's leco challenge today's problem is search a 2d matrix 2. write an efficient algorithm that searches for a target value in an m times an integer matrix the matrix has the following properties integers in each row are sorted and ascending from left to right integers in each column are sorted and asce...
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
878
hey everybody this is larry this is day 11 of the dissembly go daily challenge hit the like button the subscribe button join me on discord let me know what you think about today's farm 878 and magical number positive integer is magical if it is divisible by either a or b okay given n a and b find the nth magical number...
Nth Magical Number
shifting-letters
A positive integer is _magical_ if it is divisible by either `a` or `b`. Given the three integers `n`, `a`, and `b`, return the `nth` magical number. Since the answer may be very large, **return it modulo** `109 + 7`. **Example 1:** **Input:** n = 1, a = 2, b = 3 **Output:** 2 **Example 2:** **Input:** n = 4, a = ...
null
Array,String
Medium
1954
322
welcome to this video in this video we're going to solve this coordinate equation queen change in this problem we're given an array of integers and a variable amount we have to find out a minimum number of coin from this integer array and the minimum coin should add up to this amount and we can repeat the coin as many ...
Coin Change
coin-change
You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money. Return _the fewest number of coins that you need to make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `-1`. You may a...
null
Array,Dynamic Programming,Breadth-First Search
Medium
1025,1393,2345
395
in this problem we are given a string and we have to find a substring out of that string based on the condition that uh all the characters in that substring should appear at least k times so this is a long problem statement so let's look at a couple of examples to understand this problem let's say this is the input str...
Longest Substring with At Least K Repeating Characters
longest-substring-with-at-least-k-repeating-characters
Given a string `s` and an integer `k`, return _the length of the longest substring of_ `s` _such that the frequency of each character in this substring is greater than or equal to_ `k`. **Example 1:** **Input:** s = "aaabb ", k = 3 **Output:** 3 **Explanation:** The longest substring is "aaa ", as 'a' is repeated 3...
null
Hash Table,String,Divide and Conquer,Sliding Window
Medium
2140,2209
72
Do it Hello ji How all missions Love breakup Attendant Help Today we are going to solve a very asked question of Deep Conference - very asked question of Deep Conference - very asked question of Deep Conference - Edit Distance, so let's quickly see what happens in this question and then we will solve it quickly. Okay, ...
Edit Distance
edit-distance
Given two strings `word1` and `word2`, return _the minimum number of operations required to convert `word1` to `word2`_. You have the following three operations permitted on a word: * Insert a character * Delete a character * Replace a character **Example 1:** **Input:** word1 = "horse ", word2 = "ros " **O...
null
String,Dynamic Programming
Hard
161,583,712,1105,2311
128
Hello Hi Friends Welcome Back To Go Into Solitude Problem 120 Four Longs For Executive Sequence Are You Front Subscribe Order To My Channel Please subscribe My Channel I Have Lots Of Good Playlist This Interview For Java Admin Please Give Up Eating For A Telephonic And White Gold Code Interviews A Play List The Play Li...
Longest Consecutive Sequence
longest-consecutive-sequence
Given an unsorted array of integers `nums`, return _the length of the longest consecutive elements sequence._ You must write an algorithm that runs in `O(n)` time. **Example 1:** **Input:** nums = \[100,4,200,1,3,2\] **Output:** 4 **Explanation:** The longest consecutive elements sequence is `[1, 2, 3, 4]`. Therefor...
null
Array,Hash Table,Union Find
Medium
298,2278
30
hi everyone let's have the code 30 substring with concatenation of our words um it's a hard problem but there are a lot sometimes actually since um it's not easy to code elegantly but personally i like this problem since uh it's something like a sliding window problem okay let's take a look at problem so we are given s...
Substring with Concatenation of All Words
substring-with-concatenation-of-all-words
You are given a string `s` and an array of strings `words`. All the strings of `words` are of **the same length**. A **concatenated substring** in `s` is a substring that contains all the strings of any permutation of `words` concatenated. * For example, if `words = [ "ab ", "cd ", "ef "]`, then `"abcdef "`, `"abef...
null
Hash Table,String,Sliding Window
Hard
76
1,979
hey welcome guys welcome to my equals section so this problem is 1 9 17 find queries comma divisor array so given the array we can equate this comma divisor smallest number and not just a number in the numbers so basically uh yeah i think everyone knows about where this karma divisor so this is the uh the standard appr...
Find Greatest Common Divisor of Array
maximum-number-of-people-that-can-be-caught-in-tag
Given an integer array `nums`, return _the **greatest common divisor** of the smallest number and largest number in_ `nums`. The **greatest common divisor** of two numbers is the largest positive integer that evenly divides both numbers. **Example 1:** **Input:** nums = \[2,5,6,9,10\] **Output:** 2 **Explanation:** ...
Try to use as much of the range of a person who is "it" as possible. Find the leftmost person who is "it" that has not caught anyone yet, and the leftmost person who is not "it" that has not been caught yet. If the person who is not "it" can be caught, pair them together and repeat the process. If the person who is not...
Array,Greedy
Medium
2191
219
welcome back everyone we're gonna be solving leeco 219 contains duplicate 2. so we're given an integer array called nums and an integer K we want to return true if there are two distinct indices I and J in the array such that nums at the ith position is equal to nums at the jth position and the absolute value of I minu...
Contains Duplicate II
contains-duplicate-ii
Given an integer array `nums` and an integer `k`, return `true` _if there are two **distinct indices**_ `i` _and_ `j` _in the array such that_ `nums[i] == nums[j]` _and_ `abs(i - j) <= k`. **Example 1:** **Input:** nums = \[1,2,3,1\], k = 3 **Output:** true **Example 2:** **Input:** nums = \[1,0,1,1\], k = 1 **Outp...
null
Array,Hash Table,Sliding Window
Easy
217,220
1,090
so for this problem you are given a set of n item and then you're given two integer arrays values and labels and they are used to store the first arrays used to store the value of the item and the second array is used to store the label of that item so it's a case where the ith element of values I and labels I used to ...
Largest Values From Labels
armstrong-number
There is a set of `n` items. You are given two integer arrays `values` and `labels` where the value and the label of the `ith` element are `values[i]` and `labels[i]` respectively. You are also given two integers `numWanted` and `useLimit`. Choose a subset `s` of the `n` elements such that: * The size of the subset...
Check if the given k-digit number equals the sum of the k-th power of it's digits. How to compute the sum of the k-th power of the digits of a number ? Can you divide the number into digits using division and modulus operations ? You can find the least significant digit of a number by taking it modulus 10. And you can ...
Math
Easy
null
1,041
welcome to september's leeco challenge today's problem is robot bounded in circle on an infinite plane a robot initially stands at zero for the x and y points and faces north the robot can receive one of three instructions g goes straight one unit l turn 90 degrees to the left and r turn 90 degrees to the right now the...
Robot Bounded In Circle
available-captures-for-rook
On an infinite plane, a robot initially stands at `(0, 0)` and faces north. Note that: * The **north direction** is the positive direction of the y-axis. * The **south direction** is the negative direction of the y-axis. * The **east direction** is the positive direction of the x-axis. * The **west direction**...
null
Array,Matrix,Simulation
Easy
null
1,386
hello everyone so in this video let us talk about a medial problem from lead code the problem name is Cinema seat allocation so as you can see that there is a cinema with n rows of seats as you can see here and in an example from 1 till n all the rows are there and there are 10 seats in each row as you can see here so ...
Cinema Seat Allocation
shift-2d-grid
A cinema has `n` rows of seats, numbered from 1 to `n` and there are ten seats in each row, labelled from 1 to 10 as shown in the figure above. Given the array `reservedSeats` containing the numbers of seats already reserved, for example, `reservedSeats[i] = [3,8]` means the seat located in row **3** and labelled with...
Simulate step by step. move grid[i][j] to grid[i][j+1]. handle last column of the grid. Put the matrix row by row to a vector. take k % vector.length and move last k of the vector to the beginning. put the vector to the matrix back the same way.
Array,Matrix,Simulation
Easy
null
752
Hello everyone welcome back to the channels so today we are going to discuss the problem the name of the problem of the exam challenge is open the lock so this problem we have a combination given and we will increase one string and that combination is 00 Okay, we can't take that to zero and do anything else, if the num...
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
1,197
hey everybody this is Larry this is me doing weekly premium problem five of October hit the like button hit the Subscribe and join me on Discord let me know what you think about today's Farm uh I forgot to do an outside intro for this so I'm going do it now um but yeah today's Farm is 11 97 minimum night moves and I ha...
Minimum Knight Moves
parsing-a-boolean-expression
In an **infinite** chess board with coordinates from `-infinity` to `+infinity`, you have a **knight** at square `[0, 0]`. A knight has 8 possible moves it can make, as illustrated below. Each move is two squares in a cardinal direction, then one square in an orthogonal direction. Return _the minimum number of steps ...
Write a function "parse" which calls helper functions "parse_or", "parse_and", "parse_not".
String,Stack,Recursion
Hard
null
76
hey everybody this is Larry this is day four of the Leo dily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about this one um yeah oh it's a hard one hopefully uh we have time because I need to well the contest is coming up and I'm not going to do the um the premium...
Minimum Window Substring
minimum-window-substring
Given two strings `s` and `t` of lengths `m` and `n` respectively, return _the **minimum window**_ **_substring_** _of_ `s` _such that every character in_ `t` _(**including duplicates**) is included in the window_. If there is no such substring, return _the empty string_ `" "`. The testcases will be generated such tha...
Use two pointers to create a window of letters in S, which would have all the characters from T. Since you have to find the minimum window in S which has all the characters from T, you need to expand and contract the window using the two pointers and keep checking the window for all the characters. This approach is als...
Hash Table,String,Sliding Window
Hard
30,209,239,567,632,727
419
hello guys in this video I will solve battleships board from leak code so in this problem we are given a 2d board which contains empty cells and battleships need each battleship is either placed horizontally or vertically and each of these battleships my is at least separated with oneself from other battleships so and ...
Battleships in a Board
battleships-in-a-board
Given an `m x n` matrix `board` where each cell is a battleship `'X'` or empty `'.'`, return _the number of the **battleships** on_ `board`. **Battleships** can only be placed horizontally or vertically on `board`. In other words, they can only be made of the shape `1 x k` (`1` row, `k` columns) or `k x 1` (`k` rows, ...
null
Array,Depth-First Search,Matrix
Medium
null
1,396
hello and welcome back to the cracking fang youtube channel today we're going to be solving leap code problem 1396 design underground system right now this is bloomberg's number one interview question so if you have an on-site interview with bloomberg coming on-site interview with bloomberg coming on-site interview wit...
Design Underground System
count-servers-that-communicate
An underground railway system is keeping track of customer travel times between different stations. They are using this data to calculate the average time it takes to travel from one station to another. Implement the `UndergroundSystem` class: * `void checkIn(int id, string stationName, int t)` * A customer w...
Store number of computer in each row and column. Count all servers that are not isolated.
Array,Depth-First Search,Breadth-First Search,Union Find,Matrix,Counting
Medium
null
1,074
hey everyone welcome back and let's write some more neat code today so today let's solve the problem number of submatrices that sum to a given Target so given this Matrix over here what exactly is a submatrix well their definition of course is going to be more complicated than it needs to be but basically it's any rect...
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
1,970
hey everybody this is Larry I don't even know if I know how to set this up anymore but it is the last day I think yeah of the June nickel day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about this problem I will be doing this or um I don't know right I mean I did...
Last Day Where You Can Still Cross
sorting-the-sentence
There is a **1-based** binary matrix where `0` represents land and `1` represents water. You are given integers `row` and `col` representing the number of rows and columns in the matrix, respectively. Initially on day `0`, the **entire** matrix is **land**. However, each day a new cell becomes flooded with **water**. ...
Divide the string into the words as an array of strings Sort the words by removing the last character from each word and sorting according to it
String,Sorting
Easy
2168
336
hello everyone welcome to CSE events I am Nishant here let's solved another lead code problem palindromic pair so in their worth it's telling that we have to find the pair of to a string if we will connect uh merge it we will get palindrome or Not Here example first if you will see ABCD tcba so if this true string will...
Palindrome Pairs
palindrome-pairs
You are given a **0-indexed** array of **unique** strings `words`. A **palindrome pair** is a pair of integers `(i, j)` such that: * `0 <= i, j < words.length`, * `i != j`, and * `words[i] + words[j]` (the concatenation of the two strings) is a palindrome. Return _an array of all the **palindrome pairs** of_ `...
null
Array,Hash Table,String,Trie
Hard
5,214,2237
109
hi guys good morning uh before starting just a quick request if you guys like the videos which I have been posting or if you guys after watching the video like it then please do the like button it helps to motivate a lot if you don't then you can also press this like button it's up to you guys but yeah please take acti...
Convert Sorted List to Binary Search Tree
convert-sorted-list-to-binary-search-tree
Given the `head` of a singly linked list where elements are sorted in **ascending order**, convert _it to a_ **_height-balanced_** _binary search tree_. **Example 1:** **Input:** head = \[-10,-3,0,5,9\] **Output:** \[0,-3,9,-10,null,5\] **Explanation:** One possible answer is \[0,-3,9,-10,null,5\], which represents t...
null
Linked List,Divide and Conquer,Tree,Binary Search Tree,Binary Tree
Medium
108,2306
209
Hello gas welcome to me YouTube channel, so today we are going to solve problem 209 minimum size sanctuary, so what is this question about, I have been given a target and this is given, so I have to extract such a thing from it. Whose less is less, give him greater and equal, you should be the target and he should be t...
Minimum Size Subarray Sum
minimum-size-subarray-sum
Given an array of positive integers `nums` and a positive integer `target`, return _the **minimal length** of a_ _subarray_ _whose sum is greater than or equal to_ `target`. If there is no such subarray, return `0` instead. **Example 1:** **Input:** target = 7, nums = \[2,3,1,2,4,3\] **Output:** 2 **Explanation:** Th...
null
Array,Binary Search,Sliding Window,Prefix Sum
Medium
76,325,718,1776,2211,2329
447
children myself startups are short and today we are going to discuss a lead code problem or 447 that is number of Boom ranks it is basically a medium level of problem so let us uh discuss it so the problem says that you are given n points in the plane that are all distinct where points of I equal to x i y i so basicall...
Number of Boomerangs
number-of-boomerangs
You are given `n` `points` in the plane that are all **distinct**, where `points[i] = [xi, yi]`. A **boomerang** is a tuple of points `(i, j, k)` such that the distance between `i` and `j` equals the distance between `i` and `k` **(the order of the tuple matters)**. Return _the number of boomerangs_. **Example 1:** ...
null
Array,Hash Table,Math
Medium
356
174
hey everyone today we're going over dungeon game so the way this game works is i'm going to start in the upper left hand corner i can move either right or down and my goal is to get to this corner where the princess is and these numbers are basically telling me as soon as i enter this room this is the amount of health ...
Dungeon Game
dungeon-game
The demons had captured the princess and imprisoned her in **the bottom-right corner** of a `dungeon`. The `dungeon` consists of `m x n` rooms laid out in a 2D grid. Our valiant knight was initially positioned in **the top-left room** and must fight his way through `dungeon` to rescue the princess. The knight has an i...
null
Array,Dynamic Programming,Matrix
Hard
62,64,741,2354
17
let's do leak Code 17 letter combinations of a phone number together it's going to be really easy it's going to be really fun given a string containing digits from 2 to 9 inclusive return all possible letter combinations that the number could represent return the answer in any order as an example you can see you have t...
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
338
hey everyone today we are going to substitute for the question counting bits so you are given integer n return array answer of ranks n plus 1 such that for each I answer I is the number of ones in the binary representation of I so let's see the example so we should check example two so n equal 5 output is zero one two ...
Counting Bits
counting-bits
Given an integer `n`, return _an array_ `ans` _of length_ `n + 1` _such that for each_ `i` (`0 <= i <= n`)_,_ `ans[i]` _is the **number of**_ `1`_**'s** in the binary representation of_ `i`. **Example 1:** **Input:** n = 2 **Output:** \[0,1,1\] **Explanation:** 0 --> 0 1 --> 1 2 --> 10 **Example 2:** **Input:** n =...
You should make use of what you have produced already. Divide the numbers in ranges like [2-3], [4-7], [8-15] and so on. And try to generate new range from previous. Or does the odd/even status of the number help you in calculating the number of 1s?
Dynamic Programming,Bit Manipulation
Easy
191
4
all right so okay the element of two sorted arrays so they give us uh array one and array two these are both sorted and they want the fifth element in the amongst these two arrays that are sorted so for example if we put those two arrays together and we had some final sorted array the fifth element would be one two thr...
Median of Two Sorted Arrays
median-of-two-sorted-arrays
Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays. The overall run time complexity should be `O(log (m+n))`. **Example 1:** **Input:** nums1 = \[1,3\], nums2 = \[2\] **Output:** 2.00000 **Explanation:** merged array = \[1,2,3\] and median is ...
null
Array,Binary Search,Divide and Conquer
Hard
null
118
Yes, hello, this is Gary Niel, a child developer. The problem we will solve today is problem number 118, Pascal's Triangle. A score is given for laughing too much, and it is a problem that returns the first laughing too much of the Pascal Triangle. The Pascal Triangle is the Pascal Triangle shown in the tif below. This...
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
70
I say hello to Korea 003 Dragons Paris inkscape Dragon that are not Used for five minutes the Point is useless raise status and test result all This Time You can't wait for one to Sit in Harmony with English you time to talk a fast is some examples are some nice shop face it is unaware that you is expected and restored...
Climbing Stairs
climbing-stairs
You are climbing a staircase. It takes `n` steps to reach the top. Each time you can either climb `1` or `2` steps. In how many distinct ways can you climb to the top? **Example 1:** **Input:** n = 2 **Output:** 2 **Explanation:** There are two ways to climb to the top. 1. 1 step + 1 step 2. 2 steps **Example 2:** ...
To reach nth step, what could have been your previous steps? (Think about the step sizes)
Math,Dynamic Programming,Memoization
Easy
747,1013,1236
473
That a hello everyone welcome defeat in zurich challenge desperation superintendent has indicated in there which where is elementary subscribe now list code on mexico is 478 so let's prana wise question answer can be giving raw painters length mark point to find out where it's possible to Do Subscribe Now Subscribe And...
Matchsticks to Square
matchsticks-to-square
You are given an integer array `matchsticks` where `matchsticks[i]` is the length of the `ith` matchstick. You want to use **all the matchsticks** to make one square. You **should not break** any stick, but you can link them up, and each matchstick must be used **exactly one time**. Return `true` if you can make this ...
Treat the matchsticks as an array. Can we split the array into 4 equal halves? Every matchstick can belong to either of the 4 sides. We don't know which one. Maybe try out all options! For every matchstick, we have to try out each of the 4 options i.e. which side it can belong to. We can make use of recursion for this....
Array,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask
Medium
null
452
Hello, so welcome to week five of our weekly lead code challenge. We have finally come to our last week, so let's move towards the solution. Yes, so let's start with our question number 73. Question number 73 is ours. Minimum number of arrows to burst balloons Ax plane means 2D plane basically and you are given their c...
Minimum Number of Arrows to Burst Balloons
minimum-number-of-arrows-to-burst-balloons
There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array `points` where `points[i] = [xstart, xend]` denotes a balloon whose **horizontal diameter** stretches between `xstart` and `xend`. You do not know the exact y-coordinates of the ball...
null
Array,Greedy,Sorting
Medium
253,435
1,356
yo what is going on it is wednesday april 27 2022 uh april is winding down like a fastball pitcher's pitch um i don't know that was a random analogy um but you're not here for the random analogies you're at uh welcome to coding with chef and uh thanks for watching my video uh please like and subscribe and comment in th...
Sort Integers by The Number of 1 Bits
minimum-number-of-moves-to-make-palindrome
You are given an integer array `arr`. Sort the integers in the array in ascending order by the number of `1`'s in their binary representation and in case of two or more integers have the same number of `1`'s you have to sort them in ascending order. Return _the array after sorting it_. **Example 1:** **Input:** arr ...
Consider a greedy strategy. Let’s start by making the leftmost and rightmost characters match with some number of swaps. If we figure out how to do that using the minimum number of swaps, then we can delete the leftmost and rightmost characters and solve the problem recursively.
Two Pointers,String,Greedy,Binary Indexed Tree
Hard
1437
501
okay so in this question we're given the binary search tree and we want to find all the modes the element that occurs the most frequently in the binary search tree so how do we do this they have a follow-up how do we do this they have a follow-up how do we do this they have a follow-up could you do it without any extra...
Find Mode in Binary Search Tree
find-mode-in-binary-search-tree
Given the `root` of a binary search tree (BST) with duplicates, return _all the [mode(s)](https://en.wikipedia.org/wiki/Mode_(statistics)) (i.e., the most frequently occurred element) in it_. If the tree has more than one mode, return them in **any order**. Assume a BST is defined as follows: * The left subtree of...
null
Tree,Depth-First Search,Binary Search Tree,Binary Tree
Easy
98
124
hey what's up guys Nick white here and you take encoding stuff on to what you need to check the description for all my information I do a bunch of stuff on my patreon if you want to support me I'd really appreciate that and then yeah reach out to me on discord it's a good place for that and I'm doing a problem today ba...
Binary Tree Maximum Path Sum
binary-tree-maximum-path-sum
A **path** in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence **at most once**. Note that the path does not need to pass through the root. The **path sum** of a path is the sum of the node's values in the path. ...
null
Dynamic Programming,Tree,Depth-First Search,Binary Tree
Hard
112,129,666,687,1492
980
welcome to september's elite code challenge today's problem is unique paths three on two dimensional grid there are four types of squares one represents the starting square two represents the ending square zero represents empty squares that we can walk over and negative one represents obstacles that we cannot walk over...
Unique Paths III
find-the-shortest-superstring
You are given an `m x n` integer array `grid` where `grid[i][j]` could be: * `1` representing the starting square. There is exactly one starting square. * `2` representing the ending square. There is exactly one ending square. * `0` representing empty squares we can walk over. * `-1` representing obstacles tha...
null
Array,String,Dynamic Programming,Bit Manipulation,Bitmask
Hard
null
1,706
daily challenge I hope I maintain consistency across the whole month and let's get started okay today's question seems like an interesting one where will the ball fall Okay so normally I don't read the question I just try to look at the diagram and then test cases and I try to figure the question out so let's try to do...
Where Will the Ball Fall
min-cost-to-connect-all-points
You have a 2-D `grid` of size `m x n` representing a box, and you have `n` balls. The box is open on the top and bottom sides. Each cell in the box has a diagonal board spanning two corners of the cell that can redirect a ball to the right or to the left. * A board that redirects the ball to the right spans the top...
Connect each pair of points with a weighted edge, the weight being the manhattan distance between those points. The problem is now the cost of minimum spanning tree in graph with above edges.
Array,Union Find,Minimum Spanning Tree
Medium
2287
1
welcome back everybody this is the solution to lee code problem number one twosome in golang let's jump right into it so a quick description of the problem we will have a slice of nums which will just be some arbitrary list of numbers says two seven three four this one is just of length four and we will also be given a...
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
920
Hello everyone, welcome to me channel, we are going to do video number 55 and in the big part of its playlist, you will know the system of DP. If you want to study carefully, then listen to it, more videos are going to come, okay and hope the question is 1920 hard mark. Yes, but literally, I will show you such examples...
Number of Music Playlists
uncommon-words-from-two-sentences
Your music player contains `n` different songs. You want to listen to `goal` songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that: * Every song is played **at least once**. * A song can only be played again only if `k` other songs have been played. Given `n`, `g...
null
Hash Table,String
Easy
2190
809
Jhal on karo ki backward scientific list ko problem 10 school regressive words and this problem yogi one two inputs one is the so friend and the most important strategically are of world records a woman you have enough to find how many words in this query words can distract Facilitation and resultant world after starti...
Expressive Words
preimage-size-of-factorial-zeroes-function
Sometimes people repeat letters to represent extra feeling. For example: * `"hello " -> "heeellooo "` * `"hi " -> "hiiii "` In these strings like `"heeellooo "`, we have groups of adjacent letters that are all the same: `"h "`, `"eee "`, `"ll "`, `"ooo "`. You are given a string `s` and an array of query strings...
null
Math,Binary Search
Hard
172
221
hi friends welcome back today we are going to solve a problem uh find area of largest square in matrix so we are given a binary matrix with zeros and ones and we have to find out the largest square formed by using once so for example we are given an original matrix here like which is a six by six it is a six rows and s...
Maximal Square
maximal-square
Given an `m x n` binary `matrix` filled with `0`'s and `1`'s, _find the largest square containing only_ `1`'s _and return its area_. **Example 1:** **Input:** matrix = \[\[ "1 ", "0 ", "1 ", "0 ", "0 "\],\[ "1 ", "0 ", "1 ", "1 ", "1 "\],\[ "1 ", "1 ", "1 ", "1 ", "1 "\],\[ "1 ", "0 ", "0 ", "1 ", "0 "\]\] **Output:*...
null
Array,Dynamic Programming,Matrix
Medium
85,769,1312,2200
1,971
Hello Album So N Statement festival import in the form of number of verses and the apps in the form of day the heart should abstain from zero two and - first of all - first of all - first of all in India in today they are what they are giving every day at the age of you I love you I Love You I Don't See The First Presi...
Find if Path Exists in Graph
incremental-memory-leak
There is a **bi-directional** graph with `n` vertices, where each vertex is labeled from `0` to `n - 1` (**inclusive**). The edges in the graph are represented as a 2D integer array `edges`, where each `edges[i] = [ui, vi]` denotes a bi-directional edge between vertex `ui` and vertex `vi`. Every vertex pair is connecte...
What is the upper bound for the number of seconds? Simulate the process of allocating memory.
Simulation
Medium
null
313
Hello One Welcome Too Late To Ways Today In This Video Will Discuss About Super On Next Number Default Settings Video I Will Recommend You To Go Through Next Number I Have Made Video Aane All Give Link In Description Box Shoulder Affidavit Before Starting This Video Mota Supada Next Numbers Will Have Understood In Last...
Super Ugly Number
super-ugly-number
A **super ugly number** is a positive integer whose prime factors are in the array `primes`. Given an integer `n` and an array of integers `primes`, return _the_ `nth` _**super ugly number**_. The `nth` **super ugly number** is **guaranteed** to fit in a **32-bit** signed integer. **Example 1:** **Input:** n = 12, ...
null
Array,Hash Table,Math,Dynamic Programming,Heap (Priority Queue)
Medium
264
1,970
hey everybody this is larry this is me going with q4 of the weekly contest 254 last day where you can still cross um i actually been watching a lot of horror thriller movies lately so this has a this name is very uh this name of this problem is very uh reminiscent of that really that's what it reminds me of anyway okay...
Last Day Where You Can Still Cross
sorting-the-sentence
There is a **1-based** binary matrix where `0` represents land and `1` represents water. You are given integers `row` and `col` representing the number of rows and columns in the matrix, respectively. Initially on day `0`, the **entire** matrix is **land**. However, each day a new cell becomes flooded with **water**. ...
Divide the string into the words as an array of strings Sort the words by removing the last character from each word and sorting according to it
String,Sorting
Easy
2168
234
And listen guys suggest ubuntu in this question that is spelling of list shoulder question is liquid form for single list read through this page for 200 bluetooth subscribe to subscribe now to receive new updates reviews and this subscribe now to the subscribe that I am very Viewers Seem Free Mode Health Specification ...
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
516
so hello coders welcome to my channel and in this video i'll be explaining the problem longest palindromic subsequence so you know this is a fairly simple problem of and what the problem asks is that i have been given a string triple b a b and i have to return the length of the longest palindromic subsequence okay so i...
Longest Palindromic Subsequence
longest-palindromic-subsequence
Given a string `s`, find _the longest palindromic **subsequence**'s length in_ `s`. A **subsequence** is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. **Example 1:** **Input:** s = "bbbab " **Output:** 4 **Explanation:** On...
null
String,Dynamic Programming
Medium
5,647,730,1250,1822,1897,2130
515
hey what's up guys it's Nick white do tech encoding stuff on Google YouTube and I do every LICO problem not a ton of them up on my channel so go check those out if you want to explain to you or just to want to do them and get another everything's in the description too so this one is called fine largest value in each t...
Find Largest Value in Each Tree Row
find-largest-value-in-each-tree-row
Given the `root` of a binary tree, return _an array of the largest value in each row_ of the tree **(0-indexed)**. **Example 1:** **Input:** root = \[1,3,2,5,3,null,9\] **Output:** \[1,3,9\] **Example 2:** **Input:** root = \[1,2,3\] **Output:** \[1,3\] **Constraints:** * The number of nodes in the tree will be...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
null
443
Hello my dear friend compression so what are you going to do in this question i character are will be given you as i need you compressed na ho c are you are going to compress they have given d algorithm so they told date what you need you do it You need you take string s and for d group of consecutive repeating charact...
String Compression
string-compression
Given an array of characters `chars`, compress it using the following algorithm: Begin with an empty string `s`. For each group of **consecutive repeating characters** in `chars`: * If the group's length is `1`, append the character to `s`. * Otherwise, append the character followed by the group's length. The co...
How do you know if you are at the end of a consecutive group of characters?
Two Pointers,String
Medium
38,271,604,1241
1,247
all right so we are trying out this problem today minimum swaps to make strings equal strings as soon as 2 of equal length consisting of letters X and Y only the task is to make these two strings equal to each other you can swap any two characters that belong to different strings which means slab S1 any index attachmen...
Minimum Swaps to Make Strings Equal
decrease-elements-to-make-array-zigzag
You are given two strings `s1` and `s2` of equal length consisting of letters `"x "` and `"y "` **only**. Your task is to make these two strings equal to each other. You can swap any two characters that belong to **different** strings, which means: swap `s1[i]` and `s2[j]`. Return the minimum number of swaps required ...
Do each case (even indexed is greater, odd indexed is greater) separately. In say the even case, you should decrease each even-indexed element until it is lower than its immediate neighbors.
Array,Greedy
Medium
null
1,857
hey everyone welcome back and let's write some more neat code today so today let's solve the problem largest color value in a directed graph now while this is a hard problem whether you're a beginner or somebody who's been grinding a lot I'm going to show you some steps you can take to solve difficult problems like the...
Largest Color Value in a Directed Graph
largest-color-value-in-a-directed-graph
There is a **directed graph** of `n` colored nodes and `m` edges. The nodes are numbered from `0` to `n - 1`. You are given a string `colors` where `colors[i]` is a lowercase English letter representing the **color** of the `ith` node in this graph (**0-indexed**). You are also given a 2D array `edges` where `edges[j]...
null
null
Hard
null
509
what's up guys disease elite called 509 people 19 number if you wanna a numbers commonly denoted F of n form a sequence called the Fibonacci sequence such that each number is the sum of the two preceding ones starting from zero and one that is f of 0 is equals to 0 F of 1 is equals to 1 f of n is equals to f of n minus...
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
415
welcome to august eco challenge today's problem is add strings given two non-negative integers num1 and given two non-negative integers num1 and given two non-negative integers num1 and num2 represented as string return the sum of num1 and num2 as a string you must solve the problem without using any built-in library f...
Add Strings
add-strings
Given two non-negative integers, `num1` and `num2` represented as string, return _the sum of_ `num1` _and_ `num2` _as a string_. You must solve the problem without using any built-in library for handling large integers (such as `BigInteger`). You must also not convert the inputs to integers directly. **Example 1:** ...
null
Math,String,Simulation
Easy
2,43,1031
1,287
hello so today while doing this contest number be weekly contest number 15 the first problem is elements appearing more than 25% of the time and the problems in than 25% of the time and the problems in than 25% of the time and the problems in a sorted array and the problem says we get an array that is sorted in non dec...
Element Appearing More Than 25% In Sorted Array
distance-between-bus-stops
Given an integer array **sorted** in non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time, return that integer. **Example 1:** **Input:** arr = \[1,2,2,6,6,6,6,7,10\] **Output:** 6 **Example 2:** **Input:** arr = \[1,1\] **Output:** 1 **Constraints:** * `1 <= arr...
Find the distance between the two stops if the bus moved in clockwise or counterclockwise directions.
Array
Easy
null
76
a new video in today's video we're going to look at leite code problem and the problem's name is minimum window substring so in this question we are given two strings s and t which are having length M and N respectively and we have to return the minimum window substring of s such that every character int including dupl...
Minimum Window Substring
minimum-window-substring
Given two strings `s` and `t` of lengths `m` and `n` respectively, return _the **minimum window**_ **_substring_** _of_ `s` _such that every character in_ `t` _(**including duplicates**) is included in the window_. If there is no such substring, return _the empty string_ `" "`. The testcases will be generated such tha...
Use two pointers to create a window of letters in S, which would have all the characters from T. Since you have to find the minimum window in S which has all the characters from T, you need to expand and contract the window using the two pointers and keep checking the window for all the characters. This approach is als...
Hash Table,String,Sliding Window
Hard
30,209,239,567,632,727
394
hey everybody this is larry this is me doing day nate 1819 uh of delete code daily challenge hit the like button to subscribe on drum and disco let me know what you think about today's farm and today's uh everything because uh the contests i believe at least in my local time i guess in everyone's local time it's about ...
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
93
Peace be upon you, my friend. How are you doing? God willing, today we will solve a new problem together. If you have not solved this problem before, please let us go to it first, and then come back to us again. You may still watch my episode if you brought Exped. It may be a different solution than the previous one. Y...
Restore IP Addresses
restore-ip-addresses
A **valid IP address** consists of exactly four integers separated by single dots. Each integer is between `0` and `255` (**inclusive**) and cannot have leading zeros. * For example, `"0.1.2.201 "` and `"192.168.1.1 "` are **valid** IP addresses, but `"0.011.255.245 "`, `"192.168.1.312 "` and `"192.168@1.1 "` are **...
null
String,Backtracking
Medium
752
1,913
hello and welcome to another video in this video we're going to be working on maximum product difference between two pairs and in the problem you're given a product difference between two pairs a b and c d is defined as a * B minus C * D and c d is defined as a * B minus C * D and c d is defined as a * B minus C * D so...
Maximum Product Difference Between Two Pairs
make-the-xor-of-all-segments-equal-to-zero
The **product difference** between two pairs `(a, b)` and `(c, d)` is defined as `(a * b) - (c * d)`. * For example, the product difference between `(5, 6)` and `(2, 7)` is `(5 * 6) - (2 * 7) = 16`. Given an integer array `nums`, choose four **distinct** indices `w`, `x`, `y`, and `z` such that the **product differ...
Let's note that for the XOR of all segments with size K to be equal to zeros, nums[i] has to be equal to nums[i+k] Basically, we need to make the first K elements have XOR = 0 and then modify them.
Array,Dynamic Programming,Bit Manipulation
Hard
null
293
all right this question is flipping so in order to um flip the entire string uh you want to know it does contain two consecutive substring plus so you can change to minus so one way of doing this is uh you Traverse and you see these two index if they are plus you know you can convert to minus and add a result into the ...
Flip Game
flip-game
You are playing a Flip Game with your friend. You are given a string `currentState` that contains only `'+'` and `'-'`. You and your friend take turns to flip **two consecutive** `"++ "` into `"-- "`. The game ends when a person can no longer make a move, and therefore the other person will be the winner. Return all ...
null
String
Easy
294
1,679
Hello Hi Everyone Welcome To Record Programming In This Video Download Maximum Keep Sankat Select Your Valuable Information By Clicking On Like Button Now Let's Friend Aadhar Number Tesu Samiti Ke And In A Given Number To Subscribe If You Liked The Video Then Improve Number of a given issue number online return of the ...
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
221
A Real Good Beginning Unit Co Problem Today Maximum Square Feet Is Lead Code Number To 2131 Problems Were Given With The Name Cross And Finally Matrix Field With Yours And Bones And Need To Find The Largest Square Containing Only Once Again Due To Remain Its Area Super Example In this particular square interest kilomet...
Maximal Square
maximal-square
Given an `m x n` binary `matrix` filled with `0`'s and `1`'s, _find the largest square containing only_ `1`'s _and return its area_. **Example 1:** **Input:** matrix = \[\[ "1 ", "0 ", "1 ", "0 ", "0 "\],\[ "1 ", "0 ", "1 ", "1 ", "1 "\],\[ "1 ", "1 ", "1 ", "1 ", "1 "\],\[ "1 ", "0 ", "0 ", "1 ", "0 "\]\] **Output:*...
null
Array,Dynamic Programming,Matrix
Medium
85,769,1312,2200
1,791
so hello everyone welcome to this new video and i will be explaining the problem find center of star graph so this is a very easy problem initially i thought it was going to be super interesting so anyway in this video i will be first explaining the idea and then i will code it's going to be i think a short video so th...
Find Center of Star Graph
richest-customer-wealth
There is an undirected **star** graph consisting of `n` nodes labeled from `1` to `n`. A star graph is a graph where there is one **center** node and **exactly** `n - 1` edges that connect the center node with every other node. You are given a 2D integer array `edges` where each `edges[i] = [ui, vi]` indicates that th...
Calculate the wealth of each customer Find the maximum element in array.
Array,Matrix
Easy
null
402
hello everyone today's questions is removed key digits given a non-negative removed key digits given a non-negative removed key digits given a non-negative integer num represent as a string removed K digits from the number so that the new number is the smallest possible so let's understand this problem using pen and pa...
Remove K Digits
remove-k-digits
Given string num representing a non-negative integer `num`, and an integer `k`, return _the smallest possible integer after removing_ `k` _digits from_ `num`. **Example 1:** **Input:** num = "1432219 ", k = 3 **Output:** "1219 " **Explanation:** Remove the three digits 4, 3, and 2 to form the new number 1219 which ...
null
String,Stack,Greedy,Monotonic Stack
Medium
321,738,1792,2305
1,032
Hello hello guys welcome to front media say today they will go through the date when the problem August recording channel industry me character please like this video in you don't forget to subscribe to the channel shayari never miss any update element history channel transferred in constructor in various Jobs in The V...
Stream of Characters
satisfiability-of-equality-equations
Design an algorithm that accepts a stream of characters and checks if a suffix of these characters is a string of a given array of strings `words`. For example, if `words = [ "abc ", "xyz "]` and the stream added the four characters (one by one) `'a'`, `'x'`, `'y'`, and `'z'`, your algorithm should detect that the suf...
null
Array,String,Union Find,Graph
Medium
null
263
Hello friends today I'm going to solve liquid problem number 263 ugly number in this problem we are given an integer n and we need to find out if the number is ugly or not an ugly number is a positive integer whose prime factors are limited to 2 3 and 5. so uh for n the value could range from my negative to positive ri...
Ugly Number
ugly-number
An **ugly number** is a positive integer whose prime factors are limited to `2`, `3`, and `5`. Given an integer `n`, return `true` _if_ `n` _is an **ugly number**_. **Example 1:** **Input:** n = 6 **Output:** true **Explanation:** 6 = 2 \* 3 **Example 2:** **Input:** n = 1 **Output:** true **Explanation:** 1 has n...
null
Math
Easy
202,204,264
1,379
hi guys welcome to algorithms made easy today we will go through the question finding a corresponding node of a binary tree in a clone of that tree so we are given two binary trees original and clone and given a reference to a node target that is present in the original node the clone tree is a copy of original tree an...
Find a Corresponding Node of a Binary Tree in a Clone of That Tree
reconstruct-a-2-row-binary-matrix
Given two binary trees `original` and `cloned` and given a reference to a node `target` in the original tree. The `cloned` tree is a **copy of** the `original` tree. Return _a reference to the same node_ in the `cloned` tree. **Note** that you are **not allowed** to change any of the two trees or the `target` node a...
You cannot do anything about colsum[i] = 2 case or colsum[i] = 0 case. Then you put colsum[i] = 1 case to the upper row until upper has reached. Then put the rest into lower row. Fill 0 and 2 first, then fill 1 in the upper row or lower row in turn but be careful about exhausting permitted 1s in each row.
Array,Greedy,Matrix
Medium
1711
962
um hello so today we are going to do this problem which is um which is uh maximum width ramp so here we are asking that we get an array of numbers and we want um there is a pair right um we call a ramp a pair of injs such that J is bigger than I and the number at position I is small or equal than the number at position...
Maximum Width Ramp
flip-string-to-monotone-increasing
A **ramp** in an integer array `nums` is a pair `(i, j)` for which `i < j` and `nums[i] <= nums[j]`. The **width** of such a ramp is `j - i`. Given an integer array `nums`, return _the maximum width of a **ramp** in_ `nums`. If there is no **ramp** in `nums`, return `0`. **Example 1:** **Input:** nums = \[6,0,8,2,1,...
null
String,Dynamic Programming
Medium
null
884
foreign welcome back to my channel and today we are going to solve a new lead code question that is uncommon words from two sentences with the help of python so the question says a sentence is a string of single space separated words where each word consists of only of lower case letters a word is uncommon if it appear...
Uncommon Words from Two Sentences
k-similar-strings
A **sentence** is a string of single-space separated words where each word consists only of lowercase letters. A word is **uncommon** if it appears exactly once in one of the sentences, and **does not appear** in the other sentence. Given two **sentences** `s1` and `s2`, return _a list of all the **uncommon words**_....
null
String,Breadth-First Search
Hard
770
1,799
hello guys welcome to deep codes and in today's video we will discuss liquid question 1799 that says maximize score after an operation so guys solving this question you will learn a new concept of using bit masking for memorization purposes so yeah guys stick to the watch the complete video and make sure to like And su...
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
314
and welcome back to the cracking fang youtube channel today we're going to be solving leap code problem 314 binary tree vertical order traversal let's read the question prompt given the root of a binary tree return the vertical order traversal of its node's values ie from top to bottom column by column if two nodes are...
Binary Tree Vertical Order Traversal
binary-tree-vertical-order-traversal
Given the `root` of a binary tree, return _**the vertical order traversal** of its nodes' values_. (i.e., from top to bottom, column by column). If two nodes are in the same row and column, the order should be from **left to right**. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** \[\[9\],\[3,...
null
Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
102
257
hey what's up guys Nick white here I do tecnico do stuff on twitch and YouTube solving all the code hack rank problems explaining the algorithms people are confused people are like how do I do this what does this code mean I'm here to explain the code it's all you got to do it hopefully it is a good explanation compare...
Binary Tree Paths
binary-tree-paths
Given the `root` of a binary tree, return _all root-to-leaf paths in **any order**_. A **leaf** is a node with no children. **Example 1:** **Input:** root = \[1,2,3,null,5\] **Output:** \[ "1->2->5 ", "1->3 "\] **Example 2:** **Input:** root = \[1\] **Output:** \[ "1 "\] **Constraints:** * The number of nodes ...
null
String,Backtracking,Tree,Depth-First Search,Binary Tree
Easy
113,1030,2217
213
Hello everyone welcome to me channel questions playlist video number are going to come ok before starting some speech or motivation 23 ka six math pass ok have you daan n kitna shikha kitna group hai aapne IF YES Cup it up if you know your style go 6 more men don't take tension friend 6 months will pass sir I couldn't ...
House Robber II
house-robber-ii
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are **arranged in a circle.** That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have a security system connected, and **it will automatical...
Since House[1] and House[n] are adjacent, they cannot be robbed together. Therefore, the problem becomes to rob either House[1]-House[n-1] or House[2]-House[n], depending on which choice offers more money. Now the problem has degenerated to the House Robber, which is already been solved.
Array,Dynamic Programming
Medium
198,256,276,337,600,656
36
hello everyone welcome to my youtube channel today we will see another lead code problem the problem of valid so do co so here what we have to find that we have nine cross nine uh pseudo forward and we need to find it out whether it's a valid or not so we need to find we need to have some particular logic and based on ...
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
272
how's it going youtube don here in this video we're going to do number 272 closest binary tree search value so given the root of a binary search tree a target value and an integer k return the k values in the bst that are closest to the target may return the answer in any order you are guaranteed to have one unique set...
Closest Binary Search Tree Value II
closest-binary-search-tree-value-ii
Given the `root` of a binary search tree, a `target` value, and an integer `k`, return _the_ `k` _values in the BST that are closest to the_ `target`. You may return the answer in **any order**. You are **guaranteed** to have only one unique set of `k` values in the BST that are closest to the `target`. **Example 1:*...
Consider implement these two helper functions: getPredecessor(N), which returns the next smaller node to N. getSuccessor(N), which returns the next larger node to N. Try to assume that each node has a parent pointer, it makes the problem much easier. Without parent pointer we just need to keep track of the path from ...
Two Pointers,Stack,Tree,Depth-First Search,Binary Search Tree,Heap (Priority Queue),Binary Tree
Hard
94,270
937
hi guys today we're gonna look at lead call number 937 we order data in log files so the problem is you have an array of vlogs each log is a space to eliminate string of words and for a short the first word in each log is an alphanumeric identifier so it says it's having our Vedic words and numeral words together it ca...
Reorder Data in Log Files
online-stock-span
You are given an array of `logs`. Each log is a space-delimited string of words, where the first word is the **identifier**. There are two types of logs: * **Letter-logs**: All words (except the identifier) consist of lowercase English letters. * **Digit-logs**: All words (except the identifier) consist of digits...
null
Stack,Design,Monotonic Stack,Data Stream
Medium
739
1,502
hey everyone today we are going to solve the little question can make arithmetic progression from seconds a sequence of numbers is called an arithmetic progression if the difference between any two consecutive elements is the same given an array of numbers are returned to if the array can be rearranged to form the arit...
Can Make Arithmetic Progression From Sequence
construct-k-palindrome-strings
A sequence of numbers is called an **arithmetic progression** if the difference between any two consecutive elements is the same. Given an array of numbers `arr`, return `true` _if the array can be rearranged to form an **arithmetic progression**. Otherwise, return_ `false`. **Example 1:** **Input:** arr = \[3,5,1\]...
If the s.length < k we cannot construct k strings from s and answer is false. If the number of characters that have odd counts is > k then the minimum number of palindrome strings we can construct is > k and answer is false. Otherwise you can construct exactly k palindrome strings and answer is true (why ?).
Hash Table,String,Greedy,Counting
Medium
null
89
I hope all doing good welcome to the land digitally and that today will do July recording challenge 201 shedding tears will have any posts in the record handed over media only question that and this is PM in this video medicine not very hard work You can not but as a little bit 50% s you have tour who little bit 50% s ...
Gray Code
gray-code
An **n-bit gray code sequence** is a sequence of `2n` integers where: * Every integer is in the **inclusive** range `[0, 2n - 1]`, * The first integer is `0`, * An integer appears **no more than once** in the sequence, * The binary representation of every pair of **adjacent** integers differs by **exactly one ...
null
Math,Backtracking,Bit Manipulation
Medium
717
739
hey everyone today we are solving lead problem number 739 daily temperatures in this problem we are given an array of iners temperatures represent the daily temperatures and we have to return an array answer so what is answer I is the number of days you have to wait after the ith day to get a warmer temperature and if ...
Daily Temperatures
daily-temperatures
Given an array of integers `temperatures` represents the daily temperatures, return _an array_ `answer` _such that_ `answer[i]` _is the number of days you have to wait after the_ `ith` _day to get a warmer temperature_. If there is no future day for which this is possible, keep `answer[i] == 0` instead. **Example 1:**...
If the temperature is say, 70 today, then in the future a warmer temperature must be either 71, 72, 73, ..., 99, or 100. We could remember when all of them occur next.
Array,Stack,Monotonic Stack
Medium
496,937
1,512
Hello Everybody Welcome To My Channel It's All The Problem Numbers Of Good As Snow In This Problem Give In More Fold It Difficult For Pun Turn On The Number Of Good Example Vighn One Two Three 500 Subscribe Singh Sudhir With Two Three Four Years In These Directions 1999 From This Two Three One Two Three 600 Some Soluti...
Number of Good Pairs
design-underground-system
Given an array of integers `nums`, return _the number of **good pairs**_. A pair `(i, j)` is called _good_ if `nums[i] == nums[j]` and `i` < `j`. **Example 1:** **Input:** nums = \[1,2,3,1,1,3\] **Output:** 4 **Explanation:** There are 4 good pairs (0,3), (0,4), (3,4), (2,5) 0-indexed. **Example 2:** **Input:** nu...
Use two hash tables. The first to save the check-in time for a customer and the second to update the total time between two stations.
Hash Table,String,Design
Medium
2285
1,515
what's up guys so let's solve this one five best position for several century and this problem is a little bit uh math so i mean so that's why i try to i think it's still i need to be film hope you guys subscribe to my channel so to leave your basically i mean you don't need to answer uh see all these all you need to k...
Best Position for a Service Centre
find-the-minimum-number-of-fibonacci-numbers-whose-sum-is-k
A delivery company wants to build a new service center in a new city. The company knows the positions of all the customers in this city on a 2D-Map and wants to build the new center in a position such that **the sum of the euclidean distances to all customers is minimum**. Given an array `positions` where `positions[i...
Generate all Fibonacci numbers up to the limit (they are few). Use greedy solution, taking at every time the greatest Fibonacci number which is smaller than or equal to the current number. Subtract this Fibonacci number from the current number and repeat again the process.
Greedy
Medium
null
314
hello everyone so let's talk about the binary vertical order traversal so you are given the root of a binary tree and you want to return a vertical order traversal so uh this is pretty straightforward so uh i mean let's talk about example one so the vertical treble so is that latest right and then you want to just uh t...
Binary Tree Vertical Order Traversal
binary-tree-vertical-order-traversal
Given the `root` of a binary tree, return _**the vertical order traversal** of its nodes' values_. (i.e., from top to bottom, column by column). If two nodes are in the same row and column, the order should be from **left to right**. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** \[\[9\],\[3,...
null
Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
102
56
and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem number 56 merge intervals given an array of intervals where intervals of i equals start of i end of i merge all overlapping intervals and return an array of non-overlapping return an array of non-overlapping return a...
Merge Intervals
merge-intervals
Given an array of `intervals` where `intervals[i] = [starti, endi]`, merge all overlapping intervals, and return _an array of the non-overlapping intervals that cover all the intervals in the input_. **Example 1:** **Input:** intervals = \[\[1,3\],\[2,6\],\[8,10\],\[15,18\]\] **Output:** \[\[1,6\],\[8,10\],\[15,18\]\...
null
Array,Sorting
Medium
57,252,253,495,616,715,761,768,1028,2297,2319
337
yeah so hello everyone so we are having today another problem the problem is that you need to get the maximum sum so these are all the notes that you have given that we have given a tree and we need to get the maximum sum in such a way that there will be no such parent child are connected which means that suppose you h...
House Robber III
house-robber-iii
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called `root`. Besides the `root`, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will automatically contact the police if ...
null
Dynamic Programming,Tree,Depth-First Search,Binary Tree
Medium
198,213
1,282
That there is a problem of Taj Mahal loot from 122. Whom are you discussing with? So let's start with this problem statement itself, that record has to be taken on the right side. This bench is a mere 10 to 15 minutes long, I was standing in the remaining two time, first understood. It was not from Custom and Central, ...
Group the People Given the Group Size They Belong To
number-of-valid-words-for-each-puzzle
There are `n` people that are split into some unknown number of groups. Each person is labeled with a **unique ID** from `0` to `n - 1`. You are given an integer array `groupSizes`, where `groupSizes[i]` is the size of the group that person `i` is in. For example, if `groupSizes[1] = 3`, then person `1` must be in a g...
Exploit the fact that the length of the puzzle is only 7. Use bit-masks to represent the word and puzzle strings. For each puzzle, count the number of words whose bit-mask is a sub-mask of the puzzle's bit-mask.
Array,Hash Table,String,Bit Manipulation,Trie
Hard
null
4
hey what's up everybody and welcome to coding with roby and in this video we're gonna be going over a top interview question now this question is in that hard category on leak code this question you have to find the median of a list and as we know lists can have x amount of numbers it does not have to be decided so it ...
Median of Two Sorted Arrays
median-of-two-sorted-arrays
Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays. The overall run time complexity should be `O(log (m+n))`. **Example 1:** **Input:** nums1 = \[1,3\], nums2 = \[2\] **Output:** 2.00000 **Explanation:** merged array = \[1,2,3\] and median is ...
null
Array,Binary Search,Divide and Conquer
Hard
null
1,004
hey guys this is it from brevity and today we're going to look at a very interesting lead code question maximum consider ones so the problem statement is actually quite simple we'll be given a array with zeros and ones and we need to return the longest continuous sub array with just has ones and here's the catch we can...
Max Consecutive Ones III
least-operators-to-express-number
Given a binary array `nums` and an integer `k`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most_ `k` `0`'s. **Example 1:** **Input:** nums = \[1,1,1,0,0,0,1,1,1,1,0\], k = 2 **Output:** 6 **Explanation:** \[1,1,1,0,0,**1**,1,1,1,1,**1**\] Bolded numbers were flipped from 0 to 1....
null
Math,Dynamic Programming
Hard
null
1,675
welcome to january's leeco challenge today's problem is minimize deviation in array you are given an array numbers of n positive integers you can perform two types of operations on any element of the array any number of times if the number is even divided by two so if it's like four then we can make it a two if the ele...
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
59
hey everyone welcome back and let's write some more neat code today so today let's solve the problem spiral Matrix 2. yesterday's Daily Elite code problem was the first variation of this problem which I solved on the main Channel and what's interesting about this problem is it's actually slightly easier than the first ...
Spiral Matrix II
spiral-matrix-ii
Given a positive integer `n`, generate an `n x n` `matrix` filled with elements from `1` to `n2` in spiral order. **Example 1:** **Input:** n = 3 **Output:** \[\[1,2,3\],\[8,9,4\],\[7,6,5\]\] **Example 2:** **Input:** n = 1 **Output:** \[\[1\]\] **Constraints:** * `1 <= n <= 20`
null
Array,Matrix,Simulation
Medium
54,921
1,292
hello so continuing on this contest 177 167 third problem is maximum side length of a square with some less than or equal to threshold so the problem says we have a matrix M by n and an integer threshold and we want to return the max side length of a square that the square has the sum such that the square has a sum les...
Maximum Side Length of a Square with Sum Less than or Equal to Threshold
immediate-food-delivery-ii
Given a `m x n` matrix `mat` and an integer `threshold`, return _the maximum side-length of a square with a sum less than or equal to_ `threshold` _or return_ `0` _if there is no such square_. **Example 1:** **Input:** mat = \[\[1,1,3,2,4,3,2\],\[1,1,3,2,4,3,2\],\[1,1,3,2,4,3,2\]\], threshold = 4 **Output:** 2 **Expl...
null
Database
Medium
null
4
hello and welcome to another video in this video we're going to be working on a median of two sorted arrays and I will start by saying this problem is very unintuitive to get but I think we're going to be able to work it out and kind of give you some intuition on how to do it and then from there what I would definitely...
Median of Two Sorted Arrays
median-of-two-sorted-arrays
Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays. The overall run time complexity should be `O(log (m+n))`. **Example 1:** **Input:** nums1 = \[1,3\], nums2 = \[2\] **Output:** 2.00000 **Explanation:** merged array = \[1,2,3\] and median is ...
null
Array,Binary Search,Divide and Conquer
Hard
null
7
liek code problem 7 reverse integer given a 32-bit signed integer reverse given a 32-bit signed integer reverse given a 32-bit signed integer reverse digits of an integer assume we are dealing with an environment which we could only store integers within the 32-bit signed integer range of negative 32-bit signed integer...
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
380
2019 Vishwas Interview Talk About The Very Mission Problem Only And Should Pages Have A Certificate Conducting Oven In This Problem With 2.3 Different Operations Research With 2.3 Different Operations Research With 2.3 Different Operations Research Institute Of But They Can Set Up Numbers The List Number From Ujjain Sa...
Insert Delete GetRandom O(1)
insert-delete-getrandom-o1
Implement the `RandomizedSet` class: * `RandomizedSet()` Initializes the `RandomizedSet` object. * `bool insert(int val)` Inserts an item `val` into the set if not present. Returns `true` if the item was not present, `false` otherwise. * `bool remove(int val)` Removes an item `val` from the set if present. Retur...
null
Array,Hash Table,Math,Design,Randomized
Medium
381
1,371
Yes, this time we will solve problem number 1 of Date 5370. The problem uses the open trust technique, so if you know it, I think there will be a place where it can be useful. And I would like to ask for a lot of likes. And the reason why I keep making videos here is torpedo. The code issue itself may be important and ...
Find the Longest Substring Containing Vowels in Even Counts
minimum-remove-to-make-valid-parentheses
Given the string `s`, return the size of the longest substring containing each vowel an even number of times. That is, 'a', 'e', 'i', 'o', and 'u' must appear an even number of times. **Example 1:** **Input:** s = "eleetminicoworoep " **Output:** 13 **Explanation:** The longest substring is "leetminicowor " which c...
Each prefix of a balanced parentheses has a number of open parentheses greater or equal than closed parentheses, similar idea with each suffix. Check the array from left to right, remove characters that do not meet the property mentioned above, same idea in backward way.
String,Stack
Medium
2095,2221
7
what's up everyone today we're gonna be going over we code number seven reverse integer there's a pretty simple problem conceptually pretty much they give us a number like this we just swap the digits around and the basic is you mod the number to get the number in the ones place and then you divide the number by 10 to ...
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
890
hey everybody this is larry this is day 21st of the may nico daily challenge end of three weeks yay hit the like button hit the subscribe button join me in discord let me know what you think about today's farm fine and replace pla pattern so i usually sub just live so it's a little bit slow let me know uh or well i mea...
Find and Replace Pattern
lemonade-change
Given a list of strings `words` and a string `pattern`, return _a list of_ `words[i]` _that match_ `pattern`. You may return the answer in **any order**. A word matches the pattern if there exists a permutation of letters `p` so that after replacing every letter `x` in the pattern with `p(x)`, we get the desired word....
null
Array,Greedy
Easy
null