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 |
|---|---|---|---|---|---|---|---|---|
1,814 | hello hi guys good morning welcome back to the new videoi I hope that you guys are doing good just let me know how you guys are doing uh in this video Problem count nice pairs in an array so it has been asked by Uber Navi and it's a good frequency in the last one two years let's see what the problem says is exactly see... | 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 |
2 | hello welcome to my channel i'm here to do my angelico challenge and today we have lit code two add two numbers you are given two non-empty linked lists you are given two non-empty linked lists you are given two non-empty linked lists representing two non-negative representing two non-negative representing two non-nega... | 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 |
289 | all right so let's take a look at this problem called game of life according to wikipedia's article the game of life also known simply as life is a cellular atomic automaton devised by the british mathematician john horton conway in 1970 the board is made up of an m by n grid of cells where each cell has an initial sta... | Game of Life | game-of-life | According to [Wikipedia's article](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life): "The **Game of Life**, also known simply as **Life**, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. "
The board is made up of an `m x n` grid of cells, where each cell has an initial st... | null | Array,Matrix,Simulation | Medium | 73 |
706 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem design hashmap basically we want to implement the main operations of a hashmap which includes putting or inserting a value using some key we can map it to some value also we should be able to retrieve elements that are ... | Design HashMap | design-hashmap | Design a HashMap without using any built-in hash table libraries.
Implement the `MyHashMap` class:
* `MyHashMap()` initializes the object with an empty map.
* `void put(int key, int value)` inserts a `(key, value)` pair into the HashMap. If the `key` already exists in the map, update the corresponding `value`.
* ... | null | null | Easy | null |
513 | hey guys welcome back to my channel and in today's video we are going to solve one more lead code question that is question number 513 find bottom left three value so this is a medium level question and it has been asked by these many companies Amazon and Microsoft in last two years so let's see what this question is a... | Find Bottom Left Tree Value | find-bottom-left-tree-value | Given the `root` of a binary tree, return the leftmost value in the last row of the tree.
**Example 1:**
**Input:** root = \[2,1,3\]
**Output:** 1
**Example 2:**
**Input:** root = \[1,2,3,4,null,5,6,null,null,7\]
**Output:** 7
**Constraints:**
* The number of nodes in the tree is in the range `[1, 104]`.
* `-... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
338 | hey guys welcome back to your channel today we're going to start with code 338 counting bits okay it's a easy problem but to be honest it was kind of tricky for me to kind of figure out how to solve it but it says easy so we're just gonna go with whatever they say okay so feel free to pause video just to read through w... | 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 |
417 | hey everyone welcome back and let's write some more neat code today so today let's solve pacific atlantic water flow so this is another problem from the blind 75 list and that's why i'm doing it today the link to this spreadsheet will be in the description again and so we will be able to fill in one more graph problem ... | 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 |
942 | okay so what do we have here di string match so let's see what the problem says so basically the problems is that we have a we have our a and let's just open the screen face yeah so we have this array we have this string and we have to print out an array such that if it is I a I should be less than a is 1 if it is D he... | DI String Match | super-palindromes | A permutation `perm` of `n + 1` integers of all the integers in the range `[0, n]` can be represented as a string `s` of length `n` where:
* `s[i] == 'I'` if `perm[i] < perm[i + 1]`, and
* `s[i] == 'D'` if `perm[i] > perm[i + 1]`.
Given a string `s`, reconstruct the permutation `perm` and return it. If there are ... | null | Math,Enumeration | Hard | null |
476 | hello everyone welcome to the channel today's question is number complement if you are new to the channel please consider subscribing we sold a lot of interview question on this channel and that can definitely help you with your interview the question says given a positive integer output its complement number and the c... | Number Complement | number-complement | The **complement** of an integer is the integer you get when you flip all the `0`'s to `1`'s and all the `1`'s to `0`'s in its binary representation.
* For example, The integer `5` is `"101 "` in binary and its **complement** is `"010 "` which is the integer `2`.
Given an integer `num`, return _its complement_.
**... | null | Bit Manipulation | Easy | null |
405 | Hello Hi Everyone My Name Is Ayush Mishra And Definition Of Voters Today We Are Going To Talk About Convert Number On List To Hexadecimal About This Problem What To Do With The Problem That You Must Have Given An Interior Name You Song Have To Convert This Number With It In This And according to whatever your skin repr... | Convert a Number to Hexadecimal | convert-a-number-to-hexadecimal | Given an integer `num`, return _a string representing its hexadecimal representation_. For negative integers, [two's complement](https://en.wikipedia.org/wiki/Two%27s_complement) method is used.
All the letters in the answer string should be lowercase characters, and there should not be any leading zeros in the answer... | null | Math,Bit Manipulation | Easy | null |
295 | welcome back to agwood yes today's question is leak code 295 find a median from datastream so 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 medium is the mean of the two middle values so we have two examples here we have two three and four the... | 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 |
338 | So hello friends, today is the 67th day of our counting bits and we are moving forward like this. In Blind 75, I like this question because it looks easy and the questions are easy to understand. There is fun in doing everything and it builds our confidence that we are moving forward so much and even after going, we ar... | 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 |
70 | Google loves to ask dynamic programming questions so let's solve one suppose we're climbing a staircase and it takes end steps to reach the top each time you can either climb one or two steps in how many distinct ways can you climb to the top n is equal to three you could take one step and one step you could take one s... | 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 |
283 | now let's take a look at a legal problem called move zeros so given an array of integer nums write a function to move all the zeros to the end while maintaining the relative order of the non-zero elements non-zero elements non-zero elements so in this case we have a uh integer array and we want to move all the zeros to... | Move Zeroes | move-zeroes | Given an integer array `nums`, move all `0`'s to the end of it while maintaining the relative order of the non-zero elements.
**Note** that you must do this in-place without making a copy of the array.
**Example 1:**
**Input:** nums = \[0,1,0,3,12\]
**Output:** \[1,3,12,0,0\]
**Example 2:**
**Input:** nums = \[0\]... | In-place means we should not be allocating any space for extra array. But we are allowed to modify the existing array. However, as a first step, try coming up with a solution that makes use of additional space. For this problem as well, first apply the idea discussed using an additional array and the in-place solution ... | Array,Two Pointers | Easy | 27 |
226 | another day another problem so let's Solve IT hello guys I hope you are all doing well in this video we're gonna solve the problem inverse binary tree so let's get started the problem is that they give you a root of binary tree and they ask you to invert the tree an inversion or mirror of binary tree is just a binary t... | 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 |
68 | good morning it's still very early so I'm not gonna be very loud so a little bit of whispering it's 7 20 A.M it's 7 20 A.M it's 7 20 A.M all right so I um I tried to solve this yesterday so that took now a whole hour and then last night I funnily like around midnight I finally got it to work so this was from eight hour... | Text Justification | text-justification | Given an array of strings `words` and a width `maxWidth`, format the text such that each line has exactly `maxWidth` characters and is fully (left and right) justified.
You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces `' '` when necessary so that ea... | null | Array,String,Simulation | Hard | 1714,2260 |
394 | hey everybody this is larry this is day 19 of the leeco daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's farm decode string unexpected wow looked like someone forgot to decode their string but okay let me refresh that's actually kind of a hilarious... | 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 |
88 | Hello Guys Myself Amrita Welcome Back To Our Channel Technosis So In This Lead Card Series Today Bill B Solving Problem Number 88 Date Is My Sorted Are It One Of The Very Important Interview Questions So No Late Get Started And Let First Understand The Problem You Are Jivan tu wait arrest namas one and namas tu sorted ... | 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 |
64 | hi everyone today we'll be taking a look at question 64 online code called minimum path sum so we're given an m by n grid with positive values and we want to find the path from the top left aka this one here to the bottom right which is this other one here which minimizes the sum of all numbers along its path and we ca... | Minimum Path Sum | minimum-path-sum | Given a `m x n` `grid` filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path.
**Note:** You can only move either down or right at any point in time.
**Example 1:**
**Input:** grid = \[\[1,3,1\],\[1,5,1\],\[4,2,1\]\]
**Output:** 7
**Explanat... | null | Array,Dynamic Programming,Matrix | Medium | 62,174,741,2067,2192 |
7 | Hello Gas Myself Amrita Welcome Back To Our Channel Techno Sage So In Today's Video C Are Going To Discuss Lead Code Problem Number Seven Date Is Reverse Wait So Let's Get Started Let's First Understand D Problem Given Un Sin 32 Beat Wait X Return X With Its Digits Reverse so basically you need to reverse the 32 beats ... | Reverse Integer | reverse-integer | Given a signed 32-bit integer `x`, return `x` _with its digits reversed_. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-231, 231 - 1]`, then return `0`.
**Assume the environment does not allow you to store 64-bit integers (signed or unsigned).**
**Example 1:**
**Input:** x = 123
... | null | Math | Medium | 8,190,2238 |
263 | hello Ellen welcome to nets at OS today in this video we will discuss about a glean number problem but before starting the video I will request you if you like my video do subscribe my channel and for understanding full concept of this ugly number problem do watch it till the end of the video so let's start ugly number... | Ugly Number | ugly-number | An **ugly number** is a positive integer whose prime factors are limited to `2`, `3`, and `5`.
Given an integer `n`, return `true` _if_ `n` _is an **ugly number**_.
**Example 1:**
**Input:** n = 6
**Output:** true
**Explanation:** 6 = 2 \* 3
**Example 2:**
**Input:** n = 1
**Output:** true
**Explanation:** 1 has n... | null | Math | Easy | 202,204,264 |
110 | Hello Hi Guys Welcome To Record Mid-Day-Meal Solving Questions Balance - Problem Channel Subscribe To 999999999 Follow Then Balance Factor Good Wishes Left And Right The Balance Put 90 Function Arrangement Height p.m. Hey friend also down below Guru personal or not I button zero otherwise sitam oneplus maximum left or ... | Balanced Binary Tree | balanced-binary-tree | Given a binary tree, determine if it is **height-balanced**.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** true
**Example 2:**
**Input:** root = \[1,2,2,3,3,null,null,4,4\]
**Output:** false
**Example 3:**
**Input:** root = \[\]
**Output:** true
**Constraints:**
* The number of nodes ... | null | Tree,Depth-First Search,Binary Tree | Easy | 104 |
836 | hey what's up guys Nick white here I did tecnico ting stuff on Twitch in YouTube do the premium way codes on patreon ask me anything in my disk or try to get back to everyone this is a rectangle overlap question it is easy got some likes here it was pretty good cool sometimes in an interview you might be asked somethin... | Rectangle Overlap | race-car | An axis-aligned rectangle is represented as a list `[x1, y1, x2, y2]`, where `(x1, y1)` is the coordinate of its bottom-left corner, and `(x2, y2)` is the coordinate of its top-right corner. Its top and bottom edges are parallel to the X-axis, and its left and right edges are parallel to the Y-axis.
Two rectangles ove... | null | Dynamic Programming | Hard | null |
1,957 | hey guys peng here so today we're gonna talk about question one for bi-weekly contest which question one for bi-weekly contest which question one for bi-weekly contest which is the past saturday the lead character to make fancy string defensive string is a string no three consecutive characters are equal given a string... | Delete Characters to Make Fancy String | closest-room | A **fancy string** is a string where no **three** **consecutive** characters are equal.
Given a string `s`, delete the **minimum** possible number of characters from `s` to make it **fancy**.
Return _the final string after the deletion_. It can be shown that the answer will always be **unique**.
**Example 1:**
**In... | Is there a way to sort the queries so it's easier to search the closest room larger than the size? Use binary search to speed up the search time. | Array,Binary Search,Sorting | Hard | 2179 |
1,508 | hi my name is Ray and today I'll be explaining question 2 from the codes by weekly contest 30 range sum of sorted sub-arrays ohms so the question gives sub-arrays ohms so the question gives sub-arrays ohms so the question gives you an input integer array the length of the array and two boundaries and you have to first ... | Range Sum of Sorted Subarray Sums | longest-happy-prefix | You are given the array `nums` consisting of `n` positive integers. You computed the sum of all non-empty continuous subarrays from the array and then sorted them in non-decreasing order, creating a new array of `n * (n + 1) / 2` numbers.
_Return the sum of the numbers from index_ `left` _to index_ `right` (**indexed ... | Use Longest Prefix Suffix (KMP-table) or String Hashing. | String,Rolling Hash,String Matching,Hash Function | Hard | 2326 |
270 | hi coders today we will solve a problem called as closest binary search tree value problem number 270 or lead code till now we have applied priority search on a sorted array where we try to find the target element a number range where we try to guess a number higher or lower than a given value and an unsorted array whe... | Closest Binary Search Tree Value | closest-binary-search-tree-value | Given the `root` of a binary search tree and a `target` value, return _the value in the BST that is closest to the_ `target`. If there are multiple answers, print the smallest.
**Example 1:**
**Input:** root = \[4,2,5,1,3\], target = 3.714286
**Output:** 4
**Example 2:**
**Input:** root = \[1\], target = 4.428571
*... | null | Binary Search,Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | 222,272,783 |
1,010 | hello everyone hope you all are doing well so i am back with another latecode daily challenge and it is late call number 1010 pair of songs with total duration divided by 60 and it is a medium level question and i also feel the same so you are given a list of song with where the ayat song has a duration of time i secon... | 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 |
143 | ex girl give it to ya wait for you to get it on your own and stole the liver yo what's up nerds welcome back to tee time with your favorite software engineer if you guys haven't already check out my channel subscribe smash that like button because i know you guys are gonna like this video you're gonna learn something s... | Reorder List | reorder-list | You are given the head of a singly linked-list. The list can be represented as:
L0 -> L1 -> ... -> Ln - 1 -> Ln
_Reorder the list to be on the following form:_
L0 -> Ln -> L1 -> Ln - 1 -> L2 -> Ln - 2 -> ...
You may not modify the values in the list's nodes. Only nodes themselves may be changed.
**Example 1:**
**... | null | Linked List,Two Pointers,Stack,Recursion | Medium | 2216 |
336 | hello everyone welcome to learn overflow in this video we will discuss another little problem this is a palindrome pairs so this is a heart type problem and i'll say a really interesting one okay so uh we'll understand what this question is asking us to do and how we can easily solve uh this question okay i'll explain ... | Palindrome Pairs | palindrome-pairs | You are given a **0-indexed** array of **unique** strings `words`.
A **palindrome pair** is a pair of integers `(i, j)` such that:
* `0 <= i, j < words.length`,
* `i != j`, and
* `words[i] + words[j]` (the concatenation of the two strings) is a palindrome.
Return _an array of all the **palindrome pairs** of_ `... | null | Array,Hash Table,String,Trie | Hard | 5,214,2237 |
775 | hey everybody this is larry this is day five of the april eco dairy challenge hit the like button to subscribe and join me in discord let me know what you think about today's farm uh and yes i did get a haircut thanks for noticing with the two of you uh today's farm is global and local versions and keep in mind that i ... | Global and Local Inversions | n-ary-tree-preorder-traversal | You are given an integer array `nums` of length `n` which represents a permutation of all the integers in the range `[0, n - 1]`.
The number of **global inversions** is the number of the different pairs `(i, j)` where:
* `0 <= i < j < n`
* `nums[i] > nums[j]`
The number of **local inversions** is the number of i... | null | Stack,Tree,Depth-First Search | Easy | 144,764,776 |
790 | problem I'm making a video and audio filing this is 790 Domino intramino tiling you have two types of tiles an end by a two by one Domino shape in a trauma shape you may rotate these shapes okay so you have this Domino shape like this of course the idea is you can rotate this little guy right so even though the shape i... | Domino and Tromino Tiling | global-and-local-inversions | You have two types of tiles: a `2 x 1` domino shape and a tromino shape. You may rotate these shapes.
Given an integer n, return _the number of ways to tile an_ `2 x n` _board_. Since the answer may be very large, return it **modulo** `109 + 7`.
In a tiling, every square must be covered by a tile. Two tilings are dif... | Where can the 0 be placed in an ideal permutation? What about the 1? | Array,Math | Medium | null |
231 | Hello guys welcome to my channel today is the day 8 and problem is the power of two flexed problem statement and tried to understand to give examples for giving may or write a function to remind that press the power switch interior is the power of two and not It's true for example wave tower 2004 646 does not the power... | 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,255 | Shri Ram Londo, how are you, everything is fine, he scored a fast century, Rajya Sabha, but its name is ' scored a fast century, Rajya Sabha, but its name is ' scored a fast century, Rajya Sabha, but its name is ' Maximum' in words from letters, which Maximum' in words from letters, which Maximum' in words from letters... | Maximum Score Words Formed by Letters | reverse-subarray-to-maximize-array-value | Given a list of `words`, list of single `letters` (might be repeating) and `score` of every character.
Return the maximum score of **any** valid set of words formed by using the given letters (`words[i]` cannot be used two or more times).
It is not necessary to use all characters in `letters` and each letter can only... | What's the score after reversing a sub-array [L, R] ? It's the score without reversing it + abs(a[R] - a[L-1]) + abs(a[L] - a[R+1]) - abs(a[L] - a[L-1]) - abs(a[R] - a[R+1]) How to maximize that formula given that abs(x - y) = max(x - y, y - x) ? This can be written as max(max(a[R] - a[L - 1], a[L - 1] - a[R]) + max(a[... | Array,Math,Greedy | Hard | null |
503 | foreign part two I hope you have seen the part one for this one because that's the prerequisite for this question and you'll understand that better if you have seen that video okay so let us read a description what it says so given a circular integer array okay that is nums okay the next element the next uh the next el... | Next Greater Element II | next-greater-element-ii | Given a circular integer array `nums` (i.e., the next element of `nums[nums.length - 1]` is `nums[0]`), return _the **next greater number** for every element in_ `nums`.
The **next greater number** of a number `x` is the first greater number to its traversing-order next in the array, which means you could search circu... | null | Array,Stack,Monotonic Stack | Medium | 496,556 |
1,684 | okay welcome back uh today 1684 count the number of consistent strings uh so we're given a string aloud uh consisting of distinct characters and an array of string words uh a string is consistent if all the characters in the string appear in the string allowed so you have to return the number of consistent strings in t... | Count the Number of Consistent Strings | find-latest-group-of-size-m | You are given a string `allowed` consisting of **distinct** characters and an array of strings `words`. A string is **consistent** if all characters in the string appear in the string `allowed`.
Return _the number of **consistent** strings in the array_ `words`.
**Example 1:**
**Input:** allowed = "ab ", words = \[... | Since the problem asks for the latest step, can you start the searching from the end of arr? Use a map to store the current “1” groups. At each step (going backwards) you need to split one group and update the map. | Array,Binary Search,Simulation | Medium | null |
858 | hey what's up guys this is john here again so let's take a look at today's daily challenge problem number 858 mineral reflection i mean this is more like i would say it's like more like a math problem but let's just take a look you know there's a special square room with mirrors on each of the four walls except for the... | Mirror Reflection | masking-personal-information | There is a special square room with mirrors on each of the four walls. Except for the southwest corner, there are receptors on each of the remaining corners, numbered `0`, `1`, and `2`.
The square room has walls of length `p` and a laser ray from the southwest corner first meets the east wall at a distance `q` from th... | null | String | Medium | null |
510 | morning everyone um today i'm actually really happy because i passed my first round with pony ai and i'm thinking to set up my final round about two weeks later but um that's all that and i'm going to do a bunch of tree problems just to get me familiar with manipulating those pointers today we're going to look at probl... | Inorder Successor in BST II | count-subarrays-with-more-ones-than-zeros | Given a `node` in a binary search tree, return _the in-order successor of that node in the BST_. If that node has no in-order successor, return `null`.
The successor of a `node` is the node with the smallest key greater than `node.val`.
You will have direct access to the node but not to the root of the tree. Each nod... | Change the zeros in nums to -1 and create a prefix sum array prefixSum using the new nums. If prefixSum[i] for any index i in the range 0 <= i < prefixSum.length is positive, that means that there are more ones than zeros in the prefix ending at index i. If prefixSum[j] > prefixSum[i] for two indexes i and j such that ... | Array,Binary Search,Divide and Conquer,Binary Indexed Tree,Segment Tree,Merge Sort,Ordered Set | Medium | 474,1999,2261 |
5 | so hello everyone how are you uh in this video i will be explaining the problem longest palindromic substring and this problem is a medium level problem and a good question and the idea to solve this problem is not that difficult to understand but it may uh like it may take you some time before it finally hits you when... | Longest Palindromic Substring | longest-palindromic-substring | Given a string `s`, return _the longest_ _palindromic_ _substring_ in `s`.
**Example 1:**
**Input:** s = "babad "
**Output:** "bab "
**Explanation:** "aba " is also a valid answer.
**Example 2:**
**Input:** s = "cbbd "
**Output:** "bb "
**Constraints:**
* `1 <= s.length <= 1000`
* `s` consist of only dig... | How can we reuse a previously computed palindrome to compute a larger palindrome? If “aba” is a palindrome, is “xabax” a palindrome? Similarly is “xabay” a palindrome? Complexity based hint:
If we use brute-force and check whether for every start and end position a substring is a palindrome we have O(n^2) start - end ... | String,Dynamic Programming | Medium | 214,266,336,516,647 |
590 | be good here hey guys what's up it's Nick here and yeah I do a lot of twitch and tech stuff on YouTube whit sorry I do a lot of tech encoding stuff on YouTube and twitch so check the description you can find out anything about me but I'm doing a lot of elite I'm doing a leak code series where i go through every problem... | 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 |
946 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem validate stack sequences we're given two integer arrays pushed and popped pushed is supposed to represent the sequence of elements that we are pushing onto a stack so this is the order that we would push elements onto a... | Validate Stack Sequences | smallest-range-ii | Given two integer arrays `pushed` and `popped` each with distinct values, return `true` _if this could have been the result of a sequence of push and pop operations on an initially empty stack, or_ `false` _otherwise._
**Example 1:**
**Input:** pushed = \[1,2,3,4,5\], popped = \[4,5,3,2,1\]
**Output:** true
**Explana... | null | Array,Math,Greedy,Sorting | Medium | null |
363 | today we're gonna be working on neat code question number 363 maximum sum of rectangle no larger than k it's very similar to the other one where we actually found out the sum of any sub array inside the 2d array but this time the only difference is that the sum should not exceed uh k so you have to find the maximum one... | Max Sum of Rectangle No Larger Than K | max-sum-of-rectangle-no-larger-than-k | Given an `m x n` matrix `matrix` and an integer `k`, return _the max sum of a rectangle in the matrix such that its sum is no larger than_ `k`.
It is **guaranteed** that there will be a rectangle with a sum no larger than `k`.
**Example 1:**
**Input:** matrix = \[\[1,0,1\],\[0,-2,3\]\], k = 2
**Output:** 2
**Explana... | null | Array,Binary Search,Dynamic Programming,Matrix,Ordered Set | Hard | null |
269 | hello there a few weeks ago I talked about this question 1953 verifying a alien dictionary which is that we've been given the ordering of the characters for some alien language and also a list of the words that is supposed to read to be sorted based on not ordering and we want to where to find that so I'm working on th... | 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 |
557 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem reverse words in a string of three even though this is an easy problem I think it's still a good problem to practice if you're a beginner it's definitely a good problem and even if you're not a beginner I would encourag... | Reverse Words in a String III | reverse-words-in-a-string-iii | Given a string `s`, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.
**Example 1:**
**Input:** s = "Let's take LeetCode contest"
**Output:** "s'teL ekat edoCteeL tsetnoc"
**Example 2:**
**Input:** s = "God Ding"
**Output:** "doG gniD"
**Constr... | null | Two Pointers,String | Easy | 541 |
464 | hi guys welcome back to my channel so I hope you're already doing well in this video we are going to solve the problem can I will and the problem is very much interesting because it includes three concept uh bit fast Game Theory and diamond from with all these concepts are so much interesting and they are not too easy ... | Can I Win | can-i-win | In the "100 game " two players take turns adding, to a running total, any integer from `1` to `10`. The player who first causes the running total to **reach or exceed** 100 wins.
What if we change the game so that players **cannot** re-use integers?
For example, two players might take turns drawing from a common pool... | null | Math,Dynamic Programming,Bit Manipulation,Memoization,Game Theory,Bitmask | Medium | 294,375,486 |
809 | okay here we go on hello everyone welcome to another video for a mocking interview on so this is a random well semi random question I pick picked up on late code I've never saw seen this questioned and it's the first time I ever read the description and I would try to make this video as short as possible but given that... | Expressive Words | preimage-size-of-factorial-zeroes-function | Sometimes people repeat letters to represent extra feeling. For example:
* `"hello " -> "heeellooo "`
* `"hi " -> "hiiii "`
In these strings like `"heeellooo "`, we have groups of adjacent letters that are all the same: `"h "`, `"eee "`, `"ll "`, `"ooo "`.
You are given a string `s` and an array of query strings... | null | Math,Binary Search | Hard | 172 |
1,091 | hello everyone welcome to day 16 of lead code may challenge today we have question number 1091 shortest path in binary tree in this question they have given us n cross and binary matrix and we have to return the length of the shortest clear path in the matrix if there is no clear path we have to written minus one a cle... | Shortest Path in Binary Matrix | maximum-average-subtree | Given an `n x n` binary matrix `grid`, return _the length of the shortest **clear path** in the matrix_. If there is no clear path, return `-1`.
A **clear path** in a binary matrix is a path from the **top-left** cell (i.e., `(0, 0)`) to the **bottom-right** cell (i.e., `(n - 1, n - 1)`) such that:
* All the visite... | Can you find the sum of values and the number of nodes for every sub-tree ? Can you find the sum of values and the number of nodes for a sub-tree given the sum of values and the number of nodes of it's left and right sub-trees ? Use depth first search to recursively find the solution for the children of a node then use... | Tree,Depth-First Search,Binary Tree | Medium | 2126 |
502 | hi everyone it's all today's daily challenge that is IPO so here uh in this question we are given that lead code is starting its ipu soon and uh they need to sell a good price of its share right so they have to work on some projects to increase their Capital before this IPO they only have limited resources and they can... | IPO | ipo | Suppose LeetCode will start its **IPO** soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before the **IPO**. Since it has limited resources, it can only finish at most `k` distinct projects before the **IPO**. Help LeetCode design... | null | Array,Greedy,Sorting,Heap (Priority Queue) | Hard | null |
48 | hello all welcome to code hub today let us solve the lead force daily challenge and the problem is rotate image you are given a n cross n 2d matrix representing an image rotate the image by 90 degrees clockwise you have to rotate the image in place which means you have to modify the input to the matrix directly do not ... | 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 |
1,704 | Hello friends welcome to my channel here soled Cod problems and prepare to the Cod interview today's problem number 17 o4 determine if string Hales are alike you're given a sing s of even length sped the S into two halves and of equal lengths and uh let a be the first half and B be the second half two strings are alike... | Determine if String Halves Are Alike | special-positions-in-a-binary-matrix | You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half.
Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppe... | Keep track of 1s in each row and in each column. Then while iterating over matrix, if the current position is 1 and current row as well as current column contains exactly one occurrence of 1. | Array,Matrix | Easy | null |
1,223 | everyone will convene here so let's discuss about we click on national fifty-eight third question dinosaur on fifty-eight third question dinosaur on fifty-eight third question dinosaur on simulation so add a simulator generates a random number between one to six and there is extra constraint that saying number I cannot... | Dice Roll Simulation | graph-connectivity-with-threshold | A die simulator generates a random number from `1` to `6` for each roll. You introduced a constraint to the generator such that it cannot roll the number `i` more than `rollMax[i]` (**1-indexed**) consecutive times.
Given an array of integers `rollMax` and an integer `n`, return _the number of distinct sequences that ... | How to build the graph of the cities? Connect city i with all its multiples 2*i, 3*i, ... Answer the queries using union-find data structure. | Array,Math,Union Find | Hard | null |
433 | Hello friends today I'm going to solve liquid problem number 433 minimum genetic mutation so we are given 8 character long string which is a gene and then we could choose from a c z and T so four of these characters to form a gene which is an eighth character along we are given a start chain an end chain and an area of... | 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 |
1,047 | hello everyone welcome to forest camp we are at 28th day of june lead code challenge and the problem we are going to cover in this video is remove all adjacent duplicates in string so we are given an input string yes as our input and we have to return the string again with after removing all the duplicate adjacent char... | Remove All Adjacent Duplicates In String | maximize-sum-of-array-after-k-negations | You are given a string `s` consisting of lowercase English letters. A **duplicate removal** consists of choosing two **adjacent** and **equal** letters and removing them.
We repeatedly make **duplicate removals** on `s` until we no longer can.
Return _the final string after all such duplicate removals have been made_... | null | Array,Greedy,Sorting | Easy | 2204 |
1,662 | hey everybody this is Larry this is day 24 25 of the legal daily challenge hit the like button and subscribe and join me on Discord let me know what you think about today's prom given two string a check of two string arrays are equivalent okay um they have to be in the same order so basically just checking account Asia... | Check If Two String Arrays are Equivalent | minimum-numbers-of-function-calls-to-make-target-array | Given two string arrays `word1` and `word2`, return `true` _if the two arrays **represent** the same string, and_ `false` _otherwise._
A string is **represented** by an array if the array elements concatenated **in order** forms the string.
**Example 1:**
**Input:** word1 = \[ "ab ", "c "\], word2 = \[ "a ", "bc "... | Work backwards: try to go from nums to arr. You should try to divide by 2 as much as possible, but you can only divide by 2 if everything is even. | Array,Greedy | Medium | null |
1,641 | 200 Hi Guys Speech Was Doing Well So That Discussing This Problem Which Aims Account Soft Toys Friends From Now Onwards Will Be Discussing All The Problems Which Of Difficulty Medium And After Weeks Of Bump Into The Hard Words For Starting A New Twist Channel You Can Consider Subscribe Video Upcoming Videos So Let's Ge... | Count Sorted Vowel Strings | countries-you-can-safely-invest-in | Given an integer `n`, return _the number of strings of length_ `n` _that consist only of vowels (_`a`_,_ `e`_,_ `i`_,_ `o`_,_ `u`_) and are **lexicographically sorted**._
A string `s` is **lexicographically sorted** if for all valid `i`, `s[i]` is the same as or comes before `s[i+1]` in the alphabet.
**Example 1:**
... | null | Database | Medium | 615 |
198 | hi everyone today we're gonna solve one problem it's called house robbers we're gonna start off by reading the question and then I'm going to show you a graphical representation of the question and solution and then we're gonna code it okay so let's go at it you are a professional robber planning to rob a house along t... | House Robber | house-robber | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and **it will automatically contact the police if two adjacent houses were broken into... | null | Array,Dynamic Programming | Medium | 152,213,256,276,337,600,656,740,2262 |
341 | hello and welcome back to the cracking Fang YouTube channel today we're going to be solving lead code problem 341 flatten nested list iterator you are given a nested list of integers nested list each element is either an integer or a list whose elements may also be integers or other lists Implement an iterator to flatt... | Flatten Nested List Iterator | flatten-nested-list-iterator | You are given a nested list of integers `nestedList`. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an iterator to flatten it.
Implement the `NestedIterator` class:
* `NestedIterator(List nestedList)` Initializes the iterator with the nested list `nestedLi... | null | Stack,Tree,Depth-First Search,Design,Queue,Iterator | Medium | 251,281,385,565 |
1,634 | hey everybody this is Larry this is me doing uh extra practice going to do uh actually I'm going to take off the premium because I think there are non premium questions that I haven't done yet so I'm going to just do that um the only thing that I will skip over for now is I think database and concurrency because I don'... | Add Two Polynomials Represented as Linked Lists | clone-n-ary-tree | A polynomial linked list is a special type of linked list where every node represents a term in a polynomial expression.
Each node has three attributes:
* `coefficient`: an integer representing the number multiplier of the term. The coefficient of the term `**9**x4` is `9`.
* `power`: an integer representing the ... | Traverse the tree, keep a hashtable with you and create a clone node for each node in the tree. Start traversing the original tree again and connect each child pointer in the cloned tree the same way as the original tree with the help of the hashtable. | Hash Table,Tree,Depth-First Search,Breadth-First Search | Medium | 133,138,1624 |
231 | hello everyone welcome to hacker heap in this quick tutorial we will look into this problem of solving power of two this is pretty simple problem it's already mentioned a easy problem so very straightforward the easiest way to do is there are two ways to do it one way is just by doing the modulus of n with two and make... | 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 |
704 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem binary search we're given an array of integers nums which are going to be sorted in ascending order and we're also given a target integer that we're going to look for if the target exists in the array then we can return... | Binary Search | binary-search | Given an array of integers `nums` which is sorted in ascending order, and an integer `target`, write a function to search `target` in `nums`. If `target` exists, then return its index. Otherwise, return `-1`.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[-1,0,3,5,... | null | null | Easy | null |
279 | Hey everyone, I hope people will be well, today we will see Perfect Square is a very good problem. Again on DP, the first question coming in the mind of many people is that brother, are you completing the playlist of Rickson or what is DP? I told you in the beginning that look what is the basic concept of DP, research,... | Perfect Squares | perfect-squares | Given an integer `n`, return _the least number of perfect square numbers that sum to_ `n`.
A **perfect square** is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, `1`, `4`, `9`, and `16` are perfect squares while `3` and `11` are not.
**Example ... | null | Math,Dynamic Programming,Breadth-First Search | Medium | 204,264 |
179 | you're doing great our today's question is largest number given a list of non-negative integers given a list of non-negative integers given a list of non-negative integers arrange them such that they form the largest number for example 10 and 2 are the given elements in the array so 210 is the output because if we plac... | Largest Number | largest-number | Given a list of non-negative integers `nums`, arrange them such that they form the largest number and return it.
Since the result may be very large, so you need to return a string instead of an integer.
**Example 1:**
**Input:** nums = \[10,2\]
**Output:** "210 "
**Example 2:**
**Input:** nums = \[3,30,34,5,9\]
*... | null | String,Greedy,Sorting | Medium | 2284 |
1,971 | one now find a path exists okay so we'll go through the question there is a bi-directional graph then there is a bi-directional graph then there is a bi-directional graph then vertices where each vertex is labeled from 0 to n minus 1. and the edges in the graph are represented as a 2d integer array HS uh where each edg... | Find if Path Exists in Graph | incremental-memory-leak | There is a **bi-directional** graph with `n` vertices, where each vertex is labeled from `0` to `n - 1` (**inclusive**). The edges in the graph are represented as a 2D integer array `edges`, where each `edges[i] = [ui, vi]` denotes a bi-directional edge between vertex `ui` and vertex `vi`. Every vertex pair is connecte... | What is the upper bound for the number of seconds? Simulate the process of allocating memory. | Simulation | Medium | null |
208 | hello welcome to sun record today we are going to solve the two zero eight lit code problem it's a implement try or prefix tree so basically if you read the problem statement saying that we need to create some data structure called try you in that structure we will going to implement three kind of method one is for ins... | Implement Trie (Prefix Tree) | implement-trie-prefix-tree | A [**trie**](https://en.wikipedia.org/wiki/Trie) (pronounced as "try ") or **prefix tree** is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker.
Implement the Trie class:
* `Trie()` ... | null | Hash Table,String,Design,Trie | Medium | 211,642,648,676,1433,1949 |
224 | welcome to september's lego challenge today's problem is basic calculator given a string s representing a valid expression implement a basic calculator to evaluate it and return the result of the evaluation you are not allowed to use any built-in functions which use any built-in functions which use any built-in functio... | Basic Calculator | basic-calculator | Given a string `s` representing a valid expression, implement a basic calculator to evaluate it, and return _the result of the evaluation_.
**Note:** You are **not** allowed to use any built-in function which evaluates strings as mathematical expressions, such as `eval()`.
**Example 1:**
**Input:** s = "1 + 1 "
**O... | null | Math,String,Stack,Recursion | Hard | 150,227,241,282,785,2147,2328 |
385 | today we're gonna be working on lead code question number 385 mini parcel uh given a string s represents the serialization of a nested list implement a parser or tutorial d serialization and return the d serialize d serialized nested integer so basically if you have been given three to five you will be returning 324 bu... | Mini Parser | mini-parser | Given a string s represents the serialization of a nested list, implement a parser to deserialize it and return _the deserialized_ `NestedInteger`.
Each element is either an integer or a list whose elements may also be integers or other lists.
**Example 1:**
**Input:** s = "324 "
**Output:** 324
**Explanation:** Yo... | null | String,Stack,Depth-First Search | Medium | 341,439,722 |
959 | hello friends today last sub-regions cut hello friends today last sub-regions cut hello friends today last sub-regions cut by slashes it says in a given urn times on greed it is composed of 1 times 1 squares each one times one square consists of a slash backslash or blanks space these characters divide the square into ... | Regions Cut By Slashes | 3sum-with-multiplicity | An `n x n` grid is composed of `1 x 1` squares where each `1 x 1` square consists of a `'/'`, `'\'`, or blank space `' '`. These characters divide the square into contiguous regions.
Given the grid `grid` represented as a string array, return _the number of regions_.
Note that backslash characters are escaped, so a `... | null | Array,Hash Table,Two Pointers,Sorting,Counting | Medium | null |
1,091 | guys welcome to another video in the series of coding today we are going to do the problem which is called shortest path in binary matrix so you are given a binary matrix and you have to find the shortest length of the path that you can take uh to travel from the first cell to the last cell and the path should be only ... | Shortest Path in Binary Matrix | maximum-average-subtree | Given an `n x n` binary matrix `grid`, return _the length of the shortest **clear path** in the matrix_. If there is no clear path, return `-1`.
A **clear path** in a binary matrix is a path from the **top-left** cell (i.e., `(0, 0)`) to the **bottom-right** cell (i.e., `(n - 1, n - 1)`) such that:
* All the visite... | Can you find the sum of values and the number of nodes for every sub-tree ? Can you find the sum of values and the number of nodes for a sub-tree given the sum of values and the number of nodes of it's left and right sub-trees ? Use depth first search to recursively find the solution for the children of a node then use... | Tree,Depth-First Search,Binary Tree | Medium | 2126 |
429 | hi everyone welcome to my youtube channel i hope y'all are doing well so today in this video we are going to solve lead code daily challenge right so this is the problem of the need for daily challenge the problem is energy tree label order traverses the problem is easy only right if you know about level order traversa... | N-ary Tree Level Order Traversal | n-ary-tree-level-order-traversal | Given an n-ary tree, return the _level order_ 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:** \[\[1\],\[3,2,4\],\... | null | null | Medium | null |
129 | so hello everyone i am straight i am a software development engineer so we are starting with this lead code premium top interview problem series we will be discussing each and every problem which are mentioned on the lead code top interviews and also this will help you to crack your next coding interview in the top not... | 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 |
940 | hey everybody this is Larry it's November 6th or well it is number six here Daylight Saving is kind of weird for me so yeah uh today we're going to do a bonus question that I haven't done before hopefully so yeah hit the like button hit the Subscribe button join me in Discord let me know what you think about this poem ... | Distinct Subsequences II | fruit-into-baskets | Given a string s, return _the number of **distinct non-empty subsequences** of_ `s`. Since the answer may be very large, return it **modulo** `109 + 7`.
A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative... | null | Array,Hash Table,Sliding Window | Medium | null |
1,171 | hello everyone so I'm solving this medium level problem called remove zero some consecutive nodes from link list it's a good problem uh I did it as a part of daily problem I'm trying to solve that so let's take a look at what this question is asking us to do so given uh given the head of Link list we repeatedly delete ... | Remove Zero Sum Consecutive Nodes from Linked List | shortest-path-in-binary-matrix | Given the `head` of a linked list, we repeatedly delete consecutive sequences of nodes that sum to `0` until there are no such sequences.
After doing so, return the head of the final linked list. You may return any such answer.
(Note that in the examples below, all sequences are serializations of `ListNode` objects.)... | Do a breadth first search to find the shortest path. | Array,Breadth-First Search,Matrix | Medium | null |
62 | hey guys it's off by one here and today we're going to be solving unique pads in this problem we're told that there's a robot on an M by n grid and the robot is initially located on the top left corner like you can see here and they want the robot to try and move to the bottom right corner where it says finish and they... | 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 |
746 | hi guys welcome to tech geek so today the question for the daily lead foot challenge problem was minimum cost climbing stairs uh that's an easy one basically it's a the same as jumping or climbing stairs or jumping the wall so that's what the series comes up with it's more of a dp problem if you think of it in a very i... | Min Cost Climbing Stairs | prefix-and-suffix-search | You are given an integer array `cost` where `cost[i]` is the cost of `ith` step on a staircase. Once you pay the cost, you can either climb one or two steps.
You can either start from the step with index `0`, or the step with index `1`.
Return _the minimum cost to reach the top of the floor_.
**Example 1:**
**Input... | For a word like "test", consider "#test", "t#test", "st#test", "est#test", "test#test". Then if we have a query like prefix = "te", suffix = "t", we can find it by searching for something we've inserted starting with "t#te". | String,Design,Trie | Hard | 211 |
76 | so in this video we are going to solve one very common and interesting problem minimum window substring so problem is that you have given the two is doing SNP and you have to find out if all the characters even it is the duplic duplicate are present in this string or not and you have to find out that Windows means if y... | Minimum Window Substring | minimum-window-substring | Given two strings `s` and `t` of lengths `m` and `n` respectively, return _the **minimum window**_ **_substring_** _of_ `s` _such that every character in_ `t` _(**including duplicates**) is included in the window_. If there is no such substring, return _the empty string_ `" "`.
The testcases will be generated such tha... | Use two pointers to create a window of letters in S, which would have all the characters from T. Since you have to find the minimum window in S which has all the characters from T, you need to expand and contract the window using the two pointers and keep checking the window for all the characters. This approach is als... | Hash Table,String,Sliding Window | Hard | 30,209,239,567,632,727 |
930 | hey guys welcome to a new video in today's video we're going to look at lead code problem and the problem's name is binary subarrays with sum so in this question we given a binary array called nums and we also given an integer goal and our task is to return the number of non-entry subarrays with a sum equal to non-entr... | Binary Subarrays With Sum | all-possible-full-binary-trees | Given a binary array `nums` and an integer `goal`, return _the number of non-empty **subarrays** with a sum_ `goal`.
A **subarray** is a contiguous part of the array.
**Example 1:**
**Input:** nums = \[1,0,1,0,1\], goal = 2
**Output:** 4
**Explanation:** The 4 subarrays are bolded and underlined below:
\[**1,0,1**,0... | null | Dynamic Programming,Tree,Recursion,Memoization,Binary Tree | Medium | null |
1,970 | hello and welcome to another Elite code video today we're going to be doing the final dream problem of the day for June 30th last day when you can still cross um and we're actually going to go over the solution that I found that I did not come up with myself I will briefly talk about the one that I came up with myself ... | Last Day Where You Can Still Cross | sorting-the-sentence | There is a **1-based** binary matrix where `0` represents land and `1` represents water. You are given integers `row` and `col` representing the number of rows and columns in the matrix, respectively.
Initially on day `0`, the **entire** matrix is **land**. However, each day a new cell becomes flooded with **water**. ... | Divide the string into the words as an array of strings Sort the words by removing the last character from each word and sorting according to it | String,Sorting | Easy | 2168 |
824 | Hello friends welcome to my channel it's all the problem got lighting pimples and problem history with string in this problem sentence subscribe like this sentence subscribe to the Page if you liked The Video then subscribe to mobile se 2 minut modi ji from hair To the end of the millennium city Chief Minister also vis... | Goat Latin | number-of-lines-to-write-string | You are given a string `sentence` that consist of words separated by spaces. Each word consists of lowercase and uppercase letters only.
We would like to convert the sentence to "Goat Latin " (a made-up language similar to Pig Latin.) The rules of Goat Latin are as follows:
* If a word begins with a vowel (`'a'`, `... | null | Array,String | Easy | null |
230 | hello guys welcome back to take those and in this video we will see how to find the K its smallest element in a BST which is from lead code day 20 of them a challenge so let us now look at the problem statement let us assume that we are given a binary search tree and in here we want to find the K smallest element withi... | 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,901 | That welcome back price today they are going to solid problem 19715 topic element 200 amazon told e know i open play list solution videos vilas coding solution videos in java j2ee Please subscribe to the Channel etc stand hai slot video divine preparation for java j2ee interviews telephonic interview More Code Intervie... | Find a Peak Element II | equal-sum-arrays-with-minimum-number-of-operations | A **peak** element in a 2D grid is an element that is **strictly greater** than all of its **adjacent** neighbors to the left, right, top, and bottom.
Given a **0-indexed** `m x n` matrix `mat` where **no two adjacent cells are equal**, find **any** peak element `mat[i][j]` and return _the length 2 array_ `[i,j]`.
Yo... | Let's note that we want to either decrease the sum of the array with a larger sum or increase the array's sum with the smaller sum. You can maintain the largest increase or decrease you can make in a binary search tree and each time get the maximum one. | Array,Hash Table,Greedy,Counting | Medium | 1263 |
1,721 | hello everyone welcome to asmr call today we are going to solve another lead code problem name swapping nodes in a linked list so basically if you have not seen the problem statement you can pause the video right now then we can begin so what they are saying here that we will be given one linked list and we also given ... | 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 |
701 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem binary search tree iterator we're basically implementing a class that represents an iterator over a binary search tree that's supposed to be implemented by in order traversal basically what you would expect from a binar... | Insert into a Binary Search Tree | insert-into-a-binary-search-tree | You are given the `root` node of a binary search tree (BST) and a `value` to insert into the tree. Return _the root node of the BST after the insertion_. It is **guaranteed** that the new value does not exist in the original BST.
**Notice** that there may exist multiple valid ways for the insertion, as long as the tre... | null | null | Medium | null |
61 | hey everyone welcome back and let's write some more neat code today so today let's solve a linked list problem rotate list we're given the head of a linked list and all we need to do is rotate the list by k places so what do they actually mean by rotate well let's just take a look at the initial list you see we have on... | 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 |
258 | hey everybody this is larry this was the code daily challenge day 26 or something like that uh i did just hit the like button to subscribe and join me on discord you asked me more questions or whatever you like uh but yeah so this problem uh i have trouble figuring how to explain this uh because this is a weird problem... | Add Digits | add-digits | Given an integer `num`, repeatedly add all its digits until the result has only one digit, and return it.
**Example 1:**
**Input:** num = 38
**Output:** 2
**Explanation:** The process is
38 --> 3 + 8 --> 11
11 --> 1 + 1 --> 2
Since 2 has only one digit, return it.
**Example 2:**
**Input:** num = 0
**Output:** 0
*... | A naive implementation of the above process is trivial. Could you come up with other methods? What are all the possible results? How do they occur, periodically or randomly? You may find this Wikipedia article useful. | Math,Simulation,Number Theory | Easy | 202,1082,2076,2264 |
1,739 | hey everybody this is larry this is me going for q4 of the recent weekly uh contest 225 or 255. wow oh no 225 okay uh building box uh hit the like button to subscribe and join me in discord i spent a little bit of rough time for me uh lately so um so definitely if i don't have the energy excuse me uh and let me know wh... | Building Boxes | split-two-strings-to-make-palindrome | You have a cubic storeroom where the width, length, and height of the room are all equal to `n` units. You are asked to place `n` boxes in this room where each box is a cube of unit side length. There are however some rules to placing the boxes:
* You can place the boxes anywhere on the floor.
* If box `x` is plac... | Try finding the largest prefix form a that matches a suffix in b Try string matching | Two Pointers,String,Greedy | Medium | null |
213 | hey everyone in this video let's go to question 213 House robber 2 on leak code this is part of our blind 75 list of questions so let's begin in this question you're a professional robber planning to rob houses along a street each house has a certain amount of money stashed all houses at this place are arranged in a ci... | House Robber II | house-robber-ii | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are **arranged in a circle.** That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have a security system connected, and **it will automatical... | Since House[1] and House[n] are adjacent, they cannot be robbed together. Therefore, the problem becomes to rob either House[1]-House[n-1] or House[2]-House[n], depending on which choice offers more money. Now the problem has degenerated to the House Robber, which is already been solved. | Array,Dynamic Programming | Medium | 198,256,276,337,600,656 |
1,721 | hey folks welcome back to another video today we're looking at question 1721 swapping nodes in a linked list the way we'll be approaching this problem is by using two pointers uh slow and fast um so let's jump right in the a couple of things that you need to set up the question is that you need three notes slow fast an... | 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 |
956 | Hello everyone welcome, we are going to do video number 41 of my channel, okay and my playlist of DP consumption question has also started, so you can start watching that too, okay and I am also available on Facebook and Instagram. Court Service with Mike's name is ok lead number is 956 yaar medium mark toh hai sorry m... | Tallest Billboard | number-of-music-playlists | You are installing a billboard and want it to have the largest height. The billboard will have two steel supports, one on each side. Each steel support must be an equal height.
You are given a collection of `rods` that can be welded together. For example, if you have rods of lengths `1`, `2`, and `3`, you can weld the... | null | Math,Dynamic Programming,Combinatorics | Hard | null |
142 | hi welcome to this video for elite code 142 linked list cycle the goal of this question is to actually find the beginning of where the cycle starts so of a linked list i should say and the other thing that you want to know is that this particular question involves a technique called fast and slow pointers it's very imp... | 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 |
957 | Hello hello everybody welcome to my channel today is the day 3 of sewa recording challenge MB problem in presence of trends in this problem for nurses back to win the best tools everyday subscribe our Channel subscribe and subscribe the Channel subscribe Video subscribe duty world ki main 1000 Subscription Rate Tools S... | 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 |
1,377 | hey what's up guys this is chung here so today uh let's take a look at this hard problem here uh number 1377 frog position after t seconds okay so you're given like an undirected tree right and the nodes are from one to okay and a frog starts jumping from node one and in each second right the frog jumps from its curren... | Frog Position After T Seconds | number-of-comments-per-post | Given an undirected tree consisting of `n` vertices numbered from `1` to `n`. A frog starts jumping from **vertex 1**. In one second, the frog jumps from its current vertex to another **unvisited** vertex if they are directly connected. The frog can not jump back to a visited vertex. In case the frog can jump to severa... | null | Database | Easy | null |
771 | hi my name's david today we're going to do number 771 jewels and stones it's a easy level record problem and the language we're going to use to solve it is will be in javascript so it was a fun one it took me a second to understand what's going to be asked though so basically you get uh you're taking jewels and stones ... | Jewels and Stones | encode-n-ary-tree-to-binary-tree | You're given strings `jewels` representing the types of stones that are jewels, and `stones` representing the stones you have. Each character in `stones` is a type of stone you have. You want to know how many of the stones you have are also jewels.
Letters are case sensitive, so `"a "` is considered a different type o... | null | Tree,Depth-First Search,Breadth-First Search,Design,Binary Tree | Hard | 765 |
67 | hello world today we're doing problem 67 at binary this was a problem given by tesla so let's see what even musk actually wants from us and is it too crazy i'm gonna remove that and let's read the problem given two binary strings a and b return their sum as a binary string that's pretty much it so what we should do now... | 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 |
112 | ranked 112 paths some come in a binary tree and a some determinable tree has a root to leaf path such that adding up all the values along the path you goes to given some believe is an OBE of no children below given a below tree or some and your journey to returns true ok time I think this is tray foolish yeah let's jus... | 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 |
1,096 | rotations okay and their grandma given below shrinks Emily can represent a set of lowercase first let's use all of expressions they know their set of words the expression represents okay grandma can be understood by some more examples single letters represent a singleton containing that word okay I mean I guess that's ... | Brace Expansion II | maximum-sum-of-two-non-overlapping-subarrays | Under the grammar given below, strings can represent a set of lowercase words. Let `R(expr)` denote the set of words the expression represents.
The grammar can best be understood through simple examples:
* Single letters represent a singleton set containing that word.
* `R( "a ") = { "a "}`
* `R( "w ") ... | We can use prefix sums to calculate any subarray sum quickly.
For each L length subarray, find the best possible M length subarray that occurs before and after it. | Array,Dynamic Programming,Sliding Window | Medium | null |
92 | Hello everyone welcome you are steam bomb so you are going to solve a problem since this is reverse de notes of list from position left to right so we must have been given two positions left and right something like this and we have the notes in between these. The links have to be reversed. Okay, if you look carefully,... | Reverse Linked List II | reverse-linked-list-ii | Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], left = 2, right = 4
**Output:** \[1,4,3,2,5\]
**Example 2:**
**I... | null | Linked List | Medium | 206 |
444 | hey what's up guys chum here again so today let's take a look at another leaf called the problem number 4 sequence reconstruction it's a medium problem as you guys can see it because a lot of downloads even I gave him gave this problem a download but still I want to talk about this problem because this is like it's a S... | Sequence Reconstruction | sequence-reconstruction | You are given an integer array `nums` of length `n` where `nums` is a permutation of the integers in the range `[1, n]`. You are also given a 2D integer array `sequences` where `sequences[i]` is a subsequence of `nums`.
Check if `nums` is the shortest possible and the only **supersequence**. The shortest **supersequen... | null | Array,Graph,Topological Sort | Medium | 210 |
1,401 | hi friends uh let's have a look at problem 1401 Circle and rectangle overlapping in this video we're going to explain a solution by locating the nearest point in the rectangle to the center of the circle so this will enable us to give solutions to this problem so in this problem the problem statement is very simple we ... | Circle and Rectangle Overlapping | number-of-burgers-with-no-waste-of-ingredients | You are given a circle represented as `(radius, xCenter, yCenter)` and an axis-aligned rectangle represented as `(x1, y1, x2, y2)`, where `(x1, y1)` are the coordinates of the bottom-left corner, and `(x2, y2)` are the coordinates of the top-right corner of the rectangle.
Return `true` _if the circle and rectangle are... | Can we have an answer if the number of tomatoes is odd ? If we have answer will be there multiple answers or just one answer ? Let us define number of jumbo burgers as X and number of small burgers as Y
We have to find an x and y in this equation 1. 4X + 2Y = tomato 2. X + Y = cheese | Math | Medium | null |
11 | hello guys in this particular example I will be discussing about lead code problem number 11 container with most water so in the problem you are given an array indicating the height of the lines you have to find the container with the most water the two points with which can have the most water say for example in the f... | 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 |
714 | hey what's up guys uh this is chung here so today uh today's daily challenge problem number 714 best time to buy and sell stock with transaction fee right so this is another very classic buy and sell stock problem the only difference for this one is that you know each transaction has a fee right so again right you're g... | Best Time to Buy and Sell Stock with Transaction Fee | best-time-to-buy-and-sell-stock-with-transaction-fee | You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day, and an integer `fee` representing a transaction fee.
Find the maximum profit you can achieve. You may complete as many transactions as you like, but you need to pay the transaction fee for each transaction.
**Note:** You... | Consider the first K stock prices. At the end, the only legal states are that you don't own a share of stock, or that you do. Calculate the most profit you could have under each of these two cases. | Array,Dynamic Programming,Greedy | Medium | 122 |
989 | hello everyone so this is lead code 989 add to array form of integer so in this we have been provided an array and we have been given a number k and we have to return the sum of the um the number given in the array and the given number 34 so consider that if we have 1 2 0 then we have to first make the number 1200 and ... | Add to Array-Form of Integer | largest-component-size-by-common-factor | The **array-form** of an integer `num` is an array representing its digits in left to right order.
* For example, for `num = 1321`, the array form is `[1,3,2,1]`.
Given `num`, the **array-form** of an integer, and an integer `k`, return _the **array-form** of the integer_ `num + k`.
**Example 1:**
**Input:** num ... | null | Array,Math,Union Find | Hard | 2276 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.