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 | in this video we'll be going over the question twosome given array of integers nums and an integer target return the indices of two numbers such that they add up to target you may assume that each input will have exactly one solution and you may not use the same element twice you can return the answer in any order so i... | Two Sum | two-sum | Given an array of integers `nums` and an integer `target`, return _indices of the two numbers such that they add up to `target`_.
You may assume that each input would have **_exactly_ one solution**, and you may not use the _same_ element twice.
You can return the answer in any order.
**Example 1:**
**Input:** nums... | A really brute force way would be to search for all possible pairs of numbers but that would be too slow. Again, it's best to try out brute force solutions for just for completeness. It is from these brute force solutions that you can come up with optimizations. So, if we fix one of the numbers, say x, we have to scan ... | Array,Hash Table | Easy | 15,18,167,170,560,653,1083,1798,1830,2116,2133,2320 |
393 | Quiet Validation, which is a very advocate challenge, JZX means that there are many conditions and many apps in it, you will have to pay attention to them before solving them, but many times such questions come in the challenge, they require a list of interviews, so today we will give it as a sample. Will cut it no mat... | UTF-8 Validation | utf-8-validation | Given an integer array `data` representing the data, return whether it is a valid **UTF-8** encoding (i.e. it translates to a sequence of valid UTF-8 encoded characters).
A character in **UTF8** can be from **1 to 4 bytes** long, subjected to the following rules:
1. For a **1-byte** character, the first bit is a `0`... | All you have to do is follow the rules. For a given integer, obtain its binary representation in the string form and work with the rules given in the problem. An integer can either represent the start of a UTF-8 character, or a part of an existing UTF-8 character. There are two separate rules for these two scenarios in... | Array,Bit Manipulation | Medium | null |
26 | elite code 26 remove duplicates from the sorted array easy so this question has four and a half thousand likes and almost 8 000 dislikes and i think the reason why i get dislikes is just because for what this question asking you to return so basically let's read the question first given an integer array nums sorted in ... | Remove Duplicates from Sorted Array | remove-duplicates-from-sorted-array | Given an integer array `nums` sorted in **non-decreasing order**, remove the duplicates [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm) such that each unique element appears only **once**. The **relative order** of the elements should be kept the **same**. Then return _the number of unique elements in_... | In this problem, the key point to focus on is the input array being sorted. As far as duplicate elements are concerned, what is their positioning in the array when the given array is sorted? Look at the image above for the answer. If we know the position of one of the elements, do we also know the positioning of all th... | Array,Two Pointers | Easy | 27,80 |
92 | hello um today we'll be doing reverse link list two which is um where we're going to be reversing only part of a linked list as opposed okay i guess it's not guaranteed that it'll always be only part of it could be you know the whole link list um but you know the whole theory behind it is you're not guaranteed to alway... | 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 |
6 | Peace be upon you, my dear friend. How are you doing? O Lord, you will be fine and in the best condition. God willing, today we will solve it together. Of course, the issue is not understood or explained very well. God willing, we will explain it together. If you do not try the issue, first try to give yourself a chanc... | Zigzag Conversion | zigzag-conversion | The string `"PAYPALISHIRING "` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S I I G
Y I R
And then read line by line: `"PAHNAPLSIIGYIR "`
Write the code that will take a string and make this co... | null | String | Medium | null |
739 | hey everybody this is larry this is day 13 from the november league daily challenge hit the like button in the subscribe button join me on discord where a bunch of smart smartypants smarty people uh post their solutions every day to get you know feedback or just like to share and all that stuff anyway okay so let's see... | Daily Temperatures | daily-temperatures | Given an array of integers `temperatures` represents the daily temperatures, return _an array_ `answer` _such that_ `answer[i]` _is the number of days you have to wait after the_ `ith` _day to get a warmer temperature_. If there is no future day for which this is possible, keep `answer[i] == 0` instead.
**Example 1:**... | If the temperature is say, 70 today, then in the future a warmer temperature must be either 71, 72, 73, ..., 99, or 100. We could remember when all of them occur next. | Array,Stack,Monotonic Stack | Medium | 496,937 |
953 | hey guys i'm jaiser who is not a good dad algorithms today i'm making this video to prepare my interview in next month from facebook so hope you can stay with me and uh in this video i'm going to take a look at 953 verify alien dictionary is marked as easy we're given a alien language word and they use the same english... | Verifying an Alien Dictionary | reverse-only-letters | In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different `order`. The `order` of the alphabet is some permutation of lowercase letters.
Given a sequence of `words` written in the alien language, and the `order` of the alphabet, return `true` if and only if the given `wor... | This problem is exactly like reversing a normal string except that there are certain characters that we have to simply skip. That should be easy enough to do if you know how to reverse a string using the two-pointer approach. | Two Pointers,String | Easy | null |
79 | welcome to equality code today we'll be taking a look at the word search problem and so you're basically given a word in this case ABC CED and board of characters and your job is to construct this word from the given board so in this particular example we can construct a BC CED by first selecting this a and then B C th... | Word Search | word-search | Given an `m x n` grid of characters `board` and a string `word`, return `true` _if_ `word` _exists in the grid_.
The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.
**Example 1:**... | null | Array,Backtracking,Matrix | Medium | 212 |
114 | That a hello everyone welcome to difficult of California subscribe to is so let's get started amazon liquid anantapur police ronit subscribe liye subscribe the subscribe my channel and tomorrow morning gandu will appoint this is not too bright side that andrew dot right bill Point To The Legend Something Like This 10 W... | Flatten Binary Tree to Linked List | flatten-binary-tree-to-linked-list | Given the `root` of a binary tree, flatten the tree into a "linked list ":
* The "linked list " should use the same `TreeNode` class where the `right` child pointer points to the next node in the list and the `left` child pointer is always `null`.
* The "linked list " should be in the same order as a [**pre-order*... | If you notice carefully in the flattened tree, each node's right child points to the next node of a pre-order traversal. | Linked List,Stack,Tree,Depth-First Search,Binary Tree | Medium | 766,1796 |
216 | Hello Everyone Welcome Back To My Channel Short Fuel Suna Do Problems Combination Marine Beautiful Problem Person Find All Felt Combination Fennel Numbers WhatsApp Chamak 2nd Sunday Following Permissions For Truth Only In Through And Through Point To These Numbers Wikinews And Its Number Is Used At Most Wanted This Is ... | Combination Sum III | combination-sum-iii | Find all valid combinations of `k` numbers that sum up to `n` such that the following conditions are true:
* Only numbers `1` through `9` are used.
* Each number is used **at most once**.
Return _a list of all possible valid combinations_. The list must not contain the same combination twice, and the combinations... | null | Array,Backtracking | Medium | 39 |
1,465 | Hello everyone welcome back on the chain itself we are going to discuss the court problem which is the name of the problem of challenge to lungi is maximum a relief quarter horizontally and vertically so what would have given us in this we have got the height checks that we have got the belt European and We have been g... | Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts | maximum-product-of-splitted-binary-tree | You are given a rectangular cake of size `h x w` and two arrays of integers `horizontalCuts` and `verticalCuts` where:
* `horizontalCuts[i]` is the distance from the top of the rectangular cake to the `ith` horizontal cut and similarly, and
* `verticalCuts[j]` is the distance from the left of the rectangular cake ... | If we know the sum of a subtree, the answer is max( (total_sum - subtree_sum) * subtree_sum) in each node. | Tree,Depth-First Search,Binary Tree | Medium | 2175 |
109 | hey everybody this is away in this video we are going to solve a problem called convert sorted list to binary search tree in this question we will be given a sorted list here is our shortcut list that is minus 10 minus 3 0 5 and 7 and we have to construct a binary search tree out of it so as you can see here is our bin... | Convert Sorted List to Binary Search Tree | convert-sorted-list-to-binary-search-tree | Given the `head` of a singly linked list where elements are sorted in **ascending order**, convert _it to a_ **_height-balanced_** _binary search tree_.
**Example 1:**
**Input:** head = \[-10,-3,0,5,9\]
**Output:** \[0,-3,9,-10,null,5\]
**Explanation:** One possible answer is \[0,-3,9,-10,null,5\], which represents t... | null | Linked List,Divide and Conquer,Tree,Binary Search Tree,Binary Tree | Medium | 108,2306 |
153 | hello i'll be going over question 153 find minimum in rotated sorted array so what makes um this question difficult is we don't know how many times it's being uh rotated so let's say we have a given input and it can be rotated by k times so we don't know what this k is it is possible we could have a k equals zero so we... | Find Minimum in Rotated Sorted Array | find-minimum-in-rotated-sorted-array | Suppose an array of length `n` sorted in ascending order is **rotated** between `1` and `n` times. For example, the array `nums = [0,1,2,4,5,6,7]` might become:
* `[4,5,6,7,0,1,2]` if it was rotated `4` times.
* `[0,1,2,4,5,6,7]` if it was rotated `7` times.
Notice that **rotating** an array `[a[0], a[1], a[2], .... | Array was originally in ascending order. Now that the array is rotated, there would be a point in the array where there is a small deflection from the increasing sequence. eg. The array would be something like [4, 5, 6, 7, 0, 1, 2]. You can divide the search space into two and see which direction to go.
Can you think ... | Array,Binary Search | Medium | 33,154 |
1,020 | Scientist A Hua Hai Hello Hi How Are You I Hope All Doing Good Welcome To The Lanka Disney Today Will Do The Number Of Tamarind Iss Media Mail Question And It's Very Easy This Fold The Same Solution App 16 Same Type Of Problem Already Show Yudhishthir Mother Previous Question This is the video in which is old is gold s... | 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 |
33 | hello everyone let's look at search in rotated sorted array the problem statement is we are giving an integer renounce sorted in ascending order and the integer target and somehow our input array is rotated as some pivot unknown index and if the target is found in the array we return the index otherwise we return negat... | Search in Rotated Sorted Array | search-in-rotated-sorted-array | There is an integer array `nums` sorted in ascending order (with **distinct** values).
Prior to being passed to your function, `nums` is **possibly rotated** at an unknown pivot index `k` (`1 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]]` ... | null | Array,Binary Search | Medium | 81,153,2273 |
272 | welcome to interview Pro in the previous video we have seen how to find the closest binary search tree value for a given Target today let's see a continuation to that problem closest binary search tree value 2. this is a lead code heart question which was asked in interviews for companies like Google Amazon and Linkedi... | Closest Binary Search Tree Value II | closest-binary-search-tree-value-ii | Given the `root` of a binary search tree, a `target` value, and an integer `k`, return _the_ `k` _values in the BST that are closest to the_ `target`. You may return the answer in **any order**.
You are **guaranteed** to have only one unique set of `k` values in the BST that are closest to the `target`.
**Example 1:*... | Consider implement these two helper functions:
getPredecessor(N), which returns the next smaller node to N.
getSuccessor(N), which returns the next larger node to N. Try to assume that each node has a parent pointer, it makes the problem much easier. Without parent pointer we just need to keep track of the path from ... | Two Pointers,Stack,Tree,Depth-First Search,Binary Search Tree,Heap (Priority Queue),Binary Tree | Hard | 94,270 |
1,697 | Hello everyone welcome to my channel with mike so today we will do video number 24 from the first graph. It is a very good question. Hard level number is 1697. The name of the question is Checking Existence of Limited Paths. Okay, what else is my playlist with graph concepts? Check out DSO. Okay, so this question will ... | Checking Existence of Edge Length Limited Paths | strings-differ-by-one-character | An undirected graph of `n` nodes is defined by `edgeList`, where `edgeList[i] = [ui, vi, disi]` denotes an edge between nodes `ui` and `vi` with distance `disi`. Note that there may be **multiple** edges between two nodes.
Given an array `queries`, where `queries[j] = [pj, qj, limitj]`, your task is to determine for e... | BruteForce, check all pairs and verify if they differ in one character. O(n^2 * m) where n is the number of words and m is the length of each string. O(m^2 * n), Use hashset, to insert all possible combinations adding a character "*". For example: If dict[i] = "abc", insert ("*bc", "a*c" and "ab*"). | Hash Table,String,Rolling Hash,Hash Function | Medium | 2256 |
1,823 | hello and welcome back everyone so today we are going to solve the fourth practice problem in stacks and Q Series and today we are discussing lead code problem 1823 find the winner of a circular game so instead of going through the problem statement I will quickly explain it in my words so the question says that we hav... | Find the Winner of the Circular Game | determine-if-string-halves-are-alike | There are `n` friends that are playing a game. The friends are sitting in a circle and are numbered from `1` to `n` in **clockwise order**. More formally, moving clockwise from the `ith` friend brings you to the `(i+1)th` friend for `1 <= i < n`, and moving clockwise from the `nth` friend brings you to the `1st` friend... | Create a function that checks if a character is a vowel, either uppercase or lowercase. | String,Counting | Easy | null |
24 | hello everyone let's take a look at the code 24 swap nodes in pairs it's a relative column clearance problem and it's not a hard problem it can be solved in two ways uh iterative solutions are recursive solutions here i'd like to use the recursive solution since a recursive is very useful in many places okay let's take... | Swap Nodes in Pairs | swap-nodes-in-pairs | Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.)
**Example 1:**
**Input:** head = \[1,2,3,4\]
**Output:** \[2,1,4,3\]
**Example 2:**
**Input:** head = \[\]
**Output:** \[\... | null | Linked List,Recursion | Medium | 25,528 |
309 | hi everyone welcome back to lead coding i'm your host faraz so in this video we are solving the third question of our assignment if you haven't tried this question please make sure to try it before watching the complete video also we have already covered the best time to buy and sell stock from part one to part four in... | Best Time to Buy and Sell Stock with Cooldown | best-time-to-buy-and-sell-stock-with-cooldown | You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the following restrictions:
* After you sell your stock, yo... | null | Array,Dynamic Programming | Medium | 121,122 |
1,882 | hey what's up guys uh this is chung here again so this time uh it's called number 1882 right process tasks using servers um so this one you know it's a pretty long description problem right so basically you're given like two zero index integers so first one is the server we have a bunch of servers and then we have a bu... | Process Tasks Using Servers | the-number-of-employees-which-report-to-each-employee | You are given two **0-indexed** integer arrays `servers` and `tasks` of lengths `n` and `m` respectively. `servers[i]` is the **weight** of the `ith` server, and `tasks[j]` is the **time needed** to process the `jth` task **in seconds**.
Tasks are assigned to the servers using a **task ... | null | Database | Easy | null |
752 | welcome to my channel so in this video i'm going to introduce the solution to this legal question called open the lock so let's get started so before we start uh to introduce the solution to this uh question i would like to invite you to subscribe this channel because it can really help me to grow so thanks a lot so le... | Open the Lock | ip-to-cidr | You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: `'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'`. The wheels can rotate freely and wrap around: for example we can turn `'9'` to be `'0'`, or `'0'` to be `'9'`. Each move consists of turning one wheel one slot.
The lock initially starts... | Convert the ip addresses to and from (long) integers. You want to know what is the most addresses you can put in this block starting from the "start" ip, up to n. It is the smallest between the lowest bit of start and the highest bit of n. Then, repeat this process with a new start and n. | String,Bit Manipulation | Medium | 93,468 |
503 | hey what's up guys uh this is chung here so today uh lead code number 503 next greater element number two so you're given like a circular array right and then the basically so the next element of the last element is the first element of the array that's what uh what the circular array means okay and you need to print t... | 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,187 | hi guys good morning welcome back to the new video sorry I am a bit late um the reasons are but yeah uh before that this is a one of the kind of problems we have never seen in the last three four months uh why I say that because firstly I'm gonna say what's gonna be applied in this but yeah if you want to know the enti... | Make Array Strictly Increasing | print-foobar-alternately | Given two integer arrays `arr1` and `arr2`, return the minimum number of operations (possibly zero) needed to make `arr1` strictly increasing.
In one operation, you can choose two indices `0 <= i < arr1.length` and `0 <= j < arr2.length` and do the assignment `arr1[i] = arr2[j]`.
If there is no way to make `arr1` str... | null | Concurrency | Medium | 1203,1216 |
342 | hey everyone welcome back and today we'll be doing another lead code 342 power of four this is an easy one given an integer and written proof it is the power of four otherwise written false so for power for 16 and then writing 64 and so on so that's it we can do this easily by loops just another while loop we keep incr... | Power of Four | power-of-four | Given an integer `n`, return _`true` if it is a power of four. Otherwise, return `false`_.
An integer `n` is a power of four, if there exists an integer `x` such that `n == 4x`.
**Example 1:**
**Input:** n = 16
**Output:** true
**Example 2:**
**Input:** n = 5
**Output:** false
**Example 3:**
**Input:** n = 1
**O... | null | Math,Bit Manipulation,Recursion | Easy | 231,326 |
735 | Hey guys, so today we are going to see what is it and as you guys can see, today's daddy challenge is Asteroid Collagen, so what is given to you in this, stress is given and in this stress its value is given and if the value is negative. If its direction is left and if its direction is if its value is positive then wha... | Asteroid Collision | asteroid-collision | We are given an array `asteroids` of integers representing asteroids in a row.
For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed.
Find out the state of the asteroids after all collisio... | Say a row of asteroids is stable. What happens when a new asteroid is added on the right? | Array,Stack | Medium | 605,2245,2317 |
537 | hello everyone so in this video let us talk about a Medi L problem from lead code the problem name is complex number multiplication so everyone of you might have understood and known about complex numbers in your high school and you already know how to do multiplication of two complex number don't worry we'll also go o... | Complex Number Multiplication | complex-number-multiplication | A [complex number](https://en.wikipedia.org/wiki/Complex_number) can be represented as a string on the form `"**real**+**imaginary**i "` where:
* `real` is the real part and is an integer in the range `[-100, 100]`.
* `imaginary` is the imaginary part and is an integer in the range `[-100, 100]`.
* `i2 == -1`.
... | null | Math,String,Simulation | Medium | null |
350 | today we're gonna be working on need code question number 350 uh intersection of two arrays part two uh it's gonna be very similar to the previous question uh we have been given two arrays num one and nums two i return the array of their intersection each element in the result must appear as many times as it shows in b... | Intersection of Two Arrays II | intersection-of-two-arrays-ii | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must appear as many times as it shows in both arrays and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2,2\]
**Example 2:**
**I... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 349,1044,1392,2282 |
350 | Hello friends welcome to a new video in this video I am going to discuss another lead called problem and this problem is based on array so the question is intersection of two arrays okay given two integer is nouns one and non-story turned an array of their non-story turned an array of their non-story turned an array of... | Intersection of Two Arrays II | intersection-of-two-arrays-ii | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must appear as many times as it shows in both arrays and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2,2\]
**Example 2:**
**I... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 349,1044,1392,2282 |
153 | hey guys Greg here let's solve leode 33 which is search in rotated sorted array now firstly if you haven't solved the problem find minimum in rotated sorted array you should definitely do that first and I have a video on that if you have then here we are so behind the scenes imagine this array was actually sorted first... | Find Minimum in Rotated Sorted Array | find-minimum-in-rotated-sorted-array | Suppose an array of length `n` sorted in ascending order is **rotated** between `1` and `n` times. For example, the array `nums = [0,1,2,4,5,6,7]` might become:
* `[4,5,6,7,0,1,2]` if it was rotated `4` times.
* `[0,1,2,4,5,6,7]` if it was rotated `7` times.
Notice that **rotating** an array `[a[0], a[1], a[2], .... | Array was originally in ascending order. Now that the array is rotated, there would be a point in the array where there is a small deflection from the increasing sequence. eg. The array would be something like [4, 5, 6, 7, 0, 1, 2]. You can divide the search space into two and see which direction to go.
Can you think ... | Array,Binary Search | Medium | 33,154 |
103 | hey everyone today we are going to sort of the little question binary treat exact level so actually I was asked about the exact same question in your interview so that's why I choose this question today and I solved the daily coding Challenge and so that is like about a bit manipulation and the weight manipulation is u... | 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 |
1,604 | It is the problem number 1600 lithic table that is called to read 'we sing we lithic table that is called to read 'we sing we lithic table that is called to read 'we sing we are more time' without water or water I are more time' without water or water I are more time' without water or water I actually liked that progra... | Alert Using Same Key-Card Three or More Times in a One Hour Period | least-number-of-unique-integers-after-k-removals | LeetCode company workers use key-cards to unlock office doors. Each time a worker uses their key-card, the security system saves the worker's name and the time when it was used. The system emits an **alert** if any worker uses the key-card **three or more times** in a one-hour period.
You are given a list of strings `... | Use a map to count the frequencies of the numbers in the array. An optimal strategy is to remove the numbers with the smallest count first. | Array,Hash Table,Greedy,Sorting,Counting | Medium | null |
393 | hi there today I'm going to go through the legal problem 393 the utf-8 the legal problem 393 the utf-8 the legal problem 393 the utf-8 validation okay this question for me at the first is really difficult to understand what's the meaning of it but I figured out I believe you guys can figure out that's where so let's go... | UTF-8 Validation | utf-8-validation | Given an integer array `data` representing the data, return whether it is a valid **UTF-8** encoding (i.e. it translates to a sequence of valid UTF-8 encoded characters).
A character in **UTF8** can be from **1 to 4 bytes** long, subjected to the following rules:
1. For a **1-byte** character, the first bit is a `0`... | All you have to do is follow the rules. For a given integer, obtain its binary representation in the string form and work with the rules given in the problem. An integer can either represent the start of a UTF-8 character, or a part of an existing UTF-8 character. There are two separate rules for these two scenarios in... | Array,Bit Manipulation | Medium | null |
518 | hello everyone welcome back here's van damson and today we are diving into very fascinating uh problem on a little daily challenge current change two so let's get started so all right let's first understand the problem we are given occurrence of different denomination and a specific uh value amount and the challenge fi... | Coin Change II | coin-change-2 | You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money.
Return _the number of combinations that make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `0`.
You may assume that yo... | null | Array,Dynamic Programming | Medium | 1393 |
667 | hey everybody this is larry this is day 12 of the april leco daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's farm uh yeah i usually solve this live so it's a little bit slow fast forward to exit uh watch another video whatever you need to do uh to... | Beautiful Arrangement II | beautiful-arrangement-ii | Given two integers `n` and `k`, construct a list `answer` that contains `n` different positive integers ranging from `1` to `n` and obeys the following requirement:
* Suppose this list is `answer = [a1, a2, a3, ... , an]`, then the list `[|a1 - a2|, |a2 - a3|, |a3 - a4|, ... , |an-1 - an|]` has exactly `k` distinct ... | null | Array,Math | Medium | 526 |
21 | Hello Everyone Swam This Video Were Going to Discuss - K March 2018 Singh Discuss - K March 2018 Singh Discuss - K March 2018 Singh Really So Let's See What is the Problem Seervi and Similar notes36 subscribe to the Page if you liked The Video then subscribe to the Page if you liked The Video Channel Ki Near Future Diw... | Merge Two Sorted Lists | merge-two-sorted-lists | You are given the heads of two sorted linked lists `list1` and `list2`.
Merge the two lists in a one **sorted** list. The list should be made by splicing together the nodes of the first two lists.
Return _the head of the merged linked list_.
**Example 1:**
**Input:** list1 = \[1,2,4\], list2 = \[1,3,4\]
**Output:**... | null | Linked List,Recursion | Easy | 23,88,148,244,1774,2071 |
31 | alright hey guys so what we're gonna do today is a fairly hard algorithm it's marked as medium on leaf code but I mean it's actually pretty it's actually quite hard if you don't know the steps to do it like if you just sit down you don't know any kind of tricks or anything if you just sit down to try to do this on your... | Next Permutation | next-permutation | A **permutation** of an array of integers is an arrangement of its members into a sequence or linear order.
* For example, for `arr = [1,2,3]`, the following are all the permutations of `arr`: `[1,2,3], [1,3,2], [2, 1, 3], [2, 3, 1], [3,1,2], [3,2,1]`.
The **next permutation** of an array of integers is the next le... | null | Array,Two Pointers | Medium | 46,47,60,267,1978 |
64 | hey everyone in this video we are going to solve the minimum path some question on lead code so we are given an M into n grid and uh what we need to do we need to return the minimum path sum from top left corner to the bottom right corner and we have to return in such a way that if we keep adding the numbers in the pat... | 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 |
454 | hello everyone today we're taking a look at leap code problem number 454 which is for some part two so you may have come across problems like twosome in the past and um the good news is that the key intuition from problems like two some will be used in this problem as well and if you don't know what that intuition is d... | 4Sum II | 4sum-ii | Given four integer arrays `nums1`, `nums2`, `nums3`, and `nums4` all of length `n`, return the number of tuples `(i, j, k, l)` such that:
* `0 <= i, j, k, l < n`
* `nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0`
**Example 1:**
**Input:** nums1 = \[1,2\], nums2 = \[-2,-1\], nums3 = \[-1,2\], nums4 = \[0,2\]
**Ou... | null | Array,Hash Table | Medium | 18 |
1,762 | welcome back everyone we're going to be solving Lee code 1762 buildings with an ocean view so we're given n buildings in a line and they give us this as an array of heights of size n that represents the heights of the buildings in a line the ocean is to the right of the buildings and a building has an ocean view if the... | Buildings With an Ocean View | furthest-building-you-can-reach | There are `n` buildings in a line. You are given an integer array `heights` of size `n` that represents the heights of the buildings in the line.
The ocean is to the right of the buildings. A building has an ocean view if the building can see the ocean without obstructions. Formally, a building has an ocean view if al... | Assume the problem is to check whether you can reach the last building or not. You'll have to do a set of jumps, and choose for each one whether to do it using a ladder or bricks. It's always optimal to use ladders in the largest jumps. Iterate on the buildings, maintaining the largest r jumps and the sum of the remain... | Array,Greedy,Heap (Priority Queue) | Medium | null |
1,026 | hey everybody this is Larry this is day nine of the December liquidation check the like button to subscribe button German Discord and let me reset this because I don't know when I saw it um I don't know why is this like uh I guess it was a year ago maybe it was on find whatever uh anyway hit the like button hit the Sub... | Maximum Difference Between Node and Ancestor | string-without-aaa-or-bbb | Given the `root` of a binary tree, find the maximum value `v` for which there exist **different** nodes `a` and `b` where `v = |a.val - b.val|` and `a` is an ancestor of `b`.
A node `a` is an ancestor of `b` if either: any child of `a` is equal to `b` or any child of `a` is an ancestor of `b`.
**Example 1:**
**Input... | null | String,Greedy | Medium | null |
92 | reverse a link list between index m to n we are indexing from one so index 1 2 3 4 5 6 & 7 if you want to reverse between 4 5 6 & 7 if you want to reverse between 4 5 6 & 7 if you want to reverse between index 3 & 6 in the end we are going to index 3 & 6 in the end we are going to index 3 & 6 in... | 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 |
1,836 | welcome back everyone we're going to be solving Lee code 1836 remove duplicates from an unsorted linked list so we're given the head of a linked list and we need to find all the values which appear more than once within the list and delete the nodes that have any of those values so in example one we're given one two th... | Remove Duplicates From an Unsorted Linked List | count-ways-to-make-array-with-product | Given the `head` of a linked list, find all the values that appear **more than once** in the list and delete the nodes that have any of those values.
Return _the linked list after the deletions._
**Example 1:**
**Input:** head = \[1,2,3,2\]
**Output:** \[1,3\]
**Explanation:** 2 appears twice in the linked list, so ... | Prime-factorize ki and count how many ways you can distribute the primes among the ni positions. After prime factorizing ki, suppose there are x amount of prime factor. There are (x + n - 1) choose (n - 1) ways to distribute the x prime factors into k positions, allowing repetitions. | Array,Math,Dynamic Programming | Hard | null |
159 | Hello Hello everyone Diwakar distance from type coding and in this video we are going to call this question long way sub string with the most distant tractors so let's see that and a string in this there are two on dating site that shows how we Hui Singh, take Pimple Ledger, the whole sting is full, if you do difficult... | Longest Substring with At Most Two Distinct Characters | longest-substring-with-at-most-two-distinct-characters | Given a string `s`, return _the length of the longest_ _substring_ _that contains at most **two distinct characters**_.
**Example 1:**
**Input:** s = "eceba "
**Output:** 3
**Explanation:** The substring is "ece " which its length is 3.
**Example 2:**
**Input:** s = "ccaabbb "
**Output:** 5
**Explanation:** The ... | null | Hash Table,String,Sliding Window | Medium | 3,239,340,1034 |
1,267 | hello welcome back today I try to solve another lead code problem 1267 Cod servers that communicate so basically we are giving a map of a server Center represent M * n so it server Center represent M * n so it server Center represent M * n so it means M row and columns so the condition is that we're going to return the... | Count Servers that Communicate | remove-zero-sum-consecutive-nodes-from-linked-list | You are given a map of a server center, represented as a `m * n` integer matrix `grid`, where 1 means that on that cell there is a server and 0 means that it is no server. Two servers are said to communicate if they are on the same row or on the same column.
Return the number of servers that communicate with any o... | Convert the linked list into an array. While you can find a non-empty subarray with sum = 0, erase it. Convert the array into a linked list. | Hash Table,Linked List | Medium | 1618 |
1,800 | all right so we're going to do problem 1800 maximum ascending subarray sum so this is a contiguous subarray problem these are quite common and i first ever looked at these type of problems i didn't even know what contiguous meant contiguous is similar to continuous in the sense that it is when applied to arrays it is m... | Maximum Ascending Subarray Sum | concatenation-of-consecutive-binary-numbers | Given an array of positive integers `nums`, return the _maximum possible sum of an **ascending** subarray in_ `nums`.
A subarray is defined as a contiguous sequence of numbers in an array.
A subarray `[numsl, numsl+1, ..., numsr-1, numsr]` is **ascending** if for all `i` where `l <= i < r`, `numsi < numsi+1`. Note th... | Express the nth number value in a recursion formula and think about how we can do a fast evaluation. | Math,Bit Manipulation,Simulation | Medium | null |
9 | hello everyone welcome to Python programming practice in this episode we are going to be covering leet code number nine palindrome number this is considered an easy problem and we'll just start by reading through the problem description and looking at the examples and then we'll get into doing the coding for the proble... | Palindrome Number | palindrome-number | Given an integer `x`, return `true` _if_ `x` _is a_ _**palindrome**__, and_ `false` _otherwise_.
**Example 1:**
**Input:** x = 121
**Output:** true
**Explanation:** 121 reads as 121 from left to right and from right to left.
**Example 2:**
**Input:** x = -121
**Output:** false
**Explanation:** From left to right, i... | Beware of overflow when you reverse the integer. | Math | Easy | 234,1375 |
1,074 | 1074 number of sub matrices that's some to target given the matrix given a matrix and a target we turned a number of non-empty sub matrices that sum to of non-empty sub matrices that sum to of non-empty sub matrices that sum to target a sub matrix x1 y1 x2 y2 is to set up all the cells within that okay I mean that's fi... | Number of Submatrices That Sum to Target | high-five | Given a `matrix` and a `target`, return the number of non-empty submatrices that sum to target.
A submatrix `x1, y1, x2, y2` is the set of all cells `matrix[x][y]` with `x1 <= x <= x2` and `y1 <= y <= y2`.
Two submatrices `(x1, y1, x2, y2)` and `(x1', y1', x2', y2')` are different if they have some coordinate that is... | How can we solve the problem if we have just one student? Given an student sort their grades and get the top 5 average. Generalize the idea to do it for many students. | Array,Hash Table,Sorting | Easy | null |
1,837 | Hello hello everyone in this video are going to solve the Christian science monitor in 20 key ok software give the best in the world channel subscribe button to rishi purush mriga ok your busy schedule in the ultimate in marathi for this software * - 5000 test after Dividing After Taking Revenge After Thirty 46664 Into... | Sum of Digits in Base K | daily-leads-and-partners | Given an integer `n` (in base `10`) and a base `k`, return _the **sum** of the digits of_ `n` _**after** converting_ `n` _from base_ `10` _to base_ `k`.
After converting, each digit should be interpreted as a base `10` number, and the sum should be returned in base `10`.
**Example 1:**
**Input:** n = 34, k = 6
**Out... | null | Database | Easy | null |
1,979 | hello everyone in this video let's discuss how to write a program to find the greatest common divisor of array given an integer nums return the greatest common divisor of the smallest number and largest number in nums the greatest common divisor of two numbers is the largest positive integer that evenly divides both th... | Find Greatest Common Divisor of Array | maximum-number-of-people-that-can-be-caught-in-tag | Given an integer array `nums`, return _the **greatest common divisor** of the smallest number and largest number in_ `nums`.
The **greatest common divisor** of two numbers is the largest positive integer that evenly divides both numbers.
**Example 1:**
**Input:** nums = \[2,5,6,9,10\]
**Output:** 2
**Explanation:**
... | Try to use as much of the range of a person who is "it" as possible. Find the leftmost person who is "it" that has not caught anyone yet, and the leftmost person who is not "it" that has not been caught yet. If the person who is not "it" can be caught, pair them together and repeat the process. If the person who is not... | Array,Greedy | Medium | 2191 |
1,725 | hey everybody this is larry this is me going with q1 of the weekly contest 224 number of rectangles that can form the largest square uh hit the like button hit the subscribe button join me on this card let me know what you think about today's prom uh and yeah and for this one it is just a rec tango and i think there is... | Number Of Rectangles That Can Form The Largest Square | number-of-sets-of-k-non-overlapping-line-segments | You are given an array `rectangles` where `rectangles[i] = [li, wi]` represents the `ith` rectangle of length `li` and width `wi`.
You can cut the `ith` rectangle to form a square with a side length of `k` if both `k <= li` and `k <= wi`. For example, if you have a rectangle `[4,6]`, you can cut it to get a square wit... | Try to use dynamic programming where the current index and remaining number of line segments to form can describe any intermediate state. To make the computation of each state in constant time, we could add another flag to the state that indicates whether or not we are in the middle of placing a line (placed start poin... | Math,Dynamic Programming | Medium | null |
137 | hello here's welcome back to coding interphase channel hope you are doing great if you haven't subscribed to the channel yet please go ahead and subscribe I have created bunch of playlists to cover various categories of problems such as BFS DFS dynamic programming stacks queues linked lists and so on please seek them o... | Single Number II | single-number-ii | Given an integer array `nums` where every element appears **three times** except for one, which appears **exactly once**. _Find the single element and return it_.
You must implement a solution with a linear runtime complexity and use only constant extra space.
**Example 1:**
**Input:** nums = \[2,2,3,2\]
**Output:**... | null | Array,Bit Manipulation | Medium | 136,260 |
289 | Hello Hi Everyone Welcome To My Channel It's All The Problem Game Offline According To Wikipedia Article The Giver Of Life Also Known As Simply Slide Cellular Automation Device The British Mathematician John Hutton Who They In India Is Made Up Of Karo Subscribe Interacts With Its Troops From Wikipedia Subscribe Indian ... | 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 |
74 | hello welcome to my channel i'm here to do my 100 lego challenge today we have leeco 74 search or 2d metrics so write an efficient algorithm that searches for a value in and m time and matrix so this metric have following properties integer in each row are sorted in from left to right and the first integer of each row ... | Search a 2D Matrix | search-a-2d-matrix | You are given an `m x n` integer matrix `matrix` with the following two properties:
* Each row is sorted in non-decreasing order.
* The first integer of each row is greater than the last integer of the previous row.
Given an integer `target`, return `true` _if_ `target` _is in_ `matrix` _or_ `false` _otherwise_.
... | null | Array,Binary Search,Matrix | Medium | 240 |
261 | in this video we're going to look at a legal problem called graph validatory so we're given a graph of the number of nodes labeled from 0 to n minus 1. you're given an integer n and a list of edges where edge i is a i and bi so we have two vertex right we have two uh notes and then this is basically represents that the... | Graph Valid Tree | graph-valid-tree | You have a graph of `n` nodes labeled from `0` to `n - 1`. You are given an integer n and a list of `edges` where `edges[i] = [ai, bi]` indicates that there is an undirected edge between nodes `ai` and `bi` in the graph.
Return `true` _if the edges of the given graph make up a valid tree, and_ `false` _otherwise_.
**... | Given n = 5 and edges = [[0, 1], [1, 2], [3, 4]], what should your return? Is this case a valid tree? According to the definition of tree on Wikipedia: “a tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles is a tree.” | Depth-First Search,Breadth-First Search,Union Find,Graph | Medium | 207,323,871 |
1,616 | hey what's up guys this is chung here so um so today let's talk about uh this week's weekly contest problems this is the third one uh number 16 okay split two strings to make palindrome as you guys can see this one got a lot of downloads the reason being is because the uh the example two here this one it's a that's a w... | Split Two Strings to Make Palindrome | minimum-difference-between-largest-and-smallest-value-in-three-moves | You are given two strings `a` and `b` of the same length. Choose an index and split both strings **at the same index**, splitting `a` into two strings: `aprefix` and `asuffix` where `a = aprefix + asuffix`, and splitting `b` into two strings: `bprefix` and `bsuffix` where `b = bprefix + bsuffix`. Check if `aprefix + bs... | The minimum difference possible is is obtained by removing 3 elements between the 3 smallest and 3 largest values in the array. | Array,Greedy,Sorting | Medium | null |
6 | Hello friends today I'm going to solve it could problem number six chit chat conversation so in this problem we are given a string as and an integer number of rows so um the string as is basically spread in object check order so basically here the given string this string is uh in a jig check order let's look at this p... | Zigzag Conversion | zigzag-conversion | The string `"PAYPALISHIRING "` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S I I G
Y I R
And then read line by line: `"PAHNAPLSIIGYIR "`
Write the code that will take a string and make this co... | null | String | Medium | null |
1,980 | all right this is Larry this is day 16 of the Leo da challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's pro uh I forgot to film myself on top so I'll sh I'll link a I'll post a drone video right now but right now I am in KOB on Mount Maya uh coming down uh... | Find Unique Binary String | faulty-sensor | Given an array of strings `nums` containing `n` **unique** binary strings each of length `n`, return _a binary string of length_ `n` _that **does not appear** in_ `nums`_. If there are multiple answers, you may return **any** of them_.
**Example 1:**
**Input:** nums = \[ "01 ", "10 "\]
**Output:** "11 "
**Explanatio... | Check for a common prefix of the two arrays. After this common prefix, there should be one array similar to the other but shifted by one. If both arrays can be shifted, return -1. | Array,Two Pointers | Easy | null |
319 | hi everyone hope everyone's doing well happy father's day welcome back for another video we are going to do another lego question the question is bulb switcher there are n bulbs that are initially off you first turn on the box then you turn off every second bulb on the third one you toggle every third bulb turning on i... | Bulb Switcher | bulb-switcher | There are `n` bulbs that are initially off. You first turn on all the bulbs, then you turn off every second bulb.
On the third round, you toggle every third bulb (turning on if it's off or turning off if it's on). For the `ith` round, you toggle every `i` bulb. For the `nth` round, you only toggle the last bulb.
Retu... | null | Math,Brainteaser | Medium | 672,1037,1491 |
892 | what's up everyone today we're gonna go over Lee code 892 surface area so the input is gonna be a 2d grid and what they want is a total surface area all the 1x1 cubes that are placed in that grid the problem didn't do a good job of visualizing it but the solution from the leak code tab is pretty easy and straightforwar... | Surface Area of 3D Shapes | shortest-subarray-with-sum-at-least-k | You are given an `n x n` `grid` where you have placed some `1 x 1 x 1` cubes. Each value `v = grid[i][j]` represents a tower of `v` cubes placed on top of cell `(i, j)`.
After placing these cubes, you have decided to glue any directly adjacent cubes to each other, forming several irregular 3D shapes.
Return _the tota... | null | Array,Binary Search,Queue,Sliding Window,Heap (Priority Queue),Prefix Sum,Monotonic Queue | Hard | null |
233 | Hello hi 100 welcome to this question number 213 loot sudhir wa and your porn subscribe video subscribe total number off kar do hum is the president of number and subscribe our channel subscribe video do voice of baje se reddy gps of the that this Video That's Nothing But Pandit Jaisa Number of Units Tips Number One Su... | Number of Digit One | number-of-digit-one | Given an integer `n`, count _the total number of digit_ `1` _appearing in all non-negative integers less than or equal to_ `n`.
**Example 1:**
**Input:** n = 13
**Output:** 6
**Example 2:**
**Input:** n = 0
**Output:** 0
**Constraints:**
* `0 <= n <= 109` | Beware of overflow. | Math,Dynamic Programming,Recursion | Hard | 172,1068 |
1,637 | today we are going to see the problem L daily challenge by vertical area between two points containing no points so you have been given points array where you have been given x coordinate and y coordinate for a given point so return the widest vertical area between two points such that no points are inside the so if yo... | Widest Vertical Area Between Two Points Containing No Points | string-compression-ii | Given `n` `points` on a 2D plane where `points[i] = [xi, yi]`, Return _the **widest vertical area** between two points such that no points are inside the area._
A **vertical area** is an area of fixed-width extending infinitely along the y-axis (i.e., infinite height). The **widest vertical area** is the one with the ... | Use dynamic programming. The state of the DP can be the current index and the remaining characters to delete. Having a prefix sum for each character can help you determine for a certain character c in some specific range, how many characters you need to delete to merge all occurrences of c in that range. | String,Dynamic Programming | Hard | null |
162 | 162 find peak element from the code let's come to the question a peak element is an element that is strictly greater than its neighbors given an integer array norms find a peak element and return its index if the array contains multiple peaks return the index to any of the peaks so the question is saying an array of nu... | Find Peak Element | find-peak-element | A peak element is an element that is strictly greater than its neighbors.
Given a **0-indexed** integer array `nums`, find a peak element, and return its index. If the array contains multiple peaks, return the index to **any of the peaks**.
You may imagine that `nums[-1] = nums[n] = -∞`. In other words, an element is... | null | Array,Binary Search | Medium | 882,2047,2273,2316 |
5 | hello let's try to solve a lead code problem today I'm going to try the problem number five longest pading to make subram so for this one if we are giving a St as ba a b a d so the longest is b a b because bab is a continuous stream because padding D padding Dr Mak stream is a continuous not empty sequence of character... | 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 |
63 | hey everybody this is larry this is me doing uh this is oh wow i am we are today uh this is day 20 of the mainly good day giant hit the like button to subscribe and join me in disco let me know what you think about today's farm hey everybody so just cutting in for a second um i apparently recorded the video with the ho... | Unique Paths II | unique-paths-ii | You are given an `m x n` integer array `grid`. There is a robot 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.
An obstacle and space are marked as ... | The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be
if obstacleGrid[i][j] is not an obstacle
... | Array,Dynamic Programming,Matrix | Medium | 62,1022 |
1,732 | hello and welcome back to another Elite code problem today we're going to be doing the problem of the day for June 19th and to find the highest altitude and so the problem reads like this there's a biker going on a road trip the road trip consists of n plus one points at different altitudes the biker starts at strip at... | Find the Highest Altitude | minimum-one-bit-operations-to-make-integers-zero | There is a biker going on a road trip. The road trip consists of `n + 1` points at different altitudes. The biker starts his trip on point `0` with altitude equal `0`.
You are given an integer array `gain` of length `n` where `gain[i]` is the **net gain in altitude** between points `i` and `i + 1` for all (`0 <=... | The fastest way to convert n to zero is to remove all set bits starting from the leftmost one. Try some simple examples to learn the rule of how many steps are needed to remove one set bit. consider n=2^k case first, then solve for all n. | Dynamic Programming,Bit Manipulation,Memoization | Hard | 2119 |
1,498 | let's solve leak code 1498 at least that's what i think it's going to be called when it's actually released number of subsequences that satisfy the given sum condition so we're given some subarray right or some array let's say 3 6 8 and a target and let's say it's 10 and we want to count every subsequence from this arr... | Number of Subsequences That Satisfy the Given Sum Condition | find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree | You are given an array of integers `nums` and an integer `target`.
Return _the number of **non-empty** subsequences of_ `nums` _such that the sum of the minimum and maximum element on it is less or equal to_ `target`. Since the answer may be too large, return it **modulo** `109 + 7`.
**Example 1:**
**Input:** nums =... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
1,060 | hey guys let's look at 1 0 6 0 missing any ministry delay we're given a solid array of unique numbers okay find the K the missing number starting from the left most number of the array like we're giving like this phone number first start from the left the next missing number is 5 because the array is 7 so 5 6 is missin... | Missing Element in Sorted Array | longest-repeating-substring | Given an integer array `nums` which is sorted in **ascending order** and all of its elements are **unique** and given also an integer `k`, return the `kth` missing number starting from the leftmost number of the array.
**Example 1:**
**Input:** nums = \[4,7,9,10\], k = 1
**Output:** 5
**Explanation:** The first missi... | Generate all substrings in O(N^2) time with hashing. Choose those hashing of strings with the largest length. | String,Binary Search,Dynamic Programming,Rolling Hash,Suffix Array,Hash Function | Medium | null |
387 | Hello hello guys welcome back to take admission in this video will see how to find most unique character in a string this is from the list day-5 of the match challenge so let's list day-5 of the match challenge so let's list day-5 of the match challenge so let's look at the problem statement the problem pimple jeevan a... | 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 |
60 | welcome to June's legal challenge today's problem is permutation sequence the set 1 2 3 2 n contains n factorial unique permutations by listing and labeling all permutations in order this is what we would get and we're going to be given a K and we want to return to case permutation sequence so say that we're given n 3 ... | Permutation Sequence | permutation-sequence | The set `[1, 2, 3, ..., n]` contains a total of `n!` unique permutations.
By listing and labeling all of the permutations in order, we get the following sequence for `n = 3`:
1. `"123 "`
2. `"132 "`
3. `"213 "`
4. `"231 "`
5. `"312 "`
6. `"321 "`
Given `n` and `k`, return the `kth` permutation sequence.
**Exa... | null | Math,Recursion | Hard | 31,46 |
1,737 | ah oh hi there didn't see you coming but please join me let's have to get our cup of pistachio shells and while at it let's solve an algorithmical problem 1737 change minimum characters to satisfy one of three conditions you are given two strings a and b that consist of lowercase letters in one operation you can change... | Change Minimum Characters to Satisfy One of Three Conditions | maximum-nesting-depth-of-the-parentheses | You are given two strings `a` and `b` that consist of lowercase letters. In one operation, you can change any character in `a` or `b` to **any lowercase letter**.
Your goal is to satisfy **one** of the following three conditions:
* **Every** letter in `a` is **strictly less** than **every** letter in `b` in the alp... | The depth of any character in the VPS is the ( number of left brackets before it ) - ( number of right brackets before it ) | String,Stack | Easy | 1208 |
278 | hello guys in this video we will be going over little problem number 278 first bad version in this question you are a product manager designing a product and one of your versions fails the quality check but since each version is based on the previous one all the bridges afterwards are also bad so suppose you're given a... | First Bad Version | first-bad-version | You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.
Suppose you have `n` versions `[1, 2, ..., n]` an... | null | Binary Search,Interactive | Easy | 34,35,374 |
1,349 | so here you are given it braids actually this is a class where students can take exam and cross means that these chairs are not good so I think that's what cross means let me check yes and dot means that you can sit on that like you know any student could be sitting there it's a good seat but the problem is one more re... | Maximum Students Taking Exam | check-if-it-is-a-straight-line | Given a `m * n` matrix `seats` that represent seats distributions in a classroom. If a seat is broken, it is denoted by `'#'` character otherwise it is denoted by a `'.'` character.
Students can see the answers of those sitting next to the left, right, upper left and upper right, but he cannot see the answers of the s... | If there're only 2 points, return true. Check if all other points lie on the line defined by the first 2 points. Use cross product to check collinearity. | Array,Math,Geometry | Easy | null |
977 | Hello everyone welcome to my channel code sari with mike so today we are going to do video number 24 of our lead code playlist ok t code 977 is quite an easy question we will do it with two approaches first will be our brute force which is said in the question Atli will do the same, the second one will be its optimal v... | Squares of a Sorted Array | distinct-subsequences-ii | Given an integer array `nums` sorted in **non-decreasing** order, return _an array of **the squares of each number** sorted in non-decreasing order_.
**Example 1:**
**Input:** nums = \[-4,-1,0,3,10\]
**Output:** \[0,1,9,16,100\]
**Explanation:** After squaring, the array becomes \[16,1,0,9,100\].
After sorting, it be... | null | String,Dynamic Programming | Hard | 2115 |
1 | hi guys in this video we're going to solve the two sum problem on lead code using python so the problem says given an array of integer nums and an integer Target return indices of two numbers such that they add up to the Target so for example you have the array 2 7 11 and 15 and the target is 9. so the solution is zero... | Two Sum | two-sum | Given an array of integers `nums` and an integer `target`, return _indices of the two numbers such that they add up to `target`_.
You may assume that each input would have **_exactly_ one solution**, and you may not use the _same_ element twice.
You can return the answer in any order.
**Example 1:**
**Input:** nums... | A really brute force way would be to search for all possible pairs of numbers but that would be too slow. Again, it's best to try out brute force solutions for just for completeness. It is from these brute force solutions that you can come up with optimizations. So, if we fix one of the numbers, say x, we have to scan ... | Array,Hash Table | Easy | 15,18,167,170,560,653,1083,1798,1830,2116,2133,2320 |
334 | hey everyone and welcome back to my Channel today we are going to be doing the eighth video in the leak code 75 study plan Series so this problem is going to be called uh increasing triplet subsequence in its ranked medium difficulty however going through the problem prior to this video it's pretty easy um I'm kind of ... | Increasing Triplet Subsequence | increasing-triplet-subsequence | Given an integer array `nums`, return `true` _if there exists a triple of indices_ `(i, j, k)` _such that_ `i < j < k` _and_ `nums[i] < nums[j] < nums[k]`. If no such indices exists, return `false`.
**Example 1:**
**Input:** nums = \[1,2,3,4,5\]
**Output:** true
**Explanation:** Any triplet where i < j < k is valid.
... | null | Array,Greedy | Medium | 300,2122,2280 |
397 | going to solve integer replacement on late code given an integer n you can apply one of the following operations if n is even replace n with n divided by two if n is odd replace n with either n plus one or n minus one so we have a parameter m here and either it'll be odd or even it's even we just keep dividing it by tw... | Integer Replacement | integer-replacement | Given a positive integer `n`, you can apply one of the following operations:
1. If `n` is even, replace `n` with `n / 2`.
2. If `n` is odd, replace `n` with either `n + 1` or `n - 1`.
Return _the minimum number of operations needed for_ `n` _to become_ `1`.
**Example 1:**
**Input:** n = 8
**Output:** 3
**Explanat... | null | Dynamic Programming,Greedy,Bit Manipulation,Memoization | Medium | null |
93 | hello everyone welcome to another one of my lead code videos and this one we'll do lead code 93 restore IP addresses this is today's daily challenge so basically we're given a string of all digits and we need to try and insert like dots in the string to create valid IP addresses and a valid IP address is basically like... | Restore IP Addresses | restore-ip-addresses | A **valid IP address** consists of exactly four integers separated by single dots. Each integer is between `0` and `255` (**inclusive**) and cannot have leading zeros.
* For example, `"0.1.2.201 "` and `"192.168.1.1 "` are **valid** IP addresses, but `"0.011.255.245 "`, `"192.168.1.312 "` and `"192.168@1.1 "` are **... | null | String,Backtracking | Medium | 752 |
912 | hey everybody this is Larry this is day wow this is the first day isn't it whoops first day of the March legal day challenge does that mean that there's a weekly as well yep so we'll be doing both today uh if you're joining me just for this one uh well welcome uh we have a long streak going I don't even know what it is... | Sort an Array | random-pick-with-weight | Given an array of integers `nums`, sort the array in ascending order and return it.
You must solve the problem **without using any built-in** functions in `O(nlog(n))` time complexity and with the smallest space complexity possible.
**Example 1:**
**Input:** nums = \[5,2,3,1\]
**Output:** \[1,2,3,5\]
**Explanation:*... | null | Math,Binary Search,Prefix Sum,Randomized | Medium | 398,894,914 |
140 | in this problem we are given a long string and we have to insert spaces between them so when we insert a space in a string we break them into different words and those words should be valid so you will be also given a dictionary so those words should be present in the dictionary so let's see an example then it will be ... | Word Break II | word-break-ii | Given a string `s` and a dictionary of strings `wordDict`, add spaces in `s` to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in **any order**.
**Note** that the same word in the dictionary may be reused multiple times in the segmentation.
**Example 1:**
**Input:... | null | Hash Table,String,Dynamic Programming,Backtracking,Trie,Memoization | Hard | 139,472 |
451 | in this video we're going to look at a legal problem called sore colors by frequency so we're given a string and we want to sort it in descending order based on the frequency of characters so we can see we have a input of tree and in this case e appeared twice while r and t appear only once so in this case we're going ... | Sort Characters By Frequency | sort-characters-by-frequency | Given a string `s`, sort it in **decreasing order** based on the **frequency** of the characters. The **frequency** of a character is the number of times it appears in the string.
Return _the sorted string_. If there are multiple answers, return _any of them_.
**Example 1:**
**Input:** s = "tree "
**Output:** "eer... | null | Hash Table,String,Sorting,Heap (Priority Queue),Bucket Sort,Counting | Medium | 347,387,1741 |
331 | guys how are you I hope are you doing good welcome to their learn code easily so today we will solve one more question in our stack Series so if you have not accessed yet the exact series excited bookmark it and I am one more series that is easy level not even the question is not only limited in this series you can als... | Verify Preorder Serialization of a Binary Tree | verify-preorder-serialization-of-a-binary-tree | One way to serialize a binary tree is to use **preorder traversal**. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as `'#'`.
For example, the above binary tree can be serialized to the string `"9,3,4,#,#,1,#,#,2,#,6,#,# "`, where `'#'` repres... | null | String,Stack,Tree,Binary Tree | Medium | null |
81 | hey everyone welcome back and let's write some more neat code today so today I'll solve the problems search and rotated sorted array 2. I solved the first one of this I think like three years ago and this problem is almost exactly the same as the first version so I will kind of summarize the solution for that one but I... | 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 |
368 | Loot hello today question is last absolutely most advanced top-10 tears and lawyers most advanced top-10 tears and lawyers most advanced top-10 tears and lawyers submitted at every player of lemon juice subscribe to is if in mount language then this condition wants that which gives us stomach ache it is custom and elem... | Largest Divisible Subset | largest-divisible-subset | Given a set of **distinct** positive integers `nums`, return the largest subset `answer` such that every pair `(answer[i], answer[j])` of elements in this subset satisfies:
* `answer[i] % answer[j] == 0`, or
* `answer[j] % answer[i] == 0`
If there are multiple solutions, return any of them.
**Example 1:**
**Inp... | null | Array,Math,Dynamic Programming,Sorting | Medium | null |
1,005 | 108 long students of this question of list code and it's saying maximum a sum of every after director Steven in it lies giver that 1019 Amazon okay and what to do in that plus I you have to do negative scent okay and negative shades We have to support so that the result of this Shimoga line will be great, it will be di... | Maximize Sum Of Array After K Negations | univalued-binary-tree | Given an integer array `nums` and an integer `k`, modify the array in the following way:
* choose an index `i` and replace `nums[i]` with `-nums[i]`.
You should apply this process exactly `k` times. You may choose the same index `i` multiple times.
Return _the largest possible sum of the array after modifying it i... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 1609 |
1,553 | hey guys welcome back to another video and today we're going to be solving the lee code question minimum number of days to eat and oranges so this question comes from the weekly lead code contest and this is from the question from august 16th challenge and this is the hardest question as you can see over here okay so w... | Minimum Number of Days to Eat N Oranges | count-triplets-that-can-form-two-arrays-of-equal-xor | There are `n` oranges in the kitchen and you decided to eat some of these oranges every day as follows:
* Eat one orange.
* If the number of remaining oranges `n` is divisible by `2` then you can eat `n / 2` oranges.
* If the number of remaining oranges `n` is divisible by `3` then you can eat `2 * (n / 3)` oran... | We are searching for sub-array of length ≥ 2 and we need to split it to 2 non-empty arrays so that the xor of the first array is equal to the xor of the second array. This is equivalent to searching for sub-array with xor = 0. Keep the prefix xor of arr in another array, check the xor of all sub-arrays in O(n^2), if th... | Array,Hash Table,Math,Bit Manipulation,Prefix Sum | Medium | null |
332 | Hello hello welcome kishan quote today they are going to solicit problem of jun28 chapter problems and construct alternative show episode no problem statement saying that you will give one two dimensional are you can play list of string with the alternative for at least they can do For Travel Destinations subscribe and... | Reconstruct Itinerary | reconstruct-itinerary | You are given a list of airline `tickets` where `tickets[i] = [fromi, toi]` represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it.
All of the tickets belong to a man who departs from `"JFK "`, thus, the itinerary must begin with `"JFK "`. If there are multiple... | null | Depth-First Search,Graph,Eulerian Circuit | Hard | 2051,2201 |
1,650 | all right so let's talk about the lowest common ancestor over by nu3 and then you are given a binary tree and then you are assigning p and q i mean you're giving q and then you want to find out the lowest common ancestor uh we're pointing uh cooling this lca so uh probably you already understand how they do it so just ... | Lowest Common Ancestor of a Binary Tree III | find-root-of-n-ary-tree | Given two nodes of a binary tree `p` and `q`, return _their lowest common ancestor (LCA)_.
Each node will have a reference to its parent node. The definition for `Node` is below:
class Node {
public int val;
public Node left;
public Node right;
public Node parent;
}
According to the **[definition of ... | Node with indegree 0 is the root | Hash Table,Bit Manipulation,Tree,Depth-First Search | Medium | 1655 |
1,792 | hey hello everyone so in this video i will be explaining the problem maximum average pass ratio and trust me this is a difficult problem because even if you have done everything correct you can get a tle like i did in the contest you know in the contest i wrote this code my idea was 100 correct but the implementation w... | Maximum Average Pass Ratio | find-the-most-competitive-subsequence | There is a school that has classes of students and each class will be having a final exam. You are given a 2D integer array `classes`, where `classes[i] = [passi, totali]`. You know beforehand that in the `ith` class, there are `totali` total students, but only `passi` number of students will pass the exam.
You are al... | In lexicographical order, the elements to the left have higher priority than those that come after. Can you think of a strategy that incrementally builds the answer from left to right? | Array,Stack,Greedy,Monotonic Stack | Medium | 402,1159 |
399 | hello everyone welcome to my channel today we'll solve lit code problem number 399 evaluate division problem statement is you are given equations in the format of a divided by b equals to k where a and b are variables represented as strings and k is the real number given some queries written the answers if the answer d... | Evaluate Division | evaluate-division | You are given an array of variable pairs `equations` and an array of real numbers `values`, where `equations[i] = [Ai, Bi]` and `values[i]` represent the equation `Ai / Bi = values[i]`. Each `Ai` or `Bi` is a string that represents a single variable.
You are also given some `queries`, where `queries[j] = [Cj, Dj]` rep... | Do you recognize this as a graph problem? | Array,Depth-First Search,Breadth-First Search,Union Find,Graph,Shortest Path | Medium | null |
138 | Hello everyone welcome to my channel with mike so today you have given link list application which is quite famous and important question and we will make it in two easy ways, today we will make it with you and they, we will understand it very well and it will be very easy and copy list in WITH RANDOM POINTS OK IT IS O... | Copy List with Random Pointer | copy-list-with-random-pointer | A linked list of length `n` is given such that each node contains an additional random pointer, which could point to any node in the list, or `null`.
Construct a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) of the list. The deep copy should consist of exactly `n` **brand new** nodes, where e... | Just iterate the linked list and create copies of the nodes on the go. Since a node can be referenced from multiple nodes due to the random pointers, make sure you are not making multiple copies of the same node. You may want to use extra space to keep old node ---> new node mapping to prevent creating multiples copies... | Hash Table,Linked List | Medium | 133,1624,1634 |
126 | hey everyone welcome back to the channel i hope you guys are doing extremely well so in the previous video we did learn about word ladder one where we had to convert the starting work to the target word using the given word list and you to do it in a minimum number of transformations so what will add to is an extension... | Word Ladder II | word-ladder-ii | A **transformation sequence** from word `beginWord` to word `endWord` using a dictionary `wordList` is a sequence of words `beginWord -> s1 -> s2 -> ... -> sk` such that:
* Every adjacent pair of words differs by a single letter.
* Every `si` for `1 <= i <= k` is in `wordList`. Note that `beginWord` does not need ... | null | Hash Table,String,Backtracking,Breadth-First Search | Hard | 127,2276 |
851 | graphs a powerful layer structure that can be used to solve a lot of problems and the one that we will solve in this video is one of them we will solve the loud and rich problem in the loud and rich problem we have a group of n people each one of them has a value that represents its quietness and we have a bunch of rel... | Loud and Rich | goat-latin | There is a group of `n` people labeled from `0` to `n - 1` where each person has a different amount of money and a different level of quietness.
You are given an array `richer` where `richer[i] = [ai, bi]` indicates that `ai` has more money than `bi` and an integer array `quiet` where `quiet[i]` is the quietness of th... | null | String | Easy | null |
330 | Welcome Back To My Channel Today Were Solving The Problem Packing Are Made Number 305 Letter Problem Basically Posted Are Yours And Your Attachment Us Jor Range 0.7 Elements Are 0.7 Elements Are 0.7 Elements Are Number Of Us Requests For User And Subscribe 200 Gr Pyaar Keval Pyar Ki Band Naam Se Total Score 183 Ki And ... | Patching Array | patching-array | Given a sorted integer array `nums` and an integer `n`, add/patch elements to the array such that any number in the range `[1, n]` inclusive can be formed by the sum of some elements in the array.
Return _the minimum number of patches required_.
**Example 1:**
**Input:** nums = \[1,3\], n = 6
**Output:** 1
Explanati... | null | Array,Greedy | Hard | 1930 |
977 | Hello to Ajay, Hello everyone, Mired Miraj and today we are going to solve a very interesting question of the examination hall, the name of which is After a Toiba, look at the question 11 add, you will get one ampere, which is spotted, return it to you. There is one that holds them square of element and shot do tight s... | Squares of a Sorted Array | distinct-subsequences-ii | Given an integer array `nums` sorted in **non-decreasing** order, return _an array of **the squares of each number** sorted in non-decreasing order_.
**Example 1:**
**Input:** nums = \[-4,-1,0,3,10\]
**Output:** \[0,1,9,16,100\]
**Explanation:** After squaring, the array becomes \[16,1,0,9,100\].
After sorting, it be... | null | String,Dynamic Programming | Hard | 2115 |
93 | hello guys I hope you are all doing well and this video will solve the leads called Problem valid IP address so the problem is that they give us an input string that contain only digits and they ask you to check if the given string is a valid IP address and the IP addresses are numerical labels allocated to each device... | Restore IP Addresses | restore-ip-addresses | A **valid IP address** consists of exactly four integers separated by single dots. Each integer is between `0` and `255` (**inclusive**) and cannot have leading zeros.
* For example, `"0.1.2.201 "` and `"192.168.1.1 "` are **valid** IP addresses, but `"0.011.255.245 "`, `"192.168.1.312 "` and `"192.168@1.1 "` are **... | null | String,Backtracking | Medium | 752 |
1,026 | hey guys welcome back to another video and today we're going to be solving the lead code question maximum difference between node and ancestor all right so given the root of a binary tree find the maximum value b for which there exists different nodes a and b so where b is equal to the absolute difference between the a... | Maximum Difference Between Node and Ancestor | string-without-aaa-or-bbb | Given the `root` of a binary tree, find the maximum value `v` for which there exist **different** nodes `a` and `b` where `v = |a.val - b.val|` and `a` is an ancestor of `b`.
A node `a` is an ancestor of `b` if either: any child of `a` is equal to `b` or any child of `a` is an ancestor of `b`.
**Example 1:**
**Input... | null | String,Greedy | Medium | null |
983 | hi guys welcome to algorithms made easy today we will go through the day 25 problem from august lead coding challenge wherein we will find the solution to problem minimum cost for tickets please like the video and if you are new don't forget to subscribe to our channel so that you never miss any update in a country pop... | Minimum Cost For Tickets | validate-stack-sequences | You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array `days`. Each day is an integer from `1` to `365`.
Train tickets are sold in **three different ways**:
* a **1-day** pass is sold for `costs[0]` dollars,
* a **7-day** pass is sold... | null | Array,Stack,Simulation | Medium | null |
1,233 | hey what's up guys this chung here again so and this time let's take a look at another little problem here number 1233 i removed subfolders from the file system and you were given a list of folders with like letters and the forward slash and if any of the folder is a subfolder of the other existing parent folders we sh... | Remove Sub-Folders from the Filesystem | number-of-ships-in-a-rectangle | Given a list of folders `folder`, return _the folders after removing all **sub-folders** in those folders_. You may return the answer in **any order**.
If a `folder[i]` is located within another `folder[j]`, it is called a **sub-folder** of it.
The format of a path is one or more concatenated strings of the form: `'/... | Use divide and conquer technique. Divide the query rectangle into 4 rectangles. Use recursion to continue with the rectangles that has ships only. | Array,Divide and Conquer,Interactive | Hard | null |
779 | hey guys thanks for joining in today's video we're going to take a look at problem 779 on leak code case symbol and grammar so what we'll do is first we'll go over the problem description then we'll perform an analysis on how we can implement a solution we'll call out any edge cases that we have to worry about we'll di... | K-th Symbol in Grammar | max-chunks-to-make-sorted-ii | We build a table of `n` rows (**1-indexed**). We start by writing `0` in the `1st` row. Now in every subsequent row, we look at the previous row and replace each occurrence of `0` with `01`, and each occurrence of `1` with `10`.
* For example, for `n = 3`, the `1st` row is `0`, the `2nd` row is `01`, and the `3rd` r... | Each k for which some permutation of arr[:k] is equal to sorted(arr)[:k] is where we should cut each chunk. | Array,Stack,Greedy,Sorting,Monotonic Stack | Hard | 780 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.