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
203
hi guys in this video we'll take a look at remove link list problem difficulty level is easy and the problem description is we have to remove all elements from the linked list which match a particular value so our example is one two six three four five six and we need to remove all the elements whose value match or who...
Remove Linked List Elements
remove-linked-list-elements
Given the `head` of a linked list and an integer `val`, remove all the nodes of the linked list that has `Node.val == val`, and return _the new head_. **Example 1:** **Input:** head = \[1,2,6,3,4,5,6\], val = 6 **Output:** \[1,2,3,4,5\] **Example 2:** **Input:** head = \[\], val = 1 **Output:** \[\] **Example 3:**...
null
Linked List,Recursion
Easy
27,237,2216
3
hey welcome to part three of my lee code and typescript this is the series aka known as leeco today keeps the dentist away so we are on part three right now and it is called longest substring without repeating characters if this is your first time here today on my channel well first thank you guys for checking this out...
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
1,749
whoa this is the kind of day where I really asked myself if it's even useful to do leak code problems anymore or even just in general be a software engineer or any way call our job right any office desk job I don't know if you guys had an opportunity to look at the chat GPT but um it's marvelous it's so impressive that...
Maximum Absolute Sum of Any Subarray
sellers-with-no-sales
You are given an integer array `nums`. The **absolute sum** of a subarray `[numsl, numsl+1, ..., numsr-1, numsr]` is `abs(numsl + numsl+1 + ... + numsr-1 + numsr)`. Return _the **maximum** absolute sum of any **(possibly empty)** subarray of_ `nums`. Note that `abs(x)` is defined as follows: * If `x` is a negative...
null
Database
Easy
1724
221
okay let's look at the today's laconian challenge question maximum square we have a 2d binary matrix with zeros and the ones we want to find that the largest square containing only ones in the return its area as an example we have four or five columns matrix the largest square here is the one that's coded in red here t...
Maximal Square
maximal-square
Given an `m x n` binary `matrix` filled with `0`'s and `1`'s, _find the largest square containing only_ `1`'s _and return its area_. **Example 1:** **Input:** matrix = \[\[ "1 ", "0 ", "1 ", "0 ", "0 "\],\[ "1 ", "0 ", "1 ", "1 ", "1 "\],\[ "1 ", "1 ", "1 ", "1 ", "1 "\],\[ "1 ", "0 ", "0 ", "1 ", "0 "\]\] **Output:*...
null
Array,Dynamic Programming,Matrix
Medium
85,769,1312,2200
516
hey everyone welcome back and let's write some more neat code today so today let's solve the problem longest palindromic subsequence we're given a string s and we want to return the length of the longest palindromic subsequence to quickly review a subsequence of a string like b a b is basically a sequence of characters...
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
316
hey everybody this is larry this is date 18 of the march leco daily challenge hit the like button hit the subscribe button join me in discord let me know what you think about today's farm uh for those of you uh who are celebrating i just want to say happy uh happy holly uh happy eating patrick's day and also uh happy p...
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
280
hi everyone welcome to netset os today in this video we'll be discussing about vehicle sort before discussing wiggle sort if you guys haven't subscribed to my channel just subscribe it so let's start so what is beggar wiggle is something to sort a array in waveform as in when we have the first data to be larger then sm...
Wiggle Sort
wiggle-sort
Given an integer array `nums`, reorder it such that `nums[0] <= nums[1] >= nums[2] <= nums[3]...`. You may assume the input array always has a valid answer. **Example 1:** **Input:** nums = \[3,5,2,1,6,4\] **Output:** \[3,5,1,6,2,4\] **Explanation:** \[1,6,2,5,3,4\] is also accepted. **Example 2:** **Input:** nums...
null
Array,Greedy,Sorting
Medium
75,324,2085
238
hello everyone welcome to sudokoda this is raveena today we are gonna solve problem number 238 which is product of array except self okay so let's start by reading the question it says that given an integer array nums written any array written an array answer such that answer of I is equal to the product of all the ele...
Product of Array Except Self
product-of-array-except-self
Given an integer array `nums`, return _an array_ `answer` _such that_ `answer[i]` _is equal to the product of all the elements of_ `nums` _except_ `nums[i]`. The product of any prefix or suffix of `nums` is **guaranteed** to fit in a **32-bit** integer. You must write an algorithm that runs in `O(n)` time and without...
null
Array,Prefix Sum
Medium
42,152,265,2267
863
hello and welcome back to the cracking fang youtube channel today we're going to be solving lead code 863 all nodes distance k in a binary tree let's read the question prompt given the root of a binary tree the value of a target node target and an integer k return an array of the value of all nodes that have a distance...
All Nodes Distance K in Binary Tree
sum-of-distances-in-tree
Given the `root` of a binary tree, the value of a target node `target`, and an integer `k`, return _an array of the values of all nodes that have a distance_ `k` _from the target node._ You can return the answer in **any order**. **Example 1:** **Input:** root = \[3,5,1,6,2,0,8,null,null,7,4\], target = 5, k = 2 **O...
null
Dynamic Programming,Tree,Depth-First Search,Graph
Hard
1021,2175
112
hello and welcome everyone let's continue with the jean prasad list by solving the path sum problem so we're giving the root of a binary tree and an integer target sum and we want to return true if the tree has any roots to leave path that adding of the values would equal the target sum so you know that the root is the...
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
475
hey yo what's up my little callers let's solve today the little question 475 which is called heaters basically given a hu given an array which represents all the houses and elsa and array which represents all the heaters we need to find the minimum ratios of heaters so that all the houses could be covered by those heat...
Heaters
heaters
Winter is coming! During the contest, your first job is to design a standard heater with a fixed warm radius to warm all the houses. Every house can be warmed, as long as the house is within the heater's warm radius range. Given the positions of `houses` and `heaters` on a horizontal line, return _the minimum radius ...
null
Array,Two Pointers,Binary Search,Sorting
Medium
null
88
hi guys welcome to one more video in this one we'll do merge sorted array so we're going to skip reading textual part of the problem description because i've spent last 30 minutes trying to draft this problem and with every draft it became more and more confusing so i said let's keep reading the textual part let's go t...
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
787
code problem number 787 cheapest flights within K stops so this problem gives us n cities connected by some number of flights we are given an array flights where each flight would have their respective from to city and the price it took right so we also given three integers The Source destination and K and the goal is ...
Cheapest Flights Within K Stops
sliding-puzzle
There are `n` cities connected by some number of flights. You are given an array `flights` where `flights[i] = [fromi, toi, pricei]` indicates that there is a flight from city `fromi` to city `toi` with cost `pricei`. You are also given three integers `src`, `dst`, and `k`, return _**the cheapest price** from_ `src` _...
Perform a breadth-first-search, where the nodes are the puzzle boards and edges are if two puzzle boards can be transformed into one another with one move.
Array,Breadth-First Search,Matrix
Hard
null
1,359
hello hi guys good morning welcome back to the new video uh oh God uh this question although it's written exactly hard here but it's not all hard if you know basic maths or as a massive basic I mean like a few concepts of maths I'll I'm gonna speak that Concepts please skip this video If you want to get the intuition b...
Count All Valid Pickup and Delivery Options
circular-permutation-in-binary-representation
Given `n` orders, each order consist in pickup and delivery services. Count all valid pickup/delivery possible sequences such that delivery(i) is always after of pickup(i). Since the answer may be too large, return it modulo 10^9 + 7. **Example 1:** **Input:** n = 1 **Output:** 1 **Explanation:** Unique order (P1, ...
Use gray code to generate a n-bit sequence. Rotate the sequence such that its first element is start.
Math,Backtracking,Bit Manipulation
Medium
null
729
hello guys welcome to my youtube channel and in this video i will discuss the problem my calendar one from lead code so we have to implement michael enter class to store our events the important point is that double booking should not happen so event will have two parameters start and end there is book class that we ha...
My Calendar I
my-calendar-i
You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a **double booking**. A **double booking** happens when two events have some non-empty intersection (i.e., some moment is common to both events.). The event can be represented as a pair of integers `start...
Store the events as a sorted list of intervals. If none of the events conflict, then the new event can be added.
Design,Segment Tree,Ordered Set
Medium
731,732
303
Hello Friends India Will Solid Problem Number 303 Link Sensory Dutable Super Will Understand Your Problem Statement Now School Boys Will See The Question Is The Meaning Of The Name Of The Subscribe The Amazing 1020 Represents A How To Represent Right Leg See Example1 Share With Everyone This And have given to where is ...
Range Sum Query - Immutable
range-sum-query-immutable
Given an integer array `nums`, handle multiple queries of the following type: 1. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`. Implement the `NumArray` class: * `NumArray(int[] nums)` Initializes the object with the integer array `nums`. * ...
null
Array,Design,Prefix Sum
Easy
304,307,325
1,632
Now [MUSIC] Let's [MUSIC] Let's see the transfer metric question of half the union a that a question we have to say that the governor name cross and tricks to new matrix answer a problem is the bank of river tax subscribe us keep one brave In Veer form, so if you subscribe to the back, if the example is that here there...
Rank Transform of a Matrix
number-of-good-ways-to-split-a-string
Given an `m x n` `matrix`, return _a new matrix_ `answer` _where_ `answer[row][col]` _is the_ _**rank** of_ `matrix[row][col]`. The **rank** is an **integer** that represents how large an element is compared to other elements. It is calculated using the following rules: * The rank is an integer starting from `1`. *...
Use two HashMap to store the counts of distinct letters in the left and right substring divided by the current index.
String,Dynamic Programming,Bit Manipulation
Medium
null
39
That and current three channel commission addiction you all cities will be discussing problem combination someone from dead back 5120 problems you new to all channels same video subscribe The Channel all problems to deal with no area of string in tears and targeted to create Not unique to return list of all the unique ...
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
787
hello everyone let's solve today's lead quad problem cheapest flights with k-stops k-stops k-stops there are n cities and some number of Lights and for an item end of Lights array which means from City and to city and cost price and we are given three integers Source City destination and K possible stops we need to fin...
Cheapest Flights Within K Stops
sliding-puzzle
There are `n` cities connected by some number of flights. You are given an array `flights` where `flights[i] = [fromi, toi, pricei]` indicates that there is a flight from city `fromi` to city `toi` with cost `pricei`. You are also given three integers `src`, `dst`, and `k`, return _**the cheapest price** from_ `src` _...
Perform a breadth-first-search, where the nodes are the puzzle boards and edges are if two puzzle boards can be transformed into one another with one move.
Array,Breadth-First Search,Matrix
Hard
null
87
Hello everyone, welcome to me channel 's question but you will understand it very easily, there is 's question but you will understand it very easily, there is 's question but you will understand it very easily, there is no need to fear much, this question is very good, its name is Scramble Singh and this question is v...
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
228
Hello everyone welcome to my channel easy question me always say it has been asked by Google ok question is good and the clean code you write the better impression will be the interview and ok otherwise you can write the code by doing different IFs but the code is as clean as possible The more you do, the better your i...
Summary Ranges
summary-ranges
You are given a **sorted unique** integer array `nums`. A **range** `[a,b]` is the set of all integers from `a` to `b` (inclusive). Return _the **smallest sorted** list of ranges that **cover all the numbers in the array exactly**_. That is, each element of `nums` is covered by exactly one of the ranges, and there is...
null
Array
Easy
163,352
1,653
hi friends welcome back today we are going to solve lead code problem 1653 minimum deletions to make string balanced uh so as you can see the like and dislike ratio this is a very likable problem and very popular problem so we will solve this problem today and this is of a medium complexity problem on lead code if you ...
Minimum Deletions to Make String Balanced
number-of-good-leaf-nodes-pairs
You are given a string `s` consisting only of characters `'a'` and `'b'`​​​​. You can delete any number of characters in `s` to make `s` **balanced**. `s` is **balanced** if there is no pair of indices `(i,j)` such that `i < j` and `s[i] = 'b'` and `s[j]= 'a'`. Return _the **minimum** number of deletions needed to ma...
Start DFS from each leaf node. stop the DFS when the number of steps done > distance. If you reach another leaf node within distance steps, add 1 to the answer. Note that all pairs will be counted twice so divide the answer by 2.
Tree,Depth-First Search,Binary Tree
Medium
null
49
so in this tutorial i'm going to show you a very simple method of solving the group anagram uh challenge and that method is simply called sauteed the software key uh the softer keys method what does it mean it means that we are going to use a dictionary and the keys of this dictionary is going to be this sorted version...
Group Anagrams
group-anagrams
Given an array of strings `strs`, group **the anagrams** together. You can return the answer in **any order**. An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. **Example 1:** **Input:** strs = \["eat","tea","tan...
null
Hash Table,String,Sorting
Medium
242,249
1,900
hey what's up guys this is juan here again so this time uh it's called number 1900 almost 20 almost 2 000 so the earliest and the latest rounds where players complete okay so this time we have a tournament where n players are practicing and the players are standing in a single row and the number from one to n and based...
The Earliest and Latest Rounds Where Players Compete
closest-dessert-cost
There is a tournament where `n` players are participating. The players are standing in a single row and are numbered from `1` to `n` based on their **initial** standing position (player `1` is the first player in the row, player `2` is the second player in the row, etc.). The tournament consists of multiple rounds (st...
As the constraints are not large, you can brute force and enumerate all the possibilities.
Array,Dynamic Programming,Backtracking
Medium
null
16
welcome back for another video we are going to do analytical question the question is if we sung closest given a integer array nonce of length n and integer target find three integers in nuns such that the sun is closest to target return the sun of the three integers you may assume that each input will have exactly one...
3Sum Closest
3sum-closest
Given an integer array `nums` of length `n` and an integer `target`, find three integers in `nums` such that the sum is closest to `target`. Return _the sum of the three integers_. You may assume that each input would have exactly one solution. **Example 1:** **Input:** nums = \[-1,2,1,-4\], target = 1 **Output:** ...
null
Array,Two Pointers,Sorting
Medium
15,259
230
Hello friends, today we will discuss that if we are given a binary sequence and we have to find out the smallest element in it, then how can we do it efficiently and along with this, we will follow it harder if our binary tree is getting modified again and again. Some elements are being added to it and some elements ar...
Kth Smallest Element in a BST
kth-smallest-element-in-a-bst
Given the `root` of a binary search tree, and an integer `k`, return _the_ `kth` _smallest value (**1-indexed**) of all the values of the nodes in the tree_. **Example 1:** **Input:** root = \[3,1,4,null,2\], k = 1 **Output:** 1 **Example 2:** **Input:** root = \[5,3,6,2,4,null,null,1\], k = 3 **Output:** 3 **Cons...
Try to utilize the property of a BST. Try in-order traversal. (Credits to @chan13) What if you could modify the BST node's structure? The optimal runtime complexity is O(height of BST).
Tree,Depth-First Search,Binary Search Tree,Binary Tree
Medium
94,671
1,732
hello everyone welcome back here is van damson and in today's video we will tackle an interesting problem about finding the highest allergies so we are given an array that represents the net gain in altitude between points and our job is to find the maximum altitude the bike and can reach so let's start our implementat...
Find the Highest Altitude
minimum-one-bit-operations-to-make-integers-zero
There is a biker going on a road trip. The road trip consists of `n + 1` points at different altitudes. The biker starts his trip on point `0` with altitude equal `0`. You are given an integer array `gain` of length `n` where `gain[i]` is the **net gain in altitude** between points `i`​​​​​​ and `i + 1` for all (`0 <=...
The fastest way to convert n to zero is to remove all set bits starting from the leftmost one. Try some simple examples to learn the rule of how many steps are needed to remove one set bit. consider n=2^k case first, then solve for all n.
Dynamic Programming,Bit Manipulation,Memoization
Hard
2119
616
hey guys how's your thing going is Jay sir who is not good at algorithms in this video I'm going to take a look at six one six add a bold tag in string or give me a string and a list of strings check dictionary we need to find a closed pair bold tags tag yeah be right to wrap the sub strings in s that exists in the dic...
Add Bold Tag in String
add-bold-tag-in-string
You are given a string `s` and an array of strings `words`. You should add a closed pair of bold tag **and** to wrap the substrings in `s` that exist in `words`. * If two such substrings overlap, you should wrap them together with only one pair of closed bold-tag. * If two substrings wrapped by bold tags are cons...
null
Array,Hash Table,String,Trie,String Matching
Medium
56,591
1,020
hey everyone welcome back and let's write some more neat code today so today let's solve the problem number of enclaves we're given an M by n Matrix which is a grid where zeros in this case are going to represent water and ones are going to represent land which is the opposite of yesterday's problem but other than that...
Number of Enclaves
longest-turbulent-subarray
You are given an `m x n` binary matrix `grid`, where `0` represents a sea cell and `1` represents a land cell. A **move** consists of walking from one land cell to another adjacent (**4-directionally**) land cell or walking off the boundary of the `grid`. Return _the number of land cells in_ `grid` _for which we cann...
null
Array,Dynamic Programming,Sliding Window
Medium
53
1,814
hey everybody this is larry this is me going with bi weekly contest 49 q3 count nice pairs in an array so yeah so to see if you have a nice pair you have to you know do this function which they wrote in a very intentionally confusing kind of way but basically um you know you just rewrite this function right um you're g...
Count Nice Pairs in an Array
jump-game-vi
You are given an array `nums` that consists of non-negative integers. Let us define `rev(x)` as the reverse of the non-negative integer `x`. For example, `rev(123) = 321`, and `rev(120) = 21`. A pair of indices `(i, j)` is **nice** if it satisfies all of the following conditions: * `0 <= i < j < nums.length` * `nu...
Let dp[i] be "the maximum score to reach the end starting at index i". The answer for dp[i] is nums[i] + max{dp[i+j]} for 1 <= j <= k. That gives an O(n*k) solution. Instead of checking every j for every i, keep track of the largest dp[i] values in a heap and calculate dp[i] from right to left. When the largest value i...
Array,Dynamic Programming,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue
Medium
239,2001
107
hey guys welcome back to another video and today we're gonna be solving the lead code question binary tree level order traversal - okay so and this is order traversal - okay so and this is order traversal - okay so and this is also the second problem of the July challenge and finally first I'm going to be going over th...
Binary Tree Level Order Traversal II
binary-tree-level-order-traversal-ii
Given the `root` of a binary tree, return _the bottom-up level order traversal of its nodes' values_. (i.e., from left to right, level by level from leaf to root). **Example 1:** **Input:** root = \[3,9,20,null,null,15,7\] **Output:** \[\[15,7\],\[9,20\],\[3\]\] **Example 2:** **Input:** root = \[1\] **Output:** \[...
null
Tree,Breadth-First Search,Binary Tree
Medium
102,637
1,552
hey what's up guys chung here again and so let's take a look at last week's or late or this week's uh weekly contest one of the problem uh 1 1552 magnetic falls between two bars um in the universe rc-137 um in the universe rc-137 um in the universe rc-137 blah okay and basically we have a list of numbers okay and we ha...
Magnetic Force Between Two Balls
build-an-array-with-stack-operations
In the universe Earth C-137, Rick discovered a special form of magnetic force between two balls if they are put in his new invented basket. Rick has `n` empty baskets, the `ith` basket is at `position[i]`, Morty has `m` balls and needs to distribute the balls into the baskets such that the **minimum magnetic force** be...
Use “Push” for numbers to be kept in target array and [“Push”, “Pop”] for numbers to be discarded.
Array,Stack,Simulation
Easy
null
231
can you solve this math coding interview question so given a value n return true if N is a power of two let's say we're given n isal to 16 2 to the 4 isal to 16 so we can return true let's first go The Brute Force approach we can continuously divide the number by two until it reaches a value of one and if any number is...
Power of Two
power-of-two
Given an integer `n`, return _`true` if it is a power of two. Otherwise, return `false`_. An integer `n` is a power of two, if there exists an integer `x` such that `n == 2x`. **Example 1:** **Input:** n = 1 **Output:** true **Explanation:** 20 = 1 **Example 2:** **Input:** n = 16 **Output:** true **Explanation:**...
null
Math,Bit Manipulation,Recursion
Easy
191,326,342
1,850
hello everyone welcome to quartus camp so we are today going to cover minimum adjacent swaps to reach the kth smallest number this is a problem that is asked in lead code contest so here the input given is a string which consists of integers and an integer k so here we need to return the minimum number of adjacent digi...
Minimum Adjacent Swaps to Reach the Kth Smallest Number
minimum-length-of-string-after-deleting-similar-ends
You are given a string `num`, representing a large integer, and an integer `k`. We call some integer **wonderful** if it is a **permutation** of the digits in `num` and is **greater in value** than `num`. There can be many wonderful integers. However, we only care about the **smallest-valued** ones. * For example, ...
If both ends have distinct characters, no more operations can be made. Otherwise, the only operation is to remove all of the same characters from both ends. We will do this as many times as we can. Note that if the length is equal 1 the answer is 1
Two Pointers,String
Medium
null
1,750
Hello Hi Everyone Welcome To My Channel It's All The Problem Minimum Like This Feeling After Deleting Similar And Forgiving Edison Setting On Leaf Characters A B C You Are To Apply Also Follow Algorithm In This Ring Any Number Of Times Pick Unknown Facts From History Guess Where All Characters in the field and this pic...
Minimum Length of String After Deleting Similar Ends
check-if-two-expression-trees-are-equivalent
Given a string `s` consisting only of characters `'a'`, `'b'`, and `'c'`. You are asked to apply the following algorithm on the string any number of times: 1. Pick a **non-empty** prefix from the string `s` where all the characters in the prefix are equal. 2. Pick a **non-empty** suffix from the string `s` where all...
Count for each variable how many times it appeared in the first tree. Do the same for the second tree and check if the count is the same for both tree.
Tree,Depth-First Search,Binary Tree
Medium
1736
649
hello guys welcome to deep codes and in today's video we will discuss lead code question 649 that says Dota 2 Senate so guys I totally understand that this question is very much difficult in terms of the question description given here and it is difficult to understand the description itself so yeah guys today in this ...
Dota2 Senate
dota2-senate
In the world of Dota2, there are two parties: the Radiant and the Dire. The Dota2 senate consists of senators coming from two parties. Now the Senate wants to decide on a change in the Dota2 game. The voting for this change is a round-based procedure. In each round, each senator can exercise **one** of the two rights:...
null
String,Greedy,Queue
Medium
495
599
hey everybody welcome back and today we will be doing another lead code 599 minimum index sum of two lists and easy one given two arrays of string list one list two find the common string with the least index sum a common string is a string that appeared in both list one and list two a comma string with the least index...
Minimum Index Sum of Two Lists
minimum-index-sum-of-two-lists
Given two arrays of strings `list1` and `list2`, find the **common strings with the least index sum**. A **common string** is a string that appeared in both `list1` and `list2`. A **common string with the least index sum** is a common string such that if it appeared at `list1[i]` and `list2[j]` then `i + j` should be...
null
Array,Hash Table,String
Easy
160
948
Hello Hi Everyone Welcome To My Channel Let's All The Problem Bag And Token So You Have An Initial Power Of P An Initial Score Of Zero And Back On Top Guns Were To Conserve This Person's Top 10 Actress Award To Maximize Your Total Score Wife Potentially Planning is token in one of the two way is your current power is a...
Bag of Tokens
sort-an-array
You have an initial **power** of `power`, an initial **score** of `0`, and a bag of `tokens` where `tokens[i]` is the value of the `ith` token (0-indexed). Your goal is to maximize your total **score** by potentially playing each token in one of two ways: * If your current **power** is at least `tokens[i]`, you may...
null
Array,Divide and Conquer,Sorting,Heap (Priority Queue),Merge Sort,Bucket Sort,Radix Sort,Counting Sort
Medium
null
1,974
can you solve this Google interview question in 30 seconds we're given a special circular typewriter and a pointer starting at a we want to type out the given word and return the minimum number of operations to do so we initialize a preview character to a and res equal to the length of the word we iterate over the word...
Minimum Time to Type Word Using Special Typewriter
find-customers-with-positive-revenue-this-year
There is a special typewriter with lowercase English letters `'a'` to `'z'` arranged in a **circle** with a **pointer**. A character can **only** be typed if the pointer is pointing to that character. The pointer is **initially** pointing to the character `'a'`. Each second, you may perform one of the following operat...
null
Database
Easy
null
394
hey what's up guys Nick white here I do tech encoding stuff on twitch and YouTube this is a pretty popular problem oh yeah by the way check the description if you want to see premium problems I do those on patreon and my discord is growing so join that okay back to the problem this is a medium problem called decode str...
Decode String
decode-string
Given an encoded string, return its decoded string. The encoding rule is: `k[encoded_string]`, where the `encoded_string` inside the square brackets is being repeated exactly `k` times. Note that `k` is guaranteed to be a positive integer. You may assume that the input string is always valid; there are no extra white...
null
String,Stack,Recursion
Medium
471,726,1076
6
okay so the question is zigzag conversion so you are giving a string and then the string is read from top to bottom to top and then continue until the end and you are going to return what you have for the first row and the second row and third row and so on so as you may see the number of row is three in this case so w...
Zigzag Conversion
zigzag-conversion
The string `"PAYPALISHIRING "` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: `"PAHNAPLSIIGYIR "` Write the code that will take a string and make this co...
null
String
Medium
null
1,029
hey everybody this is larry this is day 25 of the march lego day challenge hit the oops hit the like button hit the subscribe button join me on discord let me know what you think about today's farm two cities scheduling i feel like this week has been a lot of ad hoc problems so hopefully today i get it pretty okay uh t...
Two City Scheduling
vertical-order-traversal-of-a-binary-tree
A company is planning to interview `2n` people. Given the array `costs` where `costs[i] = [aCosti, bCosti]`, the cost of flying the `ith` person to city `a` is `aCosti`, and the cost of flying the `ith` person to city `b` is `bCosti`. Return _the minimum cost to fly every person to a city_ such that exactly `n` people...
null
Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree
Hard
null
130
hey hello there today silly coding challenge question has called surrounded regions we have a 2d board containing two kinds of values X I know the regions of the O's can be considered as captured if they are surrounded by the X so for all those regions that are captured we want to flip the those O's into X so looking a...
Surrounded Regions
surrounded-regions
Given an `m x n` matrix `board` containing `'X'` and `'O'`, _capture all regions that are 4-directionally surrounded by_ `'X'`. A region is **captured** by flipping all `'O'`s into `'X'`s in that surrounded region. **Example 1:** **Input:** board = \[\[ "X ", "X ", "X ", "X "\],\[ "X ", "O ", "O ", "X "\],\[ "X ", "...
null
Array,Depth-First Search,Breadth-First Search,Union Find,Matrix
Medium
200,286
352
uh red code number 352 data stream as disjoint intervals this is hard question let's get into it uh given a data stream input of non-negative integers a1 a2 non-negative integers a1 a2 non-negative integers a1 a2 to a n summarize the numbers since of 5 as your list of disjoint intervals for example supposed integers fr...
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,079
hello guys my name is lazaro and today we'll be doing a lee code problem this problem is called letter tau possibilities you have n tiles where each towel has one letter tiles of i printed on it return the number of possible non-empty return the number of possible non-empty return the number of possible non-empty seque...
Letter Tile Possibilities
sum-of-root-to-leaf-binary-numbers
You have `n` `tiles`, where each tile has one letter `tiles[i]` printed on it. Return _the number of possible non-empty sequences of letters_ you can make using the letters printed on those `tiles`. **Example 1:** **Input:** tiles = "AAB " **Output:** 8 **Explanation:** The possible sequences are "A ", "B ", "AA...
Find each path, then transform that path to an integer in base 10.
Tree,Depth-First Search,Binary Tree
Easy
null
8
hello and welcome to the eighth video in this liquid and C shop Series in this video we're going to be doing the challenge called string to integer so if we switch over to World web browser and let's start so implement the Maya toy stringus function which converts a string to a 32-bit side integer the string to a 32-bi...
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
71
hello so let's talk about a simplified path so you're giving a string path so which is absolute path and then you want to convert your command and no nicole path so what does connection focus mean so it basically is to return the shortest possible path uh in the string s so like for a given absolute path right you can ...
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
763
hello guys I hope you are all doing well in this video we'll be solving the problem with called Partition labels before we get started make sure you subscribe and like the video without further Ado let's get started so the problem is that they give you a string and they ask you to partition it into as many parts as pos...
Partition Labels
special-binary-string
You are given a string `s`. We want to partition the string into as many parts as possible so that each letter appears in at most one part. Note that the partition is done so that after concatenating all the parts in order, the resultant string should be `s`. Return _a list of integers representing the size of these ...
Draw a line from (x, y) to (x+1, y+1) if we see a "1", else to (x+1, y-1). A special substring is just a line that starts and ends at the same y-coordinate, and that is the lowest y-coordinate reached. Call a mountain a special substring with no special prefixes - ie. only at the beginning and end is the lowest y-coo...
String,Recursion
Hard
678
129
welcome back and today is March 14th and this is today's daily recode problem so today it was called some route to Leaf numbers and it's a medium level binary tree question now if you remember yesterday if you were there for it was also a tree question but it was actually an easy level one now this one I find it's give...
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
778
lead code problem number 778 swim in Rising water so this problem gives us a n times n integer Matrix called grid where each value represents the elevation at that point I and J so here it says uh when the rain starts to fall uh blah okay so to summarize everything basically from the top left corner of the grid to the ...
Swim in Rising Water
reorganize-string
You are given an `n x n` integer matrix `grid` where each value `grid[i][j]` represents the elevation at that point `(i, j)`. The rain starts to fall. At time `t`, the depth of the water everywhere is `t`. You can swim from a square to another 4-directionally adjacent square if and only if the elevation of both square...
Alternate placing the most common letters.
Hash Table,String,Greedy,Sorting,Heap (Priority Queue),Counting
Medium
358,621,1304
433
Hi gas welcome and welcome back to my channel, so today our problem is minimum genetic mutation, so what is given to us in this problem statement, what are we given here, what is to be fine, we understand all this through examples. That's fine, what do you do, read this statement carefully, understand what is there, wh...
Minimum Genetic Mutation
minimum-genetic-mutation
A gene string can be represented by an 8-character long string, with choices from `'A'`, `'C'`, `'G'`, and `'T'`. Suppose we need to investigate a mutation from a gene string `startGene` to a gene string `endGene` where one mutation is defined as one single character changed in the gene string. * For example, `"AAC...
null
Hash Table,String,Breadth-First Search
Medium
127
71
okay guys let's do the 71st problem I we C simplify path given an absolute path for file Unix St and simplifi for example and we have some con cases we have to take care of so let's get right at it uh so first let's create a string array s we store part uh split across the string slash uh in this uh array and you have ...
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
217
what is up YouTube Welcome to this new series for data structure and algorithm so this is a basically a spin-off series so this is a basically a spin-off series so this is a basically a spin-off series coming out of my last video which covered the concepts around DS and algo for data engineering interviews but the goal...
Contains Duplicate
contains-duplicate
Given an integer array `nums`, return `true` if any value appears **at least twice** in the array, and return `false` if every element is distinct. **Example 1:** **Input:** nums = \[1,2,3,1\] **Output:** true **Example 2:** **Input:** nums = \[1,2,3,4\] **Output:** false **Example 3:** **Input:** nums = \[1,1,1,...
null
Array,Hash Table,Sorting
Easy
219,220
345
foreign and we need to return the string see what they given ovals of a e i o u and they told that they are appearing both lowercase and uppercase and they are more than once so in the example one was the given allo and the output is h-o-l-l-e output is h-o-l-l-e output is h-o-l-l-e is going to work let's we can take a...
Reverse Vowels of a String
reverse-vowels-of-a-string
Given a string `s`, reverse only all the vowels in the string and return it. The vowels are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`, and they can appear in both lower and upper cases, more than once. **Example 1:** **Input:** s = "hello" **Output:** "holle" **Example 2:** **Input:** s = "leetcode" **Output:** "leotc...
null
Two Pointers,String
Easy
344,1089
417
welcome to midnight coding today we will solve the problem pacific atlantic water flow this is a graph problem but before we continue with our explanation please hit the like button as it will give you eternal luck and if you are looking into getting into any of the fan companies or big tech companies if you hit the li...
Pacific Atlantic Water Flow
pacific-atlantic-water-flow
There is an `m x n` rectangular island that borders both the **Pacific Ocean** and **Atlantic Ocean**. The **Pacific Ocean** touches the island's left and top edges, and the **Atlantic Ocean** touches the island's right and bottom edges. The island is partitioned into a grid of square cells. You are given an `m x n` i...
null
Array,Depth-First Search,Breadth-First Search,Matrix
Medium
null
23
have you ever completed a hard leak code problem well you're about to the problem is called merge K sorted lists you are given an array of K linked lists called lists and each linked list is sorted in ascending order we want to merge all the linked lists into one sorted linked list and return it we'll start the list of...
Merge k Sorted Lists
merge-k-sorted-lists
You are given an array of `k` linked-lists `lists`, each linked-list is sorted in ascending order. _Merge all the linked-lists into one sorted linked-list and return it._ **Example 1:** **Input:** lists = \[\[1,4,5\],\[1,3,4\],\[2,6\]\] **Output:** \[1,1,2,3,4,4,5,6\] **Explanation:** The linked-lists are: \[ 1->4...
null
Linked List,Divide and Conquer,Heap (Priority Queue),Merge Sort
Hard
21,264
86
hi everyone in this video we're going to go over another lead code question partition list major tech companies like google facebook microsoft linkedin are asking this question while they're conducting their technical interviews i hope you will find this video tutorial helpful for your technical preparation let's start...
Partition List
partition-list
Given the `head` of a linked list and a value `x`, partition it such that all nodes **less than** `x` come before nodes **greater than or equal** to `x`. You should **preserve** the original relative order of the nodes in each of the two partitions. **Example 1:** **Input:** head = \[1,4,3,2,5,2\], x = 3 **Output:**...
null
Linked List,Two Pointers
Medium
2265
1,010
Hello Everyone Come Have Hard Memorable New Year Celebration And You Must Have A Question S Westerners Videos Positive Video then subscribe to the Page if you liked The Video then subscribe to the Video then subscribe to subscribe and subscribe Airplane Mode Trick Interpretation Suresh Victim of Butt ee ki pedon song w...
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
1,235
hey everyone welcome back and let's write some more neat code today so today let's solve the problem maximum profit in job scheduling we're given n jobs each job has a start time and an end time as well as a profit associated with it the problem is that some of these jobs might overlap each other but we want to find th...
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
2
lead code problem tube add two numbers hey everyone this is keystrokes welcome back to the channel today we'll be solving lead code problem number two which is about adding two numbers represented by a link list lead code ranks this problem as medium so let's dive right into it so let's take a look at the problem state...
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
1,793
hey welcome to pomodora Joe for Sunday October 22nd 2023 today we're looking at lead code problem 1793 maximum score of a good subarray this is a hard problem all right we are given an array of integers nums zero indexed and an integer K all right so we have an array of integers and a number K the score of a subay i j ...
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
1,446
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 darts I'm coding they've been explanation near the end and for more context they'll be a link below on this actual screencast of the contest how did you do let me know you do hit the like button eith...
Consecutive Characters
angle-between-hands-of-a-clock
The **power** of the string is the maximum length of a non-empty substring that contains only one unique character. Given a string `s`, return _the **power** of_ `s`. **Example 1:** **Input:** s = "leetcode " **Output:** 2 **Explanation:** The substring "ee " is of length 2 with the character 'e' only. **Example ...
The tricky part is determining how the minute hand affects the position of the hour hand. Calculate the angles separately then find the difference.
Math
Medium
null
590
so hey guys what's up in this video we're going to see about a problem on lead code that is a post or traversal on the generic tree right so previously we have been discussing about the pre-order traversals about the pre-order traversals about the pre-order traversals the what is basically the genetry if you haven't wa...
N-ary Tree Postorder Traversal
n-ary-tree-postorder-traversal
Given the `root` of an n-ary tree, return _the postorder traversal of its nodes' values_. Nary-Tree input serialization is represented in their level order traversal. Each group of children is separated by the null value (See examples) **Example 1:** **Input:** root = \[1,null,3,2,4,null,5,6\] **Output:** \[5,6,3,2,...
null
null
Easy
null
674
hello everyone today we're going to be solving lead code question 674 longest continuous increasing subsequence this is a sliding window problem and we're given an unsorted array of integers nums and we're being asked to return the length of the longest continuous increasing subsequence so to put this into other words ...
Longest Continuous Increasing Subsequence
longest-continuous-increasing-subsequence
Given an unsorted array of integers `nums`, return _the length of the longest **continuous increasing subsequence** (i.e. subarray)_. The subsequence must be **strictly** increasing. A **continuous increasing subsequence** is defined by two indices `l` and `r` (`l < r`) such that it is `[nums[l], nums[l + 1], ..., num...
null
Array
Easy
673,727
1
in this episode from coding adventures we're gonna implement two sum coding puzzle from lead code so let's get started all right so we're looking here at this uh to some coding puzzle from lead code and this is an easy puzzle and let's read it before we start implementing it so basically we are given an array of intege...
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
899
Hey Everyone, So today we will do question number 6 of our Strings playlist, orderly queue, okay, I will not call it hard, actually, it is easy but tricky, okay, let's see why it is so, why is it not asked by Amazon, it is a good question and our input is something like this. The output is like this, so once we underst...
Orderly Queue
binary-gap
You are given a string `s` and an integer `k`. You can choose one of the first `k` letters of `s` and append it at the end of the string.. Return _the lexicographically smallest string you could have after applying the mentioned step any number of moves_. **Example 1:** **Input:** s = "cba ", k = 1 **Output:** "ac...
null
Math,Bit Manipulation
Easy
null
167
what solve leak code 167 to some to so we're given an input array that's already sorted in ascending order and we want to find two numbers that sum up to some target that we're also given so in this case the target is nine the two numbers that sum up to nine in this array are two and seven and we want to return the ind...
Two Sum II - Input Array Is Sorted
two-sum-ii-input-array-is-sorted
Given a **1-indexed** array of integers `numbers` that is already **_sorted in non-decreasing order_**, find two numbers such that they add up to a specific `target` number. Let these two numbers be `numbers[index1]` and `numbers[index2]` where `1 <= index1 < index2 <= numbers.length`. Return _the indices of the two n...
null
Array,Two Pointers,Binary Search
Medium
1,653,1083
1,365
Work in this field Ajay Ko That Hello Everyone Welcome to Your Own This Video Kiya Video Channel Problem Solve Any Problem Is Gautam Pawan Adhir And Hai Let's Get Your Problem Statement Problems That Is Vivek Roy Janam And Is According Point How Many Number Siddhi Are Is Mall Ardent Taste Is Point Name Side Effect Acco...
How Many Numbers Are Smaller Than the Current Number
how-many-numbers-are-smaller-than-the-current-number
Given the array `nums`, for each `nums[i]` find out how many numbers in the array are smaller than it. That is, for each `nums[i]` you have to count the number of valid `j's` such that `j != i` **and** `nums[j] < nums[i]`. Return the answer in an array. **Example 1:** **Input:** nums = \[8,1,2,2,3\] **Output:** \[4,...
null
null
Easy
null
264
Loot The Verses Saal Tak Koi Question Phanda Chips Company 30-day Challenge Question Awadhi Number Too 30-day Challenge Question Awadhi Number Too 30-day Challenge Question Awadhi Number Too Clear Question In SSC To Understand The Question From This YouTube Channel Interior This Printer In Tableau Number 9 Water Period...
Ugly Number II
ugly-number-ii
An **ugly number** is a positive integer whose prime factors are limited to `2`, `3`, and `5`. Given an integer `n`, return _the_ `nth` _**ugly number**_. **Example 1:** **Input:** n = 10 **Output:** 12 **Explanation:** \[1, 2, 3, 4, 5, 6, 8, 9, 10, 12\] is the sequence of the first 10 ugly numbers. **Example 2:** ...
The naive approach is to call isUgly for every number until you reach the nth one. Most numbers are not ugly. Try to focus your effort on generating only the ugly ones. An ugly number must be multiplied by either 2, 3, or 5 from a smaller ugly number. The key is how to maintain the order of the ugly numbers. Try a simi...
Hash Table,Math,Dynamic Programming,Heap (Priority Queue)
Medium
23,204,263,279,313,1307
161
welcome to my channel so in this video i'm going to cover the solution to this question do some love coding work at the same time i'm going to try to follow the general steps we should follow in a coding interview when i try to solve this problem so first of all let's restore this problem what added distance so given t...
One Edit Distance
one-edit-distance
Given two strings `s` and `t`, return `true` if they are both one edit distance apart, otherwise return `false`. A string `s` is said to be one distance apart from a string `t` if you can: * Insert **exactly one** character into `s` to get `t`. * Delete **exactly one** character from `s` to get `t`. * Replace *...
null
Two Pointers,String
Medium
72
303
hey everyone welcome back to my channel before we get started don't forget to click the Subscribe button if you want more videos about coding interviews so in this video we'll be solving the problem lead code range some query let's get started let's imagine we have a bunch of numbers and these numbers are all in one li...
Range Sum Query - Immutable
range-sum-query-immutable
Given an integer array `nums`, handle multiple queries of the following type: 1. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`. Implement the `NumArray` class: * `NumArray(int[] nums)` Initializes the object with the integer array `nums`. * ...
null
Array,Design,Prefix Sum
Easy
304,307,325
97
That Hello Hello Hello Welcome To The Second Of New Delhi And Aspirations In Turning Spring Intervention In This Very Famous Sexual Problem And Without Subscribe I Online Me Juice Pick Up In The Unsound Slide Show Interleaving Spring Cloud 9 7 To Questions Will Give three streams in total First way is Chief Basi Subscr...
Interleaving String
interleaving-string
Given strings `s1`, `s2`, and `s3`, find whether `s3` is formed by an **interleaving** of `s1` and `s2`. An **interleaving** of two strings `s` and `t` is a configuration where `s` and `t` are divided into `n` and `m` substrings respectively, such that: * `s = s1 + s2 + ... + sn` * `t = t1 + t2 + ... + tm` * `|...
null
String,Dynamic Programming
Medium
null
1,008
i 1008 construct binary search tree from pre-order traversal we turn the root pre-order traversal we turn the root pre-order traversal we turn the root node of a binary search tree that matches the given for your the traversal we call that binary search tree is a binary tree where every node any descendant of the known...
Construct Binary Search Tree from Preorder Traversal
binary-tree-cameras
Given an array of integers preorder, which represents the **preorder traversal** of a BST (i.e., **binary search tree**), construct the tree and return _its root_. It is **guaranteed** that there is always possible to find a binary search tree with the given requirements for the given test cases. A **binary search tr...
null
Dynamic Programming,Tree,Depth-First Search,Binary Tree
Hard
1021
1,721
hey everybody this is larry this is me going with weekly contest 223 question two swapping notes in the linked list so this one i think um in terms of algorithm i don't think there's anything tricky about it in terms of understanding you have a linked list you want to find two notes and then you want to swap them um i ...
Swapping Nodes in a Linked List
maximum-profit-of-operating-a-centennial-wheel
You are given the `head` of a linked list, and an integer `k`. Return _the head of the linked list after **swapping** the values of the_ `kth` _node from the beginning and the_ `kth` _node from the end (the list is **1-indexed**)._ **Example 1:** **Input:** head = \[1,2,3,4,5\], k = 2 **Output:** \[1,4,3,2,5\] **Ex...
Think simulation Note that the number of turns will never be more than 50 / 4 * n
Array,Simulation
Medium
null
374
374 guess number higher or lower so we are playing the guessing game the game is as follow I pick a number from 1 to n you have to guess which number I picked every time it gets wrong I will tell you whether the number I picked is higher or lower than your guess you call uh you call a predefined API into guests in whic...
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
203
hello everyone and welcome to another liquor question so we'll be doing a little easy question it is to remove linked list elements based on what is specified so given the head of a linked list and an integer value we have to remove all the nodes whereby the value by the node's value is the same as the value and then r...
Remove Linked List Elements
remove-linked-list-elements
Given the `head` of a linked list and an integer `val`, remove all the nodes of the linked list that has `Node.val == val`, and return _the new head_. **Example 1:** **Input:** head = \[1,2,6,3,4,5,6\], val = 6 **Output:** \[1,2,3,4,5\] **Example 2:** **Input:** head = \[\], val = 1 **Output:** \[\] **Example 3:**...
null
Linked List,Recursion
Easy
27,237,2216
300
hello guys and welcome back to lead Logics this is the longest increasing subsequence problem from lead code this is a lead code medium and the number for this is 300 so in the given problem we are given with an integer AR nums and we have to return the length of the longest strictly increasing subsequence so let's see...
Longest Increasing Subsequence
longest-increasing-subsequence
Given an integer array `nums`, return _the length of the longest **strictly increasing**_ _**subsequence**_. **Example 1:** **Input:** nums = \[10,9,2,5,3,7,101,18\] **Output:** 4 **Explanation:** The longest increasing subsequence is \[2,3,7,101\], therefore the length is 4. **Example 2:** **Input:** nums = \[0,1,...
null
Array,Binary Search,Dynamic Programming
Medium
334,354,646,673,712,1766,2096,2234
119
in this video we'll be going over pascal's triangle two so given integer row index return the row index row of the pascal triangle notice that the row index starts from zero so in this pascal triangle we have initially have a list of the value of one then for each additional row we have a one in the front and one at th...
Pascal's Triangle II
pascals-triangle-ii
Given an integer `rowIndex`, return the `rowIndexth` (**0-indexed**) row of the **Pascal's triangle**. In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown: **Example 1:** **Input:** rowIndex = 3 **Output:** \[1,3,3,1\] **Example 2:** **Input:** rowIndex = 0 **Output:** \[...
null
Array,Dynamic Programming
Easy
118,2324
137
Hello everyone today our question is single number two so in this question we first read this question what do we have to do ok so in this question we are given an array named names ok it has elements and which is present That is, first of all the elements are present three times but there is one element which is prese...
Single Number II
single-number-ii
Given an integer array `nums` where every element appears **three times** except for one, which appears **exactly once**. _Find the single element and return it_. You must implement a solution with a linear runtime complexity and use only constant extra space. **Example 1:** **Input:** nums = \[2,2,3,2\] **Output:**...
null
Array,Bit Manipulation
Medium
136,260
1,535
all right let's talk about finding winners over again so we're giving the integer rate array of distinct integer and integer k so basically you just have to keep comparing the first two integer and the smaller size will go back and if the integer left leg wins the k times we can actually return the number so this is a ...
Find the Winner of an Array Game
build-array-where-you-can-find-the-maximum-exactly-k-comparisons
Given an integer array `arr` of **distinct** integers and an integer `k`. A game will be played between the first two elements of the array (i.e. `arr[0]` and `arr[1]`). In each round of the game, we compare `arr[0]` with `arr[1]`, the larger integer wins and remains at position `0`, and the smaller integer moves to t...
Use dynamic programming approach. Build dp table where dp[a][b][c] is the number of ways you can start building the array starting from index a where the search_cost = c and the maximum used integer was b. Recursively, solve the small sub-problems first. Optimize your answer by stopping the search if you exceeded k cha...
Dynamic Programming
Hard
null
827
Have already gone to this welcome to our channel Tweet Sunny and you will be talking about apply very good problem Old meeting treatment from Ireland Mention ice as a problem Delhi total ok thinking problem is smart engine Google interviewer his problems really interesting than you can see The number of likes is used a...
Making A Large Island
expressive-words
You are given an `n x n` binary matrix `grid`. You are allowed to change **at most one** `0` to be `1`. Return _the size of the largest **island** in_ `grid` _after applying this operation_. An **island** is a 4-directionally connected group of `1`s. **Example 1:** **Input:** grid = \[\[1,0\],\[0,1\]\] **Output:** ...
null
Array,Two Pointers,String
Medium
null
1,567
Jhal Hello Everyone WhatsApp Hindi Depicting Problem Which Came In Today's List Ko Delhi Contact To Or Its Called National Anthem Survey Deposit Products Elements In The Positive Product Number And They Are Not Limited To 98100 Android C Institute For This Problem Lutave Products Ko Subscribe Indian 1008 Composition Eg...
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
312
hello friends today less of their birth blooms problem that first see the statement given a balloons index from 0 to n minus 1 each balloon is planted with a number only 2 represented by a right numbers you are asked to burst all the blooms if there you first blue line you will hear numbers left times numbers I times s...
Burst Balloons
burst-balloons
You are given `n` balloons, indexed from `0` to `n - 1`. Each balloon is painted with a number on it represented by an array `nums`. You are asked to burst all the balloons. If you burst the `ith` balloon, you will get `nums[i - 1] * nums[i] * nums[i + 1]` coins. If `i - 1` or `i + 1` goes out of bounds of the array, ...
null
Array,Dynamic Programming
Hard
1042
6
hey everyone welcome back and let's write some more neat code today so today let's solve elite code six another classic zigzag conversion i'm surprised it took us this long to solve this one but it's not super bad even though again it has a ton of dislikes but it's not the worst problem out there i've seen some much wo...
Zigzag Conversion
zigzag-conversion
The string `"PAYPALISHIRING "` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: `"PAHNAPLSIIGYIR "` Write the code that will take a string and make this co...
null
String
Medium
null
190
this is leak code reverse bits and although this problem says it's easy I think the optimal solution is not easy to think of we'll start with the easy solution and then go into the more difficult optimal solution after so the most obvious and easy solution is to start with our integer convert that to a binary string re...
Reverse Bits
reverse-bits
Reverse bits of a given 32 bits unsigned integer. **Note:** * Note that in some languages, such as Java, there is no unsigned integer type. In this case, both input and output will be given as a signed integer type. They should not affect your implementation, as the integer's internal binary representation is the s...
null
Divide and Conquer,Bit Manipulation
Easy
7,191,2238
802
Hello Hi Friends Welcome Back Today We Are Going To Solid Problem 802 Find Events To All Sections Aa Before You Go Through The Problem Description And Some Examples For I Just Want To Mention That My Channel Dedicated To Help People Preparing For Coding Interview More Interviews And My Channel More Than 210 Examples Wh...
Find Eventual Safe States
k-th-smallest-prime-fraction
There is a directed graph of `n` nodes with each node labeled from `0` to `n - 1`. The graph is represented by a **0-indexed** 2D integer array `graph` where `graph[i]` is an integer array of nodes adjacent to node `i`, meaning there is an edge from node `i` to each node in `graph[i]`. A node is a **terminal node** if...
null
Array,Binary Search,Heap (Priority Queue)
Hard
378,668,719
748
hey everyone today I'll be doing another lead code problem 748 shortest completing one this is an easy one we are given a license plate string and our world uh Birds which is an array of uh strings so we have to return the element which uses the most you can say words from the license plate in this case the license pla...
Shortest Completing Word
largest-number-at-least-twice-of-others
Given a string `licensePlate` and an array of strings `words`, find the **shortest completing** word in `words`. A **completing** word is a word that **contains all the letters** in `licensePlate`. **Ignore numbers and spaces** in `licensePlate`, and treat letters as **case insensitive**. If a letter appears more than...
Scan through the array to find the unique largest element `m`, keeping track of it's index `maxIndex`. Scan through the array again. If we find some `x != m` with `m < 2*x`, we should return `-1`. Otherwise, we should return `maxIndex`.
Array,Sorting
Easy
2274,2327
171
Hello hello everyone this is it code number 171 question is excel sheet columbus question state bank giver ministry in different types of ap arvind person appointed for obscene item number and number of the number one is the amazing number ok subscribe first time in the history and Subscribe hospital le tu capital edit...
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
16
what's up guys xavier elon here i go over hack rank and leak code tutorial so check out my channel subscribe if you haven't already and please hit that like button so i can grow this channel um it helps a lot actually today i'm going over threesome closest so i'm finally like recovering from coved so i feel good um i'm...
3Sum Closest
3sum-closest
Given an integer array `nums` of length `n` and an integer `target`, find three integers in `nums` such that the sum is closest to `target`. Return _the sum of the three integers_. You may assume that each input would have exactly one solution. **Example 1:** **Input:** nums = \[-1,2,1,-4\], target = 1 **Output:** ...
null
Array,Two Pointers,Sorting
Medium
15,259
1,458
Hey guys welcome and welcome back to my youtube 1 of 2 look at all the sequences wherever all the sequences come then it should come to your mind that brother Rickson will definitely be engaged because look where all the sequences come there we have the option. They are like yes ok take this element or don't take this ...
Max Dot Product of Two Subsequences
sort-integers-by-the-number-of-1-bits
Given two arrays `nums1` and `nums2`. Return the maximum dot product between **non-empty** subsequences of nums1 and nums2 with the same length. A subsequence of a array is a new array which is formed from the original array by deleting some (can be none) of the characters without disturbing the relative positions of...
Simulate the problem. Count the number of 1's in the binary representation of each integer. Sort by the number of 1's ascending and by the value in case of tie.
Array,Bit Manipulation,Sorting,Counting
Easy
2204
1,198
hi everyone with Calvin here so let's discuss about beauty contest 9 third question find smallest common element in on all row so we are given a matrix mat and then every row have sought that increasing order and we've been asked to return the smallest common element in all row and otherwise we written a minus 1 if the...
Find Smallest Common Element in All Rows
unpopular-books
Given an `m x n` matrix `mat` where every row is sorted in **strictly** **increasing** order, return _the **smallest common element** in all rows_. If there is no common element, return `-1`. **Example 1:** **Input:** mat = \[\[1,2,3,4,5\],\[2,4,5,8,10\],\[3,5,7,9,11\],\[1,3,5,7,9\]\] **Output:** 5 **Example 2:** ...
null
Database
Medium
null
206
hello guys welcome to algorithms Made Easy my name is Richard and today we will be discussing the question reverse linked list in this question we are given a head of a singly linked list and we need to reverse the list and return the reverse list in this video we'll discuss how we can solve this problem both recursive...
Reverse Linked List
reverse-linked-list
Given the `head` of a singly linked list, reverse the list, and return _the reversed list_. **Example 1:** **Input:** head = \[1,2,3,4,5\] **Output:** \[5,4,3,2,1\] **Example 2:** **Input:** head = \[1,2\] **Output:** \[2,1\] **Example 3:** **Input:** head = \[\] **Output:** \[\] **Constraints:** * The number...
null
Linked List,Recursion
Easy
92,156,234,2196,2236
922
Loot Electronic Now let's talk about A Letter Problem 102 which is clear shot amazed toe problems statement say give and drop integers notification try to explain more subscribe then we put in this then we should leave it like I appointed here then I will put it in and if it happened then five I find one number inducti...
Sort Array By Parity II
possible-bipartition
Given an array of integers `nums`, half of the integers in `nums` are **odd**, and the other half are **even**. Sort the array so that whenever `nums[i]` is odd, `i` is **odd**, and whenever `nums[i]` is even, `i` is **even**. Return _any answer array that satisfies this condition_. **Example 1:** **Input:** nums =...
null
Depth-First Search,Breadth-First Search,Union Find,Graph
Medium
null
61
now we're going to solve according interview problem rotate list you're given a linked list rotate the list to the right by k plus h where k is non-negative h where k is non-negative h where k is non-negative for example let's suppose that we're given this linked list and k equals to 2. now we have to rotate this linke...
Rotate List
rotate-list
Given the `head` of a linked list, rotate the list to the right by `k` places. **Example 1:** **Input:** head = \[1,2,3,4,5\], k = 2 **Output:** \[4,5,1,2,3\] **Example 2:** **Input:** head = \[0,1,2\], k = 4 **Output:** \[2,0,1\] **Constraints:** * The number of nodes in the list is in the range `[0, 500]`. * ...
null
Linked List,Two Pointers
Medium
189,725
747
Hello friends, welcome to the 16th day of the challenge. Our challenge is going very well, many people are coming and joining, it is feeling very good. In this way, you guys keep supporting us, we will keep bringing such challenges today. Our day is 16, let's solve our problem on the end screen. Okay, so the number of ...
Largest Number At Least Twice of Others
min-cost-climbing-stairs
You are given an integer array `nums` where the largest integer is **unique**. Determine whether the largest element in the array is **at least twice** as much as every other number in the array. If it is, return _the **index** of the largest element, or return_ `-1` _otherwise_. **Example 1:** **Input:** nums = \[3...
Say f[i] is the final cost to climb to the top from step i. Then f[i] = cost[i] + min(f[i+1], f[i+2]).
Array,Dynamic Programming
Easy
70
102
all right this lead code question is called binary tree level order traversal it says given a binary tree return the level order traversal of its nodes values meaning from left to right level by level so for example if we have this binary tree which is 3 9 2015 7 will return its level order traversal which is pretty mu...
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
62
hi everyone in this video Let's solve lead code problem number 62 unique parts so we are given a grid M by n grit and a robot is placed at the top left position which is the start position and we are asked to find the number of unique ways that the robot can reach from the start position to the finish position and the ...
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
877
hey there welcome back to lead coding so i was recently solving the stone game seven which appeared in one of the recent contest and i already had video for stone game three four and five so i thought why don't we complete the entire list starting from the stone game one till the stone game seven so now we are at the s...
Stone Game
shortest-path-visiting-all-nodes
Alice and Bob play a game with piles of stones. There are an **even** number of piles arranged in a row, and each pile has a **positive** integer number of stones `piles[i]`. The objective of the game is to end with the most stones. The **total** number of stones across all the piles is **odd**, so there are no ties. ...
null
Dynamic Programming,Bit Manipulation,Breadth-First Search,Graph,Bitmask
Hard
null
957
Hello Guys Welcome To Illusion Time Disney Today We Will Go Through Death Problems From July Recording Challenge Various Sales Of Friends Please Like This Video N You Don't Forget To Subscribe To This Channel Sweater Never Miss Any Update Sometime 8170 And It's York Reminder West Is The Vedic Times After They Can Chang...
Prison Cells After N Days
minimum-add-to-make-parentheses-valid
There are `8` prison cells in a row and each cell is either occupied or vacant. Each day, whether the cell is occupied or vacant changes according to the following rules: * If a cell has two adjacent neighbors that are both occupied or both vacant, then the cell becomes occupied. * Otherwise, it becomes vacant. ...
null
String,Stack,Greedy
Medium
2095
49
Hello Hi B110 Welcome To The Video Tutorial Solution Of And Top Interview Problem Group And Drums Sidhi Like This 043 Subscribe This Problem Is Very Famous In More Like Every Top Company Limited Company No Problem Very Important Basic Programming And Understand This To Avoid Giving Of Strength Of All in One Group Meena...
Group Anagrams
group-anagrams
Given an array of strings `strs`, group **the anagrams** together. You can return the answer in **any order**. An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. **Example 1:** **Input:** strs = \["eat","tea","tan...
null
Hash Table,String,Sorting
Medium
242,249