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 |
|---|---|---|---|---|---|---|---|---|
424 | So today we have given our 71st Longest Repeating Character Replacement Question of Blind 75, which is of medium type and you will understand it easily. We have given the string S and wait for K. So look here, we have taken S and K. For string level and integer, now these are uppercase letters of English, so it is writ... | Longest Repeating Character Replacement | longest-repeating-character-replacement | You are given a string `s` and an integer `k`. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most `k` times.
Return _the length of the longest substring containing the same letter you can get after performing the above operations_.
... | null | Hash Table,String,Sliding Window | Medium | 340,1046,2119,2134,2319 |
278 | hey how's it going guys and welcome to techsoup uh today we're going over the 277 8 question back uh first bat version uh so your product manager and currently leading a team to develop a new product unfortunately the latest version of your products fills the quality check since each version is developed based on the p... | First Bad Version | first-bad-version | You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.
Suppose you have `n` versions `[1, 2, ..., n]` an... | null | Binary Search,Interactive | Easy | 34,35,374 |
593 | Jhaal Hello Hi Guys Welcome to Kota Students Question is well it's there in this question Vriddhi Coordinator for points in to-do space Person 1234 points in to-do space Person 1234 points in to-do space Person 1234 Point consists of and not recorded Nav of point is represented by entry Are Bittu in tiers for example t... | Valid Square | valid-square | Given the coordinates of four points in 2D space `p1`, `p2`, `p3` and `p4`, return `true` _if the four points construct a square_.
The coordinate of a point `pi` is represented as `[xi, yi]`. The input is **not** given in any order.
A **valid square** has four equal sides with positive length and four equal angles (9... | null | Math,Geometry | Medium | null |
206 | So the name of the question is Reverse Gender List. This question will be found as question number 206. I will give its link in the description. You can go and solve it. This is a very fundamental question. The link list has to be reversed. This question is never asked directly in the interview. But there are many such... | 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 |
295 | hey there and welcome to another Elite code problem so today we're going to be doing problem number 295 find median from data stream it's definitely a popular Pro problem I think it might actually be on the top 75 I'm not really sure about that but let's get into it so the median is the middle value in an unordered int... | Find Median from Data Stream | find-median-from-data-stream | The **median** is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two middle values.
* For example, for `arr = [2,3,4]`, the median is `3`.
* For example, for `arr = [2,3]`, the median is `(2 + 3) / 2 = 2.5`.
Implement the M... | null | Two Pointers,Design,Sorting,Heap (Priority Queue),Data Stream | Hard | 480,1953,2207 |
113 | hey everybody this is Larry this is day 24 of delete code daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's Forum no haven't gotten any free points lately or coins or whatever anyway today's poem is perhaps some two 113. all right so we turn all woo... | Path Sum II | path-sum-ii | Given the `root` of a binary tree and an integer `targetSum`, return _all **root-to-leaf** paths where the sum of the node values in the path equals_ `targetSum`_. Each path should be returned as a list of the node **values**, not node references_.
A **root-to-leaf** path is a path starting from the root and ending at... | null | Backtracking,Tree,Depth-First Search,Binary Tree | Medium | 112,257,437,666,2217 |
202 | hey guys it's 3am and we're gonna do some really cut so on today's question I'm going to do happy numbers which is an easy question that's normally used by Google for their interviews write an algorithm to determine if a number n is happy a happy number is a number defined by the following process so starting with any ... | Happy Number | happy-number | Write an algorithm to determine if a number `n` is happy.
A **happy number** is a number defined by the following process:
* Starting with any positive integer, replace the number by the sum of the squares of its digits.
* Repeat the process until the number equals 1 (where it will stay), or it **loops endlessly ... | null | Hash Table,Math,Two Pointers | Easy | 141,258,263,2076 |
34 | hey everyone welcome back and let's write some more neat code today so today let's solve first and last position of an element in a sorted array so we're given an array of numbers and they're in sorted order in ascending order and we just want to find a certain value so a target value that we're looking for and we want... | Find First and Last Position of Element in Sorted Array | find-first-and-last-position-of-element-in-sorted-array | Given an array of integers `nums` sorted in non-decreasing order, find the starting and ending position of a given `target` value.
If `target` is not found in the array, return `[-1, -1]`.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[5,7,7,8,8,10\], target = 8
*... | null | Array,Binary Search | Medium | 278,2165,2210 |
123 | 200 Hello everyone, now I have come to the best time to buy and sell stock. It is good for problem solvers and those who have accidents. Problem Z buy sell is its president's point. This point is a variation of it. Twice you can buy any stock and peel it and after doing once you can do the second start bike then subscr... | 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 |
242 | everyone welcome back and let's write some more neat code today so today let's solve the problem valid anagram and we're actually going to be solving this a few different ways so maybe you will learn something today so we're given two strings s and t and we want to return true if t is an anagram of s or basically if bo... | Valid Anagram | valid-anagram | Given two strings `s` and `t`, return `true` _if_ `t` _is an anagram of_ `s`_, and_ `false` _otherwise_.
An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
**Example 1:**
**Input:** s = "anagram", t = "nagaram"
**... | null | Hash Table,String,Sorting | Easy | 49,266,438 |
167 | everyone welcome to Tech wired in this lead Court Series today we are going to see two sum with the input array is sorted many people skip this particular problem due to it's not that much famous but they since they are not solving this particular problem they are struggled with threesome so first we will see how to so... | 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 |
126 | Hello Viewers Welcome Back To Decades And This Video Will See The WhatsApp To Problem World Record 30th June Challenge 16 Personal Problem Veer The In The World Must Be Constructed From Subscribed Next 9 News One Example To Give Two Example Which Nothing and no weir top national board of directors and dictionary presen... | Word Ladder II | word-ladder-ii | A **transformation sequence** from word `beginWord` to word `endWord` using a dictionary `wordList` is a sequence of words `beginWord -> s1 -> s2 -> ... -> sk` such that:
* Every adjacent pair of words differs by a single letter.
* Every `si` for `1 <= i <= k` is in `wordList`. Note that `beginWord` does not need ... | null | Hash Table,String,Backtracking,Breadth-First Search | Hard | 127,2276 |
142 | hello everyone let's follow the code 142 link list cycle two given the head of a link list return the not where the cycle begins if there is no cycle return null there is a cycle in link list if there is some note in the list that can be reached Again by continuously move following the next pointer internally POS is us... | 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,836 | welcome back to Taco Jess today's question is leak code 1836 remove duplicates from an unsorted linked list so we're given ahead of a linked list and we need to find all the values that appear more than once in the list and delete the nodes that have any of those values and then return the link list after the deletions... | Remove Duplicates From an Unsorted Linked List | count-ways-to-make-array-with-product | Given the `head` of a linked list, find all the values that appear **more than once** in the list and delete the nodes that have any of those values.
Return _the linked list after the deletions._
**Example 1:**
**Input:** head = \[1,2,3,2\]
**Output:** \[1,3\]
**Explanation:** 2 appears twice in the linked list, so ... | Prime-factorize ki and count how many ways you can distribute the primes among the ni positions. After prime factorizing ki, suppose there are x amount of prime factor. There are (x + n - 1) choose (n - 1) ways to distribute the x prime factors into k positions, allowing repetitions. | Array,Math,Dynamic Programming | Hard | null |
90 | hi everyone today we are going to solve the little code question subset 2. so the other day i solved the subsets 1 so i put the link in the description below you can check it later so the difference between subsets 1 and subset 2 is subset 2 has a duplicate number but the solution set must not contain duplicate subset ... | Subsets II | subsets-ii | Given an integer array `nums` that may contain duplicates, return _all possible_ _subsets_ _(the power set)_.
The solution set **must not** contain duplicate subsets. Return the solution in **any order**.
**Example 1:**
**Input:** nums = \[1,2,2\]
**Output:** \[\[\],\[1\],\[1,2\],\[1,2,2\],\[2\],\[2,2\]\]
**Example... | null | Array,Backtracking,Bit Manipulation | Medium | 78,2109 |
48 | hello everyone welcome to my channel coding together my name is vikas Puja today we will see another loot code problem that is rotate image it's a middle level question medium level question and it's a very popular question as you can see from the likes so we are given with an N cross n 2D Matrix representing an image ... | Rotate Image | rotate-image | You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise).
You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati... | null | Array,Math,Matrix | Medium | 2015 |
11 | hi everyone welcome to my channel if you like this video please give a like and subscribe that helps a lot in this problem we have n vertical lines for example we have seven lines here we can use two lines together with the x axis to form a container like line three and six and it's asking us to find two lines so that ... | Container With Most Water | container-with-most-water | You are given an integer array `height` of length `n`. There are `n` vertical lines drawn such that the two endpoints of the `ith` line are `(i, 0)` and `(i, height[i])`.
Find two lines that together with the x-axis form a container, such that the container contains the most water.
Return _the maximum amount of water... | The aim is to maximize the area formed between the vertical lines. The area of any container is calculated using the shorter line as length and the distance between the lines as the width of the rectangle.
Area = length of shorter vertical line * distance between lines
We can definitely get the maximum width ... | Array,Two Pointers,Greedy | Medium | 42 |
1,617 | hey what's up guys this is juan here so today uh let's take a look at uh the last problem of this week's weekly contest which is 1617 count subtrees with max distance between cities um i think this is a great problem you know it's a good heart problem here so it's a tree or graph problem basically you know basically th... | Count Subtrees With Max Distance Between Cities | stone-game-iv | There are `n` cities numbered from `1` to `n`. You are given an array `edges` of size `n-1`, where `edges[i] = [ui, vi]` represents a bidirectional edge between cities `ui` and `vi`. There exists a unique path between each pair of cities. In other words, the cities form a **tree**.
A **subtree** is a subset of cities ... | Use dynamic programming to keep track of winning and losing states. Given some number of stones, Alice can win if she can force Bob onto a losing state. | Math,Dynamic Programming,Game Theory | Hard | 1685,1788,1808,2002,2156 |
1,041 | Jhaal Hello Hi Guys Welcome To Code Special Today's Question Is Robot Bond Inner Circle In This Question Were Given In Forest Land And Robot Standing And Explain Robot Initially Place 80 And His Place In North Side Heart Robot Candy Vegetable Infections That Is Festival Means Creative One Unit Head In Which Differs In ... | Robot Bounded In Circle | available-captures-for-rook | On an infinite plane, a robot initially stands at `(0, 0)` and faces north. Note that:
* The **north direction** is the positive direction of the y-axis.
* The **south direction** is the negative direction of the y-axis.
* The **east direction** is the positive direction of the x-axis.
* The **west direction**... | null | Array,Matrix,Simulation | Easy | null |
791 | Today we are going to solve lead code problem number 791 on custom s string y, we have been given two strings, one is order, second is s and all the characters on order are unique and what is this order, what does it tell, dependency of character, then which one. Which character will come first, which character will co... | Custom Sort String | split-bst | You are given two strings order and s. All the characters of `order` are **unique** and were sorted in some custom order previously.
Permute the characters of `s` so that they match the order that `order` was sorted. More specifically, if a character `x` occurs before a character `y` in `order`, then `x` should occur ... | Use recursion. If root.val <= V, you split root.right into two halves, then join it's left half back on root.right. | Tree,Binary Search Tree,Recursion,Binary Tree | Medium | 450 |
383 | um hello so today we are going to do this problem ransom note which is part of fleet code daily challenge so um we'll get around 70 string and the magazine string and we want to return true if ransom node can be constructed by using letters from magazine right so if we can construct it by using letters from magazine we... | Ransom Note | ransom-note | Given two strings `ransomNote` and `magazine`, return `true` _if_ `ransomNote` _can be constructed by using the letters from_ `magazine` _and_ `false` _otherwise_.
Each letter in `magazine` can only be used once in `ransomNote`.
**Example 1:**
**Input:** ransomNote = "a", magazine = "b"
**Output:** false
**Example ... | null | Hash Table,String,Counting | Easy | 691 |
207 | hello guys today we are going to see the lead code question 207 that is course schedule there is a total of numm courses you have to take lbel Z to count num courses minus one you are given an array prerequisites where prerequisites I is equal to a i bi indicates that you must take course bi if you want to take course ... | 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 |
6 | okay hi everyone today we're going to solve this problem that is uh lead code six zigzag conversion it's a very classic problem and as you can see it is a medium level problem and it has a lot of dislikes like I think the ratio is not very good uh it's below one or maybe below you know like basically this is not a good... | 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,074 | welcome to april's lego challenge today's problem is number of sub matrices that sum to target given a matrix and target we turn the number of non-empty sum matrices that number of non-empty sum matrices that number of non-empty sum matrices that sum to target some matrix x1 y1 x2 y2 is the set of all cells with x 1 be... | Number of Submatrices That Sum to Target | high-five | Given a `matrix` and a `target`, return the number of non-empty submatrices that sum to target.
A submatrix `x1, y1, x2, y2` is the set of all cells `matrix[x][y]` with `x1 <= x <= x2` and `y1 <= y <= y2`.
Two submatrices `(x1, y1, x2, y2)` and `(x1', y1', x2', y2')` are different if they have some coordinate that is... | How can we solve the problem if we have just one student? Given an student sort their grades and get the top 5 average. Generalize the idea to do it for many students. | Array,Hash Table,Sorting | Easy | null |
845 | hey everybody this is abe in this video we are going to solve a problem called the longest mountain in array so rather than reading the whole question i'll just simply explain you what it says so uh in this question called longest mountain in array we will be given an array here we have the same array as we have seen i... | Longest Mountain in Array | longest-mountain-in-array | You may recall that an array `arr` is a **mountain array** if and only if:
* `arr.length >= 3`
* There exists some index `i` (**0-indexed**) 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 - 1]`
Given an integer arr... | null | null | Medium | null |
1,374 | hey everyone i'll be going over uh leeco problem 1374 generate a string with characters that have odd counts so this one's uh worded very weirdly that's got a lot of dislikes so i'm going to do it anyways just because i don't know i really doubt this would come up in an interview but basically what you have to do is uh... | Generate a String With Characters That Have Odd Counts | leftmost-column-with-at-least-a-one | Given an integer `n`, _return a string with `n` characters such that each character in such string occurs **an odd number of times**_.
The returned string must contain only lowercase English letters. If there are multiples valid strings, return **any** of them.
**Example 1:**
**Input:** n = 4
**Output:** "pppz "
**... | 1. (Binary Search) For each row do a binary search to find the leftmost one on that row and update the answer. 2. (Optimal Approach) Imagine there is a pointer p(x, y) starting from top right corner. p can only move left or down. If the value at p is 0, move down. If the value at p is 1, move left. Try to figure out th... | Array,Binary Search,Matrix,Interactive | Medium | null |
896 | Hello Friends Hindi Shikshan Be Appointed As One Of The Simplest To Problem Monitor Nick Are You Will Give Anti Are Identified A Monitor Are Not What Is Monitoring Should Shoulder Elements Of Order Completely In Increasing Order Ascending Order Consider Increasing Pimple Are All Elements Or Increasing Order Only 100 Gi... | Monotonic Array | smallest-subtree-with-all-the-deepest-nodes | An array is **monotonic** if it is either monotone increasing or monotone decreasing.
An array `nums` is monotone increasing if for all `i <= j`, `nums[i] <= nums[j]`. An array `nums` is monotone decreasing if for all `i <= j`, `nums[i] >= nums[j]`.
Given an integer array `nums`, return `true` _if the given array is ... | null | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
698 | welcome to september's leco challenge this problem is called partition to k equals sum subsets given an integer array nums and an integer k return true if it is possible to divide this array into k non-empty to divide this array into k non-empty to divide this array into k non-empty subsets whose sums are all equal for... | Partition to K Equal Sum Subsets | partition-to-k-equal-sum-subsets | Given an integer array `nums` and an integer `k`, return `true` if it is possible to divide this array into `k` non-empty subsets whose sums are all equal.
**Example 1:**
**Input:** nums = \[4,3,2,3,5,2,1\], k = 4
**Output:** true
**Explanation:** It is possible to divide it into 4 subsets (5), (1, 4), (2,3), (2,3) w... | We can figure out what target each subset must sum to. Then, let's recursively search, where at each call to our function, we choose which of k subsets the next value will join. | Array,Dynamic Programming,Backtracking,Bit Manipulation,Memoization,Bitmask | Medium | 416,2135 |
275 | hello everyone my name is Eric today I want to talk about the code daily challenge on June 18th h-index to these problems we want to h-index to these problems we want to h-index to these problems we want to calculate in 18 days for scientists and what is knowledge index 18 test means a scientist has ended H if H of his... | H-Index II | h-index-ii | Given an array of integers `citations` where `citations[i]` is the number of citations a researcher received for their `ith` paper and `citations` is sorted in **ascending order**, return _the researcher's h-index_.
According to the [definition of h-index on Wikipedia](https://en.wikipedia.org/wiki/H-index): The h-ind... | Expected runtime complexity is in O(log n) and the input is sorted. | Array,Binary Search | Medium | 274 |
338 | Hello Welcome To Exit Polls Today This Video Will Discuss List Code Number 338 Counting Will Not Active Number Name Number Ranges From 0291 Representation On That And You Will Have To Examples Subscribe For Example This Question Se Account Number Of Set The Number Of Way From 202 A S N Fatich Vihar Two Representatives ... | 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 |
1,190 | Our question meter which is the striker question and digit description of Ajay who is performing is this question number one which is the edit description of Ajay who is performing is this question number one which is the edit description of Ajay who is performing is this question number one which is the edit question ... | Reverse Substrings Between Each Pair of Parentheses | smallest-common-region | You are given a string `s` that consists of lower case English letters and brackets.
Reverse the strings in each pair of matching parentheses, starting from the innermost one.
Your result should **not** contain any brackets.
**Example 1:**
**Input:** s = "(abcd) "
**Output:** "dcba "
**Example 2:**
**Input:** s... | Try to model the problem as a graph problem. The given graph is a tree. The problem is reduced to finding the lowest common ancestor of two nodes in a tree. | Array,Hash Table,String,Tree,Depth-First Search,Breadth-First Search | Medium | 235,236 |
229 | wait are you worried about lead code daily challenge batches your profile does not have such batches don't worry runtime error brings a solution for everyday's lead code daily challenge problem solution so do subscribe the runtime error so that your profile can have such batches so lead code problem of the day solution... | Majority Element II | majority-element-ii | Given an integer array of size `n`, find all elements that appear more than `⌊ n/3 ⌋` times.
**Example 1:**
**Input:** nums = \[3,2,3\]
**Output:** \[3\]
**Example 2:**
**Input:** nums = \[1\]
**Output:** \[1\]
**Example 3:**
**Input:** nums = \[1,2\]
**Output:** \[1,2\]
**Constraints:**
* `1 <= nums.length <... | How many majority elements could it possibly have?
Do you have a better hint? Suggest it! | Array,Hash Table,Sorting,Counting | Medium | 169,1102 |
1,010 | yeahyeah Hello everyone lullabies programmers today I will introduce to you a problem titled pairs of songs with a total length divisible by 60 we have the problem We only know the following: 60 we have the problem We only know the following: 60 we have the problem We only know the following: in a list of songs, the le... | 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 |
349 | Okay, so first of all what we do is look at its braid force and then let's see how to find its intersection of 2s. So first of all what will be the intersection of 2s. Basically whatever are the common elements between these two, that too for this we will Okay, so what is going to be their intersection? What is the com... | Intersection of Two Arrays | intersection-of-two-arrays | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must be **unique** and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2\]
**Example 2:**
**Input:** nums1 = \[4,9,5\], nums2 = \... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 350,1149,1392,2190,2282 |
933 | Jhaal Hello Hi Guys Welcome To Code Vaishnav Today's Question This Number And This And Calls In This Question Being Given Recent Counter Class Which Country Number Of Recent Request With In A Certain Time SIM View To Implement Recent Counter Class In This Will Given Two Functions Vs Encounter Deprisal converter adventu... | Number of Recent Calls | increasing-order-search-tree | You have a `RecentCounter` class which counts the number of recent requests within a certain time frame.
Implement the `RecentCounter` class:
* `RecentCounter()` Initializes the counter with zero recent requests.
* `int ping(int t)` Adds a new request at time `t`, where `t` represents some time in milliseconds, a... | null | Stack,Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | null |
70 | hello everybody welcome to my channel today is the last day of july challenge and the problem is climbing stairs are you excited for another monthly challenge and share your experience how your experience with this july challenge in the comment section you are climbing a staircase it takes any steps to reach to the top... | 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 |
80 | okay so let's try the next coding exercise so open the lead and go to the so open the lead and go to the so open the lead and go to the problems tab and in the search question number 80 hit enter so you will find this question like uh remove duplicates from sorted array it's come under the medium category so click on i... | Remove Duplicates from Sorted Array II | remove-duplicates-from-sorted-array-ii | Given an integer array `nums` sorted in **non-decreasing order**, remove some duplicates [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm) such that each unique element appears **at most twice**. The **relative order** of the elements should be kept the **same**.
Since it is impossible to change the len... | null | Array,Two Pointers | Medium | 26 |
343 | everybody so today we are going to first learn what is DP then we are going to solve today's lead code problem so while learning DP most of you get scared you should be just kidding so if you are trying to learn DP this video is going to be a gold mine for you guys so let's start basically dynamic programming means you... | Integer Break | integer-break | Given an integer `n`, break it into the sum of `k` **positive integers**, where `k >= 2`, and maximize the product of those integers.
Return _the maximum product you can get_.
**Example 1:**
**Input:** n = 2
**Output:** 1
**Explanation:** 2 = 1 + 1, 1 \* 1 = 1.
**Example 2:**
**Input:** n = 10
**Output:** 36
**Exp... | There is a simple O(n) solution to this problem. You may check the breaking results of n ranging from 7 to 10 to discover the regularities. | Math,Dynamic Programming | Medium | 1936 |
1,793 | hello guys and welcome back to lead Logics this is the maximum score of a good array it is a lead code hard but it won't be a hard problem if you watch the video till this end because I'm going to tell you a super simple approach to this problem so the number for this is 1793 in this question you are given with an arra... | 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 |
271 | hey everyone in this video let's take a look at question 271 encode and decode strings only code this is part of a blind 75 list of questions so let's begin now this question is actually a premium question and that's why we're doing it on the lint code website that's why the number here is different but otherwise the q... | Encode and Decode Strings | encode-and-decode-strings | Design an algorithm to encode **a list of strings** to **a string**. The encoded string is then sent over the network and is decoded back to the original list of strings.
Machine 1 (sender) has the function:
string encode(vector strs) {
// ... your code
return encoded\_string;
}
Machine 2 (receiver) has the func... | null | Array,String,Design | Medium | 38,297,443,696 |
1,260 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem shift 2d grid we're given a 2d grid of dimensions m by n and we're given an integer k we need to shift the grid k times now a shift operation is more simple than it might seems you can read this description to get the p... | Shift 2D Grid | day-of-the-year | Given a 2D `grid` of size `m x n` and an integer `k`. You need to shift the `grid` `k` times.
In one shift operation:
* Element at `grid[i][j]` moves to `grid[i][j + 1]`.
* Element at `grid[i][n - 1]` moves to `grid[i + 1][0]`.
* Element at `grid[m - 1][n - 1]` moves to `grid[0][0]`.
Return the _2D grid_ after... | Have a integer array of how many days there are per month. February gets one extra day if its a leap year. Then, we can manually count the ordinal as day + (number of days in months before this one). | Math,String | Easy | null |
1,008 | thank you so in this video we are going to construct binary search TV if you have given already the pre-order version so given already the pre-order version so given already the pre-order version so let me understand what is the pre-order let me understand what is the pre-order let me understand what is the pre-order d... | 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 |
450 | hey guys welcome back to my channel and i'm back again with another really interesting coding interview question video this time guys we are going to solve question number 450 delete node in a binary search tree before i start with the video guys just want to request you that if you have not yet subscribed to my channe... | Delete Node in a BST | delete-node-in-a-bst | Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return _the **root node reference** (possibly updated) of the BST_.
Basically, the deletion can be divided into two stages:
1. Search for a node to remove.
2. If the node is found, delete the node.
**Example 1:**
**Inpu... | null | Tree,Binary Search Tree,Binary Tree | Medium | 791 |
155 | okay let's talk about mistake so for me style you are going to implement a step class and what you actually need to do is uh you have push up top and get main function so this is the function you have right um for the example i'm just talking about the example so if you have stacked so you have push negative two and yo... | Min Stack | min-stack | Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
Implement the `MinStack` class:
* `MinStack()` initializes the stack object.
* `void push(int val)` pushes the element `val` onto the stack.
* `void pop()` removes the element on the top of the stack.
* `int top(... | Consider each node in the stack having a minimum value. (Credits to @aakarshmadhavan) | Stack,Design | Easy | 239,716 |
368 | what's up everybody today let's solve the question 368 largest divisable subset this is the February 9th of the Lego daily challenge so we're given a set of a distinct positive integers array nums and we're trying to return the largest subset answer that every pair within this answer is either answer I mod answer J is ... | Largest Divisible Subset | largest-divisible-subset | Given a set of **distinct** positive integers `nums`, return the largest subset `answer` such that every pair `(answer[i], answer[j])` of elements in this subset satisfies:
* `answer[i] % answer[j] == 0`, or
* `answer[j] % answer[i] == 0`
If there are multiple solutions, return any of them.
**Example 1:**
**Inp... | null | Array,Math,Dynamic Programming,Sorting | Medium | null |
1,481 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem number of unique integers after K removals so I'm going to show you a couple solutions for this problem but more importantly I'm going to raise a couple points that hopefully make you realize that coding interviews can ... | Least Number of Unique Integers after K Removals | students-with-invalid-departments | Given an array of integers `arr` and an integer `k`. Find the _least number of unique integers_ after removing **exactly** `k` elements**.**
**Example 1:**
**Input:** arr = \[5,5,4\], k = 1
**Output:** 1
**Explanation**: Remove the single 4, only 5 is left.
**Example 2:**
**Input:** arr = \[4,3,1,1,3,3,2\], k = 3
*... | null | Database | Easy | null |
226 | boys up nerds xavier elan here i hope everybody's being productive during this quarantine I know I've been getting a lot of work done I'm actually gonna be doing a few videos every week so please subscribe to my channel if you haven't already so today I'm going over invert binary tree I chose this one because I just th... | Invert Binary Tree | invert-binary-tree | Given the `root` of a binary tree, invert the tree, and return _its root_.
**Example 1:**
**Input:** root = \[4,2,7,1,3,6,9\]
**Output:** \[4,7,2,9,6,3,1\]
**Example 2:**
**Input:** root = \[2,1,3\]
**Output:** \[2,3,1\]
**Example 3:**
**Input:** root = \[\]
**Output:** \[\]
**Constraints:**
* The number of n... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
67 | hello everyone let's take a look at the code 67 and finally it's a very popular interview on question especially for facebook and as we can see it's easy problem but um it's not that easy to write like claim your passcode and if we meet this problem in the interview like we better to prevent like writing any box so we ... | Add Binary | add-binary | Given two binary strings `a` and `b`, return _their sum as a binary string_.
**Example 1:**
**Input:** a = "11", b = "1"
**Output:** "100"
**Example 2:**
**Input:** a = "1010", b = "1011"
**Output:** "10101"
**Constraints:**
* `1 <= a.length, b.length <= 104`
* `a` and `b` consist only of `'0'` or `'1'` chara... | null | Math,String,Bit Manipulation,Simulation | Easy | 2,43,66,1031 |
295 | Ajay Ko Hello Everyone Welcome To Days We Were United Producers Point Media From Data Stream In This Question In The Stream Of Numbers Coming To Medium Bollywood Celebs' Problem Solved Bollywood Celebs' Problem Solved Bollywood Celebs' Problem Solved Video Template That Without Modulate Type Presentation Notification L... | Find Median from Data Stream | find-median-from-data-stream | The **median** is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two middle values.
* For example, for `arr = [2,3,4]`, the median is `3`.
* For example, for `arr = [2,3]`, the median is `(2 + 3) / 2 = 2.5`.
Implement the M... | null | Two Pointers,Design,Sorting,Heap (Priority Queue),Data Stream | Hard | 480,1953,2207 |
44 | hello everyone let's do this classic question uh leader code hard 44 wild card matching uh it's a classical question to be solved by 2d table and the basic idea is very straightforward we iterate all the possible prefix from the pattern and the string and the mark whether they match then we use this 2d table to let thi... | Wildcard Matching | wildcard-matching | Given an input string (`s`) and a pattern (`p`), implement wildcard pattern matching with support for `'?'` and `'*'` where:
* `'?'` Matches any single character.
* `'*'` Matches any sequence of characters (including the empty sequence).
The matching should cover the **entire** input string (not partial).
**Exam... | null | String,Dynamic Programming,Greedy,Recursion | Hard | 10 |
1,846 | Hello everyone welcome to my channel quote story with mike so today we are going to do video number 22 of our greedy playlist lead code number 1846 is not at all medium it is a very easy question which is said in the question as it is I have done it and with in Five minutes I was able to solve it ok the name of the que... | Maximum Element After Decreasing and Rearranging | maximum-element-after-decreasing-and-rearranging | You are given an array of positive integers `arr`. Perform some operations (possibly none) on `arr` so that it satisfies these conditions:
* The value of the **first** element in `arr` must be `1`.
* The absolute difference between any 2 adjacent elements must be **less than or equal to** `1`. In other words, `abs... | null | null | Medium | null |
1,882 | hey everybody this is larry this is mikoma q3 of the weekly contest 243 process tasks using servers um so this one is not easy but it's not that hard you just have to kind of keep track of everything but i really struggled with this problem during the contest um i had a couple of misreadings and misunderstandings and u... | Process Tasks Using Servers | the-number-of-employees-which-report-to-each-employee | You are given two **0-indexed** integer arrays `servers` and `tasks` of lengths `n` and `m` respectively. `servers[i]` is the **weight** of the `ith` server, and `tasks[j]` is the **time needed** to process the `jth` task **in seconds**.
Tasks are assigned to the servers using a **task ... | null | Database | Easy | null |
54 | question 54 of leak code spiral matrix so given an m by n matrix return all elements of the matrix in spiral order so we have matrix one through nine and we need to return one two three six nine eight seven four and five it's quite a simple question to understand but it's pretty tricky in implementing it so we have thi... | Spiral Matrix | spiral-matrix | Given an `m x n` `matrix`, return _all elements of the_ `matrix` _in spiral order_.
**Example 1:**
**Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[1,2,3,6,9,8,7,4,5\]
**Example 2:**
**Input:** matrix = \[\[1,2,3,4\],\[5,6,7,8\],\[9,10,11,12\]\]
**Output:** \[1,2,3,4,8,12,11,10,9,5,6,7\]
**Const... | Well for some problems, the best way really is to come up with some algorithms for simulation. Basically, you need to simulate what the problem asks us to do. We go boundary by boundary and move inwards. That is the essential operation. First row, last column, last row, first column and then we move inwards by 1 and th... | Array,Matrix,Simulation | Medium | 59,921 |
923 | hey everybody this is larry this is day 23 of the march lead code daily challenge hit the like button hit the subscribe button join me in discord let me know what you think about today's farm threesome with multiples multiple fixes yeah i can't even say it okay given an integer way away target i j k so that i times j t... | 3Sum With Multiplicity | super-egg-drop | Given an integer array `arr`, and an integer `target`, return the number of tuples `i, j, k` such that `i < j < k` and `arr[i] + arr[j] + arr[k] == target`.
As the answer can be very large, return it **modulo** `109 + 7`.
**Example 1:**
**Input:** arr = \[1,1,2,2,3,3,4,4,5,5\], target = 8
**Output:** 20
**Explanatio... | null | Math,Binary Search,Dynamic Programming | Hard | 2031 |
269 | all right we're gonna be doing alien dictionary uh using khan's algorithm uh which is basically a breath first search so uh they gave us a list of words and these words are in alphabetical order uh but it's not necessarily in like an english alphabetical order we assume that it's like in some alien language so if we ju... | Alien Dictionary | alien-dictionary | There is a new alien language that uses the English alphabet. However, the order among the letters is unknown to you.
You are given a list of strings `words` from the alien language's dictionary, where the strings in `words` are **sorted lexicographically** by the rules of this new language.
Return _a string of the u... | null | Array,String,Depth-First Search,Breadth-First Search,Graph,Topological Sort | Hard | 210 |
1,347 | hello this is the solution to problem number two of the likud contest so in this problem we are given two strings SNT which are of equal size and in one step or you can choose any character of t and replace it by another character so we need to return the minimum number of such steps to make t and s as anagrams so wate... | Minimum Number of Steps to Make Two Strings Anagram | distance-to-a-cycle-in-undirected-graph | You are given two strings of the same length `s` and `t`. In one step you can choose **any character** of `t` and replace it with **another character**.
Return _the minimum number of steps_ to make `t` an anagram of `s`.
An **Anagram** of a string is a string that contains the same characters with a different (or the... | This problem can be broken down into two parts: finding the cycle, and finding the distance between each node and the cycle. How can we find the cycle? We can use DFS and keep track of the nodes we’ve seen, and the order that we see them in. Once we see a node we’ve already visited, we know that the cycle contains the ... | Depth-First Search,Breadth-First Search,Union Find,Graph | Hard | 2218 |
1,732 | hello everyone our today's problem is find the highest altitude so let's understand the problem statement first and then we can see the approach and code so there is a biker going on a road trip and the road trip consists of n plus one points at different altitudes the bike will start his script on point zero with alti... | 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 |
1,026 | hey hello there today I'm looking at the binary tree question 1026 maximum difference between node and ancestor so given the root of a binary tree we want to find the maximum difference between two three nodes values such that on one condition that one of the node has to be a ancestor of the other node look at an examp... | Maximum Difference Between Node and Ancestor | string-without-aaa-or-bbb | Given the `root` of a binary tree, find the maximum value `v` for which there exist **different** nodes `a` and `b` where `v = |a.val - b.val|` and `a` is an ancestor of `b`.
A node `a` is an ancestor of `b` if either: any child of `a` is equal to `b` or any child of `a` is an ancestor of `b`.
**Example 1:**
**Input... | null | String,Greedy | Medium | null |
838 | hey what's up guys Nick white here dude checking counting stuff on Twitch in YouTube and I put the premium Lea codes on my patreon and I have a disk or two feeling join that check everything it's all in the description we're doing a problem called push Domino's it is a medium problem decent amount of likes it is very s... | Push Dominoes | design-linked-list | There are `n` dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to the left or to the right.
After each second, each domino that is falling to the left pushes the adjacent domino on the left. Similarly, the dominoes falling to the righ... | null | Linked List,Design | Medium | 1337 |
287 | okay this is uh leak code 287 find the duplicate number in javascript looking down here you have an array it's only one number that can be duplicated in it and you're supposed to return it so what i did for this problem is i created an object and all i'm going to do for the object uh loop through this array here and ba... | Find the Duplicate Number | find-the-duplicate-number | Given an array of integers `nums` containing `n + 1` integers where each integer is in the range `[1, n]` inclusive.
There is only **one repeated number** in `nums`, return _this repeated number_.
You must solve the problem **without** modifying the array `nums` and uses only constant extra space.
**Example 1:**
**... | null | Array,Two Pointers,Binary Search,Bit Manipulation | Medium | 41,136,142,268,645 |
96 | in this video we're going to take a look at a legal problem called unique binary search trees so given a an integer end return the number of structurally unique binary search trees which has exactly a number of nodes of unique values from 1 to n so you can see here we have an example of n is equal to three so there are... | Unique Binary Search Trees | unique-binary-search-trees | Given an integer `n`, return _the number of structurally unique **BST'**s (binary search trees) which has exactly_ `n` _nodes of unique values from_ `1` _to_ `n`.
**Example 1:**
**Input:** n = 3
**Output:** 5
**Example 2:**
**Input:** n = 1
**Output:** 1
**Constraints:**
* `1 <= n <= 19` | null | Math,Dynamic Programming,Tree,Binary Search Tree,Binary Tree | Medium | 95 |
78 | On Karo Hello Everyone Welcome To My Channel Today Live In And Problem Is This Problem Give Answers Of Distinct In Teachers Return All Possible Subscribe Node Solutions And Must Contain Duplicate Subscribe In Us 123 But They Can Make How Many Possible Subscribe Can Include Number And Not Include I Can Increase The Tota... | Subsets | subsets | Given an integer array `nums` of **unique** elements, return _all possible_ _subsets_ _(the power set)_.
The solution set **must not** contain duplicate subsets. Return the solution in **any order**.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[\],\[1\],\[2\],\[1,2\],\[3\],\[1,3\],\[2,3\],\[1,2,3\]\]
... | null | Array,Backtracking,Bit Manipulation | Medium | 90,320,800,2109,2170 |
163 | now let's go over question number 163 missing ranges the question says you are given a inclusive range lower and upper so we have our range of numbers and a sorted unique integer array of numbers so our array is going to be consisted of numbers they're going to be unique and sorted where all elements are in the inclusi... | Missing Ranges | missing-ranges | You are given an inclusive range `[lower, upper]` and a **sorted unique** integer array `nums`, where all elements are in the inclusive range.
A number `x` is considered **missing** if `x` is in the range `[lower, upper]` and `x` is not in `nums`.
Return _the **smallest sorted** list of ranges that **cover every miss... | null | Array | Easy | 228 |
728 | hey everyone welcome back and today I'll be doing another lead chord problem uh seven to eight self dividing number this is an easy one uh cell dividing number is a number that is divisible by every digit it contains for example one two eight is a subdividing number because it is divisible by one to eight so dividing n... | Self Dividing Numbers | self-dividing-numbers | A **self-dividing number** is a number that is divisible by every digit it contains.
* For example, `128` is **a self-dividing number** because `128 % 1 == 0`, `128 % 2 == 0`, and `128 % 8 == 0`.
A **self-dividing number** is not allowed to contain the digit zero.
Given two integers `left` and `right`, return _a l... | For each number in the range, check whether it is self dividing by converting that number to a character array (or string in Python), then checking that each digit is nonzero and divides the original number. | Math | Easy | 507 |
42 | Hello everyone, I welcome you all friends, today we both see a very important question which is our question that we should also see, you will see this question, there is a back in all the records, I will give a bundle of both typing of rain water top interesting questions and This question has been asked many times in... | Trapping Rain Water | trapping-rain-water | Given `n` non-negative integers representing an elevation map where the width of each bar is `1`, compute how much water it can trap after raining.
**Example 1:**
**Input:** height = \[0,1,0,2,1,0,1,3,2,1,2,1\]
**Output:** 6
**Explanation:** The above elevation map (black section) is represented by array \[0,1,0,2,1,... | null | Array,Two Pointers,Dynamic Programming,Stack,Monotonic Stack | Hard | 11,238,407,756 |
689 | okay so lead code practicing um the first goal in this video is to see how to solve this problem and then you're going to do some coding work and the second goal is to see how it should behave in real interview so let's get started so in a real interview the first time the first step is always to try to fully understan... | Maximum Sum of 3 Non-Overlapping Subarrays | maximum-sum-of-3-non-overlapping-subarrays | Given an integer array `nums` and an integer `k`, find three non-overlapping subarrays of length `k` with maximum sum and return them.
Return the result as a list of indices representing the starting position of each interval (**0-indexed**). If there are multiple answers, return the lexicographically smallest one.
*... | null | Array,Dynamic Programming | Hard | 123 |
530 | Hello everyone welcome back to me channel once again so here we will talk about today's daily problems list of late co and today's daily problem is an easy level problem but this is the problem of the beast. So, those who are afraid of tray, they must watch this video carefully because in this video we are going to sol... | Minimum Absolute Difference in BST | minimum-absolute-difference-in-bst | Given the `root` of a Binary Search Tree (BST), return _the minimum absolute difference between the values of any two different nodes in the tree_.
**Example 1:**
**Input:** root = \[4,2,6,1,3\]
**Output:** 1
**Example 2:**
**Input:** root = \[1,0,48,null,null,12,49\]
**Output:** 1
**Constraints:**
* The number... | null | Tree,Depth-First Search,Breadth-First Search,Binary Search Tree,Binary Tree | Easy | 532 |
1,410 | So changes p chilli and this problem solve sdm and learnty councilor can show what a sandwich problem is suggestion connect with governor se input strand road train content festival code uprooted which has special characters but so changed and specific is to tight so marine special characters purpose given Us Like Quot... | HTML Entity Parser | traffic-light-controlled-intersection | **HTML entity parser** is the parser that takes HTML code as input and replace all the entities of the special characters by the characters itself.
The special characters and their entities for HTML are:
* **Quotation Mark:** the entity is `"` and symbol character is `"`.
* **Single Quote Mark:** the entity ... | null | Concurrency | Easy | null |
1,609 | hello everyone this is on visual sandal today let's talk about record 1609 even all three if you like these videos you could spell me by subscribing my channel or click the likes of the video you can find the complete code and of my video your links in the description below let's look at the problem description first s... | Even Odd Tree | find-all-the-lonely-nodes | A binary tree is named **Even-Odd** if it meets the following conditions:
* The root of the binary tree is at level index `0`, its children are at level index `1`, their children are at level index `2`, etc.
* For every **even-indexed** level, all nodes at the level have **odd** integer values in **strictly increa... | Do a simple tree traversal, try to check if the current node is lonely or not. Node is lonely if at least one of the left/right pointers is null. | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 563,1005 |
806 | So hello everyone welcome to my channel, today we will do another question of August Challenge itself, so let's look at the question, the word question is the question of this level only, so what is the purpose of the question that international modes are defined as standard and coding where this letter is. Map you a s... | Number of Lines To Write String | domino-and-tromino-tiling | You are given a string `s` of lowercase English letters and an array `widths` denoting **how many pixels wide** each lowercase English letter is. Specifically, `widths[0]` is the width of `'a'`, `widths[1]` is the width of `'b'`, and so on.
You are trying to write `s` across several lines, where **each line is no long... | null | Dynamic Programming | Medium | null |
410 | Hello hello friends cigarette spider problem latest find this unlocking and problem name split a glass by which heart problem is solved one problem solution chapter note and sacred heart problem in the series is what should 315 medium problems create mount and shoaib vacancy detail very important point platform stateme... | Split Array Largest Sum | split-array-largest-sum | Given an integer array `nums` and an integer `k`, split `nums` into `k` non-empty subarrays such that the largest sum of any subarray is **minimized**.
Return _the minimized largest sum of the split_.
A **subarray** is a contiguous part of the array.
**Example 1:**
**Input:** nums = \[7,2,5,10,8\], k = 2
**Output:*... | null | Array,Binary Search,Dynamic Programming,Greedy | Hard | 1056,1192,2242,2330 |
219 | Hands free, I have given this Adarsh Mishra on Hands free, I have given this Adarsh Mishra on Hands free, I have given this Adarsh Mishra on UN Mission Code and today we are going to talk about the list of our content duplicate, so get it, which you had seen in the last section of the proposal, this committee wil... | Contains Duplicate II | contains-duplicate-ii | Given an integer array `nums` and an integer `k`, return `true` _if there are two **distinct indices**_ `i` _and_ `j` _in the array such that_ `nums[i] == nums[j]` _and_ `abs(i - j) <= k`.
**Example 1:**
**Input:** nums = \[1,2,3,1\], k = 3
**Output:** true
**Example 2:**
**Input:** nums = \[1,0,1,1\], k = 1
**Outp... | null | Array,Hash Table,Sliding Window | Easy | 217,220 |
128 | hello everyone and welcome back to my channel learn to code with Aditi today I am going to write the code and also explain you all the algorithm for this longest consecutive sequence problem which is there in lead code so let me give you a small overview of this problem we are given with an unsorted array of integers a... | Longest Consecutive Sequence | longest-consecutive-sequence | Given an unsorted array of integers `nums`, return _the length of the longest consecutive elements sequence._
You must write an algorithm that runs in `O(n)` time.
**Example 1:**
**Input:** nums = \[100,4,200,1,3,2\]
**Output:** 4
**Explanation:** The longest consecutive elements sequence is `[1, 2, 3, 4]`. Therefor... | null | Array,Hash Table,Union Find | Medium | 298,2278 |
442 | welcome to august leeco challenge today's problem is find all duplicates in an array given an array of integers one through n and equaling the size of array some element elements appear twice and others appear once find all elements that appear twice in this array and could you do it without extra space and an o of n r... | Find All Duplicates in an Array | find-all-duplicates-in-an-array | Given an integer array `nums` of length `n` where all the integers of `nums` are in the range `[1, n]` and each integer appears **once** or **twice**, return _an array of all the integers that appears **twice**_.
You must write an algorithm that runs in `O(n)` time and uses only constant extra space.
**Example 1:**
... | null | Array,Hash Table | Medium | 448 |
209 | hi everyone welcome back to a new video today we are going to solve a new question from Top interview 150 and this is going to be a new topic for us which is sliding window and we will be solving the first question of sliding window today which is minimum size subar sum this is a medium level question okay so now let's... | 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 |
404 | hello everyone so today in this video we'll actually go over another problem from lead code the problem name is sum of left leaves so what you can see in this problem is that you're given a root of a binary tree okay and you have to return the sum of all the left leaves cool so let's draw out some tree to even understa... | Sum of Left Leaves | sum-of-left-leaves | Given the `root` of a binary tree, return _the sum of all left leaves._
A **leaf** is a node with no children. A **left leaf** is a leaf that is the left child of another node.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 24
**Explanation:** There are two left leaves in the binary tree, wit... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
138 | hey everybody this is larry this is day 12 of delete code daily challenge i'm guessing we're going to have a linked list problem let's see what's good the situation uh copy list for random pointer your linked list of length n is given such that each node contain additional random pointer which can point to any node in ... | 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,647 | hello hi guys good morning welcome back to the new video and many of you are asking that why the energy was low see the energy was not low someone was there so I had to speak so that person don't wake up cool uh let's see many implications to make characters frequents unique frequency is unique uh a string s is called ... | Minimum Deletions to Make Character Frequencies Unique | can-convert-string-in-k-moves | A string `s` is called **good** if there are no two different characters in `s` that have the same **frequency**.
Given a string `s`, return _the **minimum** number of characters you need to delete to make_ `s` _**good**._
The **frequency** of a character in a string is the number of times it appears in the string. F... | Observe that shifting a letter x times has the same effect of shifting the letter x + 26 times. You need to check whether k is large enough to cover all shifts with the same remainder after modulo 26. | Hash Table,String | Medium | null |
190 | hey guys welcome back to another video and today we're going to be solving the lead code question reverse bits so we're given a 32-bit unsigned integer so we're given a 32-bit unsigned integer so we're given a 32-bit unsigned integer and our goal is to just reverse it and give that as the output so let's say we're give... | 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 |
997 | hey everybody this is larry this is day three of the new year january whatever you like to call it uh hit the like button in the subscribe button join me in discord let me know what you think about today's farm a yeezy problem called find the town judge so okay so there's a town there's one to end okay one of these peo... | Find the Town Judge | find-the-town-judge | In a town, there are `n` people labeled from `1` to `n`. There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
1. The town judge trusts nobody.
2. Everybody (except for the town judge) trusts the town judge.
3. There is exactly one person that satisfies properties **... | null | null | Easy | null |
328 | That Welcome Back Friends Today I Am Going To Solid Co Problem Three Two Eight Valve Link Superintendent Of Police One Of The Other Life Famous Interview Questions That Is Penthouse Related To Link List In Java Interview Safar Preparing For Any Java Technical Interview Se Mix And You Understand This Fact and Practice Q... | 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 |
36 | Welcome to my channel, ok, so this question is very good, it is a popular company, Google, Apple, Uber, Snapchat, Microsoft, Amazon, so let's see the example, okay, and what is there in it, whether this Sudoku you have is valid or not, okay, now it is valid. How will they know which box of 3/3 is visible? One is this, ... | Valid Sudoku | valid-sudoku | Determine if a `9 x 9` Sudoku board is valid. Only the filled cells need to be validated **according to the following rules**:
1. Each row must contain the digits `1-9` without repetition.
2. Each column must contain the digits `1-9` without repetition.
3. Each of the nine `3 x 3` sub-boxes of the grid must contain... | null | Array,Hash Table,Matrix | Medium | 37,2254 |
260 | this is the third version of a single number problem here we have again a list of numbers and each number is occurring twice except two numbers so if you look at this example you see that one is here and one is also here exactly two times not more not less similarly two is here and two is here but these numbers three a... | 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 |
1,652 | come guys welcome to my recovery section so before i start uh hopefully you guys subscribe to my channel okay so uh this video uh let's talk about this one six uh one six five two diffuser the bob the bump okay so not bad so you have a bomb to diffuse and your time is running out your informer will provide you a circul... | Defuse the Bomb | minimum-suffix-flips | You have a bomb to defuse, and your time is running out! Your informer will provide you with a **circular** array `code` of length of `n` and a key `k`.
To decrypt the code, you must replace every number. All the numbers are replaced **simultaneously**.
* If `k > 0`, replace the `ith` number with the sum of the **n... | Consider a strategy where the choice of bulb with number i is increasing. In such a strategy, you no longer need to worry about bulbs that have been set to the left. | String,Greedy | Medium | null |
1,029 | hi welcome to a lee code medium question i just realized that i've been solving a lot of easy questions and then the playlist for the code medium is becoming really dry so i want to update it so let's solve this question it's called two cd scheduling and it says a company is planning to interview two n people given the... | 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 |
992 | Hello Friends Today I Will Discuss Now Interest Problem List Code Problem Names of Address with Kids Sweater Heart Problem and Also Like and a Way to Solve This Position of Obscuritism Still Very Hard to Understand Shoaib South Africa and Sciences Problem Breeding Couple of Years From The Website Also Discuss in this A... | Subarrays with K Different Integers | delete-columns-to-make-sorted-ii | Given an integer array `nums` and an integer `k`, return _the number of **good subarrays** of_ `nums`.
A **good array** is an array where the number of different integers in that array is exactly `k`.
* For example, `[1,2,3,1,2]` has `3` different integers: `1`, `2`, and `3`.
A **subarray** is a **contiguous** par... | null | Array,String,Greedy | Medium | null |
117 | hey everyone welcome back and today we'll be doing another lead code problem 117 populating next right pointers in each Note 2 we have already done the one part this is a medium one given a binary tree uh with this structure ain't well left and our next pointer and population each uh next pointer to its right node if t... | Populating Next Right Pointers in Each Node II | populating-next-right-pointers-in-each-node-ii | Given a binary tree
struct Node {
int val;
Node \*left;
Node \*right;
Node \*next;
}
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to `NULL`.
Initially, all next pointers are set to `NULL`.
**Example 1:**
**Input:** root = \[1,2,3... | null | Linked List,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 116 |
1,650 | foreign 1650 lowest common answer of a binary tree three so in this problem you're given two nodes of a binary tree that's in the method signature here so you're given node p and node Q and so the definition of a node is you have access to a value you have access to the left node from this specific node and the right n... | Lowest Common Ancestor of a Binary Tree III | find-root-of-n-ary-tree | Given two nodes of a binary tree `p` and `q`, return _their lowest common ancestor (LCA)_.
Each node will have a reference to its parent node. The definition for `Node` is below:
class Node {
public int val;
public Node left;
public Node right;
public Node parent;
}
According to the **[definition of ... | Node with indegree 0 is the root | Hash Table,Bit Manipulation,Tree,Depth-First Search | Medium | 1655 |
377 | hello everyone welcome back here's van damson and today we are going to unravel the magic behind combination Zoom 4 problem from lit code using a technique that's an ancient as it's powerful so memorization so let's dive in so all right let's set the stage we are given a unique array of integer into Target and our task... | 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 |
905 | hi guys I'm getting this videos all the even integers at the beginning of the array followed by the odd integers so what they told in the question is they have given an array it contains human or integers and what we need to return is we have to return the even integers all the element integers in the array must be in ... | Sort Array By Parity | length-of-longest-fibonacci-subsequence | Given an integer array `nums`, move all the even integers at the beginning of the array followed by all the odd integers.
Return _**any array** that satisfies this condition_.
**Example 1:**
**Input:** nums = \[3,1,2,4\]
**Output:** \[2,4,3,1\]
**Explanation:** The outputs \[4,2,3,1\], \[2,4,1,3\], and \[4,2,1,3\] w... | null | Array,Hash Table,Dynamic Programming | Medium | 1013 |
438 | everyone so today is day 17 of the many whip code coding challenge I've been serving all these problems every day for 17 days now and today's problem I looked at it and I thought it's a really good problem to share so I decided to make this video where by explaining the techniques and the implementation I'll use those ... | Find All Anagrams in a String | find-all-anagrams-in-a-string | Given two strings `s` and `p`, return _an array of all the start indices of_ `p`_'s anagrams in_ `s`. You may 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:**
*... | null | Hash Table,String,Sliding Window | Medium | 242,567 |
108 | um hello so today we are going to do this problem called um convert sorted array to binary research tree um so the problem says we have an array of integers numbers and the elements are sorted in increasing order and we want to convert it to a hate-balanced binary search tree it to a hate-balanced binary search tree it... | Convert Sorted Array to Binary Search Tree | convert-sorted-array-to-binary-search-tree | Given an integer array `nums` where the elements are sorted in **ascending order**, convert _it to a_ **_height-balanced_** _binary search tree_.
**Example 1:**
**Input:** nums = \[-10,-3,0,5,9\]
**Output:** \[0,-3,9,-10,null,5\]
**Explanation:** \[0,-10,5,null,-3,null,9\] is also accepted:
**Example 2:**
**Input... | null | Array,Divide and Conquer,Tree,Binary Search Tree,Binary Tree | Easy | 109 |
467 | the 67 unique subrings in R around string yeah let me first explain this question so we are having a red around string so it going to be something like AB c d e until to Z and 2 a and until a b c d until to Z and this will be unlimited it means this kind of wrap around the dream will be unlimited we don't know how long... | Unique Substrings in Wraparound String | unique-substrings-in-wraparound-string | We define the string `base` to be the infinite wraparound string of `"abcdefghijklmnopqrstuvwxyz "`, so `base` will look like this:
* `"...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd.... "`.
Given a string `s`, return _the number of **unique non-empty substrings** of_ `s` _are present in_ `base`.
**E... | One possible solution might be to consider allocating an array size of 26 for each character in the alphabet. (Credits to @r2ysxu) | String,Dynamic Programming | Medium | null |
658 | You are welcome seriously from Shravan, till now I am adding tomatoes that you will destroy the fort. In this video, the people who are also included in what I will tell you may not understand further. If you have not seen some tips then I will make you clear about Chakra Meditation. Please friend, look at the settings... | Find K Closest Elements | find-k-closest-elements | Given a **sorted** integer array `arr`, two integers `k` and `x`, return the `k` closest integers to `x` in the array. The result should also be sorted in ascending order.
An integer `a` is closer to `x` than an integer `b` if:
* `|a - x| < |b - x|`, or
* `|a - x| == |b - x|` and `a < b`
**Example 1:**
**Input:... | null | Array,Two Pointers,Binary Search,Sorting,Heap (Priority Queue) | Medium | 374,375,719 |
163 | hey YouTube welcome back uh today we have this problem it's a missing Rangers uh say you are giving an inclusive range low and upper and source is unique Integrity called Norms where all elements are within the inclusive range a number X is considered a missing if x is in the range lower upper and X is not in nums okay... | Missing Ranges | missing-ranges | You are given an inclusive range `[lower, upper]` and a **sorted unique** integer array `nums`, where all elements are in the inclusive range.
A number `x` is considered **missing** if `x` is in the range `[lower, upper]` and `x` is not in `nums`.
Return _the **smallest sorted** list of ranges that **cover every miss... | null | Array | Easy | 228 |
1,577 | hello and welcome back to lead coding on this channel we discuss problems which are frequently asked in programming interviews today we are here with the problem number of ways where square of number is equal to product of two numbers given two areas of integer numbers one and nums two return the number of triplets for... | Number of Ways Where Square of Number Is Equal to Product of Two Numbers | probability-of-a-two-boxes-having-the-same-number-of-distinct-balls | Given two arrays of integers `nums1` and `nums2`, return the number of triplets formed (type 1 and type 2) under the following rules:
* Type 1: Triplet (i, j, k) if `nums1[i]2 == nums2[j] * nums2[k]` where `0 <= i < nums1.length` and `0 <= j < k < nums2.length`.
* Type 2: Triplet (i, j, k) if `nums2[i]2 == nums1[j... | Check how many ways you can distribute the balls between the boxes. Consider that one way you will use (x1, x2, x3, ..., xk) where xi is the number of balls from colour i. The probability of achieving this way randomly is ( (ball1 C x1) * (ball2 C x2) * (ball3 C x3) * ... * (ballk C xk)) / (2n C n). The probability of ... | Math,Dynamic Programming,Backtracking,Combinatorics,Probability and Statistics | Hard | null |
141 | hi everyone welcome to my channel I'm MK let's solve another lco daily challenge so this problem is marked as easy but I'm not sure about that uh I'm thinking about someone who has recently started learning about link list it's not an easy problem for them but it's marked easy because this is a classic problem we are g... | Linked List Cycle | linked-list-cycle | Given `head`, the head of a linked list, determine if the linked list has a cycle in it.
There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that tail's `next` pointer is co... | null | Hash Table,Linked List,Two Pointers | Easy | 142,202 |
1,011 | Hello Guys Welcome To Another Video Not Straight Upside Down Shoulder Problem Used Oil Capacity To Ship Packages Vidhan DS-7 Capacity To Ship Packages Vidhan DS-7 Capacity To Ship Packages Vidhan DS-7 Darkness Of And It's You To Final List Weight Capacity Of About Pushpa Always Within Days And Students In Not Open Lett... | Capacity To Ship Packages Within D Days | flip-binary-tree-to-match-preorder-traversal | A conveyor belt has packages that must be shipped from one port to another within `days` days.
The `ith` package on the conveyor belt has a weight of `weights[i]`. Each day, we load the ship with packages on the conveyor belt (in the order given by `weights`). We may not load more weight than the maximum weight capaci... | null | Tree,Depth-First Search,Binary Tree | Medium | null |
1,625 | hey guys what is up welcome to the elite code problem today we're doing column 16 25 let's crack so called graphically sound smallest string after applying operations you're given a string x of even line consisting of digits from zero to nine and two integers a and b you can apply either the following two operation any... | Lexicographically Smallest String After Applying Operations | group-sold-products-by-the-date | You are given a string `s` of **even length** consisting of digits from `0` to `9`, and two integers `a` and `b`.
You can apply either of the following two operations any number of times and in any order on `s`:
* Add `a` to all odd indices of `s` **(0-indexed)**. Digits post `9` are cycled back to `0`. For example... | null | Database | Easy | 2335 |
368 | hey everybody this is Larry this is day 13 of the June the code daily challenge let me know what you think of today's problem hit the like button hit the subscribe one and that's get started now largest divisible was upset okay give me a sub distinct positive integers find it largest subset such that every pair as sub ... | Largest Divisible Subset | largest-divisible-subset | Given a set of **distinct** positive integers `nums`, return the largest subset `answer` such that every pair `(answer[i], answer[j])` of elements in this subset satisfies:
* `answer[i] % answer[j] == 0`, or
* `answer[j] % answer[i] == 0`
If there are multiple solutions, return any of them.
**Example 1:**
**Inp... | null | Array,Math,Dynamic Programming,Sorting | Medium | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.