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 |
|---|---|---|---|---|---|---|---|---|
407 | hello friends today less of tribe around water to problem even an M times and metrics of positive integers representing the height of each unit cell near to D elevation map computes the volume of water it is able to trap after ending let's see this example we can imagine as a 3d picture so after branding we know this t... | Trapping Rain Water II | trapping-rain-water-ii | Given an `m x n` integer matrix `heightMap` representing the height of each unit cell in a 2D elevation map, return _the volume of water it can trap after raining_.
**Example 1:**
**Input:** heightMap = \[\[1,4,3,1,3,2\],\[3,2,1,3,2,4\],\[2,3,3,2,3,1\]\]
**Output:** 4
**Explanation:** After the rain, water is trapped... | null | Array,Breadth-First Search,Heap (Priority Queue),Matrix | Hard | 42 |
740 | lol hey guys welcome back to my channel and this video we are going to solve lead and used as five problem of market code 100 giver statement is this and interior AIIMS you want to maximize the number of points you get by performing the following operation any Number of Times Pain in Terms of End Its Two Points at Awar... | Delete and Earn | delete-and-earn | You are given an integer array `nums`. You want to maximize the number of points you get by performing the following operation any number of times:
* Pick any `nums[i]` and delete it to earn `nums[i]` points. Afterwards, you must delete **every** element equal to `nums[i] - 1` and **every** element equal to `nums[i]... | If you take a number, you might as well take them all. Keep track of what the value is of the subset of the input with maximum M when you either take or don't take M. | Array,Hash Table,Dynamic Programming | Medium | 198 |
7 | oh this is Kevin I'm a software engineer at Google and graduate from the X program at UC Berkeley go bears and today I'm gonna be talking about leak code number seven reverse integer and this is an easy problem all right so for this problem the idea is you're given some integer 1 2 3 for example and you just want to re... | Reverse Integer | reverse-integer | Given a signed 32-bit integer `x`, return `x` _with its digits reversed_. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-231, 231 - 1]`, then return `0`.
**Assume the environment does not allow you to store 64-bit integers (signed or unsigned).**
**Example 1:**
**Input:** x = 123
... | null | Math | Medium | 8,190,2238 |
1,043 | hi I'm Jack are doing today tell today let's look at this new problem it's 10:43 partition array for a maximum it's 10:43 partition array for a maximum it's 10:43 partition array for a maximum sum this is the first time I look at this problem given an integer array a you partition the array into contiguous sub arrays o... | Partition Array for Maximum Sum | grid-illumination | Given an integer array `arr`, partition the array into (contiguous) subarrays of length **at most** `k`. After partitioning, each subarray has their values changed to become the maximum value of that subarray.
Return _the largest sum of the given array after partitioning. Test cases are generated so that the answer fi... | null | Array,Hash Table | Hard | 51 |
538 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem convert binary search tree into a grader tree so we're given the root of a binary search tree and we want to convert it such that every key of the original binary search tree is changed to be the original value plus the... | Convert BST to Greater Tree | convert-bst-to-greater-tree | Given the `root` of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus the sum of all keys greater than the original key in BST.
As a reminder, a _binary search tree_ is a tree that satisfies these constraints:
* The left subtree of a... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | null |
513 | hey everyone welcome back and today we'll be doing another lead code problem 513 find bottom left tree value this is the medium one given the root of the binary written the most left value in the last row of the tree so the left value here in example one you can see it is one because it is the most left value and in an... | 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 |
485 | Hello Guys Welcome's Mist Full Volume Maximum Quantity One Festival Quantity Example You've Done Something Like Friend 12141 Seervi is a Tiny Case That Dancer in This Case for Economy Per Maximum Side Mother Teresa Ko at Maximum Subscribe button click and subscribe my channel like and it's something like this is very b... | Max Consecutive Ones | max-consecutive-ones | Given a binary array `nums`, return _the maximum number of consecutive_ `1`_'s in the array_.
**Example 1:**
**Input:** nums = \[1,1,0,1,1,1\]
**Output:** 3
**Explanation:** The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s is 3.
**Example 2:**
**Input:** nums = ... | You need to think about two things as far as any window is concerned. One is the starting point for the window. How do you detect that a new window of 1s has started? The next part is detecting the ending point for this window.
How do you detect the ending point for an existing window? If you figure these two things... | Array | Easy | 487,1046,1542,1999 |
1,710 | That a hello everyone welcome to day routine to julie challenge and aspirations maximum unit time truck in this fashion wear give in the defects number of boxes and units per box also give the total capacity of the match david warner religion units do Do Subscribe Maximum Unit Blood List Ko 1170 Electronic Bulb Skin Su... | Maximum Units on a Truck | find-servers-that-handled-most-number-of-requests | You are assigned to put some amount of boxes onto **one truck**. You are given a 2D array `boxTypes`, where `boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]`:
* `numberOfBoxesi` is the number of boxes of type `i`.
* `numberOfUnitsPerBoxi` is the number of units in each box of the type `i`.
You are also given... | To speed up the next available server search, keep track of the available servers in a sorted structure such as an ordered set. To determine if a server is available, keep track of the end times for each task in a heap and add the server to the available set once the soonest task ending time is less than or equal to th... | Array,Greedy,Heap (Priority Queue),Ordered Set | Hard | null |
1,624 | hey everybody this is larry this is me going over q1 of the weekly contest 211 uh largest substring between two equal characters so this one um you know a couple of ways you can do it uh you could probably do it by characters like abs try for a and then try for b and then try for c and then just look at the farthest on... | Largest Substring Between Two Equal Characters | clone-binary-tree-with-random-pointer | Given a string `s`, return _the length of the longest substring between two equal characters, excluding the two characters._ If there is no such substring return `-1`.
A **substring** is a contiguous sequence of characters within a string.
**Example 1:**
**Input:** s = "aa "
**Output:** 0
**Explanation:** The optim... | Traverse the tree, keep a hashtable with you and create a nodecopy for each node in the tree. Start traversing the original tree again and connect the left, right and random pointers 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,Binary Tree | Medium | 133,138,1634 |
202 | lead code problem number 202 happy number so this problem wants us to write an algorithm to determine if a number is happy so a number but a happy number is a number defined by the following process so starting with any positive integer we replace the number by the sum of the squares of its digits we repeat this proces... | 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 |
18 | hi everyone today we are going to solve the little question for some so you are given a randoms of an integer return array of all the unique druplets a b c d e such that so all numbers are greater than or equal zero in the less than n and the a b c and d are distinct and a plus b plus C plus t equal Target so you made ... | 4Sum | 4sum | Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that:
* `0 <= a, b, c, d < n`
* `a`, `b`, `c`, and `d` are **distinct**.
* `nums[a] + nums[b] + nums[c] + nums[d] == target`
You may return the answer in **any order**.
**Examp... | null | Array,Two Pointers,Sorting | Medium | 1,15,454,2122 |
1,812 | okay lead code number eighteen twelve determining color of a chess per square pretty straightforward task description we have the coordinate of the square in a chess format with the letter and with the corresponding number and we have to say whether it's white or not return a boolean so it's a pretty easy assumption to... | Determine Color of a Chessboard Square | reformat-phone-number | You are given `coordinates`, a string that represents the coordinates of a square of the chessboard. Below is a chessboard for your reference.
Return `true` _if the square is white, and_ `false` _if the square is black_.
The coordinate will always represent a valid chessboard square. The coordinate will always have t... | Discard all the spaces and dashes. Use a while loop. While the string still has digits, check its length and see which rule to apply. | String | Easy | null |
491 | non-decreasing subsequence and sorry for non-decreasing subsequence and sorry for non-decreasing subsequence and sorry for not posting recently I've been a little bit busy so this is um you can use the template from subsets like if you just type lead code subsets it's a typical backtracking problem and so once I'll ass... | Non-decreasing Subsequences | increasing-subsequences | Given an integer array `nums`, return _all the different possible non-decreasing subsequences of the given array with at least two elements_. You may return the answer in **any order**.
**Example 1:**
**Input:** nums = \[4,6,7,7\]
**Output:** \[\[4,6\],\[4,6,7\],\[4,6,7,7\],\[4,7\],\[4,7,7\],\[6,7\],\[6,7,7\],\[7,7\]... | null | Array,Hash Table,Backtracking,Bit Manipulation | Medium | 646 |
222 | hello everyone welcome back to another video phenomenal forest let's continue our liquor challenge today's Neko question is called counting completed reload give a complete para new tree contact a number of Lord you didn't injure two finally what is completed funnily tree on Wikipedia here they yoga tompa has pink even... | Count Complete Tree Nodes | count-complete-tree-nodes | Given the `root` of a **complete** binary tree, return the number of the nodes in the tree.
According to **[Wikipedia](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled in a complete binary tree, and all nodes in the last level are as far lef... | null | Binary Search,Tree,Depth-First Search,Binary Tree | Medium | 270 |
733 | hey there friends great to see you again on quadmaster Quest today we are diving into a colorful pixel Adventure so let's Jump Right In and find the question description on link let's find out the flood field problem segment here an image is represented by a grid of M rows and N columns where image I and J represent th... | Flood Fill | flood-fill | An image is represented by an `m x n` integer grid `image` where `image[i][j]` represents the pixel value of the image.
You are also given three integers `sr`, `sc`, and `color`. You should perform a **flood fill** on the image starting from the pixel `image[sr][sc]`.
To perform a **flood fill**, consider the startin... | Write a recursive function that paints the pixel if it's the correct color, then recurses on neighboring pixels. | Array,Depth-First Search,Breadth-First Search,Matrix | Easy | 463 |
82 | in this problem we have a single linked list and it's sorted and there are some nodes which are duplicated so if the list is sorted all the duplicate nodes will come together so we have to remove those duplicate nodes and there are two versions of this problem so in the in one version uh you have to remove just the dup... | Remove Duplicates from Sorted List II | remove-duplicates-from-sorted-list-ii | Given the `head` of a sorted linked list, _delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list_. Return _the linked list **sorted** as well_.
**Example 1:**
**Input:** head = \[1,2,3,3,4,4,5\]
**Output:** \[1,2,5\]
**Example 2:**
**Input:** head = \[1,1,1,2,3\]
**Outpu... | null | Linked List,Two Pointers | Medium | 83,1982 |
1,344 | Hai Hello Guys Welcome To Karta Usman Disney Today Absolutely Sudhar Day Routine Problem July Decoding Challenge Angle Between Hands Of Clans Please Like This Video Fuel Ke To Subscribe Our Channel Sudhar Information Update That Given To Number 12 Minutes And Small Rangoli And Degrees From Vipin Gaur And Minute Disgust... | Angle Between Hands of a Clock | maximum-equal-frequency | Given two numbers, `hour` and `minutes`, return _the smaller angle (in degrees) formed between the_ `hour` _and the_ `minute` _hand_.
Answers within `10-5` of the actual value will be accepted as correct.
**Example 1:**
**Input:** hour = 12, minutes = 30
**Output:** 165
**Example 2:**
**Input:** hour = 3, minutes ... | Keep track of the min and max frequencies. The number to be eliminated must have a frequency of 1, same as the others or the same +1. | Array,Hash Table | Hard | null |
8 | hello uh this is kevin i'm a software engineer at google and um cal berkeley each grad go bears and today i'm going to talk about lee code number eight string to integer a to i ask you to integer cool so this problem uh basically it's just asking you to convert a um a number that's in a string into an integer and this ... | String to Integer (atoi) | string-to-integer-atoi | Implement the `myAtoi(string s)` function, which converts a string to a 32-bit signed integer (similar to C/C++'s `atoi` function).
The algorithm for `myAtoi(string s)` is as follows:
1. Read in and ignore any leading whitespace.
2. Check if the next character (if not already at the end of the string) is `'-'` or `... | null | String | Medium | 7,65,2168 |
1,189 | given the strain text written the maximum number of the word balloon that it can form by using any of the characters in this given text and most once design an acronym to implement that's about today's video less time Valley this is where my dream started hi everyone this is Steve here today we're going through another... | Maximum Number of Balloons | encode-number | Given a string `text`, you want to use the characters of `text` to form as many instances of the word **"balloon "** as possible.
You can use each character in `text` **at most once**. Return the maximum number of instances that can be formed.
**Example 1:**
**Input:** text = "nlaebolko "
**Output:** 1
**Example 2... | Try to find the number of binary digits returned by the function. The pattern is to start counting from zero after determining the number of binary digits. | Math,String,Bit Manipulation | Medium | 1070 |
1,913 | hello everyone today we are solving lead code problem number 1 1913 maximum product difference between two pairs okay so if we consider any pairs so 5 6 or 7 2 7 what is the product difference 5 into 6 subtracted by like 2 into 7 so this is the product difference of any uh two pairs and in this problem we are given arr... | Maximum Product Difference Between Two Pairs | make-the-xor-of-all-segments-equal-to-zero | The **product difference** between two pairs `(a, b)` and `(c, d)` is defined as `(a * b) - (c * d)`.
* For example, the product difference between `(5, 6)` and `(2, 7)` is `(5 * 6) - (2 * 7) = 16`.
Given an integer array `nums`, choose four **distinct** indices `w`, `x`, `y`, and `z` such that the **product differ... | Let's note that for the XOR of all segments with size K to be equal to zeros, nums[i] has to be equal to nums[i+k] Basically, we need to make the first K elements have XOR = 0 and then modify them. | Array,Dynamic Programming,Bit Manipulation | Hard | null |
732 | hey guys welcome back to programmer fillers and today we'll be discussing about the lead code problem 721 my calendar third it's a hard problem and okay let's start the problem so it's a lead code 72 732 my calendar third problem it's a hard problem so what it says right K booking happen when gay events have a some kno... | My Calendar III | my-calendar-iii | A `k`\-booking happens when `k` events have some non-empty intersection (i.e., there is some time that is common to all `k` events.)
You are given some events `[startTime, endTime)`, after each given event, return an integer `k` representing the maximum `k`\-booking between all the previous events.
Implement the `MyC... | Treat each interval [start, end) as two events "start" and "end", and process them in sorted order. | Design,Segment Tree,Ordered Set | Hard | 729,731 |
1,600 | hello everyone welcome to the lead code challenge in this video i would like to discuss about the problem throne inheritance so this is this problem is part of a weekly challenge so let's check the description a kingdom consists of a king his children his grandchildren and so on every once in a while someone in the fam... | Throne Inheritance | throne-inheritance | A kingdom consists of a king, his children, his grandchildren, and so on. Every once in a while, someone in the family dies or a child is born.
The kingdom has a well-defined order of inheritance that consists of the king as the first member. Let's define the recursive function `Successor(x, curOrder)`, which given a ... | null | null | Medium | null |
1,910 | foreign that will be that is s and part and we need to perform the following operation or else until all occurrences of Class substring part are removed so basically we need to find the most occurs of the substring part and remove it from the from this and after removing this substring which characters we are left in a... | Remove All Occurrences of a Substring | check-if-binary-string-has-at-most-one-segment-of-ones | Given two strings `s` and `part`, perform the following operation on `s` until **all** occurrences of the substring `part` are removed:
* Find the **leftmost** occurrence of the substring `part` and **remove** it from `s`.
Return `s` _after removing all occurrences of_ `part`.
A **substring** is a contiguous seque... | It's guaranteed to have at least one segment The string size is small so you can count all segments of ones with no that have no adjacent ones. | String | Easy | 1999 |
394 | everyone we're going to be solving leak code 394 today and this is decode string so we're given an encoded string and we want to return the decoded string so the encoding rule is that we have some number K and inside these brackets we're going to have an encoded string and this encoded string is going to be repe repeat... | 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 |
82 | Hello hello welcome to my channel, Azam ki try karenge Titu remove duplicate songs started less, it means one more point in this only in removing the brigade, some elements are kept there but the question with S is different from Mathura, it is understood here. 123 456 So if this is like this then you have to remove th... | Remove Duplicates from Sorted List II | remove-duplicates-from-sorted-list-ii | Given the `head` of a sorted linked list, _delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list_. Return _the linked list **sorted** as well_.
**Example 1:**
**Input:** head = \[1,2,3,3,4,4,5\]
**Output:** \[1,2,5\]
**Example 2:**
**Input:** head = \[1,1,1,2,3\]
**Outpu... | null | Linked List,Two Pointers | Medium | 83,1982 |
4 | so this is a problem we're given two sorted arrays of arbitrary links and we want to find the medium of their union so say that one of the first to raise a and a second right be the union of both of these arrays begin 1 2 3 4 5 6 8 9 and the medium will be 5 because 5 is the middle of this array and the reason for it i... | Median of Two Sorted Arrays | median-of-two-sorted-arrays | Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays.
The overall run time complexity should be `O(log (m+n))`.
**Example 1:**
**Input:** nums1 = \[1,3\], nums2 = \[2\]
**Output:** 2.00000
**Explanation:** merged array = \[1,2,3\] and median is ... | null | Array,Binary Search,Divide and Conquer | Hard | null |
1,913 | hello everyone welcome to code clips so in this video we will solve uh lead code problem number 1913 that is maximum product difference between two pairs so let's go by the problem statement says that the product difference between two pairs a comma b and c comma d is defined as a star b minus c star t for example the ... | Maximum Product Difference Between Two Pairs | make-the-xor-of-all-segments-equal-to-zero | The **product difference** between two pairs `(a, b)` and `(c, d)` is defined as `(a * b) - (c * d)`.
* For example, the product difference between `(5, 6)` and `(2, 7)` is `(5 * 6) - (2 * 7) = 16`.
Given an integer array `nums`, choose four **distinct** indices `w`, `x`, `y`, and `z` such that the **product differ... | Let's note that for the XOR of all segments with size K to be equal to zeros, nums[i] has to be equal to nums[i+k] Basically, we need to make the first K elements have XOR = 0 and then modify them. | Array,Dynamic Programming,Bit Manipulation | Hard | null |
829 | welcome to a code report solution video in this video we're going to be covering the solution to problem 3 from leak code contest 83 entitled consecutive numbers sum the problem statement is very simple and it states given a positive integer n how many ways can we write it as a sum of consecutive positive integers and ... | Consecutive Numbers Sum | subdomain-visit-count | Given an integer `n`, return _the number of ways you can write_ `n` _as the sum of consecutive positive integers._
**Example 1:**
**Input:** n = 5
**Output:** 2
**Explanation:** 5 = 2 + 3
**Example 2:**
**Input:** n = 9
**Output:** 3
**Explanation:** 9 = 4 + 5 = 2 + 3 + 4
**Example 3:**
**Input:** n = 15
**Output... | null | Array,Hash Table,String,Counting | Medium | null |
639 | Ajay Ko That Stitch On Film Lootera Press Decode Waste To The Question This Avadhesh Subscribe To Put Without Maths Slide Presentation Of Deposits And Let's Get Started Soak In This To-Do List 2068 Soak In This To-Do List 2068 Soak In This To-Do List 2068 E Want Friends And Request them into account all possible ways i... | Decode Ways II | decode-ways-ii | A message containing letters from `A-Z` can be **encoded** into numbers using the following mapping:
'A' -> "1 "
'B' -> "2 "
...
'Z' -> "26 "
To **decode** an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For examp... | null | String,Dynamic Programming | Hard | 91,2091,2251 |
389 | this is leadcore challenge 389 it's called find the difference we are giving two strings S and T is basically the same string as s but is generated by randomly shuffling the characters inside of s and then adding one more letter at a random position so we need to find what is that extra letter and return it so they see... | Find the Difference | find-the-difference | You are given two strings `s` and `t`.
String `t` is generated by random shuffling string `s` and then add one more letter at a random position.
Return the letter that was added to `t`.
**Example 1:**
**Input:** s = "abcd ", t = "abcde "
**Output:** "e "
**Explanation:** 'e' is the letter that was added.
**Exam... | null | Hash Table,String,Bit Manipulation,Sorting | Easy | 136 |
387 | hello guys welcome to study algorithms and today we would be looking at finding the first unique character in a string first I would go over some sample test cases and show you what do you mean by the first unique character next we would discuss a brute force solution to the problem we will then try to optimize it foll... | First Unique Character in a String | first-unique-character-in-a-string | Given a string `s`, _find the first non-repeating character in it and return its index_. If it does not exist, return `-1`.
**Example 1:**
**Input:** s = "leetcode"
**Output:** 0
**Example 2:**
**Input:** s = "loveleetcode"
**Output:** 2
**Example 3:**
**Input:** s = "aabb"
**Output:** -1
**Constraints:**
* `... | null | Hash Table,String,Queue,Counting | Easy | 451 |
442 | welcome to joystick my friend in this video we are going to look into a problem that has been asked in interviews of companies like amazon and d shop the problem is print duplicate elements in an array we'll write a java program to solve this problem and let me tell you that we won't use two loops to find the duplicate... | 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 |
263 | e Hello everyone, today we are together again with the result, the name of your question today is Adnan. Whether the number given to you for the first turnover was a number in your mind, friends, ugly numbers were funny, when we look at the examples defined as numbers with only prime divisors 2, 3 and 5, here is the nu... | 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 |
103 | hello everyone today we will discuss the lead code problem 103 which is binary zigzag level order traversal which is based on the theory of level order traversal which i just discussed in the previous video so i will highly recommend you that you first watch the previous video level order traversal then it will be very... | Binary Tree Zigzag Level Order Traversal | binary-tree-zigzag-level-order-traversal | Given the `root` of a binary tree, return _the zigzag level order traversal of its nodes' values_. (i.e., from left to right, then right to left for the next level and alternate between).
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[3\],\[20,9\],\[15,7\]\]
**Example 2:**
**Input:** roo... | null | Tree,Breadth-First Search,Binary Tree | Medium | 102 |
69 | what's up everyone today we're going to go really code 69 square root of a number so first we'll go over the input output and we'll look at the approach then i'll draw a diagram and finally we'll look at the code and complexity okay so the input is going to be a number and the output is also going to be a number if we ... | Sqrt(x) | sqrtx | Given a non-negative integer `x`, return _the square root of_ `x` _rounded down to the nearest integer_. The returned integer should be **non-negative** as well.
You **must not use** any built-in exponent function or operator.
* For example, do not use `pow(x, 0.5)` in c++ or `x ** 0.5` in python.
**Example 1:**
... | Try exploring all integers. (Credits: @annujoshi) Use the sorted property of integers to reduced the search space. (Credits: @annujoshi) | Math,Binary Search | Easy | 50,367 |
1,218 | Hello everyone welcome to me channel question's playlist has been created and video songs have started in it so you can start that also. Medium mark is ok to read scratch DP but it is going to be a very easy DP question and We will understand why there is a DCA question and will also make it in a very basic way. First ... | Longest Arithmetic Subsequence of Given Difference | lowest-common-ancestor-of-deepest-leaves | Given an integer array `arr` and an integer `difference`, return the length of the longest subsequence in `arr` which is an arithmetic sequence such that the difference between adjacent elements in the subsequence equals `difference`.
A **subsequence** is a sequence that can be derived from `arr` by deleting some or n... | Do a postorder traversal. Then, if both subtrees contain a deepest leaf, you can mark this node as the answer (so far). The final node marked will be the correct answer. | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 1816 |
848 | hello everyone welcome to coding culture this channel will contain those programs whose explanation is either not present on youtube or the explanation is present but not up to the mark so without wasting time let's get started so today is the eighth day of the september date coding challenge and the today's question i... | Shifting Letters | shifting-letters | You are given a string `s` of lowercase English letters and an integer array `shifts` of the same length.
Call the `shift()` of a letter, the next letter in the alphabet, (wrapping around so that `'z'` becomes `'a'`).
* For example, `shift('a') = 'b'`, `shift('t') = 'u'`, and `shift('z') = 'a'`.
Now for each `shif... | null | null | Medium | null |
72 | welcome to this new video where we'll see the edit distance problem so what does the problem say it says given two words of strings word one and we're two create a function that returns the minimum number of operations required to convert word1 to word2 note that we have 3 possible operations we can either insert a cha... | Edit Distance | edit-distance | Given two strings `word1` and `word2`, return _the minimum number of operations required to convert `word1` to `word2`_.
You have the following three operations permitted on a word:
* Insert a character
* Delete a character
* Replace a character
**Example 1:**
**Input:** word1 = "horse ", word2 = "ros "
**O... | null | String,Dynamic Programming | Hard | 161,583,712,1105,2311 |
115 | hello everyone so welcome to my channel today we are going to do lead code question distinct subsequences so today is the third day for the dp series so here's the third question in front of you so basically you need to first figure out that this question is similar to which sort of question and then we'll proceed with... | Distinct Subsequences | distinct-subsequences | Given two strings `s` and `t`, return _the number of distinct_ **_subsequences_** _of_ `s` _which equals_ `t`.
The test cases are generated so that the answer fits on a 32-bit signed integer.
**Example 1:**
**Input:** s = "rabbbit ", t = "rabbit "
**Output:** 3
**Explanation:**
As shown below, there are 3 ways you... | null | String,Dynamic Programming | Hard | 2115 |
1,796 | hey guys welcome to a new video in today's video we're going to look at a lead code problem and the problem's name is second largest digit in a string in this question we're given a string s which contains alphanumeric characters we have to return the second largest numerical digit that appears in the string else if th... | Second Largest Digit in a String | correct-a-binary-tree | Given an alphanumeric string `s`, return _the **second largest** numerical digit that appears in_ `s`_, or_ `-1` _if it does not exist_.
An **alphanumeric** string is a string consisting of lowercase English letters and digits.
**Example 1:**
**Input:** s = "dfa12321afd "
**Output:** 2
**Explanation:** The digits t... | If you traverse the tree from right to left, the invalid node will point to a node that has already been visited. | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 114,766 |
925 | Hello This Video They Would Be Solving D First Question is Inside DSP Preparation Series This Lead Code 925 Problem So Friend Read This Problem Statement A Little Bit It Is In Easy Category So The Name Of This Question Is Long Breast Name So Your Friend Is Typing This Name In Keyboard Some Times Wait Typing N Character... | Long Pressed Name | construct-binary-tree-from-preorder-and-postorder-traversal | Your friend is typing his `name` into a keyboard. Sometimes, when typing a character `c`, the key might get _long pressed_, and the character will be typed 1 or more times.
You examine the `typed` characters of the keyboard. Return `True` if it is possible that it was your friends name, with some characters (possibly ... | null | Array,Hash Table,Divide and Conquer,Tree,Binary Tree | Medium | null |
328 | today we will solve a linked list based problem and here the task is to group together all the even and odd nodes and uh by odd nodes we mean uh the position of the node not the value in the node it may be possible that all values are odd then we will call that this first node third node fifth node these are odd nodes ... | 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 |
1,239 | oh hey everybody this is Larry this is day 24 of the liquid daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's contest ooh easy peasy clicked on this button for extra 10 coins yay um anyway today's problem is 12 39 maximum length of concatenated stri... | Maximum Length of a Concatenated String with Unique Characters | largest-1-bordered-square | You are given an array of strings `arr`. A string `s` is formed by the **concatenation** of a **subsequence** of `arr` that has **unique characters**.
Return _the **maximum** possible length_ of `s`.
A **subsequence** is an array that can be derived from another array by deleting some or no elements without changing ... | For each square, know how many ones are up, left, down, and right of this square. You can find it in O(N^2) using dynamic programming. Now for each square ( O(N^3) ), we can evaluate whether that square is 1-bordered in O(1). | Array,Dynamic Programming,Matrix | Medium | null |
136 | hey everybody this is away and in this video we are going to solve a problem called single number this is 136 problem in the lead code so in this question we will be given a non-empty area of integer nums given a non-empty area of integer nums given a non-empty area of integer nums every element appear twice except for... | Single Number | single-number | Given a **non-empty** array of integers `nums`, every element appears _twice_ except for one. Find that single one.
You must implement a solution with a linear runtime complexity and use only constant extra space.
**Example 1:**
**Input:** nums = \[2,2,1\]
**Output:** 1
**Example 2:**
**Input:** nums = \[4,1,2,1,2... | null | Array,Bit Manipulation | Easy | 137,260,268,287,389 |
1,020 | Hello everyone, very warm welcome to your new video, from today we will also do the problems of daily challenge to the lead, so I had created it earlier, so I had asked like in it, should I do the daily challenge to the lead or not, so 96% of you said like it. Yes, we not, so 96% of you said like it. Yes, we not, so 96... | Number of Enclaves | longest-turbulent-subarray | You are given an `m x n` binary matrix `grid`, where `0` represents a sea cell and `1` represents a land cell.
A **move** consists of walking from one land cell to another adjacent (**4-directionally**) land cell or walking off the boundary of the `grid`.
Return _the number of land cells in_ `grid` _for which we cann... | null | Array,Dynamic Programming,Sliding Window | Medium | 53 |
51 | hey guys let's take a look at number 51 in Queens I think this problem is something we learned that when we were at our College the so we are going to put n queens into this n 2 dimensional matrix so none neither two queens at the same row or same column or at the same diagonal yeah we need to return the possible solut... | N-Queens | n-queens | The **n-queens** puzzle is the problem of placing `n` queens on an `n x n` chessboard such that no two queens attack each other.
Given an integer `n`, return _all distinct solutions to the **n-queens puzzle**_. You may return the answer in **any order**.
Each solution contains a distinct board configuration of the n-... | null | Array,Backtracking | Hard | 52,1043 |
57 | hello everyone so in our previous video we actually saw the problem of merge intervals so in this video we will actually see one more problem insert interval so friends before we start in case if you are new to my channel then please subscribe to my channel and click the bell icon so that you never miss any update so i... | Insert Interval | insert-interval | You are given an array of non-overlapping intervals `intervals` where `intervals[i] = [starti, endi]` represent the start and the end of the `ith` interval and `intervals` is sorted in ascending order by `starti`. You are also given an interval `newInterval = [start, end]` that represents the start and end of another i... | null | Array | Medium | 56,715 |
96 | hi guys today let's discuss the lead code question 96 unique binary search given an integer n written the number of structurally unique binary searies which has exactly n nodes of unique values from 1 to n so let's go to the example one so given the input n is equal to 3 the values of the uh the three node values can r... | 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 |
5 | in this video we'll be going over the longest paladromic substring so give it a string as return the longest palatronic substrate and so in our first example we have babad and our longest panel dramatic substrings bab and in our second example we have c b d and our longest palindromic substring is b and b so let's firs... | 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 |
77 | to take that let's dive into our today's problem combinations we are given two integers nnk return all the possible combinations of K chosen from range 1 to n you may return unseen annual for example when n is 4 K is 2 we have to choose two numbers out of this range one to four so we're choose one and two one and three... | Combinations | combinations | Given two integers `n` and `k`, return _all possible combinations of_ `k` _numbers chosen from the range_ `[1, n]`.
You may return the answer in **any order**.
**Example 1:**
**Input:** n = 4, k = 2
**Output:** \[\[1,2\],\[1,3\],\[1,4\],\[2,3\],\[2,4\],\[3,4\]\]
**Explanation:** There are 4 choose 2 = 6 total combin... | null | Backtracking | Medium | 39,46 |
1,704 | hi my name is david today we're going to do number one seven zero four determine if string halves are like this is an easy level problem on lead code i'm gonna solve it in javascript so basically you have a question you have input a book and you want to see you want to split it in half and you want to see if the number... | 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 |
269 | right so welcome back today we are going to do liquid question 269 alien dictionary so the question says there is a new alien language that use the English alphabet however the order among the letter is unknown to you are given a list of string words from the alien languages dictionary we are the student in the words a... | 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 |
937 | yeahyeah Hi everyone, I'm a programmer. Today I will introduce to you a problem with the following title: rearranging data in following title: rearranging data in following title: rearranging data in boxes and original files. When they do, we will have specific requirements as follows, giving us a root piece for each l... | Reorder Data in Log Files | online-stock-span | You are given an array of `logs`. Each log is a space-delimited string of words, where the first word is the **identifier**.
There are two types of logs:
* **Letter-logs**: All words (except the identifier) consist of lowercase English letters.
* **Digit-logs**: All words (except the identifier) consist of digits... | null | Stack,Design,Monotonic Stack,Data Stream | Medium | 739 |
18 | welcome to jvk school today we are gonna store number 18 for some discussion is you are going to pick four numbers and then make same as the target but it shouldn't have to duplicate so first of all we are gonna initialize Leisure to array and then we are gonna store it all right the reason why we are sort later after ... | 4Sum | 4sum | Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that:
* `0 <= a, b, c, d < n`
* `a`, `b`, `c`, and `d` are **distinct**.
* `nums[a] + nums[b] + nums[c] + nums[d] == target`
You may return the answer in **any order**.
**Examp... | null | Array,Two Pointers,Sorting | Medium | 1,15,454,2122 |
1,004 | given in a way of a of zero and ones we may change up K values from zero to one we turn the length of the longest contiguous subway that contains only one once okay so basically we this is a the phrasing is a little awkward sorry I just want make sure I understand it specially since I have some reading comprehension to... | Max Consecutive Ones III | least-operators-to-express-number | Given a binary array `nums` and an integer `k`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most_ `k` `0`'s.
**Example 1:**
**Input:** nums = \[1,1,1,0,0,0,1,1,1,1,0\], k = 2
**Output:** 6
**Explanation:** \[1,1,1,0,0,**1**,1,1,1,1,**1**\]
Bolded numbers were flipped from 0 to 1.... | null | Math,Dynamic Programming | Hard | null |
594 | hey everybody this is larry this is day four of the february leco daily challenge uh i created a new haircut so hit the like button to subscribe and join me in discord let me know what you think about today's prom uh so i'm gonna try a little bit different uh today before going into the problem uh um okay uh which is t... | Longest Harmonious Subsequence | longest-harmonious-subsequence | We define a harmonious array as an array where the difference between its maximum value and its minimum value is **exactly** `1`.
Given an integer array `nums`, return _the length of its longest harmonious subsequence among all its possible subsequences_.
A **subsequence** of array is a sequence that can be derived f... | null | Array,Hash Table,Sorting | Easy | null |
1,433 | um hello so today we are going to solve this problem check if the string can break another string so we have two strings s1 and s2 that have the same size and we want to check if some permutation of string s1 can break um s2 or vice versa in other words s2 can break s1 or vice versa and then we have a string x can brea... | Check If a String Can Break Another String | encrypt-and-decrypt-strings | Given two strings: `s1` and `s2` with the same size, check if some permutation of string `s1` can break some permutation of string `s2` or vice-versa. In other words `s2` can break `s1` or vice-versa.
A string `x` can break string `y` (both of size `n`) if `x[i] >= y[i]` (in alphabetical order) for all `i` between `0`... | For encryption, use hashmap to map each char of word1 to its value. For decryption, use trie to prune when necessary. | Array,Hash Table,String,Design,Trie | Hard | 208,212,1949 |
51 | looking at lead code number 51 it's called n queens this is a pretty hard question but we're going to break it down step by step and try to get to a very efficient solution we're also going to be using a template a back tracking recursive depth first search helper function that we used as a template and if you haven't ... | N-Queens | n-queens | The **n-queens** puzzle is the problem of placing `n` queens on an `n x n` chessboard such that no two queens attack each other.
Given an integer `n`, return _all distinct solutions to the **n-queens puzzle**_. You may return the answer in **any order**.
Each solution contains a distinct board configuration of the n-... | null | Array,Backtracking | Hard | 52,1043 |
374 | we're playing a game guess a number although if you're higher lower or you got it when you're faced with a problem like this what you're essentially looking for is an efficient search algorithm one of the basic ones yet highly efficient is binary search binary research works on a sorted data structure by starting from ... | Guess Number Higher or Lower | guess-number-higher-or-lower | We are playing the Guess Game. The game is as follows:
I pick a number from `1` to `n`. You have to guess which number I picked.
Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess.
You call a pre-defined API `int guess(int num)`, which returns three possible re... | null | Binary Search,Interactive | Easy | 278,375,658 |
905 | hey everybody this is Larry this is day 28th oh and there uh is that the no that's tomorrow uh 28 of the theod d challenge uh hit the like button hit the Subscribe button drw your on Discord is my computer lagging I don't know wish you first to AC on the I don't know which way I always forget but if you see it click on... | 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 |
704 | welcome to october's lead code challenge today's problem is binary search given a sorted integer array nums and a target value write a function to search target in nums if target exists return its index otherwise return negative one so this problem is basically one of the building blocks of algorithms you should defini... | 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 |
190 | hello everyone welcome back today we will be solving one lead code question reverse bit reverse bits of a Cuban 32-bit unsigned integer note that in 32-bit unsigned integer note that in 32-bit unsigned integer note that in some languages such as Java or JavaScript there is no unsigned integer type in this case both inp... | 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 |
102 | hi guys welcome to algorithms made easy my name is kushpu and in this video we will see the question binary tree level order traversal given a root of a binary tree return the level order traversal of all its nodes that is from left to right level by level so we need to go from left to right on each level and for each ... | Binary Tree Level Order Traversal | binary-tree-level-order-traversal | Given the `root` of a binary tree, return _the level order traversal of its nodes' values_. (i.e., from left to right, level by level).
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[3\],\[9,20\],\[15,7\]\]
**Example 2:**
**Input:** root = \[1\]
**Output:** \[\[1\]\]
**Example 3:**
**I... | null | Tree,Breadth-First Search,Binary Tree | Medium | 103,107,111,314,637,764,1035 |
127 | what is up you guys hope you guys are doing well during this crazy time so today we're gonna go over a medium difficulty problem called word ladder which is primarily asked at Amazon Facebook and Google this problem is fairly difficult the first time I actually came across this problem I struggled with it a lot so I fe... | Word Ladder | word-ladder | 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,Breadth-First Search | Hard | 126,433 |
32 | hey guys welcome to my channel the tech coders and today we are going to solve question number 32 of lead code that is longest valid parenthesis okay so question states that you are given a string containing just the characters opening parenthesis and a closing parenthesis and we are supposed to return the length of th... | Longest Valid Parentheses | longest-valid-parentheses | Given a string containing just the characters `'('` and `')'`, return _the length of the longest valid (well-formed) parentheses_ _substring_.
**Example 1:**
**Input:** s = "(() "
**Output:** 2
**Explanation:** The longest valid parentheses substring is "() ".
**Example 2:**
**Input:** s = ")()()) "
**Output:** ... | null | String,Dynamic Programming,Stack | Hard | 20 |
268 | hey everyone welcome back to my channel before we get started don't forget to click the Subscribe button if you want more videos about coding interviews so today in this video we'll be solving the lead code problem missing numbers so let's get started the problem is that they give us an array that contains and distinct... | Missing Number | missing-number | Given an array `nums` containing `n` distinct numbers in the range `[0, n]`, return _the only number in the range that is missing from the array._
**Example 1:**
**Input:** nums = \[3,0,1\]
**Output:** 2
**Explanation:** n = 3 since there are 3 numbers, so all numbers are in the range \[0,3\]. 2 is the missing number... | null | Array,Hash Table,Math,Bit Manipulation,Sorting | Easy | 41,136,287,770,2107 |
3 | hey everyone in this video we are going to solve the longest substring without repeating characters question on lead code so we are given a string s and we have to return the longest substring that does not contain any duplicates in which all the characters are unique so in this particular example the output is 3 becau... | Longest Substring Without Repeating Characters | longest-substring-without-repeating-characters | Given a string `s`, find the length of the **longest** **substring** without repeating characters.
**Example 1:**
**Input:** s = "abcabcbb "
**Output:** 3
**Explanation:** The answer is "abc ", with the length of 3.
**Example 2:**
**Input:** s = "bbbbb "
**Output:** 1
**Explanation:** The answer is "b ", with t... | null | Hash Table,String,Sliding Window | Medium | 159,340,1034,1813,2209 |
1,948 | hey what's up guys uh this is chong here again so lead code number 1948 delete duplicate folders in system all right so this one you know basically we're given like a bunch of paths right where the path is an array representing an absolute path to the eyes folder in the file system right for example this one two three ... | Delete Duplicate Folders in System | rearrange-products-table | Due to a bug, there are many duplicate folders in a file system. You are given a 2D array `paths`, where `paths[i]` is an array representing an absolute path to the `ith` folder in the file system.
* For example, `[ "one ", "two ", "three "]` represents the path `"/one/two/three "`.
Two folders (not necessarily on ... | null | Database | Easy | 1926 |
748 | hi so this question is shortest completing word so you have a student license plate and also the area of string so I got multiple streams in the array so a completing word is a word that contains a letter so you probably just understand the question really right so in this one I mean you have to ignore the digits so th... | Shortest Completing Word | largest-number-at-least-twice-of-others | Given a string `licensePlate` and an array of strings `words`, find the **shortest completing** word in `words`.
A **completing** word is a word that **contains all the letters** in `licensePlate`. **Ignore numbers and spaces** in `licensePlate`, and treat letters as **case insensitive**. If a letter appears more than... | Scan through the array to find the unique largest element `m`, keeping track of it's index `maxIndex`.
Scan through the array again. If we find some `x != m` with `m < 2*x`, we should return `-1`.
Otherwise, we should return `maxIndex`. | Array,Sorting | Easy | 2274,2327 |
1,282 | hey everyone today we're going to be doing leak code 1282 group the people given the group size they belong to so there are n people that are split into some unknown number of groups each person is labeled 0 to n minus 1. so this is a lot of gibberish here i'm just gonna take the test case and start explaining what the... | Group the People Given the Group Size They Belong To | number-of-valid-words-for-each-puzzle | There are `n` people that are split into some unknown number of groups. Each person is labeled with a **unique ID** from `0` to `n - 1`.
You are given an integer array `groupSizes`, where `groupSizes[i]` is the size of the group that person `i` is in. For example, if `groupSizes[1] = 3`, then person `1` must be in a g... | Exploit the fact that the length of the puzzle is only 7. Use bit-masks to represent the word and puzzle strings. For each puzzle, count the number of words whose bit-mask is a sub-mask of the puzzle's bit-mask. | Array,Hash Table,String,Bit Manipulation,Trie | Hard | null |
1,601 | microphone was off last time so towards second July 2023 lava look at the lead code daily challenge that is maximum number of achievable transfer requests if you have read through the question so what is the question state is we have 0 to 1 uh n number of buildings and our requests two dimensionary that's been given an... | Maximum Number of Achievable Transfer Requests | maximum-number-of-achievable-transfer-requests | We have `n` buildings numbered from `0` to `n - 1`. Each building has a number of employees. It's transfer season, and some employees want to change the building they reside in.
You are given an array `requests` where `requests[i] = [fromi, toi]` represents an employee's request to transfer from building `fromi` to bu... | null | null | Hard | null |
86 | um hello so today we are going to do this problem um partition list so the problem asks us to um given a head of a linked list and the value x um we want to partition it partition this linked list such that all the nodes smaller than x come before and all those greater than x or equal come after x and we want to at the... | Partition List | partition-list | Given the `head` of a linked list and a value `x`, partition it such that all nodes **less than** `x` come before nodes **greater than or equal** to `x`.
You should **preserve** the original relative order of the nodes in each of the two partitions.
**Example 1:**
**Input:** head = \[1,4,3,2,5,2\], x = 3
**Output:**... | null | Linked List,Two Pointers | Medium | 2265 |
1,640 | happy 2021 everyone and welcome to this year's january leco challenge i really hope that this here is going to be a good one for you all so let's get started this question is called check array formation through concatenation you are given an array of distinct integers r an array of integer arrays pieces where the inte... | Check Array Formation Through Concatenation | design-a-file-sharing-system | You are given an array of **distinct** integers `arr` and an array of integer arrays `pieces`, where the integers in `pieces` are **distinct**. Your goal is to form `arr` by concatenating the arrays in `pieces` **in any order**. However, you are **not** allowed to reorder the integers in each array `pieces[i]`.
Return... | Try to solve it by keeping for each file chunk, the users who have this chunk. Try to solve it by keeping all the users in the system with their owned chunks, and when you request a chunk, check all users for it. | Hash Table,Design,Heap (Priority Queue),Data Stream | Medium | 355 |
1,696 | alright guys welcome to our channel code with sunny and in this video i will be talking about a series of problems called jump game and today we will be dealing with jumper game six and the index you are seeing is one six nine six and the problem is of categorized as one of the medium type problems of the lead code so ... | Jump Game VI | strange-printer-ii | You are given a **0-indexed** integer array `nums` and an integer `k`.
You are initially standing at index `0`. In one move, you can jump at most `k` steps forward without going outside the boundaries of the array. That is, you can jump from index `i` to any index in the range `[i + 1, min(n - 1, i + k)]` **inclusive*... | Try thinking in reverse. Given the grid, how can you tell if a colour was painted last? | Array,Graph,Topological Sort,Matrix | Hard | 664 |
18 | hello everyone let's look at four sound before we even look at the problem statement if you haven't looked at my solution for threesome and three some closest feel free to pause the video and look at those two videos first that's question number 15 and 16. let's have a look at the problem statement we are given an arra... | 4Sum | 4sum | Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that:
* `0 <= a, b, c, d < n`
* `a`, `b`, `c`, and `d` are **distinct**.
* `nums[a] + nums[b] + nums[c] + nums[d] == target`
You may return the answer in **any order**.
**Examp... | null | Array,Two Pointers,Sorting | Medium | 1,15,454,2122 |
1,481 | hey guys this is jessery in this video i'm going to take a look at the 5 4 least number of unit integers after k removals we're giving an array of integers and the integer k find the least number of unique integers after removing exactly k elements so we're given like five four we need to remove a one element we could ... | 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 |
1,705 | hey there everyone welcome back to lead coding in this video we'll be solving the question number two of lead code weekly contest 221 name of the problem is maximum number of eaten apples there's a special kind of apple tree that grows apple on every day for n days on the i eighth day it is going to grow some certain n... | Maximum Number of Eaten Apples | count-unhappy-friends | There is a special kind of apple tree that grows apples every day for `n` days. On the `ith` day, the tree grows `apples[i]` apples that will rot after `days[i]` days, that is on day `i + days[i]` the apples will be rotten and cannot be eaten. On some days, the apple tree does not grow any apples, which are denoted by ... | Create a matrix “rank” where rank[i][j] holds how highly friend ‘i' views ‘j’. This allows for O(1) comparisons between people | Array,Simulation | Medium | null |
113 | so uh hello everyone so today we are going to solve this path from 2 problem okay and I will try to solve it while explaining or okay so this is also my first time solving this problem so let's get started okay so the problem says that we have been given a root of a binary tree and an integer Target sum okay return all... | 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 |
81 | hi good morning good afternoon and good evening so today let's solve this question called search in your disorder way too you have watched my previous video you'll find this question very similar to a search in rotating software however there are two differences here according to the question the first difference here ... | Search in Rotated Sorted Array II | search-in-rotated-sorted-array-ii | There is an integer array `nums` sorted in non-decreasing order (not necessarily with **distinct** values).
Before being passed to your function, `nums` is **rotated** at an unknown pivot index `k` (`0 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nu... | null | Array,Binary Search | Medium | 33 |
490 | what's up y'all got a graph problem for you here today this problem was mostly smooth sailing so uh yeah we'll jump right into it all right there is a ball and a maze with empty spaces represented as zeros and walls represented as ones ball can go through the empty spaces by rolling up down left or right but it won't s... | The Maze | the-maze | There is a ball in a `maze` with empty spaces (represented as `0`) and walls (represented as `1`). The ball can go through the empty spaces by rolling **up, down, left or right**, but it won't stop rolling until hitting a wall. When the ball stops, it could choose the next direction.
Given the `m x n` `maze`, the ball... | null | Depth-First Search,Breadth-First Search,Graph | Medium | 499,505 |
583 | hey what's up guys uh this is chung here again so today uh daily challenge problem right number 583 delete operation for two streams okay so you're giving like two strings right word one word two then you need to return the minimum number of steps required to make word one word two the same right and how can we make th... | Delete Operation for Two Strings | delete-operation-for-two-strings | Given two strings `word1` and `word2`, return _the minimum number of **steps** required to make_ `word1` _and_ `word2` _the same_.
In one **step**, you can delete exactly one character in either string.
**Example 1:**
**Input:** word1 = "sea ", word2 = "eat "
**Output:** 2
**Explanation:** You need one step to mak... | null | String,Dynamic Programming | Medium | 72,712,1250 |
1,846 | Hello friends welcome to my channel here solve cot problems and prepare to the cot interview today problem number is 184 6 maximum element after decreasing and rearranging you're given an array of positive integers R perform some operations possibly none on R so that it satisfied these conditions the value of the first... | 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 |
371 | hello everyone welcome to my channel coding together my name is vikas oja today we will see another lead code problem that is sum of two integers it's a medium level question so let's the problem statement that it's a simple sum of two integers but the point is the constraint is we don't have to use the plus or minus o... | Sum of Two Integers | sum-of-two-integers | Given two integers `a` and `b`, return _the sum of the two integers without using the operators_ `+` _and_ `-`.
**Example 1:**
**Input:** a = 1, b = 2
**Output:** 3
**Example 2:**
**Input:** a = 2, b = 3
**Output:** 5
**Constraints:**
* `-1000 <= a, b <= 1000` | null | Math,Bit Manipulation | Medium | 2 |
35 | hello coders welcome back to my channel in this video i am going to provide you detailed solution of this question so what let me tell you what we are going to use in this uh and this solution so the first very first thing is we are going to use if else block again we are going to use f lf else block and also we are go... | Search Insert Position | search-insert-position | Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[1,3,5,6\], target = 5
**Output:** 2
**Exa... | null | Array,Binary Search | Easy | 278 |
349 | hi so in this video uh we'll discuss uh write a we have a problem basically write a JavaScript function that find the intersection of two arrays the function should take to AR to array input and written a new con new array containing elements that are common into both array okay so we have given two arrays over there a... | 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 |
219 | start cricket if there are you distant indices i and g true date on industrial the values are equal ok values are equal ok values are equal ok pick the absolute difference which is given to us ok so I have done these two conditions so let's see the first example How many in this, if I see what is the value of i, ... | 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 |
316 | hello and welcome back to the cracking Fang YouTube channel today we're going to be solving lead code problem 316 remove duplicate letters given a string s remove duplicate letters so that every letter appears once and only once you must make sure your result is the smallest in lexicographical order among all possible ... | Remove Duplicate Letters | remove-duplicate-letters | Given a string `s`, remove duplicate letters so that every letter appears once and only once. You must make sure your result is **the smallest in lexicographical order** among all possible results.
**Example 1:**
**Input:** s = "bcabc "
**Output:** "abc "
**Example 2:**
**Input:** s = "cbacdcbc "
**Output:** "a... | Greedily try to add one missing character. How to check if adding some character will not cause problems ? Use bit-masks to check whether you will be able to complete the sub-sequence if you add the character at some index i. | String,Stack,Greedy,Monotonic Stack | Medium | 2157 |
16 | Hua Hai Hello Everyone Welcome To 27th July Channel Subscribe Bhi Na Enters In The Middle Of Two Centers Where The Volume To The Difference Between The Giver Numbers - 151 - 151 subscribe to subscribe our achchha lagga is veer member and e think She Dighant Past Gas Switch On Please Comment Subscribe The Same Time This... | 3Sum Closest | 3sum-closest | Given an integer array `nums` of length `n` and an integer `target`, find three integers in `nums` such that the sum is closest to `target`.
Return _the sum of the three integers_.
You may assume that each input would have exactly one solution.
**Example 1:**
**Input:** nums = \[-1,2,1,-4\], target = 1
**Output:** ... | null | Array,Two Pointers,Sorting | Medium | 15,259 |
371 | hello friends we are still not employed by a fan company so let's not stop plate coding till we get there today we are going to work upon a lead code medium problem sum of two integers so let's understand the problem statement basically we are given uh two elements uh a and b and we need to return the sum of two intege... | Sum of Two Integers | sum-of-two-integers | Given two integers `a` and `b`, return _the sum of the two integers without using the operators_ `+` _and_ `-`.
**Example 1:**
**Input:** a = 1, b = 2
**Output:** 3
**Example 2:**
**Input:** a = 2, b = 3
**Output:** 5
**Constraints:**
* `-1000 <= a, b <= 1000` | null | Math,Bit Manipulation | Medium | 2 |
51 | Hello Hi Everyone Welcome To My Channel It's All The Problem And Coins For This Is Very Famous And Splendor Problem Hit To Dance In Facebook Amazon And Most Companies And It's Very Difficult Backtracking Problem Solve Here In This Problem Given And Coins And Will Have To Plus 2 And Coins In And Crops And Chess Board Sa... | N-Queens | n-queens | The **n-queens** puzzle is the problem of placing `n` queens on an `n x n` chessboard such that no two queens attack each other.
Given an integer `n`, return _all distinct solutions to the **n-queens puzzle**_. You may return the answer in **any order**.
Each solution contains a distinct board configuration of the n-... | null | Array,Backtracking | Hard | 52,1043 |
979 | hello friends today we'll solve code problem which says that distribute coin in a binary tree the statement says that given the root of a binary tree with node and each node in the tree has value no dot val coins and there are end coins in all in one move we may choose two adjacent node and move point from one node to ... | Distribute Coins in Binary Tree | di-string-match | You are given the `root` of a binary tree with `n` nodes where each `node` in the tree has `node.val` coins. There are `n` coins in total throughout the whole tree.
In one move, we may choose two adjacent nodes and move one coin from one node to another. A move may be from parent to child, or from child to parent.
Re... | null | Array,Math,Two Pointers,String,Greedy | Easy | null |
507 | we solve let go question like And subscribe lead code 507 the perfect number um so we're gonna be solving this problem it's an easy one on lead code and by the way I do so Fleet code questions um like if you have any like questions about the code that you can solve just you can comment down below and I'll be more a lot... | Perfect Number | perfect-number | A [**perfect number**](https://en.wikipedia.org/wiki/Perfect_number) is a **positive integer** that is equal to the sum of its **positive divisors**, excluding the number itself. A **divisor** of an integer `x` is an integer that can divide `x` evenly.
Given an integer `n`, return `true` _if_ `n` _is a perfect number,... | null | Math | Easy | 728 |
509 | welcome to joey's tech in this video we will look into solving the fibonacci number problem using the dynamic programming technique if you solve this problem using the dynamic programming technique then your solution will be 100 faster than all the online submissions done on lead code here is the proof you can find thi... | Fibonacci Number | inorder-successor-in-bst-ii | The **Fibonacci numbers**, commonly denoted `F(n)` form a sequence, called the **Fibonacci sequence**, such that each number is the sum of the two preceding ones, starting from `0` and `1`. That is,
F(0) = 0, F(1) = 1
F(n) = F(n - 1) + F(n - 2), for n > 1.
Given `n`, calculate `F(n)`.
**Example 1:**
**Input:** n = ... | null | Tree,Binary Search Tree,Binary Tree | Medium | 285 |
206 | Hello everyone, Evgeniy Sulima nov is with you and today we will look at the solution to the problem type code number 206 expanding a linked list according to the conditions of this problem, we are given a singly linked list and we must expand it, for example, and if we received the list 12345 small as an input, this m... | 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 |
46 | elite code question 46 permutations given an array numbers of distinct integers return all the possible permutations you can return the answer in any order constraints numbers.length in any order constraints numbers.length in any order constraints numbers.length is always going to be greater than 1 or equal to 1 and le... | Permutations | permutations | Given an array `nums` of distinct integers, return _all the possible permutations_. You can return the answer in **any order**.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,1\],\[3,1,2\],\[3,2,1\]\]
**Example 2:**
**Input:** nums = \[0,1\]
**Output:** \[\[0,1\],\[1,0\... | null | Array,Backtracking | Medium | 31,47,60,77 |
653 | Use is going to post the most satisfactory updation, understand the point, on this point, by placing the Science Seminar Tasty in front of you people, we have to tell you what is the percentage between two numbers which will be added to be equal to the time, as if we had given 2322 here. And here I saw that 2010 will g... | Two Sum IV - Input is a BST | two-sum-iv-input-is-a-bst | Given the `root` of a binary search tree and an integer `k`, return `true` _if there exist two elements in the BST such that their sum is equal to_ `k`, _or_ `false` _otherwise_.
**Example 1:**
**Input:** root = \[5,3,6,2,4,null,7\], k = 9
**Output:** true
**Example 2:**
**Input:** root = \[5,3,6,2,4,null,7\], k = ... | null | Hash Table,Two Pointers,Tree,Depth-First Search,Breadth-First Search,Binary Search Tree,Binary Tree | Easy | 1,167,170,1150 |
1,390 | hello yours welcome back to my channel hope you are enjoying all the videos that I'm uploading if you have not subscribed yet please subscribe to my channel and click the bell icon so that you get all the future videos as updates to your mobile or emails today I'm back with another problem from read code for divisors g... | Four Divisors | average-selling-price | Given an integer array `nums`, return _the sum of divisors of the integers in that array that have exactly four divisors_. If there is no such integer in the array, return `0`.
**Example 1:**
**Input:** nums = \[21,4,7\]
**Output:** 32
**Explanation:**
21 has 4 divisors: 1, 3, 7, 21
4 has 3 divisors: 1, 2, 4
7 has 2... | null | Database | Easy | null |
37 | hello and welcome to another leak code solution video this is problem number 37 soduku solver for this problem we write a program to solve a Soko puzzle by filling the empty cells Soko solution must satisfy all of the following rules each of the digits 1 through nine must occur exactly once in each row each of the digi... | Sudoku Solver | sudoku-solver | Write a program to solve a Sudoku puzzle by filling the empty cells.
A sudoku solution must satisfy **all of the following rules**:
1. Each of the digits `1-9` must occur exactly once in each row.
2. Each of the digits `1-9` must occur exactly once in each column.
3. Each of the digits `1-9` must occur exactly onc... | null | Array,Backtracking,Matrix | Hard | 36,1022 |
312 | code problem number 312 burst balloons so this problem gives us nend balloons index from one uh from zero to n minus one which if each balloon painted with a number on it which represented by array nums so we are expected to burst all the balloons when we after we burst the balloon we will need to calculate the score u... | Burst Balloons | burst-balloons | You are given `n` balloons, indexed from `0` to `n - 1`. Each balloon is painted with a number on it represented by an array `nums`. You are asked to burst all the balloons.
If you burst the `ith` balloon, you will get `nums[i - 1] * nums[i] * nums[i + 1]` coins. If `i - 1` or `i + 1` goes out of bounds of the array, ... | null | Array,Dynamic Programming | Hard | 1042 |
368 | hello everyone today's question largest divisible subset now I will move to pen and paper explaining the problem statement so in this problem statement you are given a set of distinct positive integers basically you have to find the largest subset such that in your subset such that every pair like this is I and this 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.