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
62
Do Hello Everyone Welcome to Ashlam Going to Explain This is Very Unique Five Them Into This Problem in This Question Located at the Top Left Corner of Amazed at Any Point in Time Subscribe by Clicking on Subscribe Button Row End Column 1 Column 105 Subscribe to the Urs of the World channel that example2 Voice Prem Sor...
Unique Paths
unique-paths
There is a robot on an `m x n` grid. The robot is initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time. Given the two integers `m` and `n`, return _the nu...
null
Math,Dynamic Programming,Combinatorics
Medium
63,64,174,2192
1,834
foreign Matrix basically uh each row contains for each process so uh we are given that in tasks array each task that is at index I has its NQ time it means at which time it arrives and its processed in time so what we are told to do is we need to uh create a order and will you have to tell that in which order the CPU w...
Single-Threaded CPU
minimum-number-of-people-to-teach
You are given `n`​​​​​​ tasks labeled from `0` to `n - 1` represented by a 2D integer array `tasks`, where `tasks[i] = [enqueueTimei, processingTimei]` means that the `i​​​​​​th`​​​​ task will be available to process at `enqueueTimei` and will take `processingTimei` to finish processing. You have a single-threaded CPU...
You can just use brute force and find out for each language the number of users you need to teach Note that a user can appear in multiple friendships but you need to teach that user only once
Array,Greedy
Medium
null
29
in this video we're going to solve a coding interview question divide two integers without using division multiplication and mode operator you're given two integers dividend and divisor divide two integers without using multiplication division and mode operator return the quotient after dividing dividend by divisor we ...
Divide Two Integers
divide-two-integers
Given two integers `dividend` and `divisor`, divide two integers **without** using multiplication, division, and mod operator. The integer division should truncate toward zero, which means losing its fractional part. For example, `8.345` would be truncated to `8`, and `-2.7335` would be truncated to `-2`. Return _the...
null
Math,Bit Manipulation
Medium
null
160
hey what's up guys it's Nick white here I do tech and gaming stuff on twitch and YouTube check the description for all my information you can go over to my patreon I'll do the premium problem solutions there and if you want to reach out to me discord is a good place I try to get back to everyone this problem is called ...
Intersection of Two Linked Lists
intersection-of-two-linked-lists
Given the heads of two singly linked-lists `headA` and `headB`, return _the node at which the two lists intersect_. If the two linked lists have no intersection at all, return `null`. For example, the following two linked lists begin to intersect at node `c1`: The test cases are generated such that there are no cycle...
null
Hash Table,Linked List,Two Pointers
Easy
599
2
hi guys welcome to algorithms made easy today we will go through the question add two numbers you are given two non-empty linked list you are given two non-empty linked list you are given two non-empty linked list representing two non-negative integers representing two non-negative integers representing two non-negativ...
Add Two Numbers
add-two-numbers
You are given two **non-empty** linked lists representing two non-negative integers. The digits are stored in **reverse order**, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 ...
null
Linked List,Math,Recursion
Medium
43,67,371,415,445,1031,1774
797
hi everyone so today we'll be solving lead code question 797 all paths from source to target so let's see what the question has to say so uh according to the question we are given an directed acyclic graph uh by a cyclic you mean that you cannot have cycles in the graph and uh there are total n nodes and they are label...
All Paths From Source to Target
rabbits-in-forest
Given a directed acyclic graph (**DAG**) of `n` nodes labeled from `0` to `n - 1`, find all possible paths from node `0` to node `n - 1` and return them in **any order**. The graph is given as follows: `graph[i]` is a list of all nodes you can visit from node `i` (i.e., there is a directed edge from node `i` to node `...
null
Array,Hash Table,Math,Greedy
Medium
null
434
all right let's talk about numbers of sequence in the string so you are given a string s return a number of sequence in the string and a sequence is defined to be a continuous sequence of known space character so you're given example one right hello my name is john so this is five characters five words and one word and...
Number of Segments in a String
number-of-segments-in-a-string
Given a string `s`, return _the number of segments in the string_. A **segment** is defined to be a contiguous sequence of **non-space characters**. **Example 1:** **Input:** s = "Hello, my name is John " **Output:** 5 **Explanation:** The five segments are \[ "Hello, ", "my ", "name ", "is ", "John "\] **Exam...
null
String
Easy
null
446
16 Love You Today Will Be Solving All Dual Report Problem Details Who Like And Comment It Slice 250 So In This Problem Be Happy And Given Clearance And When Vitamin A Number Of All Your Activities Subsidy Now Directly Which Novartis Benefit In Subsequent Which Is zakhm sequence of events 220 pulsar 135 reel and real we...
Arithmetic Slices II - Subsequence
arithmetic-slices-ii-subsequence
Given an integer array `nums`, return _the number of all the **arithmetic subsequences** of_ `nums`. A sequence of numbers is called arithmetic if it consists of **at least three elements** and if the difference between any two consecutive elements is the same. * For example, `[1, 3, 5, 7, 9]`, `[7, 7, 7, 7]`, and ...
null
Array,Dynamic Programming
Hard
413
1,650
hey guys so today we will be solving the code 1650 which is lowest common ancestor of a binary t3 so in this question we are given two nodes of a binary p and q and we need to return their lowest common ancestor each node will be level difference to its parent node the definition for node is flow we are given the value...
Lowest Common Ancestor of a Binary Tree III
find-root-of-n-ary-tree
Given two nodes of a binary tree `p` and `q`, return _their lowest common ancestor (LCA)_. Each node will have a reference to its parent node. The definition for `Node` is below: class Node { public int val; public Node left; public Node right; public Node parent; } According to the **[definition of ...
Node with indegree 0 is the root
Hash Table,Bit Manipulation,Tree,Depth-First Search
Medium
1655
349
today we're going to be working on record question number 349 uh intersection of two arrays uh given two integer arrays nums one and nums to return an array of their intersection each element in the result must be unique okay and you may return the result in any order so just by the definition of it we know we're gonna...
Intersection of Two Arrays
intersection-of-two-arrays
Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must be **unique** and you may return the result in **any order**. **Example 1:** **Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\] **Output:** \[2\] **Example 2:** **Input:** nums1 = \[4,9,5\], nums2 = \...
null
Array,Hash Table,Two Pointers,Binary Search,Sorting
Easy
350,1149,1392,2190,2282
1,605
well there is problem number 1600 5 liters which is called fine the matrix with robbins with sounds this is a very interesting test because if there is really a problem that can be done in an interview in fact that is the typical problem that they answer through an interview It's pretty good because you can make good b...
Find Valid Matrix Given Row and Column Sums
minimum-number-of-days-to-make-m-bouquets
You are given two arrays `rowSum` and `colSum` of non-negative integers where `rowSum[i]` is the sum of the elements in the `ith` row and `colSum[j]` is the sum of the elements of the `jth` column of a 2D matrix. In other words, you do not know the elements of the matrix, but you do know the sums of each row and column...
If we can make m or more bouquets at day x, then we can still make m or more bouquets at any day y > x. We can check easily if we can make enough bouquets at day x if we can get group adjacent flowers at day x.
Array,Binary Search
Medium
2134,2257
54
Merry Christmas let's take a look at number 54 spiral matrix we're given a matrix of M n elements M rows and n columns which are all elements of the matrix inspire order which is a one two three six nine eight seven four five this is actually this is not about algorithms about this is about how we Travis special data s...
Spiral Matrix
spiral-matrix
Given an `m x n` `matrix`, return _all elements of the_ `matrix` _in spiral order_. **Example 1:** **Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\] **Output:** \[1,2,3,6,9,8,7,4,5\] **Example 2:** **Input:** matrix = \[\[1,2,3,4\],\[5,6,7,8\],\[9,10,11,12\]\] **Output:** \[1,2,3,4,8,12,11,10,9,5,6,7\] **Const...
Well for some problems, the best way really is to come up with some algorithms for simulation. Basically, you need to simulate what the problem asks us to do. We go boundary by boundary and move inwards. That is the essential operation. First row, last column, last row, first column and then we move inwards by 1 and th...
Array,Matrix,Simulation
Medium
59,921
1,489
Hello everyone, welcome to my channel, we are going to do video number 33 and today a very good application of the playlist with graph convolution questions that I have created is going to be released, okay, so I want to say that every time I see it in the players with graph convolution questions. It is quite good. You...
Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree
pizza-with-3n-slices
Given a weighted undirected connected graph with `n` vertices numbered from `0` to `n - 1`, and an array `edges` where `edges[i] = [ai, bi, weighti]` represents a bidirectional and weighted edge between nodes `ai` and `bi`. A minimum spanning tree (MST) is a subset of the graph's edges that connects all vertices withou...
By studying the pattern of the operations, we can find out that the problem is equivalent to: Given an integer array with size 3N, select N integers with maximum sum and any selected integers are not next to each other in the array. The first one in the array is considered next to the last one in the array. Use Dynamic...
Array,Dynamic Programming,Greedy,Heap (Priority Queue)
Hard
null
5
hello friends my name is too sharp and today I am going to talk about how to find the longest palindromic substring in linear time using monikers algorithm so here you are given a string and you have to find the longest palindromic substring in this string so there are many palindromic substring in this string for exam...
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
65
all right hello everybody um this is another uh lit go hard even though it's hard it's just the multiple test cases that you need to go through that is just annoying right so if we all done mumbo jumbo here uh we can just decide how to track a couple of things uh we need to understand if the number uh or if what we're ...
Valid Number
valid-number
A **valid number** can be split up into these components (in order): 1. A **decimal number** or an **integer**. 2. (Optional) An `'e'` or `'E'`, followed by an **integer**. A **decimal number** can be split up into these components (in order): 1. (Optional) A sign character (either `'+'` or `'-'`). 2. One of the...
null
String
Hard
8
3
hey everybody this is abel in this video we are going to solve a problem called longest substring without repeating character this is third problem in the lead code so in this question what we have to do we have to return the length of the longest substring without repeating characters so here we have a string abc bb i...
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
39
Hello Guys Today We Are Going To Discuss The Problem Combination 14 Problems Galvanized Were Given In Araria Distic In Teachers Someshwar Dasham Distic Share And Attempted To Get Some Water Sports Doing Security Combination Candidate Sach The Number Subscribe Like To Create Different Combinations And Numbers With A tar...
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
1,880
Hello guys suggestion or hour song this question of list to deepen this thing words equal submission of two but this big question that we will explain and in this we have to do that first second third which is first world in all of these that we convert in the interior If we use this for , convert in the interior If we...
Check if Word Equals Summation of Two Words
largest-merge-of-two-strings
The **letter value** of a letter is its position in the alphabet **starting from 0** (i.e. `'a' -> 0`, `'b' -> 1`, `'c' -> 2`, etc.). The **numerical value** of some string of lowercase English letters `s` is the **concatenation** of the **letter values** of each letter in `s`, which is then **converted** into an inte...
Build the result character by character. At each step, you choose a character from one of the two strings. If the next character of the first string is larger than that of the second string, or vice versa, it's optimal to use the larger one. If both are equal, think of a criteria that lets you decide which string to co...
Two Pointers,String,Greedy
Medium
null
1,011
Hello friends today I'm going to solve liquid problem number one or eleven capacity to ship packages with d-days so capacity to ship packages with d-days so capacity to ship packages with d-days so in this problem we are given an area of Weights where each Elementary presents the weight of package at that index and we ...
Capacity To Ship Packages Within D Days
flip-binary-tree-to-match-preorder-traversal
A conveyor belt has packages that must be shipped from one port to another within `days` days. The `ith` package on the conveyor belt has a weight of `weights[i]`. Each day, we load the ship with packages on the conveyor belt (in the order given by `weights`). We may not load more weight than the maximum weight capaci...
null
Tree,Depth-First Search,Binary Tree
Medium
null
1,769
hello everyone welcome to another video now in this video we are going to look at a very easy level question this is very easy level question but we will be looking at the optimized solution here and uh for the sake of uh the beginning right this is just the beginning we are starting with the medium level question so w...
Minimum Number of Operations to Move All Balls to Each Box
get-maximum-in-generated-array
You have `n` boxes. You are given a binary string `boxes` of length `n`, where `boxes[i]` is `'0'` if the `ith` box is **empty**, and `'1'` if it contains **one** ball. In one operation, you can move **one** ball from a box to an adjacent box. Box `i` is adjacent to box `j` if `abs(i - j) == 1`. Note that after doing ...
Try generating the array. Make sure not to fall in the base case of 0.
Array,Dynamic Programming,Simulation
Easy
null
51
welcome everyone it's time to do another lead code problem today's problem is problem 51 in Queens so the problem says uh it's an n Queen puzzle so you are given a n into n uh chessboard where you have to play Queens in h row okay and if you're familiar with queens and if you're familiar with chess and how the queen mo...
N-Queens
n-queens
The **n-queens** puzzle is the problem of placing `n` queens on an `n x n` chessboard such that no two queens attack each other. Given an integer `n`, return _all distinct solutions to the **n-queens puzzle**_. You may return the answer in **any order**. Each solution contains a distinct board configuration of the n-...
null
Array,Backtracking
Hard
52,1043
1,456
hey everyone welcome back today we are going to see problem number 1456 maximum number of vowels in a substring of given length first we will see the explanation of the problem statement then the logic and the code now let's dive into the solution so here I have the first example from the lake website so here we have a...
Maximum Number of Vowels in a Substring of Given Length
find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance
Given a string `s` and an integer `k`, return _the maximum number of vowel letters in any substring of_ `s` _with length_ `k`. **Vowel letters** in English are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`. **Example 1:** **Input:** s = "abciiidef ", k = 3 **Output:** 3 **Explanation:** The substring "iii " contains 3 vow...
Use Floyd-Warshall's algorithm to compute any-point to any-point distances. (Or can also do Dijkstra from every node due to the weights are non-negative). For each city calculate the number of reachable cities within the threshold, then search for the optimal city.
Dynamic Programming,Graph,Shortest Path
Medium
2171
96
new elliptical problem unique binary first trees so these companies have already asked this question in interviews also so basically in this question if you know the Catalan CDs then this question will very easy for you because if you know catalencies you will directly print the Catalan numbers and that will give you t...
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
914
all right let's talk about x of a kind in a deck of curves so in a deck of cards each card has an integer written on it return true if only if you can choose x greater equivalent than 2 such that it is possible to split the entire deck into one or more groups of course and then there are the rules each school has exact...
X of a Kind in a Deck of Cards
random-point-in-non-overlapping-rectangles
You are given an integer array `deck` where `deck[i]` represents the number written on the `ith` card. Partition the cards into **one or more groups** such that: * Each group has **exactly** `x` cards where `x > 1`, and * All the cards in one group have the same integer written on them. Return `true` _if such pa...
null
Math,Binary Search,Reservoir Sampling,Prefix Sum,Ordered Set,Randomized
Medium
912,915
106
Ajay Ko Hello friends dynasty site from wedding and today we have to solve the question whose name is Construct Mind Tree from Postorder and Inaudible so first of all let us understand this problem and we will see on verification. Lover in positive function inside which you get two green one poster and one inverter see...
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
516
um hello so today we are going to do this problem which is part of Fleet code daily challenge uh longest palindromic subsequence so basically we have a string s and we want to find the longest palindromic subsequence um in s so subsequence means we can skip letters and then we want palindromic which means basically it ...
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
229
Jhaal Hello Hi Guys Welcome to Lotus Today's question is maturity element to in this question Bihar Government Year for 10 to find all elements of the pear more than in three times when is the price of the year ago as children in need time and oven space it Means date for example give darkness also 2.3 element which is...
Majority Element II
majority-element-ii
Given an integer array of size `n`, find all elements that appear more than `⌊ n/3 ⌋` times. **Example 1:** **Input:** nums = \[3,2,3\] **Output:** \[3\] **Example 2:** **Input:** nums = \[1\] **Output:** \[1\] **Example 3:** **Input:** nums = \[1,2\] **Output:** \[1,2\] **Constraints:** * `1 <= nums.length <...
How many majority elements could it possibly have? Do you have a better hint? Suggest it!
Array,Hash Table,Sorting,Counting
Medium
169,1102
83
all right so the clicker question is called remove duplicates from sorted list it says given a sorted linked list delete all duplicates such that each element appears only once the first example is the linked list 1 2 and the output is 1 2 because it removes the duplicate one and then the second example is 1 2 3 and th...
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
45
hey what's up guys uh this is sean here so this time uh today's daily challenge problem right number 45 jump game number two um so given like an array right and you're initially standing at first index and each element in this array represents the maximum jump length from this position and your goal is to reach the las...
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,603
Let's talk about a Brahmin who has problem vs. Joe's design fighting system. What problem statement do we have in this? Designer parking system for parking lord dufferin lottery cancer packing specific medium and small with this number has lots of size so implementing the calling system class we are one. Parking system...
Design Parking System
running-sum-of-1d-array
Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size. Implement the `ParkingSystem` class: * `ParkingSystem(int big, int medium, int small)` Initializes object of the `ParkingSystem` class. The number of slot...
Think about how we can calculate the i-th number in the running sum from the (i-1)-th number.
Array,Prefix Sum
Easy
null
102
them one zero two 102 10 2 1 Nail 2 102 probably 102 on Lee code binary tree level order traversal so this is a medium um it's a Friday I felt like today I was going to approach just maybe an easier problem to get me hyped up for the weekend last thing I want to do is get stuck on a hard and then spend the rest of the ...
Binary Tree Level Order Traversal
binary-tree-level-order-traversal
Given the `root` of a binary tree, return _the level order traversal of its nodes' values_. (i.e., from left to right, level by level). **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** \[\[3\],\[9,20\],\[15,7\]\] **Example 2:** **Input:** root = \[1\] **Output:** \[\[1\]\] **Example 3:** **I...
null
Tree,Breadth-First Search,Binary Tree
Medium
103,107,111,314,637,764,1035
46
hello boys and girls and welcome to another episode of your favorite algorithm channel my name is Ryan powers and today I'm gonna be taking you through leak code 46 permutations so let's introduce the problem given a collection of distinct integers we return all possible permutations well that was a pretty short descri...
Permutations
permutations
Given an array `nums` of distinct integers, return _all the possible permutations_. You can return the answer in **any order**. **Example 1:** **Input:** nums = \[1,2,3\] **Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,1\],\[3,1,2\],\[3,2,1\]\] **Example 2:** **Input:** nums = \[0,1\] **Output:** \[\[0,1\],\[1,0\...
null
Array,Backtracking
Medium
31,47,60,77
202
Have fennel seeds students from this question of list to division happy number is ok so basically it is a saying that if the number is not shifted then it is not there so we have to say that whatever number is there, cross it and add it while riding. Do it last, if he goes to the net mention number is happy and if he i...
Happy Number
happy-number
Write an algorithm to determine if a number `n` is happy. A **happy number** is a number defined by the following process: * Starting with any positive integer, replace the number by the sum of the squares of its digits. * Repeat the process until the number equals 1 (where it will stay), or it **loops endlessly ...
null
Hash Table,Math,Two Pointers
Easy
141,258,263,2076
59
the question name is spiral Matrix second to understand this question uh very easily we have to just go through first a spiral Matrix one I have solved this question also so that question also the question is given a positive integer and generate an N cross n Matrix filled with elements from 1 to n Square in spiral ord...
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
338
Hello everyone, welcome, you must have given me a channel, okay if N = 5, then I have made a ray of size N + 1, N = 5, then I have made a ray of size N + 1, N = 5, then I have made a ray of size N + 1, okay, just what do you have to find out, if binary operation is done for each index, then how much forest will be spen...
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
71
everyone so today we are looking at lead code number 71 it's a question called simplify path so here we're going to be given a string path and it's going to be an absolute path starting with the slash to a file or directory in a unix style file system and we want to convert it into a simplified canonical path so in a u...
Simplify Path
simplify-path
Given a string `path`, which is an **absolute path** (starting with a slash `'/'`) to a file or directory in a Unix-style file system, convert it to the simplified **canonical path**. In a Unix-style file system, a period `'.'` refers to the current directory, a double period `'..'` refers to the directory up a level,...
null
String,Stack
Medium
null
918
hello friends today less of the maximum some circular sub-array problem we are some circular sub-array problem we are some circular sub-array problem we are given a circular array C of integers represented by a find the maximum possible sum of a non-empty sub array of possible sum of a non-empty sub array of possible s...
Maximum Sum Circular Subarray
reachable-nodes-in-subdivided-graph
Given a **circular integer array** `nums` of length `n`, return _the maximum possible sum of a non-empty **subarray** of_ `nums`. A **circular array** means the end of the array connects to the beginning of the array. Formally, the next element of `nums[i]` is `nums[(i + 1) % n]` and the previous element of `nums[i]` ...
null
Graph,Heap (Priority Queue),Shortest Path
Hard
2213,2218
759
hey yo what's up guys babybear4812 coming at you one more time uh today with problem 759 or the employee free time problem this one's ranked hard i think it's slightly on the easier side of hard problems but it's hard nonetheless um oops what did i do here past six months or zero to six months pinterest facebook micros...
Employee Free Time
set-intersection-size-at-least-two
We are given a list `schedule` of employees, which represents the working time for each employee. Each employee has a list of non-overlapping `Intervals`, and these intervals are in sorted order. Return the list of finite intervals representing **common, positive-length free time** for _all_ employees, also in sorted...
null
Array,Greedy,Sorting
Hard
null
874
Yes, hello everyone, I'm a programmer. Today I will introduce to you a mathematical problem with the following formulas: you a mathematical problem with the following formulas: you a mathematical problem with the following formulas: Build a walking robot. About the detailed problem as follows, we have a robot. placed i...
Walking Robot Simulation
backspace-string-compare
A robot on an infinite XY-plane starts at point `(0, 0)` facing north. The robot can receive a sequence of these three possible types of `commands`: * `-2`: Turn left `90` degrees. * `-1`: Turn right `90` degrees. * `1 <= k <= 9`: Move forward `k` units, one unit at a time. Some of the grid squares are `obstacl...
null
Two Pointers,String,Stack,Simulation
Easy
1720
1,536
hi everyone welcome back today let's solve another decode weekly contest medium problem the mini minimum swaps to arrange a binary grid also it says it's a medium question but i feel like the difficulty is around median to heart first let's see the question statement so given an n times n binary matrix and in one step ...
Minimum Swaps to Arrange a Binary Grid
customers-who-bought-products-a-and-b-but-not-c
Given an `n x n` binary `grid`, in one step you can choose two **adjacent rows** of the grid and swap them. A grid is said to be **valid** if all the cells above the main diagonal are **zeros**. Return _the minimum number of steps_ needed to make the grid valid, or **\-1** if the grid cannot be valid. The main diago...
null
Database
Medium
null
332
hey everyone today we are going to solve the readable question reconstruct itinerary so you are given a list of air running tickets where ticket I has from I and the 2i represents a departure and the arrival airport of one flight we construct the itinerary in order and return it all of the ticket Belong To The Man Who ...
Reconstruct Itinerary
reconstruct-itinerary
You are given a list of airline `tickets` where `tickets[i] = [fromi, toi]` represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it. All of the tickets belong to a man who departs from `"JFK "`, thus, the itinerary must begin with `"JFK "`. If there are multiple...
null
Depth-First Search,Graph,Eulerian Circuit
Hard
2051,2201
952
hey guys welcome back to another video and today we're going to be solving the lead code question largest component size by common factor all right so in this question we're given a non-empty array question we're given a non-empty array question we're given a non-empty array of unique positive integers a consider the f...
Largest Component Size by Common Factor
word-subsets
You are given an integer array of unique positive integers `nums`. Consider the following graph: * There are `nums.length` nodes, labeled `nums[0]` to `nums[nums.length - 1]`, * There is an undirected edge between `nums[i]` and `nums[j]` if `nums[i]` and `nums[j]` share a common factor greater than `1`. Return _t...
null
Array,Hash Table,String
Medium
null
894
hey how you doing guys it's ilya bella here i recording stuff on youtube share description for all my information i do all lit code problems uh make sure you subscribe to this channel give me big thumbs up to support it and this is called all possible fall binary trees a full binary tree is a binary tree where each nod...
All Possible Full Binary Trees
random-pick-with-blacklist
Given an integer `n`, return _a list of all possible **full binary trees** with_ `n` _nodes_. Each node of each tree in the answer must have `Node.val == 0`. Each element of the answer is the root node of one possible tree. You may return the final list of trees in **any order**. A **full binary tree** is a binary tr...
null
Hash Table,Math,Binary Search,Sorting,Randomized
Hard
398,912,2107
318
today we're gonna be working on date code question number 318 maximum product of world lens given a string array words return the maximum value of length of word I multiply by length of word J where the two words do not share common letters um if no such two words existed and zero so in this example the two longest str...
Maximum Product of Word Lengths
maximum-product-of-word-lengths
Given a string array `words`, return _the maximum value of_ `length(word[i]) * length(word[j])` _where the two words do not share common letters_. If no such two words exist, return `0`. **Example 1:** **Input:** words = \[ "abcw ", "baz ", "foo ", "bar ", "xtfn ", "abcdef "\] **Output:** 16 **Explanation:** The two ...
null
Array,String,Bit Manipulation
Medium
null
1
What's up geeks and welcome to the channel!&nbsp; Today we are going to tackle one of the&nbsp; most asked problems in coding interviews,&nbsp; I was actually asked to solve this problem&nbsp; myself, and it is the Two Sum Problem.&nbsp; To do that suppose you are&nbsp; given an array of integers,&nbsp; what you need t...
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
452
uh we will solve this problem today 452 minimum number of arrows to burst balloons we have spherical balloons taped into flat wall that represents X Y plane okay the balloons are represented as 2D integer array points where point of I is X star and x and denotes a balloon whose horizontal diameter stretches between X s...
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
85
hello folks in this video we will see how to solve the maximal rectangle problem which is a hard problem on lead code so we'll be given a binary matrix like this and from this binary matrix we have to find the rectangle with largest area okay the rectangle containing only once okay so how we can solve this problem prev...
Maximal Rectangle
maximal-rectangle
Given a `rows x cols` binary `matrix` filled with `0`'s and `1`'s, find the largest rectangle 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 "\]\] **Ou...
null
Array,Dynamic Programming,Stack,Matrix,Monotonic Stack
Hard
84,221
212
hey everybody this is Larry this is November 4th um the fourth day of the legal daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's problem I'm trying to see if there's a free um thing does not so I don't know if you know where it is let me know I don...
Word Search II
word-search-ii
Given an `m x n` `board` of characters and a list of strings `words`, return _all words on the board_. Each word must be constructed from letters of sequentially adjacent cells, where **adjacent cells** are horizontally or vertically neighboring. The same letter cell may not be used more than once in a word. **Exampl...
You would need to optimize your backtracking to pass the larger test. Could you stop backtracking earlier? If the current candidate does not exist in all words' prefix, you could stop backtracking immediately. What kind of data structure could answer such query efficiently? Does a hash table work? Why or why not? How a...
Array,String,Backtracking,Trie,Matrix
Hard
79,1022,1433
329
hey everybody this is larry this is day 10 of the april eco daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's file the longest increasing path in the matrix we're given m and n return the longest increasing path in the matrix okay so yeah i usually ...
Longest Increasing Path in a Matrix
longest-increasing-path-in-a-matrix
Given an `m x n` integers `matrix`, return _the length of the longest increasing path in_ `matrix`. From each cell, you can either move in four directions: left, right, up, or down. You **may not** move **diagonally** or move **outside the boundary** (i.e., wrap-around is not allowed). **Example 1:** **Input:** matr...
null
Dynamic Programming,Depth-First Search,Breadth-First Search,Graph,Topological Sort,Memoization
Hard
null
7
in this video we'll go over leak code question number seven reverse integer given a signed 32-bit integer we need to given a signed 32-bit integer we need to given a signed 32-bit integer we need to reverse the digits and return the result but if reversing it causes the value to go outside of the signed 32-bit 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
1,994
hey what's up guys uh this is sean here again so lead code number 1994 the number of good subsets okay so this one is another like subsets uh or subsequences problem right so this time you're given like integer array numbers because subset numbers of good if it's a product can be represented as a product for one or mor...
The Number of Good Subsets
minimum-number-of-swaps-to-make-the-binary-string-alternating
You are given an integer array `nums`. We call a subset of `nums` **good** if its product can be represented as a product of one or more **distinct prime** numbers. * For example, if `nums = [1, 2, 3, 4]`: * `[2, 3]`, `[1, 2, 3]`, and `[1, 3]` are **good** subsets with products `6 = 2*3`, `6 = 2*3`, and `3 = 3...
Think about all valid strings of length n. Try to count the mismatched positions with each valid string of length n.
String,Greedy
Medium
null
991
hey everybody this is larry this is day 23 of the march lego daily challenge hit the like button hit the subscribe button join me on discord let me know what you're thinking let me know how you're doing and all that good stuff and today's problem is broken calculator uh okay so you can multiply the number on two or thi...
Broken Calculator
array-of-doubled-pairs
There is a broken calculator that has the integer `startValue` on its display initially. In one operation, you can: * multiply the number on display by `2`, or * subtract `1` from the number on display. Given two integers `startValue` and `target`, return _the minimum number of operations needed to display_ `targ...
null
Array,Hash Table,Greedy,Sorting
Medium
2117
1,688
all right let's talk about tons of message in tournaments so you are given integer and the number of teams in the tournament that has a string rule so it's determined it's even team or all team so there are different rules so return the number of matches playing the terminal into the winner until the winner is decided ...
Count of Matches in Tournament
the-most-recent-orders-for-each-product
You are given an integer `n`, the number of teams in a tournament that has strange rules: * If the current number of teams is **even**, each team gets paired with another team. A total of `n / 2` matches are played, and `n / 2` teams advance to the next round. * If the current number of teams is **odd**, one team ...
null
Database
Medium
1671,1735
108
Hello everyone, you are on the Lagovsky channel, here we solve slitcode problems. Don’t forget to we solve slitcode problems. Don’t forget to we solve slitcode problems. Don’t forget to subscribe, write your comments and let’s subscribe, write your comments and let’s subscribe, write your comments and let’s go to probl...
Convert Sorted Array to Binary Search Tree
convert-sorted-array-to-binary-search-tree
Given an integer array `nums` where the elements are sorted in **ascending order**, convert _it to a_ **_height-balanced_** _binary search tree_. **Example 1:** **Input:** nums = \[-10,-3,0,5,9\] **Output:** \[0,-3,9,-10,null,5\] **Explanation:** \[0,-10,5,null,-3,null,9\] is also accepted: **Example 2:** **Input...
null
Array,Divide and Conquer,Tree,Binary Search Tree,Binary Tree
Easy
109
240
hey guys today we are going to solve the problem search in a two-dimensional problem search in a two-dimensional problem search in a two-dimensional Matrix 2 in this problem we are asked to write an efficient algorithm that searches for a value Target in an M byn integer Matrix and we are being told that the Matrix has...
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
215
Hello friends, welcome to your channel, today is our day 35. I want to discuss something before starting the question challenge to the lead. I did n't realize that the challenge has reached 35 days, but a very interesting journey is going on for you guys. We are getting a lot of support. Okay, so keep supporting like t...
Kth Largest Element in an Array
kth-largest-element-in-an-array
Given an integer array `nums` and an integer `k`, return _the_ `kth` _largest element in the array_. Note that it is the `kth` largest element in the sorted order, not the `kth` distinct element. You must solve it in `O(n)` time complexity. **Example 1:** **Input:** nums = \[3,2,1,5,6,4\], k = 2 **Output:** 5 **Ex...
null
Array,Divide and Conquer,Sorting,Heap (Priority Queue),Quickselect
Medium
324,347,414,789,1014,2113,2204,2250
1,639
Hello everyone my name is Gitanjali and today we will be discussing daily need code problem so today's problem is number of waste form a target string life en dictionary so basically what is the problem statement if we understand through an example then according to the problem we There will be a word 'airgun' problem ...
Number of Ways to Form a Target String Given a Dictionary
friendly-movies-streamed-last-month
You are given a list of strings of the **same length** `words` and a string `target`. Your task is to form `target` using the given `words` under the following rules: * `target` should be formed from left to right. * To form the `ith` character (**0-indexed**) of `target`, you can choose the `kth` character of th...
null
Database
Easy
null
129
welcome back everyone we're gonna be solving Lee code 129 sum of root to Leaf numbers so we're given the root of a binary tree containing the digits from zero to nine each root to the leaf path and the tree will represent a number for example root to Leaf path one two and three represents the number 123. and we need to...
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
171
uh hey everybody this is larry this is day 22 of the february lego day challenge hit the like button in the subscribe button join me on discord let me know what you think so my voice is a little bit better today hopefully maybe not let me know what you think about that but thanks for people who have been wishing me wel...
Excel Sheet Column Number
excel-sheet-column-number
Given a string `columnTitle` that represents the column title as appears in an Excel sheet, return _its corresponding column number_. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 ... **Example 1:** **Input:** columnTitle = "A " **Output:** 1 **Example 2:** **Input:** columnTitle = "AB " **Ou...
null
Math,String
Easy
168,2304
65
Hello guys welcome oil hot time when will be discussing question number in this question definition of world number one official appointed loot-loot no problem subscribe number which problem subscribe number servi canteen that deserts minus plus yacht and which oil no duty on the spot On Varden Adher Due Servidor Vidro...
Valid Number
valid-number
A **valid number** can be split up into these components (in order): 1. A **decimal number** or an **integer**. 2. (Optional) An `'e'` or `'E'`, followed by an **integer**. A **decimal number** can be split up into these components (in order): 1. (Optional) A sign character (either `'+'` or `'-'`). 2. One of the...
null
String
Hard
8
829
Oh consecutive numbers some 829 given a positive integer n how many ways can we write as a sum of consecutive positive integers okay this seems like a very mouthy thing thanks to five random Walker okay so I think okay so I mean I don't know I don't have an immediate win for this I think something about is that well yo...
Consecutive Numbers Sum
subdomain-visit-count
Given an integer `n`, return _the number of ways you can write_ `n` _as the sum of consecutive positive integers._ **Example 1:** **Input:** n = 5 **Output:** 2 **Explanation:** 5 = 2 + 3 **Example 2:** **Input:** n = 9 **Output:** 3 **Explanation:** 9 = 4 + 5 = 2 + 3 + 4 **Example 3:** **Input:** n = 15 **Output...
null
Array,Hash Table,String,Counting
Medium
null
735
Hello Hi Guys Welcome To Dad Today's Questions Asked About Pollution In This Question Being In The History Of Interior Representing Asteroid In Rock Reduce Darkness Present In A Single Road Avoidance Sign Representing Erection It Means 16 Near Your Parents Here The Number Sew Sentence Painted A Movie Idi Things Moving ...
Asteroid Collision
asteroid-collision
We are given an array `asteroids` of integers representing asteroids in a row. For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed. Find out the state of the asteroids after all collisio...
Say a row of asteroids is stable. What happens when a new asteroid is added on the right?
Array,Stack
Medium
605,2245,2317
1,424
we can discuss question from lead cold we click on dist 186 diagonal travel - we click on dist 186 diagonal travel - we click on dist 186 diagonal travel - you are given a list of lists of integers numb return all the elements of numbers in diagonal order in the following diagram as shown so as you can see this is the ...
Diagonal Traverse II
maximum-candies-you-can-get-from-boxes
Given a 2D integer array `nums`, return _all elements of_ `nums` _in diagonal order as shown in the below images_. **Example 1:** **Input:** nums = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\] **Output:** \[1,4,2,7,5,3,8,6,9\] **Example 2:** **Input:** nums = \[\[1,2,3,4,5\],\[6,7\],\[8\],\[9,10,11\],\[12,13,14,15,16\]\] **Ou...
Use Breadth First Search (BFS) to traverse all possible boxes you can open. Only push to the queue the boxes the you have with their keys.
Array,Breadth-First Search
Hard
null
387
Ki Where Her Again With Jeetendra Video Only These Problems Solutions Will Be Coming Discuss Loot Code Problem Changes First Unique Character In A String And Yet Started On Ki X Video Problem Description Which Says Give String For In The Forest Lawn Repairing Credit And Determine Its Index Love You To Find For Defeatin...
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
286
hey everyone in this video let's take a look at question 286 walls and Gates only code this is part of our blind 75 list of questions so let's begin this is actually a premium problem on Lee code and that's why we're doing it on the lint code website and why the number here is different but otherwise the question the t...
Walls and Gates
walls-and-gates
You are given an `m x n` grid `rooms` initialized with these three possible values. * `-1` A wall or an obstacle. * `0` A gate. * `INF` Infinity means an empty room. We use the value `231 - 1 = 2147483647` to represent `INF` as you may assume that the distance to a gate is less than `2147483647`. Fill each empt...
null
Array,Breadth-First Search,Matrix
Medium
130,200,317,865,1036
81
hey everyone today we are going to solve the readable questions such in rotated sorted array2 so actually this question is almost same as such in loaded distorted array one so difference is we have duplicate number in the input list so in that case I'm giving an array lens after rotating an integer Target and the retur...
Search in Rotated Sorted Array II
search-in-rotated-sorted-array-ii
There is an integer array `nums` sorted in non-decreasing order (not necessarily with **distinct** values). Before being passed to your function, `nums` is **rotated** at an unknown pivot index `k` (`0 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nu...
null
Array,Binary Search
Medium
33
556
Hey guys welcome to waali dhundhi si today going to see the question elements and subscribe - The Video then subscribe to subscribe - The Video then subscribe to subscribe - The Video then subscribe to the Page if you liked The Video then do final number to hi Arvind number hello this tenth digit ka peene to update in ...
Next Greater Element III
next-greater-element-iii
Given a positive integer `n`, find _the smallest integer which has exactly the same digits existing in the integer_ `n` _and is greater in value than_ `n`. If no such positive integer exists, return `-1`. **Note** that the returned integer should fit in **32-bit integer**, if there is a valid answer but it does not fi...
null
Math,Two Pointers,String
Medium
496,503,1997
219
um hello so today we are going to do this problem which is part of lead code October daily challenge contains duplicate 2. so the problem says we have an array of numbers and then integer K and we want to return true if there exists two distinct indices I and J such that the numbers at that position at those positions ...
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,656
hey everybody this is larry this is me going number q1 of the recent weekly contest 215 uh design and audit stream uh so this one is pretty straightforward except just a lot of reading uh so while you're reading it hit the like button to subscribe and join me on discord now let me know how you feel about this one but b...
Design an Ordered Stream
count-good-triplets
There is a stream of `n` `(idKey, value)` pairs arriving in an **arbitrary** order, where `idKey` is an integer between `1` and `n` and `value` is a string. No two pairs have the same `id`. Design a stream that returns the values in **increasing order of their IDs** by returning a **chunk** (list) of values after each...
Notice that the constraints are small enough for a brute force solution to pass. Loop through all triplets, and count the ones that are good.
Array,Enumeration
Easy
2122
1,657
Jhal Hello Guys Welcome Parivartan Video subscribe and subscribe the Channel Please subscribe and subscribe the Video then subscribe to The Amazing Forest at 2nd Anniversary Celebration of Loot Jadhav Awal Kantirva Problem subscribe to subscribe the subscribe and share and subscribe this Video Return Forms Will Write B...
Determine if Two Strings Are Close
find-the-winner-of-an-array-game
Two strings are considered **close** if you can attain one from the other using the following operations: * Operation 1: Swap any two **existing** characters. * For example, `abcde -> aecdb` * Operation 2: Transform **every** occurrence of one **existing** character into another **existing** character, and d...
If k ≥ arr.length return the max element of the array. If k < arr.length simulate the game until a number wins k consecutive games.
Array,Simulation
Medium
null
449
Jhaal Hello Hi Guys Welcome To Special Today's Question Is Serial Light And Utilize Binary Search Tree In This Question Web Design And Told Them To Se R Lives And This Sewing Lowest Rate Is No Restriction On How Are Se Religion And Civilization Gautam Footwork Press The British This leads woman candy cereals to strings...
Serialize and Deserialize BST
serialize-and-deserialize-bst
Serialization is converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment. Design an algorithm to serialize and deserialize a **binary search t...
null
String,Tree,Depth-First Search,Breadth-First Search,Design,Binary Search Tree,Binary Tree
Medium
297,652,765
1,574
hello everybody welcome to my channel let's solve the lit code problem sorted sub array to be removed to make arrays sorted so given an integer array and remove a sub array can be empty from the array such that the remaining elements in array are non-decreasing a summary is a are non-decreasing a summary is a are non-d...
Shortest Subarray to be Removed to Make Array Sorted
maximum-product-of-two-elements-in-an-array
Given an integer array `arr`, remove a subarray (can be empty) from `arr` such that the remaining elements in `arr` are **non-decreasing**. Return _the length of the shortest subarray to remove_. A **subarray** is a contiguous subsequence of the array. **Example 1:** **Input:** arr = \[1,2,3,10,4,2,3,5\] **Output:*...
Use brute force: two loops to select i and j, then select the maximum value of (nums[i]-1)*(nums[j]-1).
Array,Sorting,Heap (Priority Queue)
Easy
null
11
hey guys welcome to private key and in this video we'll be solving a very interesting lead quote question called container the most water so the problem statement is actually quite simple you'll be given a array of heights so this is basically the array and consider each one of this value to be a pillar so the value on...
Container With Most Water
container-with-most-water
You are given an integer array `height` of length `n`. There are `n` vertical lines drawn such that the two endpoints of the `ith` line are `(i, 0)` and `(i, height[i])`. Find two lines that together with the x-axis form a container, such that the container contains the most water. Return _the maximum amount of water...
The aim is to maximize the area formed between the vertical lines. The area of any container is calculated using the shorter line as length and the distance between the lines as the width of the rectangle. Area = length of shorter vertical line * distance between lines We can definitely get the maximum width ...
Array,Two Pointers,Greedy
Medium
42
278
what is up you guys my name is max and in this video i'm going to show you how to solve first bad version on leak code so in the problem description it says that we are a product manager and we are working with a team to develop a new product however the latest version of our product fails are quality check and since e...
First Bad Version
first-bad-version
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad. Suppose you have `n` versions `[1, 2, ..., n]` an...
null
Binary Search,Interactive
Easy
34,35,374
1,319
hello today we will be solving lead code problem 13:19 number of operations to problem 13:19 number of operations to problem 13:19 number of operations to make network connected this is a medium level problem n was available through weekly contest number 171 it's also available through the problems page so let's begin ...
Number of Operations to Make Network Connected
unique-number-of-occurrences
There are `n` computers numbered from `0` to `n - 1` connected by ethernet cables `connections` forming a network where `connections[i] = [ai, bi]` represents a connection between computers `ai` and `bi`. Any computer can reach any other computer directly or indirectly through the network. You are given an initial com...
Find the number of occurrences of each element in the array using a hash map. Iterate through the hash map and check if there is a repeated value.
Array,Hash Table
Easy
null
144
hey everyone today we'll be doing another lead code 144 binary tree pre-ordered traversal what is the pre-ordered traversal what is the pre-ordered traversal what is the pre-order traversal first of all pre-order traversal first of all pre-order traversal first of all a pre-order is a traversal in which a pre-order is ...
Binary Tree Preorder Traversal
binary-tree-preorder-traversal
Given the `root` of a binary tree, return _the preorder traversal of its nodes' values_. **Example 1:** **Input:** root = \[1,null,2,3\] **Output:** \[1,2,3\] **Example 2:** **Input:** root = \[\] **Output:** \[\] **Example 3:** **Input:** root = \[1\] **Output:** \[1\] **Constraints:** * The number of nodes ...
null
Stack,Tree,Depth-First Search,Binary Tree
Easy
94,255,775
209
hey guys welcome to a new video in today's video we're going to look at a lead code problem and the problem's name is minimum size subarray sum so in this question we given an array of integers called nums and we are also given a positive integer called Target and our task is to return the minimum length of a subarray ...
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
1,465
hey everybody this is Larry I'm doing this problem as part of a contest so you're gonna watch me live as I go through my daughter's I'm coding they've been explanation near the end and for more context they'll be a link below on this actual screen cats of the contest how did you do let me know you do hit the like butto...
Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts
maximum-product-of-splitted-binary-tree
You are given a rectangular cake of size `h x w` and two arrays of integers `horizontalCuts` and `verticalCuts` where: * `horizontalCuts[i]` is the distance from the top of the rectangular cake to the `ith` horizontal cut and similarly, and * `verticalCuts[j]` is the distance from the left of the rectangular cake ...
If we know the sum of a subtree, the answer is max( (total_sum - subtree_sum) * subtree_sum) in each node.
Tree,Depth-First Search,Binary Tree
Medium
2175
92
hey everybody this is larry this is day 21 of delete code daily challenge hit the like button oh no three points hit the subscribe button join me on discord let me know what you think about today's prom it is a thursday hopefully everyone's doing all right i am sweating raise weight hot here in new york probably not as...
Reverse Linked List II
reverse-linked-list-ii
Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_. **Example 1:** **Input:** head = \[1,2,3,4,5\], left = 2, right = 4 **Output:** \[1,4,3,2,5\] **Example 2:** **I...
null
Linked List
Medium
206
47
hello so today we are doing this problem called permutation 2 which is very similar to a problem I did before called permutations problem 46 I will put the link in the description for the solution for that one I think you should watch that one first and this problem says that we get a collection of numbers that may con...
Permutations II
permutations-ii
Given a collection of numbers, `nums`, that might contain duplicates, return _all possible unique permutations **in any order**._ **Example 1:** **Input:** nums = \[1,1,2\] **Output:** \[\[1,1,2\], \[1,2,1\], \[2,1,1\]\] **Example 2:** **Input:** nums = \[1,2,3\] **Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,...
null
Array,Backtracking
Medium
31,46,267,1038
1,743
hi friends uh welcome to followup in this video we are going to look at problem 1743 restall the array from adjacent pairs on our purpose for this video is to explain the concept degree in graph Theory so here this concept is associated with undirected graph so our plan will be the following first we're going to digest...
Restore the Array From Adjacent Pairs
count-substrings-that-differ-by-one-character
There is an integer array `nums` that consists of `n` **unique** elements, but you have forgotten it. However, you do remember every pair of adjacent elements in `nums`. You are given a 2D integer array `adjacentPairs` of size `n - 1` where each `adjacentPairs[i] = [ui, vi]` indicates that the elements `ui` and `vi` a...
Take every substring of s, change a character, and see how many substrings of t match that substring. Use a Trie to store all substrings of t as a dictionary.
Hash Table,String,Dynamic Programming
Medium
2256
253
hi everyone today's question is meeting rooms 2. this is a very popular question amongst companies like amazon bloomberg facebook google apple microsoft and so on right now so the question says given an area of meeting time intervals consisting of start and end times i'll find the minimum number of conference rooms req...
Meeting Rooms II
meeting-rooms-ii
Given an array of meeting time intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of conference rooms required_. **Example 1:** **Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\] **Output:** 2 **Example 2:** **Input:** intervals = \[\[7,10\],\[2,4\]\] **Output:** 1 **Constr...
Think about how we would approach this problem in a very simplistic way. We will allocate rooms to meetings that occur earlier in the day v/s the ones that occur later on, right? If you've figured out that we have to sort the meetings by their start time, the next thing to think about is how do we do the allocation? Th...
Array,Two Pointers,Greedy,Sorting,Heap (Priority Queue)
Medium
56,252,452,1184
1,356
Hello everyone today trusting gift pistachio problem is short bike twitter account in that we were given a challenge and this gooseberry has to be shifted in that it has to be started because whatever number is there in it whose mind is video Most of all, you have to keep that first, you have to talk to the younger bro...
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
529
hey everybody this is Larry I hit the like button hit the subscribe button let me know how you're doing this farm I'm gonna stop alive right about now Boyd's okay cool 5:29 minesweeper let's Boyd's okay cool 5:29 minesweeper let's Boyd's okay cool 5:29 minesweeper let's play the minesweeper game and it is a big compute...
Minesweeper
minesweeper
Let's play the minesweeper game ([Wikipedia](https://en.wikipedia.org/wiki/Minesweeper_(video_game)), [online game](http://minesweeperonline.com))! You are given an `m x n` char matrix `board` representing the game board where: * `'M'` represents an unrevealed mine, * `'E'` represents an unrevealed empty square, ...
null
Array,Depth-First Search,Breadth-First Search,Matrix
Medium
2206
939
hey what's up guys chung here again so this time i want to talk about this lead called the problem number 939 minimum area rectangle you know this is one of those like uh you can call it either math or g geography problem you know since we haven't really talked about this kind of problem before and i feel like a it's a...
Minimum Area Rectangle
valid-permutations-for-di-sequence
You are given an array of points in the **X-Y** plane `points` where `points[i] = [xi, yi]`. Return _the minimum area of a rectangle formed from these points, with sides parallel to the X and Y axes_. If there is not any such rectangle, return `0`. **Example 1:** **Input:** points = \[\[1,1\],\[1,3\],\[3,1\],\[3,3\]...
null
Dynamic Programming
Hard
null
68
so today we are actually going to solve very disliked and yet very popular lead code problem that has been asked at tons of different companies so let's get started with the question so the lead code problem we are going to solve is called text justification now you can see that this is a lead code hard problem and als...
Text Justification
text-justification
Given an array of strings `words` and a width `maxWidth`, format the text such that each line has exactly `maxWidth` characters and is fully (left and right) justified. You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces `' '` when necessary so that ea...
null
Array,String,Simulation
Hard
1714,2260
108
okay let's talk about converse sorted array to binary search tree so you are giving the array and you are changing the red to the binary search tree and there is a way to find out the root because the arrays are really shortest so basically you just need a middle index so the middle index is left plus right minus left ...
Convert Sorted Array to Binary Search Tree
convert-sorted-array-to-binary-search-tree
Given an integer array `nums` where the elements are sorted in **ascending order**, convert _it to a_ **_height-balanced_** _binary search tree_. **Example 1:** **Input:** nums = \[-10,-3,0,5,9\] **Output:** \[0,-3,9,-10,null,5\] **Explanation:** \[0,-10,5,null,-3,null,9\] is also accepted: **Example 2:** **Input...
null
Array,Divide and Conquer,Tree,Binary Search Tree,Binary Tree
Easy
109
410
Jhaal hey guys welcome back to my channel in this video we are going to solve split air cure assam 100 giver statement hair given and adams witch consist of native in tears and user name you can spread fear into a beneficial continue saver is right and allowing them To minimize the largest time, what is there in the mo...
Split Array Largest Sum
split-array-largest-sum
Given an integer array `nums` and an integer `k`, split `nums` into `k` non-empty subarrays such that the largest sum of any subarray is **minimized**. Return _the minimized largest sum of the split_. A **subarray** is a contiguous part of the array. **Example 1:** **Input:** nums = \[7,2,5,10,8\], k = 2 **Output:*...
null
Array,Binary Search,Dynamic Programming,Greedy
Hard
1056,1192,2242,2330
1,027
hello everyone welcome back series of announced and today we are revisiting the lead code problem longest arithmetic subsequence we receive great feedback on our previous video on this topic and some of you have suggested some optimization so in this video we are going to optimize our previous solution so let's get sta...
Longest Arithmetic Subsequence
sum-of-even-numbers-after-queries
Given an array `nums` of integers, return _the length of the longest arithmetic subsequence in_ `nums`. **Note** that: * A **subsequence** is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements. * A sequence `seq` is arithmetic if `s...
null
Array,Simulation
Medium
null
46
hello everyone my name is sakshi and in this video we are going to solve problem number 46 on lead code which is given an array numbers of distinct integers we have to return all the possible permutations of the delay we will follow these three simple steps to solve this problem firstly we will look at the recursion tr...
Permutations
permutations
Given an array `nums` of distinct integers, return _all the possible permutations_. You can return the answer in **any order**. **Example 1:** **Input:** nums = \[1,2,3\] **Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,1\],\[3,1,2\],\[3,2,1\]\] **Example 2:** **Input:** nums = \[0,1\] **Output:** \[\[0,1\],\[1,0\...
null
Array,Backtracking
Medium
31,47,60,77
257
hi friends welcome back today we are going to solve lead code problem 257 binary tree paths given the root of a binary tree written all root to leave parts in any order a leaf is a node with no children so they have given us a binary tree here and as you can see one two five is one path here and one two three 1 2 3 is ...
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
466
hello everyone so today we'll be solving a little heart problem and it is called county reputations and it the problem is as follows that uh we can define a string in for s comma n and this string it basically represents the as a string concatenated n times and there is one more concept in this problem that a string s1...
Count The Repetitions
count-the-repetitions
We define `str = [s, n]` as the string `str` which consists of the string `s` concatenated `n` times. * For example, `str == [ "abc ", 3] == "abcabcabc "`. We define that string `s1` can be obtained from string `s2` if we can remove some characters from `s2` such that it becomes `s1`. * For example, `s1 = "abc "...
null
String,Dynamic Programming
Hard
null
205
some problems will try to confuse you by using a new terminology and you will often find these kind of problems in the beginning rounds of all of these tech companies and hidden beneath it is a very simple string problem one such problem is isomorphic strings on lead code let's see what we can do about it Hello friends...
Isomorphic Strings
isomorphic-strings
Given two strings `s` and `t`, _determine if they are isomorphic_. Two strings `s` and `t` are isomorphic if the characters in `s` can be replaced to get `t`. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same characte...
null
Hash Table,String
Easy
290
326
welcome to joey's tech my friends in this video we'll solve a lead code problem which is power of three it's a good problem to solve and is one of the popular interview questions that is asked from lead code so let's quickly take a look at its problem statement you are given an integer in the ask is that your program s...
Power of Three
power-of-three
Given an integer `n`, return _`true` if it is a power of three. Otherwise, return `false`_. An integer `n` is a power of three, if there exists an integer `x` such that `n == 3x`. **Example 1:** **Input:** n = 27 **Output:** true **Explanation:** 27 = 33 **Example 2:** **Input:** n = 0 **Output:** false **Explanat...
null
Math,Recursion
Easy
231,342,1889
211
hello guys i'm raj and welcome back to the new episode of competitive programming with python series guys if you are a new viewer to this channel please subscribe it and uh click the bell icon if you have any doubts please comment it on the comment section so today's uh problem that we are going to try for is this lead...
Design Add and Search Words Data Structure
design-add-and-search-words-data-structure
Design a data structure that supports adding new words and finding if a string matches any previously added string. Implement the `WordDictionary` class: * `WordDictionary()` Initializes the object. * `void addWord(word)` Adds `word` to the data structure, it can be matched later. * `bool search(word)` Returns ...
You should be familiar with how a Trie works. If not, please work on this problem: Implement Trie (Prefix Tree) first.
String,Depth-First Search,Design,Trie
Medium
208,746
1,793
Welcome to the runtime error today in this video we will see lead code problem of the day that is maximum score of good so this is basically a hard level question but I don't think so that this is a hard level question because when I solved this question Then I came to know that this is a very easy question, if you hav...
Maximum Score of a Good Subarray
minimum-moves-to-make-array-complementary
You are given an array of integers `nums` **(0-indexed)** and an integer `k`. The **score** of a subarray `(i, j)` is defined as `min(nums[i], nums[i+1], ..., nums[j]) * (j - i + 1)`. A **good** subarray is a subarray where `i <= k <= j`. Return _the maximum possible **score** of a **good** subarray._ **Example 1:**...
Given a target sum x, each pair of nums[i] and nums[n-1-i] would either need 0, 1, or 2 modifications. Can you find the optimal target sum x value such that the sum of modifications is minimized? Create a difference array to efficiently sum all the modifications.
Array,Hash Table,Prefix Sum
Medium
null
218
today we're gonna be working on lead quote question number 218 the skyline problem a city skyline is the outer contour of the silhouette formed by all the buildings in that city uh when viewed from a distance uh given the solution given the locations and heights of all the buildings i returned the skyline formed by the...
The Skyline Problem
the-skyline-problem
A city's **skyline** is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of all the buildings, return _the **skyline** formed by these buildings collectively_. The geometric information of each building is given in the array `buil...
null
Array,Divide and Conquer,Binary Indexed Tree,Segment Tree,Line Sweep,Heap (Priority Queue),Ordered Set
Hard
699
244
let's go through liquid 244 shortest word distances distance okay and two right distance to um but this question is give us the word dictionary which is a string array and also what I want and a word too and let's find the shortest distance um we can take a look at the example the word dictionary like a practice make p...
Shortest Word Distance II
shortest-word-distance-ii
Design a data structure that will be initialized with a string array, and then it should answer queries of the shortest distance between two different strings from the array. Implement the `WordDistance` class: * `WordDistance(String[] wordsDict)` initializes the object with the strings array `wordsDict`. * `int ...
null
Array,Hash Table,Two Pointers,String,Design
Medium
21,243,245
33
Hello friends today Arvind subscribe number three and click the subscribe button and subscribe my channel subscribe it subscribe hai ki want to spend side by side arrest 3242 subscribe script writing note subscribe and subscribe our Channel subscribe and subscribe the Channel Shampoo Per Cent In 90s Quite From The Diff...
Search in Rotated Sorted Array
search-in-rotated-sorted-array
There is an integer array `nums` sorted in ascending order (with **distinct** values). Prior to being passed to your function, `nums` is **possibly rotated** at an unknown pivot index `k` (`1 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]]` ...
null
Array,Binary Search
Medium
81,153,2273
479
hey what's up guys yeah just for fun yeah so that song is a little 479 largest perimeter product okay so this problem is very bad and very many people don't do not like it so given array end return the largest parent or integer that can be represented as a product to an integers in the written module one three seven ok...
Largest Palindrome Product
largest-palindrome-product
Given an integer n, return _the **largest palindromic integer** that can be represented as the product of two `n`\-digits integers_. Since the answer can be very large, return it **modulo** `1337`. **Example 1:** **Input:** n = 2 **Output:** 987 Explanation: 99 x 91 = 9009, 9009 % 1337 = 987 **Example 2:** **Input:...
null
Math
Hard
null