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
929
hello and welcome today we're doing a question from lee code it's called unique email addresses it's an easy um let's get started so every email consists of a local name and a domain name separated by the at sign for example in alice is sign for example in alice is sign for example in alice is the local name and is the...
Unique Email Addresses
groups-of-special-equivalent-strings
Every **valid email** consists of a **local name** and a **domain name**, separated by the `'@'` sign. Besides lowercase letters, the email may contain one or more `'.'` or `'+'`. * For example, in `"alice@leetcode.com "`, `"alice "` is the **local name**, and `"leetcode.com "` is the **domain name**. If you add pe...
null
Array,Hash Table,String
Medium
null
133
Hello hello guys welcome back to tech to join this video will see the common problem which is program successful hot list code number 133 so let's not look at problems statement in this problem and goli to create a lot of given one day problem in graph interacted With Nothing But and subscribe to the Channel 900 This i...
Clone Graph
clone-graph
Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph. Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph. Each node in the graph contains a value (`int`) and a list (`List[Node]`)...
null
Hash Table,Depth-First Search,Breadth-First Search,Graph
Medium
138,1624,1634
316
Hello everyone welcome to my channel codestorywithMIK, so today you are going to do video number 20 of the strings playlist Leetcode number is 360 medium marked but I will tell you the story in a simple way you will be able to code it on your on ok the name of the question There are many similar questions like this Rem...
Remove Duplicate Letters
remove-duplicate-letters
Given a string `s`, remove duplicate letters so that every letter appears once and only once. You must make sure your result is **the smallest in lexicographical order** among all possible results. **Example 1:** **Input:** s = "bcabc " **Output:** "abc " **Example 2:** **Input:** s = "cbacdcbc " **Output:** "a...
Greedily try to add one missing character. How to check if adding some character will not cause problems ? Use bit-masks to check whether you will be able to complete the sub-sequence if you add the character at some index i.
String,Stack,Greedy,Monotonic Stack
Medium
2157
974
Hello everyone, today we will be discussing question number 974 of lead code which is sabri sam divisible by request. You are watching the videos of these two questions sub are equals and continuous sub are equals because these are questions in prefix hum pattern. This is also a question of Prefix Hum Pattern, isn't it...
Subarray Sums Divisible by K
reorder-data-in-log-files
Given an integer array `nums` and an integer `k`, return _the number of non-empty **subarrays** that have a sum divisible by_ `k`. A **subarray** is a **contiguous** part of an array. **Example 1:** **Input:** nums = \[4,5,0,-2,-3,1\], k = 5 **Output:** 7 **Explanation:** There are 7 subarrays with a sum divisible b...
null
Array,String,Sorting
Easy
null
1,695
credit program is the sixth 1695 the maximum erasure energy value their you're given an array of positive integers nouns and one two days want to make a unicorn want to make a subway containing nucleometer and this sub array with the unique element we need to find the maximum score of subway so we need to consider this...
Maximum Erasure Value
maximum-sum-obtained-of-any-permutation
You are given an array of positive integers `nums` and want to erase a subarray containing **unique elements**. The **score** you get by erasing the subarray is equal to the **sum** of its elements. Return _the **maximum score** you can get by erasing **exactly one** subarray._ An array `b` is called to be a subarray...
Indexes with higher frequencies should be bound with larger values
Array,Greedy,Sorting,Prefix Sum
Medium
null
1,680
hi dear folks today's lead code challenge is concatenation of consecutive binary numbers here we are given input in the form of n so there are few steps which we need to do to get into the output firstly we have two I trade from the value 1 till the value n so for example if the input is 3 we have to firstly have the v...
Concatenation of Consecutive Binary Numbers
count-all-possible-routes
Given an integer `n`, return _the **decimal value** of the binary string formed by concatenating the binary representations of_ `1` _to_ `n` _in order, **modulo**_ `109 + 7`. **Example 1:** **Input:** n = 1 **Output:** 1 **Explanation: ** "1 " in binary corresponds to the decimal value 1. **Example 2:** **Input:**...
Use dynamic programming to solve this problem with each state defined by the city index and fuel left. Since the array contains distinct integers fuel will always be spent in each move and so there can be no cycles.
Array,Dynamic Programming,Memoization
Hard
null
643
hey everyone welcome back and today we will be doing another lead code problem six four three maximum average sub array one this is an easy one you are given an integer array nums consisting of n elements and an integer k find a contiguous sub array where length is equal to K and has the maximum average value and retur...
Maximum Average Subarray I
maximum-average-subarray-i
You are given an integer array `nums` consisting of `n` elements, and an integer `k`. Find a contiguous subarray whose **length is equal to** `k` that has the maximum average value and return _this value_. Any answer with a calculation error less than `10-5` will be accepted. **Example 1:** **Input:** nums = \[1,12,...
null
Array,Sliding Window
Easy
644,2211
24
welcome back today we are going to understand to delete your question and today we have given this question uh swipe two notes in the pairs right so this is the question based on the link list and we have to swap every two nodes to adjacent nodes you can say and we have to return its head as you can see we have to swip...
Swap Nodes in Pairs
swap-nodes-in-pairs
Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.) **Example 1:** **Input:** head = \[1,2,3,4\] **Output:** \[2,1,4,3\] **Example 2:** **Input:** head = \[\] **Output:** \[\...
null
Linked List,Recursion
Medium
25,528
419
okay we are starting with Lee code number 419 or battleships on a board given an end times n Matrix board where each cell is a battleship X or empty period return the number of battleships on the board Battleship can only be placed horizontally or vertically on the board in other words they could be made up of the shap...
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
112
okay so leak code question 112 path sum given the root of a binary tree and an integer target sum return true if the tree is a root to leaf path such that adding up all the values along the path equals target sum a leaf is a node with no children so we have an example here of a tree and they've highlighted the root or ...
Path Sum
path-sum
Given the `root` of a binary tree and an integer `targetSum`, return `true` if the tree has a **root-to-leaf** path such that adding up all the values along the path equals `targetSum`. A **leaf** is a node with no children. **Example 1:** **Input:** root = \[5,4,8,11,null,13,4,7,2,null,null,null,1\], targetSum = 22...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
113,124,129,437,666
232
hi everyone welcome back to the channel and today we solve e code daily challenge problem number 232 Implement Q using Stacks so outside it's one of the classic problems and uh it you know it this question is asked many of times in very famous company interviews and uh we're going to look into it today so first we'll c...
Implement Queue using Stacks
implement-queue-using-stacks
Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (`push`, `peek`, `pop`, and `empty`). Implement the `MyQueue` class: * `void push(int x)` Pushes element x to the back of the queue. * `int pop()` Removes the element from th...
null
Stack,Design,Queue
Easy
225
138
Ajay Ko Hands Free Mode Dynasty Site From Falling End Inside today's video we will solve this problem, I have filled it earlier this year, what will we do inside this problem, we will copy the link list, we have to TRP but it is within the end appointed s. So you will have some life points left, from that you have to c...
Copy List with Random Pointer
copy-list-with-random-pointer
A linked list of length `n` is given such that each node contains an additional random pointer, which could point to any node in the list, or `null`. Construct a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) of the list. The deep copy should consist of exactly `n` **brand new** nodes, where e...
Just iterate the linked list and create copies of the nodes on the go. Since a node can be referenced from multiple nodes due to the random pointers, make sure you are not making multiple copies of the same node. You may want to use extra space to keep old node ---> new node mapping to prevent creating multiples copies...
Hash Table,Linked List
Medium
133,1624,1634
1,463
Jhal Hello guys welcome to kar di david koche face pe ek paath subscribe do subscribe and subscribe the Channel Please subscribe and subscribe the Channel Jhal will leave and give these problems on Tuesday subscribe rural web designing channel health and subscribe The Amazing The Robot 2.0 The Robot 2.0 The Robot 2.0 T...
Cherry Pickup II
the-k-weakest-rows-in-a-matrix
You are given a `rows x cols` matrix `grid` representing a field of cherries where `grid[i][j]` represents the number of cherries that you can collect from the `(i, j)` cell. You have two robots that can collect cherries for you: * **Robot #1** is located at the **top-left corner** `(0, 0)`, and * **Robot #2** is...
Sort the matrix row indexes by the number of soldiers and then row indexes.
Array,Binary Search,Sorting,Heap (Priority Queue),Matrix
Easy
null
977
what is going on everyone so today we are looking at lead code number 977 it's a question called squares of assorted array and here we're going to be given an integer array num sorted in non-decreasing order non-decreasing order non-decreasing order we're going to return the array of the squares of each number in non-d...
Squares of a Sorted Array
distinct-subsequences-ii
Given an integer array `nums` sorted in **non-decreasing** order, return _an array of **the squares of each number** sorted in non-decreasing order_. **Example 1:** **Input:** nums = \[-4,-1,0,3,10\] **Output:** \[0,1,9,16,100\] **Explanation:** After squaring, the array becomes \[16,1,0,9,100\]. After sorting, it be...
null
String,Dynamic Programming
Hard
2115
1,521
hey what's up guys uh chung here again today i want to talk about another lead code problem here uh 1521. find the value of mysterious function closest to target so this is the last problem in the last week's weekly contest it's a hard problem and uh i wanna try to explain this uh this i the concept for this problem to...
Find a Value of a Mysterious Function Closest to Target
find-a-value-of-a-mysterious-function-closest-to-target
Winston was given the above mysterious function `func`. He has an integer array `arr` and an integer `target` and he wants to find the values `l` and `r` that make the value `|func(arr, l, r) - target|` minimum possible. Return _the minimum possible value_ of `|func(arr, l, r) - target|`. Notice that `func` should be...
null
null
Hard
null
87
If Ajay is there, now let us discuss its tabulation message, so we brought the solution from here, in it I had three are you made, but now they were piled up, Singh and spring 2016, so and lag, so these three two alarm set, you spring loan. I am taking for example great strength dos it would be a and we try to make fro...
Scramble String
scramble-string
We can scramble a string s to get a string t using the following algorithm: 1. If the length of the string is 1, stop. 2. If the length of the string is > 1, do the following: * Split the string into two non-empty substrings at a random index, i.e., if the string is `s`, divide it to `x` and `y` where `s = x +...
null
String,Dynamic Programming
Hard
null
1,704
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 determine if string halves are alike so in this question we given a string is consisting of even length we have to split this string into two halves of equal length and let a be the first half and B be ...
Determine if String Halves Are Alike
special-positions-in-a-binary-matrix
You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half. Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppe...
Keep track of 1s in each row and in each column. Then while iterating over matrix, if the current position is 1 and current row as well as current column contains exactly one occurrence of 1.
Array,Matrix
Easy
null
382
Hello hello guys welcome to sameer and subscribe button click subscribe and subscribe the Video then subscribe to hai na ho will to values ​​in to-do list na ho will to values ​​in to-do list na ho will to values ​​in to-do list meeting hai ko strong hum old amazing last veer value setting on loot index members also of...
Linked List Random Node
linked-list-random-node
Given a singly linked list, return a random node's value from the linked list. Each node must have the **same probability** of being chosen. Implement the `Solution` class: * `Solution(ListNode head)` Initializes the object with the head of the singly-linked list `head`. * `int getRandom()` Chooses a node randoml...
null
Linked List,Math,Reservoir Sampling,Randomized
Medium
398
84
hi today let's do this question on Lake Oh question number a four largest rectangle in this program so we are given a n non-negative integers given a n non-negative integers given a n non-negative integers representing a histogram for example given s we are having a histogram like this and we want to find the area of t...
Largest Rectangle in Histogram
largest-rectangle-in-histogram
Given an array of integers `heights` representing the histogram's bar height where the width of each bar is `1`, return _the area of the largest rectangle in the histogram_. **Example 1:** **Input:** heights = \[2,1,5,6,2,3\] **Output:** 10 **Explanation:** The above is a histogram where width of each bar is 1. The l...
null
Array,Stack,Monotonic Stack
Hard
85,1918
220
welcome to september's leeco challenge today's problem is contains duplicate three given array of integers find out whether there are two distinct indices i and j in the array such that the absolute difference between the numbers i and j are at most t and the absolute difference between the i and j indices are at most ...
Contains Duplicate III
contains-duplicate-iii
You are given an integer array `nums` and two integers `indexDiff` and `valueDiff`. Find a pair of indices `(i, j)` such that: * `i != j`, * `abs(i - j) <= indexDiff`. * `abs(nums[i] - nums[j]) <= valueDiff`, and Return `true` _if such pair exists or_ `false` _otherwise_. **Example 1:** **Input:** nums = \[1...
Time complexity O(n logk) - This will give an indication that sorting is involved for k elements. Use already existing state to evaluate next state - Like, a set of k sorted numbers are only needed to be tracked. When we are processing the next number in array, then we can utilize the existing sorted state and it is...
Array,Sliding Window,Sorting,Bucket Sort,Ordered Set
Medium
217,219
621
That The Problems Doctor Schedule And They Will Send You Will Add A Few Tests To Time And Distance Between Central Midfielder Letters For Patent This First Thing He Did Not Alone But It's Positive This Is Not Satire For Next Two Units Subscribe To So let's go through the problem share transfer denoted by latest 2G hai ...
Task Scheduler
task-scheduler
Given a characters array `tasks`, representing the tasks a CPU needs to do, where each letter represents a different task. Tasks could be done in any order. Each task is done in one unit of time. For each unit of time, the CPU could complete either one task or just be idle. However, there is a non-negative integer `n`...
null
Array,Hash Table,Greedy,Sorting,Heap (Priority Queue),Counting
Medium
358,778,2084
207
course schedule 207 there are a total of n courses you have to take label from 0 to and minus 1 some courses may have prerequisites for example to take course zero you have to first take course one which expresses appear 0 1 give it a total number of courses and a list of prerequisite is it possible for you to finish a...
Course Schedule
course-schedule
There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`. * For example, the pair `[0, 1]`, indicates that to take cou...
This problem is equivalent to finding if a cycle exists in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topologica...
Depth-First Search,Breadth-First Search,Graph,Topological Sort
Medium
210,261,310,630
708
hello friends today less of the insert into a cyclic salted ELISA problem we are given note from unsightly linked list which is sorted in ascending order we need to write a function to insert a value into the list so that it remains a sacre coeur so to the list and the given list node can be a reference to ending singl...
Insert into a Sorted Circular Linked List
insert-into-a-sorted-circular-linked-list
Given a Circular Linked List node, which is sorted in non-descending order, write a function to insert a value `insertVal` into the list such that it remains a sorted circular list. The given node can be a reference to any single node in the list and may not necessarily be the smallest value in the circular list. If t...
null
null
Medium
null
501
hey everyone welcome back to another video today we're going to talk about a question that is officially marked as easy and even has a pretty high acceptance rate however finding a method to solve this problem optimally is a surprisingly tough Challenge and I'm willing to bet you'll still be surprised when you see the ...
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
1,897
So hello what is up guys so today's question is our re distributors to make all strings equal ok so our question today is easy you are given an array of strings words ok zero index ok in one operation pick two distinct index i and j where words i is a non mt string and move any character from words of a to any position...
Redistribute Characters to Make All Strings Equal
maximize-palindrome-length-from-subsequences
You are given an array of strings `words` (**0-indexed**). In one operation, pick two **distinct** indices `i` and `j`, where `words[i]` is a non-empty string, and move **any** character from `words[i]` to **any** position in `words[j]`. Return `true` _if you can make **every** string in_ `words` _**equal** using **a...
Let's ignore the non-empty subsequence constraint. We can concatenate the two strings and find the largest palindromic subsequence with dynamic programming. Iterate through every pair of characters word1[i] and word2[j], and see if some palindrome begins with word1[i] and ends with word2[j]. This ensures that the subse...
String,Dynamic Programming
Hard
516
74
hey everybody this is larry this is day 16 of the leeco daily challenge uh hit the like button hit the subscribe button join me on discord uh let me know what you think about today's problem uh search a 2d matrix why did you fishing matrix uh yeah you official album that search a value in m times n the matrix are sorte...
Search a 2D Matrix
search-a-2d-matrix
You are given an `m x n` integer matrix `matrix` with the following two properties: * Each row is sorted in non-decreasing order. * The first integer of each row is greater than the last integer of the previous row. Given an integer `target`, return `true` _if_ `target` _is in_ `matrix` _or_ `false` _otherwise_. ...
null
Array,Binary Search,Matrix
Medium
240
463
yo what's up guys this is Chung here again so let's take a look at another least called problem today number 463 island perimeter so yeah I think I like this problem here so you're given like a map a two-dimensional array here which map a two-dimensional array here which map a two-dimensional array here which consists ...
Island Perimeter
island-perimeter
You are given `row x col` `grid` representing a map where `grid[i][j] = 1` represents land and `grid[i][j] = 0` represents water. Grid cells are connected **horizontally/vertically** (not diagonally). The `grid` is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells)...
null
Array,Depth-First Search,Breadth-First Search,Matrix
Easy
695,733,1104
106
hello everyone so today we will be doing lead code problem 106 that is constructing a binary tree from in order and post order traversal so we are given two integer arrays that is in order and post order where an order is of course our in order traversal and poster there is the posterior traversal of the binary tree so...
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
352
hey everyone welcome to the second leite code coding problem explanation today's problem is going to be data stream as to Joint intervals um so I already did the mock interview and it was actually this problem's actually pretty hard um so I spent like a whole hour and at the end I still had a bug or like a comp runtime...
Data Stream as Disjoint Intervals
data-stream-as-disjoint-intervals
Given a data stream input of non-negative integers `a1, a2, ..., an`, summarize the numbers seen so far as a list of disjoint intervals. Implement the `SummaryRanges` class: * `SummaryRanges()` Initializes the object with an empty stream. * `void addNum(int value)` Adds the integer `value` to the stream. * `int...
null
Binary Search,Design,Ordered Set
Hard
228,436,715
1,567
hey what's up guys we're back with another elite code video today we're gonna be doing problem 1567 maximum length of subarray with positive product what the hell was that give an array of integers and nums find the maximum length of a sub array where the product of all of its elements are is positive a sub array of an...
Maximum Length of Subarray With Positive Product
maximum-number-of-vowels-in-a-substring-of-given-length
Given an array of integers `nums`, find the maximum length of a subarray where the product of all its elements is positive. A subarray of an array is a consecutive sequence of zero or more values taken out of that array. Return _the maximum length of a subarray with positive product_. **Example 1:** **Input:** nums...
Keep a window of size k and maintain the number of vowels in it. Keep moving the window and update the number of vowels while moving. Answer is max number of vowels of any window.
String,Sliding Window
Medium
null
151
good morning my name is Aran singana and in today's video I'll be solving the question number 551 with the title reverse word string in lead code uh so the question is of medium difficulty level and it covers topics such as uh two pointer and strings so the question is pretty simple it says that given a input string s ...
Reverse Words in a String
reverse-words-in-a-string
Given an input string `s`, reverse the order of the **words**. A **word** is defined as a sequence of non-space characters. The **words** in `s` will be separated by at least one space. Return _a string of the words in reverse order concatenated by a single space._ **Note** that `s` may contain leading or trailing s...
null
Two Pointers,String
Medium
186
814
Hi gas welcome and welcome back to my channel so what is our problem today so what has been given to us in this problem statement, here we have been given a binary tree and what do we have to do, the trick is to see if someone has such patience. Which one does not have van? If there is no van then what will we do? We w...
Binary Tree Pruning
smallest-rotation-with-highest-score
Given the `root` of a binary tree, return _the same tree where every subtree (of the given tree) not containing a_ `1` _has been removed_. A subtree of a node `node` is `node` plus every node that is a descendant of `node`. **Example 1:** **Input:** root = \[1,null,0,0,1\] **Output:** \[1,null,0,null,1\] **Explanati...
null
Array,Prefix Sum
Hard
null
1,189
welcome back everyone we're going to be solving Lee code 1189 maximum number of balloons so we're given a string text and we want to use the characters of text to form as many instances of the word balloon as possible we can use each character and text at most once and we want to return the maximum number of instances ...
Maximum Number of Balloons
encode-number
Given a string `text`, you want to use the characters of `text` to form as many instances of the word **"balloon "** as possible. You can use each character in `text` **at most once**. Return the maximum number of instances that can be formed. **Example 1:** **Input:** text = "nlaebolko " **Output:** 1 **Example 2...
Try to find the number of binary digits returned by the function. The pattern is to start counting from zero after determining the number of binary digits.
Math,String,Bit Manipulation
Medium
1070
1,903
hello guys and welcome back to lead Logics this is the largest odd number in a string problem it is a lead code easy and the number for this is 1 1903 so in this problem we are given with a string num and this string nums represent a large integer and in the problem we have to return the largest value odd integer from ...
Largest Odd Number in String
design-most-recently-used-queue
You are given a string `num`, representing a large integer. Return _the **largest-valued odd** integer (as a string) that is a **non-empty substring** of_ `num`_, or an empty string_ `" "` _if no odd integer exists_. A **substring** is a contiguous sequence of characters within a string. **Example 1:** **Input:** nu...
You can store the data in an array and apply each fetch by moving the ith element to the end of the array (i.e, O(n) per operation). A better way is to use the square root decomposition technique. You can build chunks of size sqrt(n). For each fetch operation, You can search for the chunk which has the ith element and ...
Array,Hash Table,Stack,Design,Binary Indexed Tree,Ordered Set
Medium
146
1,953
Hello hello everyone welcome back to my channel in today's video vishal decode 1953 mitti maximum number of seats for which you can work for electrification zara and projects number from CO2 and minus one india government teacher and miles to that person microlight in most number of issues of This Product Has And Rule ...
Maximum Number of Weeks for Which You Can Work
finding-mk-average
There are `n` projects numbered from `0` to `n - 1`. You are given an integer array `milestones` where each `milestones[i]` denotes the number of milestones the `ith` project has. You can work on the projects following these two rules: * Every week, you will finish **exactly one** milestone of **one** project. You ...
At each query, try to save and update the sum of the elements needed to calculate MKAverage. You can use BSTs for fast insertion and deletion of the elements.
Design,Queue,Heap (Priority Queue),Ordered Set
Hard
295,789,2207
1,010
hey everybody this is larry this is day eight of the december league daily challenge hit the like button hit the subscribe button drumming on discord let me know what you think about today's problem pairs of songs with total duration they were divisible by 60. um so if you're new to this channel just want to remind you...
Pairs of Songs With Total Durations Divisible by 60
powerful-integers
You are given a list of songs where the `ith` song has a duration of `time[i]` seconds. Return _the number of pairs of songs for which their total duration in seconds is divisible by_ `60`. Formally, we want the number of indices `i`, `j` such that `i < j` with `(time[i] + time[j]) % 60 == 0`. **Example 1:** **Input...
null
Hash Table,Math
Medium
null
212
Hey gas welcome back, what have you given us in my channel, here you have given us a board of M * N, which has what board of M * N, which has what board of M * N, which has what characters are there, okay and what else you have given here, you have given us a list of stings in which some The words are ok, what do we ha...
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
260
hey guys welcome back to another video and today we're going to be solving the lead code question single number three so in this question we're given an array of numbers nums in which exactly two elements appear only once and all of the other elements appear exactly twice so when you find the two elements which appear ...
Single Number III
single-number-iii
Given an integer array `nums`, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in **any order**. You must write an algorithm that runs in linear runtime complexity and uses only constant extra space. ...
null
Array,Bit Manipulation
Medium
136,137
70
Hello friends today I'm going to solve liquid problem number 70 climbing stairs in this problem we are given the value n which is the number of stairs in the staircase and we are given that each time we could either climb um one step or two steps and we need to find how many ways and how many distinct ways can we climb...
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
451
hey everyone welcome back and let's write some more neat code today so today let's solve the problem sort characters by frequency we're given a string s and we want to sort it in decreasing order based on the frequency of the characters and the frequency is of course the number of times a character appears in the input...
Sort Characters By Frequency
sort-characters-by-frequency
Given a string `s`, sort it in **decreasing order** based on the **frequency** of the characters. The **frequency** of a character is the number of times it appears in the string. Return _the sorted string_. If there are multiple answers, return _any of them_. **Example 1:** **Input:** s = "tree " **Output:** "eer...
null
Hash Table,String,Sorting,Heap (Priority Queue),Bucket Sort,Counting
Medium
347,387,1741
374
Hello Everyone, So the problem we will solve today is again the problem of binary search and this problem is gas number higher and lower. Okay, now let us look at the problem statement here. We are playing a guessing game. We have given the gas game. Dum game is aaj follow I pick number from van tu n means whatever is ...
Guess Number Higher or Lower
guess-number-higher-or-lower
We are playing the Guess Game. The game is as follows: I pick a number from `1` to `n`. You have to guess which number I picked. Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess. You call a pre-defined API `int guess(int num)`, which returns three possible re...
null
Binary Search,Interactive
Easy
278,375,658
1,961
hey everybody this is larry this is me going with q1 of the weekly contest 253 on neetco check if string is a prefix of array so this one i kind of look at the complexity and then didn't really think about it uh that much um basically the idea is that i just did brute force i did what they told you by adding the word a...
Check If String Is a Prefix of Array
maximum-ice-cream-bars
Given a string `s` and an array of strings `words`, determine whether `s` is a **prefix string** of `words`. A string `s` is a **prefix string** of `words` if `s` can be made by concatenating the first `k` strings in `words` for some **positive** `k` no larger than `words.length`. Return `true` _if_ `s` _is a **prefi...
It is always optimal to buy the least expensive ice cream bar first. Sort the prices so that the cheapest ice cream bar comes first.
Array,Greedy,Sorting
Medium
null
91
hey everybody this is Larry this is day oh I guess day one of the um October Lego day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's problem and yeah let's get this started we have a I don't know if you can see it here because I think my face is blocki...
Decode Ways
decode-ways
A message containing letters from `A-Z` can be **encoded** into numbers using the following mapping: 'A' -> "1 " 'B' -> "2 " ... 'Z' -> "26 " To **decode** an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For examp...
null
String,Dynamic Programming
Medium
639,2091
123
okay let's take a look at lead code 123 best time to buy and sell stock three and then if you can so i'm going to show you how to do this in a general way so that you can also knock out uh best time to buy and stella stock for so it's the exact same code so i'm not gonna actually show you how to i'm not actually gonna ...
Best Time to Buy and Sell Stock III
best-time-to-buy-and-sell-stock-iii
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day. Find the maximum profit you can achieve. You may complete **at most two transactions**. **Note:** You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again). **Exampl...
null
Array,Dynamic Programming
Hard
121,122,188,689
236
hey everybody this is larry this is day 26 uh no free coins of the lego day challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's prom lowest common ancestor of a binary tree lca so this one it's going to be a medium so it probably doesn't need it but there i...
Lowest Common Ancestor of a Binary Tree
lowest-common-ancestor-of-a-binary-tree
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the [definition of LCA on Wikipedia](https://en.wikipedia.org/wiki/Lowest_common_ancestor): "The lowest common ancestor is defined between two nodes `p` and `q` as the lowest node in `T` that has both `p` and `q` as...
null
Tree,Depth-First Search,Binary Tree
Medium
235,1190,1354,1780,1790,1816,2217
88
welcome to january's eco challenge today's problem is merge sorted array given two sorted integer arrays merge nums two into nums one as one sorted array the number of elements initialized in nums one and nums two are m and n respectively you may assume that numbers one has enough space to hold the additional elements ...
Merge Sorted Array
merge-sorted-array
You are given two integer arrays `nums1` and `nums2`, sorted in **non-decreasing order**, and two integers `m` and `n`, representing the number of elements in `nums1` and `nums2` respectively. **Merge** `nums1` and `nums2` into a single array sorted in **non-decreasing order**. The final sorted array should not be re...
You can easily solve this problem if you simply think about two elements at a time rather than two arrays. We know that each of the individual arrays is sorted. What we don't know is how they will intertwine. Can we take a local decision and arrive at an optimal solution? If you simply consider one element each at a ti...
Array,Two Pointers,Sorting
Easy
21,1019,1028
1,822
hello guys welcome back today we are going to understand this quality question right uh 8 18 22 sign of the product of an array so we have the we have uh there is a function we have given sine of function X that will return uh one if it is positive minus 1 if it is negative and 0 if it is equal to 0 so we have given an...
Sign of the Product of an Array
longest-palindromic-subsequence-ii
There is a function `signFunc(x)` that returns: * `1` if `x` is positive. * `-1` if `x` is negative. * `0` if `x` is equal to `0`. You are given an integer array `nums`. Let `product` be the product of all values in the array `nums`. Return `signFunc(product)`. **Example 1:** **Input:** nums = \[-1,-2,-3,-4,...
As with any good dp problem that uses palindromes, try building the palindrome from the edges The prime point is to check that no two adjacent characters are equal, so save the past character while building the palindrome.
String,Dynamic Programming
Medium
516
92
hello everyone so in this video we are going to solve a question of fleet code that is reverse linked list2 so let's start with the problem statement given the head of a secret linked list and two integers left and right where left is less than equal to right reverse the nodes of the list from position left to position...
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
35
hello guys in this video we will be looking at another application of binary search through problem number 35 search insert position in this problem we're given a sorted array of distinct integers which means no repeats and their target value and we need to return the index if the target is found and if not we will ret...
Search Insert Position
search-insert-position
Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You must write an algorithm with `O(log n)` runtime complexity. **Example 1:** **Input:** nums = \[1,3,5,6\], target = 5 **Output:** 2 **Exa...
null
Array,Binary Search
Easy
278
1,791
welcome back friends today we are going to solve record problems 1791 find center of star graph there is a undirected star graph consisting of any nodes labeled from 1 to n a star graph is a graph where there is one central node and exactly n minus 1 edges that are connected the center node with every other node you ar...
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
459
Hello guys welcome to code basis our question of today is repeated something pattern we read the question is saying given in this string check refrigerated can be constructed by taking suffering of patent pending multiple copies of substance to weather you may zoom given String consist of lower case English letters and...
Repeated Substring Pattern
repeated-substring-pattern
Given a string `s`, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. **Example 1:** **Input:** s = "abab " **Output:** true **Explanation:** It is the substring "ab " twice. **Example 2:** **Input:** s = "aba " **Output:** false **Example 3:** ...
null
String,String Matching
Easy
28,686
951
one two three hello guys welcome to another video today we're going to look at another little problem flip equivalent binary trees um I picked this one because it's recently asked by Google and it's a medium questioned not going to bang on my head too hard I think so let's get started for a binary tree T we can define ...
Flip Equivalent Binary Trees
partition-array-into-disjoint-intervals
For a binary tree **T**, we can define a **flip operation** as follows: choose any node, and swap the left and right child subtrees. A binary tree **X** is _flip equivalent_ to a binary tree **Y** if and only if we can make **X** equal to **Y** after some number of flip operations. Given the roots of two binary trees...
null
Array
Medium
2138
18
welcome to about the training record solution if you want the best marketing interview experience in north america feel free to check us out at and if you want to receive the latest tech interview news feel free to subscribe to our wechat here and if you have any questions feel free to send us email at about training a...
4Sum
4sum
Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that: * `0 <= a, b, c, d < n` * `a`, `b`, `c`, and `d` are **distinct**. * `nums[a] + nums[b] + nums[c] + nums[d] == target` You may return the answer in **any order**. **Examp...
null
Array,Two Pointers,Sorting
Medium
1,15,454,2122
342
hey this is Topher with a lonely Dash and today we're going over lead code question 342 power of four which states given an integer n return true if it is a power of four otherwise return false an integer N is a power of four if there exists an integer X such that n = 4 to exists an integer X such that n = 4 to exists ...
Power of Four
power-of-four
Given an integer `n`, return _`true` if it is a power of four. Otherwise, return `false`_. An integer `n` is a power of four, if there exists an integer `x` such that `n == 4x`. **Example 1:** **Input:** n = 16 **Output:** true **Example 2:** **Input:** n = 5 **Output:** false **Example 3:** **Input:** n = 1 **O...
null
Math,Bit Manipulation,Recursion
Easy
231,326
1,071
back with another video the stoner coder today we'll be doing leap code question 1071 greatest common divisors of strings make sure you guys hit that like button and always subscribe for more amazing content so let's do it for two strings s and t we say t device s if and only if s equals t plus dot plus t for example T...
Greatest Common Divisor of Strings
binary-prefix-divisible-by-5
For two strings `s` and `t`, we say "`t` divides `s` " if and only if `s = t + ... + t` (i.e., `t` is concatenated with itself one or more times). Given two strings `str1` and `str2`, return _the largest string_ `x` _such that_ `x` _divides both_ `str1` _and_ `str2`. **Example 1:** **Input:** str1 = "ABCABC ", str2...
If X is the first i digits of the array as a binary number, then 2X + A[i] is the first i+1 digits.
Array
Easy
null
1,572
hey everyone welcome back and let's write some more neat code today so today let's solve the problem Matrix diagonal sum even though this is an easy one it can be a little tricky to code it up in a pretty like concise way so I'm really going to break down my thought process for you in this problem and by the end of the...
Matrix Diagonal Sum
subrectangle-queries
Given a square matrix `mat`, return the sum of the matrix diagonals. Only include the sum of all the elements on the primary diagonal and all the elements on the secondary diagonal that are not part of the primary diagonal. **Example 1:** **Input:** mat = \[\[**1**,2,**3**\], \[4,**5**,6\], ...
Use brute force to update a rectangle and, response to the queries in O(1).
Array,Design,Matrix
Medium
null
337
hey everybody this is larry this is me doing day five yeah day five of the league code daily challenge hit the like button to subscribe one join me on discord come have a chat um today's forum is how is wobbler3 uh we did the other um was it housewife two maybe uh we did another one a couple of days ago so let's see th...
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
142
hi and welcome to prototype we'll be solving the problem for lead code 142 lengthless cycle 2. this is another problem delete code 75 study plan let's get to it so given the head of a linked list return the node where the cycle begins if there is no cycle return null there is a cycle in a linked list if there is some n...
Linked List Cycle II
linked-list-cycle-ii
Given the `head` of a linked list, return _the node where the cycle begins. If there is no cycle, return_ `null`. There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that ta...
null
Hash Table,Linked List,Two Pointers
Medium
141,287
1,903
Hello Friends Hindi Section Be Appointed Discuss Another Simple List Co Problem Largest And Number In Friend Give Strength Which Is Representing Anti A The Interior Can Be Small Or Large Different Sunday Infatuated With Interesting Format The Amazing From All Video Egg Final Responsible Member Of The And Share Subscrib...
Largest Odd Number in String
design-most-recently-used-queue
You are given a string `num`, representing a large integer. Return _the **largest-valued odd** integer (as a string) that is a **non-empty substring** of_ `num`_, or an empty string_ `" "` _if no odd integer exists_. A **substring** is a contiguous sequence of characters within a string. **Example 1:** **Input:** nu...
You can store the data in an array and apply each fetch by moving the ith element to the end of the array (i.e, O(n) per operation). A better way is to use the square root decomposition technique. You can build chunks of size sqrt(n). For each fetch operation, You can search for the chunk which has the ith element and ...
Array,Hash Table,Stack,Design,Binary Indexed Tree,Ordered Set
Medium
146
918
Hello friends today I'm going to solve liquid problem number 918 maximum some circular sub array so in this problem we are given a circular integer area Norms of length and we need to return a maximum possible sum of Norm empty sub array of knobs and what's a circular array basically a circular array means uh you start...
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
261
hey what's up guys this is shown here so today let's take a look at another classic graph problem here which is numbered 261 graph a valid tree so basically you're given like a number of nodes and a list of edges right so the address has like from not from two students is undirected so there's gonna be so this graph li...
Graph Valid Tree
graph-valid-tree
You have a graph of `n` nodes labeled from `0` to `n - 1`. You are given an integer n and a list of `edges` where `edges[i] = [ai, bi]` indicates that there is an undirected edge between nodes `ai` and `bi` in the graph. Return `true` _if the edges of the given graph make up a valid tree, and_ `false` _otherwise_. **...
Given n = 5 and edges = [[0, 1], [1, 2], [3, 4]], what should your return? Is this case a valid tree? According to the definition of tree on Wikipedia: “a tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles is a tree.”
Depth-First Search,Breadth-First Search,Union Find,Graph
Medium
207,323,871
1,370
hello everyone so in this video let us talk about one more easy problem from lead code the problem name is increasing decreasing string so the problem statement goes like this that you're given a string S as you can see in the input now you have to reorder the string according to the given algorithm now what you'll do ...
Increasing Decreasing String
count-number-of-nice-subarrays
You are given a string `s`. Reorder the string using the following algorithm: 1. Pick the **smallest** character from `s` and **append** it to the result. 2. Pick the **smallest** character from `s` which is greater than the last appended character to the result and **append** it. 3. Repeat step 2 until you cannot ...
After replacing each even by zero and every odd by one can we use prefix sum to find answer ? Can we use two pointers to count number of sub-arrays ? Can we store indices of odd numbers and for each k indices count number of sub-arrays contains them ?
Array,Hash Table,Math,Sliding Window
Medium
null
162
welcome to july's leeco challenge today's problem is find peak element a peak element is an element that is strictly greater than its neighbors given an integer array nums find a peak element and return its index if the array contains multiple peaks return the index to any of the peaks you can imagine that the first an...
Find Peak Element
find-peak-element
A peak element is an element that is strictly greater than its neighbors. Given a **0-indexed** integer array `nums`, find a peak element, and return its index. If the array contains multiple peaks, return the index to **any of the peaks**. You may imagine that `nums[-1] = nums[n] = -∞`. In other words, an element is...
null
Array,Binary Search
Medium
882,2047,2273,2316
1,793
hello everyone and good morning to all of you this is our nth day of 75 days lead coding Challenge and here is the problem which name is a maximum score of a good sub lead code 179 93 problem so before going forward in this video please make sure that you have liked and subscribed to this channel this will motivate me ...
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
328
the good part about a linked list is that it does not have any indices right so you can insert and remove elements at any place unlike an array correct but at the same time the bad part about a linked list is that it does not have any indices so what do you do in such problems where you have to do some operations based...
Odd Even Linked List
odd-even-linked-list
Given the `head` of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return _the reordered list_. The **first** node is considered **odd**, and the **second** node is **even**, and so on. Note that the relative order inside both the even and odd groups s...
null
Linked List
Medium
725
110
this video we're going to look at a legal problem called balanced binary tree so given the binary tree determine if it is a height balance so for this problem the height balance binary tree is defined as a binary tree in which the left subtree and the right shape subtree of every node different in heights by no more th...
Balanced Binary Tree
balanced-binary-tree
Given a binary tree, determine if it is **height-balanced**. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** true **Example 2:** **Input:** root = \[1,2,2,3,3,null,null,4,4\] **Output:** false **Example 3:** **Input:** root = \[\] **Output:** true **Constraints:** * The number of nodes ...
null
Tree,Depth-First Search,Binary Tree
Easy
104
377
Hello everyone, welcome to my channel, you have been asked to try it. Well, this question is quite standard, but people often make a mistake in it. It is simple, it is done with the standard method, so read and understand what is happening, okay. So what does it mean, we cannot do it, we can achieve it and this is our ...
Combination Sum IV
combination-sum-iv
Given an array of **distinct** integers `nums` and a target integer `target`, return _the number of possible combinations that add up to_ `target`. The test cases are generated so that the answer can fit in a **32-bit** integer. **Example 1:** **Input:** nums = \[1,2,3\], target = 4 **Output:** 7 **Explanation:** Th...
null
Array,Dynamic Programming
Medium
39
1,252
Work in this field Ajay Ko That [ That [ That Hello Everyone Hello Friends Welcome to your new video in this video By going to discuss the problem number 125 Subscribe Values ​​in Values ​​in Values ​​in the problem itself problem cross this life is Wearing A is equal to saw machine represents location Padhan location ...
Cells with Odd Values in a Matrix
break-a-palindrome
There is an `m x n` matrix that is initialized to all `0`'s. There is also a 2D array `indices` where each `indices[i] = [ri, ci]` represents a **0-indexed location** to perform some increment operations on the matrix. For each location `indices[i]`, do **both** of the following: 1. Increment **all** the cells on ro...
How to detect if there is impossible to perform the replacement? Only when the length = 1. Change the first non 'a' character to 'a'. What if the string has only 'a'? Change the last character to 'b'.
String,Greedy
Medium
null
1,095
hey everybody this is lry this is day 12 of the Lego daddy challenge hit the like button hit the Subscribe button drop me on Discord let me know what you think about today's prom uh 1095 finding Mountain away all right we have a hard problem which is should be fine I'm really tired I've been on the plane or some form o...
Find in Mountain Array
two-city-scheduling
_(This problem is an **interactive problem**.)_ You may recall that an array `arr` is a **mountain array** if and only if: * `arr.length >= 3` * There exists some `i` with `0 < i < arr.length - 1` such that: * `arr[0] < arr[1] < ... < arr[i - 1] < arr[i]` * `arr[i] > arr[i + 1] > ... > arr[arr.length ...
null
Array,Greedy,Sorting
Medium
null
1,235
hey everybody this is Larry this is day 26th of the legal daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about this part maximum profit in job scheduling um hope everyone's having a great weekend Thanksgiving weekend long weekend whatever it is that you'd like...
Maximum Profit in Job Scheduling
maximum-profit-in-job-scheduling
We have `n` jobs, where every job is scheduled to be done from `startTime[i]` to `endTime[i]`, obtaining a profit of `profit[i]`. You're given the `startTime`, `endTime` and `profit` arrays, return the maximum profit you can take such that there are no two jobs in the subset with overlapping time range. If you choose...
null
null
Hard
null
387
hello viewers welcome back to my channel hope you are doing great if you haven't subscribed to my channel yet please go ahead and subscribe I have created several playlists for various problem categories such as dynamic programming sorting searching BFS DFS and so on please check them out I have uploaded the core for t...
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
771
all right welcome to this video we're gonna solve Lika prom 771 jewels and stones now I do want to say ahead of time this is a very easy problem to solve at least in my opinion and I would never expect to be asked this on-site never expect to be asked this on-site never expect to be asked this on-site interview however...
Jewels and Stones
encode-n-ary-tree-to-binary-tree
You're given strings `jewels` representing the types of stones that are jewels, and `stones` representing the stones you have. Each character in `stones` is a type of stone you have. You want to know how many of the stones you have are also jewels. Letters are case sensitive, so `"a "` is considered a different type o...
null
Tree,Depth-First Search,Breadth-First Search,Design,Binary Tree
Hard
765
73
hello friends in this video we will solve it code problem number 73 set matrix zeros so first we will understand the problem statement after that we will see approach for this problem and at the end we will see code in java the question says that we have given encroachment matrix if an element is zero we need to set it...
Set Matrix Zeroes
set-matrix-zeroes
Given an `m x n` integer matrix `matrix`, if an element is `0`, set its entire row and column to `0`'s. You must do it [in place](https://en.wikipedia.org/wiki/In-place_algorithm). **Example 1:** **Input:** matrix = \[\[1,1,1\],\[1,0,1\],\[1,1,1\]\] **Output:** \[\[1,0,1\],\[0,0,0\],\[1,0,1\]\] **Example 2:** **In...
If any cell of the matrix has a zero we can record its row and column number using additional memory. But if you don't want to use extra memory then you can manipulate the array instead. i.e. simulating exactly what the question says. Setting cell values to zero on the fly while iterating might lead to discrepancies. ...
Array,Hash Table,Matrix
Medium
289,2244,2259,2314
66
all right today we're going to be solving problem 66 plus one it's an easy problem it has a lot of likes but it has even more dislikes i actually like this problem so let's just do it uh i'm not going to read the description because description is a little bit confusing i will just show the example so we have number 12...
Plus One
plus-one
You are given a **large integer** represented as an integer array `digits`, where each `digits[i]` is the `ith` digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading `0`'s. Increment the large integer by one and re...
null
Array,Math
Easy
43,67,369,1031
213
today we'll be going over leode problem 2113 house Rober 2 this is another problem off the blind 75 list which is a list of problems commonly asked during technical interviews in this problem we're going to imagine that we are a professional robber and we want to rob a certain amount of houses along a road what we want...
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
598
welcome to august leeco challenge today's problem is range edition two you are given an m times n matrix initialized with all zeros and an array of operations where ops i equals a comma b essentially means uh it should be incremented by one for all of zero less than or equal to x less than a well essentially they give ...
Range Addition II
range-addition-ii
You are given an `m x n` matrix `M` initialized with all `0`'s and an array of operations `ops`, where `ops[i] = [ai, bi]` means `M[x][y]` should be incremented by one for all `0 <= x < ai` and `0 <= y < bi`. Count and return _the number of maximum integers in the matrix after performing all the operations_. **Exampl...
null
Array,Math
Easy
370
105
hey everyone welcome back and let's write some more neat code today so today let's solve a pretty fun problem construct a binary tree from a pre-order construct a binary tree from a pre-order construct a binary tree from a pre-order and in order traversal so we're actually given two integer arrays representing one the ...
Construct Binary Tree from Preorder and Inorder Traversal
construct-binary-tree-from-preorder-and-inorder-traversal
Given two integer arrays `preorder` and `inorder` where `preorder` is the preorder traversal of a binary tree and `inorder` is the inorder traversal of the same tree, construct and return _the binary tree_. **Example 1:** **Input:** preorder = \[3,9,20,15,7\], inorder = \[9,3,15,20,7\] **Output:** \[3,9,20,null,null,...
null
Array,Hash Table,Divide and Conquer,Tree,Binary Tree
Medium
106
148
a very interesting problem with Donald liko it is sort linked list so basically um if we know that if we want to sort a array it would be much simple with a lot of methods such as bubble sword or merge sword and quicksort so today we're gonna apply merge sword in this case we can think this linked list as the same as t...
Sort List
sort-list
Given the `head` of a linked list, return _the list after sorting it in **ascending order**_. **Example 1:** **Input:** head = \[4,2,1,3\] **Output:** \[1,2,3,4\] **Example 2:** **Input:** head = \[-1,5,3,4,0\] **Output:** \[-1,0,3,4,5\] **Example 3:** **Input:** head = \[\] **Output:** \[\] **Constraints:** * ...
null
Linked List,Two Pointers,Divide and Conquer,Sorting,Merge Sort
Medium
21,75,147,1992
713
what's up nerds welcome back to t-time what's up nerds welcome back to t-time what's up nerds welcome back to t-time with your favorite software engineer if you guys haven't already if you guys are new to the channel check me out subscribe i post record videos a few times a week i also have a slack channel where i post...
Subarray Product Less Than K
subarray-product-less-than-k
Given an array of integers `nums` and an integer `k`, return _the number of contiguous subarrays where the product of all the elements in the subarray is strictly less than_ `k`. **Example 1:** **Input:** nums = \[10,5,2,6\], k = 100 **Output:** 8 **Explanation:** The 8 subarrays that have product less than 100 are: ...
For each j, let opt(j) be the smallest i so that nums[i] * nums[i+1] * ... * nums[j] is less than k. opt is an increasing function.
Array,Sliding Window
Medium
152,325,560,1083,2233
112
hello everybody welcome to another video on problem solving in this video we're going to be solving a problem on lead code which is path sum so it's a relatively simple problem you can see it's tagged as easy so let's just go through the description and then we'll see how i'll be solving it so the problem says that we'...
Path Sum
path-sum
Given the `root` of a binary tree and an integer `targetSum`, return `true` if the tree has a **root-to-leaf** path such that adding up all the values along the path equals `targetSum`. A **leaf** is a node with no children. **Example 1:** **Input:** root = \[5,4,8,11,null,13,4,7,2,null,null,null,1\], targetSum = 22...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Easy
113,124,129,437,666
779
Hello everyone welcome, my name is Himanshu, you are watching the lecture, I will give the D series review, so let's start You must have seen in the thumbnail, what is the question, so see friend, once you define the question, input. What will be given to you? In the input you will be given two numbers N and K. Okay, N...
K-th Symbol in Grammar
max-chunks-to-make-sorted-ii
We build a table of `n` rows (**1-indexed**). We start by writing `0` in the `1st` row. Now in every subsequent row, we look at the previous row and replace each occurrence of `0` with `01`, and each occurrence of `1` with `10`. * For example, for `n = 3`, the `1st` row is `0`, the `2nd` row is `01`, and the `3rd` r...
Each k for which some permutation of arr[:k] is equal to sorted(arr)[:k] is where we should cut each chunk.
Array,Stack,Greedy,Sorting,Monotonic Stack
Hard
780
356
hey everybody this is Larry this is day 15 of the February uh 20. hit the like button hit the Subscribe button drop me a Discord let me know what you think about today I'm doing a next year premium problem just to charge myself in it also just you know get my money's worth um I did get a request about 356 so let me tak...
Line Reflection
line-reflection
Given `n` points on a 2D plane, find if there is such a line parallel to the y-axis that reflects the given points symmetrically. In other words, answer whether or not if there exists a line that after reflecting all points over the given line, the original points' set is the same as the reflected ones. **Note** that...
Find the smallest and largest x-value for all points. If there is a line then it should be at y = (minX + maxX) / 2. For each point, make sure that it has a reflected point in the opposite side.
Array,Hash Table,Math
Medium
149,447
216
Hello Guys Today They Are Going Prince Combination Sentry Problem Swiping This Is The Second Last Problem His Name Not The Second Like This Is The Thirteenth Problem In Our Back Tracking List Withdrawal Episode 212 Problems And Discrimination Problem Is 210 Commission Problem Is Singh Find All Wealth Combinations of Nu...
Combination Sum III
combination-sum-iii
Find all valid combinations of `k` numbers that sum up to `n` such that the following conditions are true: * Only numbers `1` through `9` are used. * Each number is used **at most once**. Return _a list of all possible valid combinations_. The list must not contain the same combination twice, and the combinations...
null
Array,Backtracking
Medium
39
1,329
Hello welcome to you new video and today we are going to discuss the challenge in this video so today's challenge is so we have given a matrix like this matrix has been given to me so what will become the diagonals this one diagonal one This diagonal, now look at this triangle, now if we sort this diagonal, it is autom...
Sort the Matrix Diagonally
minimum-cost-to-move-chips-to-the-same-position
A **matrix diagonal** is a diagonal line of cells starting from some cell in either the topmost row or leftmost column and going in the bottom-right direction until reaching the matrix's end. For example, the **matrix diagonal** starting from `mat[2][0]`, where `mat` is a `6 x 3` matrix, includes cells `mat[2][0]`, `ma...
The first move keeps the parity of the element as it is. The second move changes the parity of the element. Since the first move is free, if all the numbers have the same parity, the answer would be zero. Find the minimum cost to make all the numbers have the same parity.
Array,Math,Greedy
Easy
1895
1,614
hi everybody my name is alisa and in this video i want to show you my solution and explain uh how i solved little problem maximum nest in depth of the parentheses honestly this specific problem took me way more time to understand what exactly the problem about than to solve it because the solution is pretty simple and ...
Maximum Nesting Depth of the Parentheses
maximum-nesting-depth-of-the-parentheses
A string is a **valid parentheses string** (denoted **VPS**) if it meets one of the following: * It is an empty string `" "`, or a single character not equal to `"( "` or `") "`, * It can be written as `AB` (`A` concatenated with `B`), where `A` and `B` are **VPS**'s, or * It can be written as `(A)`, where `A` i...
null
null
Easy
null
496
Jhal Hello Everyone Welcome To Coding Cut To Edison Electronic Problem Vacancy Abhi Problem Hai No List Greater Element That One Should First Planning Department Will Give U 2017 Element For Example For One And Two Se 0.5 1342 Se 0.5 1342 Se 0.5 1342 Nine Percent Second One Is Most Termed Hey To ki and dialects of pres...
Next Greater Element I
next-greater-element-i
The **next greater element** of some element `x` in an array is the **first greater** element that is **to the right** of `x` in the same array. You are given two **distinct 0-indexed** integer arrays `nums1` and `nums2`, where `nums1` is a subset of `nums2`. For each `0 <= i < nums1.length`, find the index `j` such ...
null
Array,Hash Table,Stack,Monotonic Stack
Easy
503,556,739,2227
1,984
hello everyone in this video we will solve read code problem number 1984 that is minimum difference between highest and lowest of k scores so let's read the problem statement first you are given a zero index array nums where nums of i represents the score of its student you are also given an integer k pick the scores o...
Minimum Difference Between Highest and Lowest of K Scores
maximum-distance-between-a-pair-of-values
You are given a **0-indexed** integer array `nums`, where `nums[i]` represents the score of the `ith` student. You are also given an integer `k`. Pick the scores of any `k` students from the array so that the **difference** between the **highest** and the **lowest** of the `k` scores is **minimized**. Return _the **m...
Since both arrays are sorted in a non-increasing way this means that for each value in the first array. We can find the farthest value smaller than it using binary search. There is another solution using a two pointers approach since the first array is non-increasing the farthest j such that nums2[j] ≥ nums1[i] is at l...
Array,Two Pointers,Binary Search,Greedy
Medium
2199
739
hello so this question is daily temperature so i give an initial array temperature and then basically you need to return the array of answer uh which is uh the number of the day you have to wait until after the item the eye day to get a warmer temperature so this question supposed to be really straightforward so just i...
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
60
Hello hello friends welcome to coding interview channel on doing great difficulty on channel please do subscribe my favorite playlist news verification problems best dance update structures such a specific that link list research and also some program dance certification in programming and on please mind Now Upload Vot...
Permutation Sequence
permutation-sequence
The set `[1, 2, 3, ..., n]` contains a total of `n!` unique permutations. By listing and labeling all of the permutations in order, we get the following sequence for `n = 3`: 1. `"123 "` 2. `"132 "` 3. `"213 "` 4. `"231 "` 5. `"312 "` 6. `"321 "` Given `n` and `k`, return the `kth` permutation sequence. **Exa...
null
Math,Recursion
Hard
31,46
334
hey everybody this is larry this is day 18 of the leeco daily december challenge hit the like button hit the subscribe button join me in discord let me know what you think about today's forum so i do explain and solve this live so if it's a little bit slow uh let me know or fast forward i usually go for my thought proc...
Increasing Triplet Subsequence
increasing-triplet-subsequence
Given an integer array `nums`, return `true` _if there exists a triple of indices_ `(i, j, k)` _such that_ `i < j < k` _and_ `nums[i] < nums[j] < nums[k]`. If no such indices exists, return `false`. **Example 1:** **Input:** nums = \[1,2,3,4,5\] **Output:** true **Explanation:** Any triplet where i < j < k is valid. ...
null
Array,Greedy
Medium
300,2122,2280
209
Hello Hi Guys, today we are doing question number three of the playlist of Sliding Window Mechanism, the name of the question is Minimum Size Ride, Assam Recruitment 201 Question, Additional Session Court Company, Google Amazon App Co Light, Facebook Governments, OK, so let's see the question. You will be given a targe...
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
8
Lucca number a string to integer implement a 2i which converts a string to integer so the function first discards as many whitespace characters as necessary until the first non-white as necessary until the first non-white as necessary until the first non-white characters found okay then starting from its character take...
String to Integer (atoi)
string-to-integer-atoi
Implement the `myAtoi(string s)` function, which converts a string to a 32-bit signed integer (similar to C/C++'s `atoi` function). The algorithm for `myAtoi(string s)` is as follows: 1. Read in and ignore any leading whitespace. 2. Check if the next character (if not already at the end of the string) is `'-'` or `...
null
String
Medium
7,65,2168
1,302
Hello everyone, Evgeniy Sulima nav and today there are 3 problems years code number 13 02 the sum of the deepest leaves according to the conditions given in return we are given the root of a binary tree and we must return the sum of the values ​​of we must return the sum of the values ​​of we must return the sum of the...
Deepest Leaves Sum
delete-characters-to-make-fancy-string
Given the `root` of a binary tree, return _the sum of values of its deepest leaves_. **Example 1:** **Input:** root = \[1,2,3,4,5,null,6,7,null,null,null,null,8\] **Output:** 15 **Example 2:** **Input:** root = \[6,7,8,2,7,1,3,9,null,1,4,null,null,null,5\] **Output:** 19 **Constraints:** * The number of nodes i...
What's the optimal way to delete characters if three or more consecutive characters are equal? If three or more consecutive characters are equal, keep two of them and delete the rest.
String
Easy
null
338
Jhaal Hello Hi Guys Question Keep Someone Today Is Counting Bags And It's Really A Good Question To Saunf Dost Wa Banner NDP Jewelers To Get Your Concept Clear In Which Manipulation The Right Question Is Headless Given In Pieces And They Need To Return Arya Answer With Full Length Inch Plus One Search For Child Abuse F...
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
528
Loot Hello Everyone Welcome To My Channel Today's Question Is Random Pick With Vivek YouTube Channel Please subscribe this Video give Ye Aaj Tak High Lifestyle W And Positive Integers Vegetable Oil Describe The Best Of Induction Heater Function With Intense Pain In Next Point Will Be Completed Within This Question To I...
Random Pick with Weight
swapping-nodes-in-a-linked-list
You are given a **0-indexed** array of positive integers `w` where `w[i]` describes the **weight** of the `ith` index. You need to implement the function `pickIndex()`, which **randomly** picks an index in the range `[0, w.length - 1]` (**inclusive**) and returns it. The **probability** of picking an index `i` is `w[i...
We can transform the linked list to an array this should ease things up After transforming the linked list to an array it becomes as easy as swapping two integers in an array then rebuilding the linked list
Linked List,Two Pointers
Medium
19,24,25
1,726
Yes, hello, this is Nagopari from Live Coding. Today, I will solve the problem of tuple with sein product, number 1726 in Litcode. Yes, the problem was also brought from Litcode, and I explained it in the ppt, and since it is a very simple problem, I will start coding right away. Now, the dictionary creates a map struc...
Tuple with Same Product
coordinate-with-maximum-network-quality
Given an array `nums` of **distinct** positive integers, return _the number of tuples_ `(a, b, c, d)` _such that_ `a * b = c * d` _where_ `a`_,_ `b`_,_ `c`_, and_ `d` _are elements of_ `nums`_, and_ `a != b != c != d`_._ **Example 1:** **Input:** nums = \[2,3,4,6\] **Output:** 8 **Explanation:** There are 8 valid tup...
The constraints are small enough to consider every possible coordinate and calculate its quality.
Array,Enumeration
Medium
null
234
Most of them will be the president and I have learned a lot in the English series, I am telling the truth, I have covered all the basic things, here this question is getting bitter, the land from the link list is fine, is it looking good, friend? This is the question of cigarette, it increases metabolism. Now if you si...
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
1,047
hello everyone let's solve today's lead code question remove or adjacent duplicating string we are given a string s and consisting of lowercase English letters this question wants us to remove author Json duplicate letters we are going to do this duplicate removers honest until we don't have adjacent duplicated letters...
Remove All Adjacent Duplicates In String
maximize-sum-of-array-after-k-negations
You are given a string `s` consisting of lowercase English letters. A **duplicate removal** consists of choosing two **adjacent** and **equal** letters and removing them. We repeatedly make **duplicate removals** on `s` until we no longer can. Return _the final string after all such duplicate removals have been made_...
null
Array,Greedy,Sorting
Easy
2204
199
hey what's up guys is Nik why'd I do tech and coding stuff on Twitch in youtube if you want to see any of that just check the description I have everything there I do all the Lika problems so I have a playlist and I have almost all not almost all of them but I have a ton of them on my channel so just go check that out ...
Binary Tree Right Side View
binary-tree-right-side-view
Given the `root` of a binary tree, imagine yourself standing on the **right side** of it, return _the values of the nodes you can see ordered from top to bottom_. **Example 1:** **Input:** root = \[1,2,3,null,5,null,4\] **Output:** \[1,3,4\] **Example 2:** **Input:** root = \[1,null,3\] **Output:** \[1,3\] **Examp...
null
Tree,Depth-First Search,Breadth-First Search,Binary Tree
Medium
116,545
110
Hello friends, welcome to this channel, today our day is 84 T code challenge, so let's go straight to the screen and start today's question. So what is today's question saying? Let us understand the number of today's question. The name of 11 question is Balance Binary. Look, first of all, this question is not very impo...
Balanced Binary Tree
balanced-binary-tree
Given a binary tree, determine if it is **height-balanced**. **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** true **Example 2:** **Input:** root = \[1,2,2,3,3,null,null,4,4\] **Output:** false **Example 3:** **Input:** root = \[\] **Output:** true **Constraints:** * The number of nodes ...
null
Tree,Depth-First Search,Binary Tree
Easy
104