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 |
|---|---|---|---|---|---|---|---|---|
125 | hello everybody and welcome back to the cracking fang youtube channel today we're going to be doing a very quick video on leap code problem 125 valid palindrome let's read the problem statement a phrase is a palindrome if after converting all uppercase letters into lowercase letters and removing all non-alphanumeric ch... | Valid Palindrome | valid-palindrome | A phrase is a **palindrome** if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.
Given a string `s`, return `true` _if it is a **palindrome**, or_ `false` _otherwise_... | null | Two Pointers,String | Easy | 234,680,2130,2231 |
1,201 | hi everyone with Kevin here so let's discuss about we click on test 155 second question actually number three so we've been asked to write a program to return the nth number of ugly number so the definition of a clean number is it's divisible by a or B or C and it's a positive number so for example here ABC is 2 3 &... | Ugly Number III | delete-tree-nodes | An **ugly number** is a positive integer that is divisible by `a`, `b`, or `c`.
Given four integers `n`, `a`, `b`, and `c`, return the `nth` **ugly number**.
**Example 1:**
**Input:** n = 3, a = 2, b = 3, c = 5
**Output:** 4
**Explanation:** The ugly numbers are 2, 3, 4, 5, 6, 8, 9, 10... The 3rd is 4.
**Example 2:... | Traverse the tree using depth first search. Find for every node the sum of values of its sub-tree. Traverse the tree again from the root and return once you reach a node with zero sum of values in its sub-tree. | Tree,Depth-First Search,Breadth-First Search | Medium | null |
1,928 | hello let's do this question um i did this question before but i'm just going to try a different solution so in this question just briefly crap you're given a graph and you want to find the minimum cost to get from node 0 to node n minus 1 where there are n nodes in the whole graph you can just use directors to do that... | Minimum Cost to Reach Destination in Time | number-of-orders-in-the-backlog | There is a country of `n` cities numbered from `0` to `n - 1` where **all the cities are connected** by bi-directional roads. The roads are represented as a 2D integer array `edges` where `edges[i] = [xi, yi, timei]` denotes a road between cities `xi` and `yi` that takes `timei` minutes to travel. There may be multiple... | Store the backlog buy and sell orders in two heaps, the buy orders in a max heap by price and the sell orders in a min heap by price. Store the orders in batches and update the fields according to new incoming orders. Each batch should only take 1 "slot" in the heap. | Array,Heap (Priority Queue),Simulation | Medium | null |
1,020 | hey guys so today we are going to discuss about the question called as number of enclaves so this is a medium question this is a lead called medium question which is a basic you know like a graph question or a dfs question so let's start reading the question so you are given an m into an binary matrix called as grade w... | Number of Enclaves | longest-turbulent-subarray | You are given an `m x n` binary matrix `grid`, where `0` represents a sea cell and `1` represents a land cell.
A **move** consists of walking from one land cell to another adjacent (**4-directionally**) land cell or walking off the boundary of the `grid`.
Return _the number of land cells in_ `grid` _for which we cann... | null | Array,Dynamic Programming,Sliding Window | Medium | 53 |
1,832 | Everyone, today we will do the question number of our strings players, okay and this is an easy level question, so before understanding the question, let's see who has asked this question, it has been asked by Joho and it is Minaj Bhai Snapdeal, okay So let's see the question, what is the input and output? Let's unders... | Check if the Sentence Is Pangram | minimum-operations-to-make-a-subsequence | A **pangram** is a sentence where every letter of the English alphabet appears at least once.
Given a string `sentence` containing only lowercase English letters, return `true` _if_ `sentence` _is a **pangram**, or_ `false` _otherwise._
**Example 1:**
**Input:** sentence = "thequickbrownfoxjumpsoverthelazydog "
**O... | The problem can be reduced to computing Longest Common Subsequence between both arrays. Since one of the arrays has distinct elements, we can consider that these elements describe an arrangement of numbers, and we can replace each element in the other array with the index it appeared at in the first array. Then the pro... | Array,Hash Table,Binary Search,Greedy | Hard | null |
904 | hi guys this is nikasha as I've already explained the logic for this problem I'll just go over the description quickly once and then start reading the code in a row of trees the eye tree produces fruit with type T of tree of I so you start at any tree of your choice then repeatedly perform one of the following step fir... | Fruit Into Baskets | leaf-similar-trees | You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by an integer array `fruits` where `fruits[i]` is the **type** of fruit the `ith` tree produces.
You want to collect as much fruit as possible. However, the owner has some strict rules that you must foll... | null | Tree,Depth-First Search,Binary Tree | Easy | null |
24 | Hello hello friends in this section we are going to discuss about one of his simple coding problem list code problem title swapan dosh in page you will give these include all they need to a place where every two years of no return its new pimple in public not Values with 12303 subscribe public not Values with 12303... | 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 |
1,509 | Loot Ego Building Option 20 Singh Tuteja Third Question of Butterfly Orthak what are you saying to us, let's look at the one, then you should peer because it is something like this, if we take the example of 5234, then first of all, 5234, you are someone saying thank you. What do you think, its school is of school and ... | Minimum Difference Between Largest and Smallest Value in Three Moves | replace-employee-id-with-the-unique-identifier | You are given an integer array `nums`.
In one move, you can choose one element of `nums` and change it to **any value**.
Return _the minimum difference between the largest and smallest value of `nums` **after performing at most three moves**_.
**Example 1:**
**Input:** nums = \[5,3,2,4\]
**Output:** 0
**Explanation... | null | Database | Easy | null |
1,854 | Ajay Ko Hello Everyone Mohit Website Compact Aaj Yaar Equal Karenge Maximum Population Arrow This question was asked Record Check in Wikileaks Party The question was quite easy Open now 33-year old ok so Open now 33-year old ok so Open now 33-year old ok so click on it Coaching Edit Question Extracting information from... | Maximum Population Year | maximum-population-year | You are given a 2D integer array `logs` where each `logs[i] = [birthi, deathi]` indicates the birth and death years of the `ith` person.
The **population** of some year `x` is the number of people alive during that year. The `ith` person is counted in year `x`'s population if `x` is in the **inclusive** range `[birthi... | null | null | Easy | null |
883 | alright guys so I didn't want to do this question so I'll just copy and paste the solution and tell you guys how to do it cuz I don't know how they found this solution though but that is how it works though it just somehow it works alright so this the question is projection area of 3d shapes you're given a grid and you... | Projection Area of 3D Shapes | car-fleet | You are given an `n x n` `grid` where we place some `1 x 1 x 1` cubes that are axis-aligned with the `x`, `y`, and `z` axes.
Each value `v = grid[i][j]` represents a tower of `v` cubes placed on top of the cell `(i, j)`.
We view the projection of these cubes onto the `xy`, `yz`, and `zx` planes.
A **projection** is ... | null | Array,Stack,Sorting,Monotonic Stack | Medium | 1902,2317 |
342 | Hello friends to Jhal Ajay, once again welcome all of you to our YouTube channel Tier-3, in all of you to our YouTube channel Tier-3, in all of you to our YouTube channel Tier-3, in today's video there is a very easy question, it is being made just for videos because we will try to update one liner because it is writte... | 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 |
172 | hey guys welcome to my channel today we're gonna be looking at factorial trailing zeros question in python so given an integer and return the number of trolling zeros in n factorial if our input by the way trailing zero means how many zeros are at the back of your output so if your input is three the output is zero bec... | Factorial Trailing Zeroes | factorial-trailing-zeroes | Given an integer `n`, return _the number of trailing zeroes in_ `n!`.
Note that `n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1`.
**Example 1:**
**Input:** n = 3
**Output:** 0
**Explanation:** 3! = 6, no trailing zero.
**Example 2:**
**Input:** n = 5
**Output:** 1
**Explanation:** 5! = 120, one trailing zero.
**Exa... | null | Math | Medium | 233,809,2222 |
47 | hi everyone welcome back to lead coding i am your host faraz so we will continue with the topic recursion and backtracking and we are here with another question this is permutations2 we have already covered the permutations one in the previous videos if you haven't watched that video make sure to do it or if you know h... | Permutations II | permutations-ii | Given a collection of numbers, `nums`, that might contain duplicates, return _all possible unique permutations **in any order**._
**Example 1:**
**Input:** nums = \[1,1,2\]
**Output:**
\[\[1,1,2\],
\[1,2,1\],
\[2,1,1\]\]
**Example 2:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,... | null | Array,Backtracking | Medium | 31,46,267,1038 |
426 | hello and welcome back my name is constantine and today we're going to solve a problem a very cool problem convert binary search tree to sort the double linked list so we're given a binary search tree and we're asked to convert it to a circular doubly linked list and they're kind enough to remind us how a double linked... | Convert Binary Search Tree to Sorted Doubly Linked List | convert-binary-search-tree-to-sorted-doubly-linked-list | Convert a **Binary Search Tree** to a sorted **Circular Doubly-Linked List** in place.
You can think of the left and right pointers as synonymous to the predecessor and successor pointers in a doubly-linked list. For a circular doubly linked list, the predecessor of the first element is the last element, and the succe... | null | null | Medium | null |
202 | okay so which one should we do okay make a choice uh which one we can do happy number reverse bits okay so let's go with this happy number yeah okay so write an algorithm to determine uh if number n is happy a happy number is determined by the following process starting with any positive integer replace the number by t... | 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 |
1,855 | hey everybody this is larry this is me going over q2 of the weekly contest 240 maximum distance between a pair of values hit the like button hit the subscribe button join me on discord let me know what you think about this problem uh so honestly i don't know if this is the reference solution i definitely did this in a ... | Maximum Distance Between a Pair of Values | maximum-distance-between-a-pair-of-values | You are given two **non-increasing 0-indexed** integer arrays `nums1` and `nums2`.
A pair of indices `(i, j)`, where `0 <= i < nums1.length` and `0 <= j < nums2.length`, is **valid** if both `i <= j` and `nums1[i] <= nums2[j]`. The **distance** of the pair is `j - i`.
Return _the **maximum distance** ... | null | null | Medium | null |
295 | Hello everyone welcome, the channel itself is going to do hypominis, this is the problem in chalai challenge, five medium from data stream, Surya, very important problem from interview perspective, so what to do in this, we have a like, you have understood but who is he in the industry or Also, let's see some specific ... | Find Median from Data Stream | find-median-from-data-stream | The **median** is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two middle values.
* For example, for `arr = [2,3,4]`, the median is `3`.
* For example, for `arr = [2,3]`, the median is `(2 + 3) / 2 = 2.5`.
Implement the M... | null | Two Pointers,Design,Sorting,Heap (Priority Queue),Data Stream | Hard | 480,1953,2207 |
252 | hey everyone today we're going to be going over lead code problem 252 meeting rooms this is another problem of the blind 75 list which is a list of problems commonly asked during technical interviews in this problem we are given an array called intervals and each interval has a start time and an end time and what we wa... | Meeting Rooms | meeting-rooms | Given an array of meeting time `intervals` where `intervals[i] = [starti, endi]`, determine if a person could attend all meetings.
**Example 1:**
**Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\]
**Output:** false
**Example 2:**
**Input:** intervals = \[\[7,10\],\[2,4\]\]
**Output:** true
**Constraints:**
* ... | null | Array,Sorting | Easy | 56,253 |
752 | hello everyone welcome to photoscamp we are at fourth day of june lead code challenge and the problem we are going to cover in this video is open the lock so the input given here is a string array which represents the dead ends string target and we have to return the number of steps we have to rotate the given lock in ... | 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 |
1,770 | Instead of Sunday heat, those who complete numbers 15 to 20 maximum can subscribe and pick up From 2nd Year Old Is Gold channel that Reddy is multiplayer i* Will do our when I multiplayer i* Will do our when I multiplayer i* Will do our when I from Amazon with him and Ko International School is okay and then will remov... | Maximum Score from Performing Multiplication Operations | minimum-deletions-to-make-character-frequencies-unique | You are given two **0-indexed** integer arrays `nums` and `multipliers` of size `n` and `m` respectively, where `n >= m`.
You begin with a score of `0`. You want to perform **exactly** `m` operations. On the `ith` operation (**0-indexed**) you will:
* Choose one integer `x` from **either the start or the end** of t... | As we can only delete characters, if we have multiple characters having the same frequency, we must decrease all the frequencies of them, except one. Sort the alphabet characters by their frequencies non-increasingly. Iterate on the alphabet characters, keep decreasing the frequency of the current character until it re... | String,Greedy,Sorting | Medium | 1355,2212 |
355 | hello friend thanks for joining today's session and thanks for stopping by my channel uh so today we will be solving one design problem on lead code this problem is called design twitter and let's first go through the problem description it says like design a simplified version of twitter where users can post tweets un... | Design Twitter | design-twitter | Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the `10` most recent tweets in the user's news feed.
Implement the `Twitter` class:
* `Twitter()` Initializes your twitter object.
* `void postTweet(int userId, int tweetId)` Composes a new tweet w... | null | Hash Table,Linked List,Design,Heap (Priority Queue) | Medium | 1640 |
144 | 294 Today's Events From This Question of List Code Special Directory of Free Water Traversal Preorder basically happens We can tell tomorrow a little bit Yes man we are very happy a little bit Change basically happens that what do we do first We print the value first Okay follow by we go to his head and left then we go... | Binary Tree Preorder Traversal | binary-tree-preorder-traversal | Given the `root` of a binary tree, return _the preorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[1,2,3\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of nodes ... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 94,255,775 |
435 | hey what's up guys chung here again and so this time let's take a look at it called problem number 435 none overlapping intervals pretty classic intervals problem so you're given like a collection of intervals find the minimum number of intervals you need to remove to make the rest of the intervals none overlapping oka... | Non-overlapping Intervals | non-overlapping-intervals | Given an array of intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping_.
**Example 1:**
**Input:** intervals = \[\[1,2\],\[2,3\],\[3,4\],\[1,3\]\]
**Output:** 1
**Explanation:** \[1,3\] can be removed ... | null | Array,Dynamic Programming,Greedy,Sorting | Medium | 452 |
498 | hey what's up guys this is john here so let's take a look at today's daily challenge problem number 498 diagonal traverse you're given like a matrix of m times n elements where we have m rows and n columns and you need to return all the elements of the matrix in the diagonal order as shown in the below image so we're t... | Diagonal Traverse | diagonal-traverse | Given an `m x n` matrix `mat`, return _an array of all the elements of the array in a diagonal order_.
**Example 1:**
**Input:** mat = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[1,2,4,7,5,3,6,8,9\]
**Example 2:**
**Input:** mat = \[\[1,2\],\[3,4\]\]
**Output:** \[1,2,3,4\]
**Constraints:**
* `m == mat.leng... | null | Array,Matrix,Simulation | Medium | 2197 |
981 | hello and welcome to another eliteco Chrome So today we're going to be doing problem number 981 time-based key value problem number 981 time-based key value problem number 981 time-based key value store and so for this problem you need to design a data structure that can hold multiple values for the same key at differe... | Time Based Key-Value Store | delete-columns-to-make-sorted | Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key's value at a certain timestamp.
Implement the `TimeMap` class:
* `TimeMap()` Initializes the object of the data structure.
* `void set(String key, String value, int timestamp)... | null | Array,String | Easy | null |
73 | going to solve question 73 set matrix 0 from lead code in time complexity and by n and constant space complexity let's go through the question so the question is saying giving a an m by an integer matrix if an element is equal to zero set its entire row and column to zero you must do it in place so what does it mean so... | Set Matrix Zeroes | set-matrix-zeroes | Given an `m x n` integer matrix `matrix`, if an element is `0`, set its entire row and column to `0`'s.
You must do it [in place](https://en.wikipedia.org/wiki/In-place_algorithm).
**Example 1:**
**Input:** matrix = \[\[1,1,1\],\[1,0,1\],\[1,1,1\]\]
**Output:** \[\[1,0,1\],\[0,0,0\],\[1,0,1\]\]
**Example 2:**
**In... | If any cell of the matrix has a zero we can record its row and column number using additional memory.
But if you don't want to use extra memory then you can manipulate the array instead. i.e. simulating exactly what the question says. Setting cell values to zero on the fly while iterating might lead to discrepancies. ... | Array,Hash Table,Matrix | Medium | 289,2244,2259,2314 |
808 | hi everyone in today challenge we are going to solve this problem the problem name is soup serving and the problem number is 808. hold it guys so first of all what we are going to do we are going to clearly understand the problem statement so first of all we will understand the problem statement after understanding the... | Soup Servings | number-of-matching-subsequences | There are two types of soup: **type A** and **type B**. Initially, we have `n` ml of each type of soup. There are four kinds of operations:
1. Serve `100` ml of **soup A** and `0` ml of **soup B**,
2. Serve `75` ml of **soup A** and `25` ml of **soup B**,
3. Serve `50` ml of **soup A** and `50` ml of **soup B**, an... | null | Hash Table,String,Trie,Sorting | Medium | 392,1051,2186 |
1,640 | hey guys what's up so today we are going to solve the first problem of 2021 on lead code daily challenge series so this is the first problem of january lead code challenge the daily challenge that is quite popular now and the problem statement goes by the name of check array formation through concatenation so i'll go t... | 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,703 | so what's up guys today we are going to solve the problem 1703 minimum adjacent swaps for K consecutive ones this is considered as a hard problem but trust me guys I will make this problem cake work for you will be able to code on your own after you know going through this whole video okay so what question says that uh... | Minimum Adjacent Swaps for K Consecutive Ones | put-boxes-into-the-warehouse-i | You are given an integer array, `nums`, and an integer `k`. `nums` comprises of only `0`'s and `1`'s. In one move, you can choose two **adjacent** indices and swap their values.
Return _the **minimum** number of moves required so that_ `nums` _has_ `k` _**consecutive**_ `1`_'s_.
**Example 1:**
**Input:** nums = \[1,... | Sort the boxes in ascending order, try to process the box with the smallest height first. | Array,Greedy,Sorting | Medium | 1719 |
712 | hello everyone so today we are going to cover minimum ascii delete sum for two strings so we are given an input of two strings s1 and s2 and we have to return the lowest ascii sum of deleted characters to make two strings equal so let's understand this problem statement with an example here is our first example the wor... | Minimum ASCII Delete Sum for Two Strings | minimum-ascii-delete-sum-for-two-strings | Given two strings `s1` and `s2`, return _the lowest **ASCII** sum of deleted characters to make two strings equal_.
**Example 1:**
**Input:** s1 = "sea ", s2 = "eat "
**Output:** 231
**Explanation:** Deleting "s " from "sea " adds the ASCII value of "s " (115) to the sum.
Deleting "t " from "eat " adds 116 to ... | Let dp(i, j) be the answer for inputs s1[i:] and s2[j:]. | String,Dynamic Programming | Medium | 72,300,583 |
210 | hello everyone today we're gonna do the core shadow problem only good so let's see the problem description first so we are given a total of num courses that we have to take which are labeled from 0 to num courses minus 1 some courses may have prerequisites for example to take course 0 you have to first take course 1 wh... | Course Schedule II | course-schedule-ii | There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`.
* For example, the pair `[0, 1]`, indicates that to take cou... | This problem is equivalent to finding the topological order in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topolo... | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 207,269,310,444,630,1101,2220 |
1,022 | Loot Hello Everyone Welcome To 11th January Liquid Channel Life Is The Great Time Don't Forget Subscribe Withdraw All Subscribe Number Traveling From Sydney With Love Subscribe 108 Converted Into Middle Interview 4000000 Subscribe Lootb School Ko Ando Friends Now In Follow Imperative That You Can Also Been Able To Talk... | Sum of Root To Leaf Binary Numbers | unique-paths-iii | You are given the `root` of a binary tree where each node has a value `0` or `1`. Each root-to-leaf path represents a binary number starting with the most significant bit.
* For example, if the path is `0 -> 1 -> 1 -> 0 -> 1`, then this could represent `01101` in binary, which is `13`.
For all leaves in the tree, c... | null | Array,Backtracking,Bit Manipulation,Matrix | Hard | 37,63,212 |
854 | friends welcome back to my Channel today we're doing another lead code problem together today we're doing lead code 854 K similar strings so basically we're given two strings S1 and S2 they are K similar if we can swap the positions of two letters in S1 exactly K times uh so that S1 is equal to S2 examples are so first... | K-Similar Strings | making-a-large-island | Strings `s1` and `s2` are `k`**\-similar** (for some non-negative integer `k`) if we can swap the positions of two letters in `s1` exactly `k` times so that the resulting string equals `s2`.
Given two anagrams `s1` and `s2`, return the smallest `k` for which `s1` and `s2` are `k`**\-similar**.
**Example 1:**
**Input... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Hard | null |
54 | Biometrics of n top equal to zero left equal to zero and right is equal to Matrix zero dot length minus one and bottom is equal to Matrix at length minus one we need a new list of integers called results then while result dot size is now you're going to Matrix dot length times Matrix of zero dot length or end I is equa... | Spiral Matrix | spiral-matrix | Given an `m x n` `matrix`, return _all elements of the_ `matrix` _in spiral order_.
**Example 1:**
**Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[1,2,3,6,9,8,7,4,5\]
**Example 2:**
**Input:** matrix = \[\[1,2,3,4\],\[5,6,7,8\],\[9,10,11,12\]\]
**Output:** \[1,2,3,4,8,12,11,10,9,5,6,7\]
**Const... | Well for some problems, the best way really is to come up with some algorithms for simulation. Basically, you need to simulate what the problem asks us to do. We go boundary by boundary and move inwards. That is the essential operation. First row, last column, last row, first column and then we move inwards by 1 and th... | Array,Matrix,Simulation | Medium | 59,921 |
904 | hello guys now actually soft flute into baskets the province a mentor seems very complicated but indeed this moment just as asked you calculates as a max window which only had two different characters which animals they have two different characters so we will use society window algorithm we keep very the window and ev... | Fruit Into Baskets | leaf-similar-trees | You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by an integer array `fruits` where `fruits[i]` is the **type** of fruit the `ith` tree produces.
You want to collect as much fruit as possible. However, the owner has some strict rules that you must foll... | null | Tree,Depth-First Search,Binary Tree | Easy | null |
2,000 | here are three tips I've learned after spending thousands of hours on leeco number one focus on easy problems then work towards mediums do not worry about hearts in a real interview they'll typically be more willing to give hints number two be honest with yourself if you don't know how to solve a problem just look at t... | Reverse Prefix of Word | minimum-speed-to-arrive-on-time | Given a **0-indexed** string `word` and a character `ch`, **reverse** the segment of `word` that starts at index `0` and ends at the index of the **first occurrence** of `ch` (**inclusive**). If the character `ch` does not exist in `word`, do nothing.
* For example, if `word = "abcdefd "` and `ch = "d "`, then you s... | Given the speed the trains are traveling at, can you find the total time it takes for you to arrive? Is there a cutoff where any speeds larger will always allow you to arrive on time? | Array,Binary Search | Medium | 1335,2013,2294 |
42 | That if we welcome back also channel ayub ice cream you will today will be solving problems typing tutor for this date sheet 2014 problem this YouTube channel please do subscribe button along-with like subscribe button along-with like subscribe button along-with like pure problem states eligible 110 negative in teacher... | Trapping Rain Water | trapping-rain-water | Given `n` non-negative integers representing an elevation map where the width of each bar is `1`, compute how much water it can trap after raining.
**Example 1:**
**Input:** height = \[0,1,0,2,1,0,1,3,2,1,2,1\]
**Output:** 6
**Explanation:** The above elevation map (black section) is represented by array \[0,1,0,2,1,... | null | Array,Two Pointers,Dynamic Programming,Stack,Monotonic Stack | Hard | 11,238,407,756 |
712 | all right let's talk about the minimum ascii to this sum of two string so giving the string one in string to return a minimum ascii sound of the character to make the string equal so in this case you are definitely using 2d array and then triverse and then using recursion and memorizing and then you will be able to sol... | Minimum ASCII Delete Sum for Two Strings | minimum-ascii-delete-sum-for-two-strings | Given two strings `s1` and `s2`, return _the lowest **ASCII** sum of deleted characters to make two strings equal_.
**Example 1:**
**Input:** s1 = "sea ", s2 = "eat "
**Output:** 231
**Explanation:** Deleting "s " from "sea " adds the ASCII value of "s " (115) to the sum.
Deleting "t " from "eat " adds 116 to ... | Let dp(i, j) be the answer for inputs s1[i:] and s2[j:]. | String,Dynamic Programming | Medium | 72,300,583 |
1,679 | Hello hello how are you today will get till we give it 10 maths number of key message please medium math question read details and only from here tutorial for specific remedy ko one phone number two coaches were amazed officer intermediate's in one operation camp 12 Number Sun Re That All Request K And Immortal Palms A... | Max Number of K-Sum Pairs | shortest-subarray-to-be-removed-to-make-array-sorted | You are given an integer array `nums` and an integer `k`.
In one operation, you can pick two numbers from the array whose sum equals `k` and remove them from the array.
Return _the maximum number of operations you can perform on the array_.
**Example 1:**
**Input:** nums = \[1,2,3,4\], k = 5
**Output:** 2
**Explana... | The key is to find the longest non-decreasing subarray starting with the first element or ending with the last element, respectively. After removing some subarray, the result is the concatenation of a sorted prefix and a sorted suffix, where the last element of the prefix is smaller than the first element of the suffix... | Array,Two Pointers,Binary Search,Stack,Monotonic Stack | Medium | null |
238 | hey everyone today we'll be going over leode problem 238 product of array except self this is another problem off the blind 75 list which is a list of problems commonly asked during technical interviews in this problem we are given an integer array called nums and we want to return an array answer such that the number ... | Product of Array Except Self | product-of-array-except-self | Given an integer array `nums`, return _an array_ `answer` _such that_ `answer[i]` _is equal to the product of all the elements of_ `nums` _except_ `nums[i]`.
The product of any prefix or suffix of `nums` is **guaranteed** to fit in a **32-bit** integer.
You must write an algorithm that runs in `O(n)` time and without... | null | Array,Prefix Sum | Medium | 42,152,265,2267 |
458 | hey everybody this is Larry this is day six of delete code daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's Farm poor pigs uh let's see okay the buckets of fun buckets of liquid where exactly one of the buckets is poisonous to figure out which one ... | Poor Pigs | poor-pigs | There are `buckets` buckets of liquid, where **exactly one** of the buckets is poisonous. To figure out which one is poisonous, you feed some number of (poor) pigs the liquid to see whether they will die or not. Unfortunately, you only have `minutesToTest` minutes to determine which bucket is poisonous.
You can feed t... | What if you only have one shot? Eg. 4 buckets, 15 mins to die, and 15 mins to test. How many states can we generate with x pigs and T tests? Find minimum x such that (T+1)^x >= N | Math,Dynamic Programming,Combinatorics | Hard | null |
1,774 | hello everyone welcome back to my Channel today let's do another lead code prom together okay today we're doing lead code 1774 closest dessert cost you would like to make dessert and are preparing to buy the ingredients the rules is that there must be exactly one base and you have the option to add one or more toppings... | Closest Dessert Cost | add-two-polynomials-represented-as-linked-lists | You would like to make dessert and are preparing to buy the ingredients. You have `n` ice cream base flavors and `m` types of toppings to choose from. You must follow these rules when making your dessert:
* There must be **exactly one** ice cream base.
* You can add **one or more** types of topping or have no topp... | Process both linked lists at the same time If the current power of the two heads is equal, add this power with the sum of the coefficients to the answer list. If one head has a larger power, add this power to the answer list and move only this head. | Linked List,Math,Two Pointers | Medium | 2,21,445 |
53 | in this video we're going to take a look at a legal problem called maximum subarray so given an integer array nums find the continuous subarray containing at least one number so in this case continuous sub array is when a we have a subarray that each element is right next to each other right so basically we want to fin... | Maximum Subarray | maximum-subarray | Given an integer array `nums`, find the subarray with the largest sum, and return _its sum_.
**Example 1:**
**Input:** nums = \[-2,1,-3,4,-1,2,1,-5,4\]
**Output:** 6
**Explanation:** The subarray \[4,-1,2,1\] has the largest sum 6.
**Example 2:**
**Input:** nums = \[1\]
**Output:** 1
**Explanation:** The subarray \... | null | Array,Divide and Conquer,Dynamic Programming | Easy | 121,152,697,1020,1849,1893 |
16 | Hello Everyone and Welcome Back to My Channel Algorithm H Why Today I am Going to Write the Code and Also Explain to You All the Algorithm to Solve This Three Some Clue Problem Ch is There in Lead Quote It is a Medium Level Problem and is Pretty Similar To the three problem that you guys must have solved before if not ... | 3Sum Closest | 3sum-closest | Given an integer array `nums` of length `n` and an integer `target`, find three integers in `nums` such that the sum is closest to `target`.
Return _the sum of the three integers_.
You may assume that each input would have exactly one solution.
**Example 1:**
**Input:** nums = \[-1,2,1,-4\], target = 1
**Output:** ... | null | Array,Two Pointers,Sorting | Medium | 15,259 |
1,047 | hey how's it going um you know I'm do I'm gonna continue finish all these Alico problems I said I was gonna do it I'm gonna do it you know I don't care how long it takes me I'm in the middle of building this course that you guys should definitely go check out that will be a full course that if you study through you wil... | Remove All Adjacent Duplicates In String | maximize-sum-of-array-after-k-negations | You are given a string `s` consisting of lowercase English letters. A **duplicate removal** consists of choosing two **adjacent** and **equal** letters and removing them.
We repeatedly make **duplicate removals** on `s` until we no longer can.
Return _the final string after all such duplicate removals have been made_... | null | Array,Greedy,Sorting | Easy | 2204 |
4 | hey there welcome to today's video we're going to walk through one of the oldest leode problems out there median of two sorted arrays the true classic that everyone should do at least once and try not to forget let's get into it so the problem description is pretty simple we're given two sorted arrays nums one and nums... | 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,010 | hey guys it's cooper codes today we're going to be taking a look at the problem pairs of songs with total durations divisible by 60. this is a great introductory medium as it applies just a little bit more functionality on top of your regular easy problems especially for hashmap problems let's get into solving it let's... | Pairs of Songs With Total Durations Divisible by 60 | powerful-integers | You are given a list of songs where the `ith` song has a duration of `time[i]` seconds.
Return _the number of pairs of songs for which their total duration in seconds is divisible by_ `60`. Formally, we want the number of indices `i`, `j` such that `i < j` with `(time[i] + time[j]) % 60 == 0`.
**Example 1:**
**Input... | null | Hash Table,Math | Medium | null |
1,846 | hey everybody this is lby It's day 15 of the Le C daily challenge hit the like button hit the Subscribe button join my Discord let me know what you think about today's far and today I am in uh Himi uh the town of the city and also the castle so yeah uh I'm here in Japan still for a little bit so yeah hit the like butto... | Maximum Element After Decreasing and Rearranging | maximum-element-after-decreasing-and-rearranging | You are given an array of positive integers `arr`. Perform some operations (possibly none) on `arr` so that it satisfies these conditions:
* The value of the **first** element in `arr` must be `1`.
* The absolute difference between any 2 adjacent elements must be **less than or equal to** `1`. In other words, `abs... | null | null | Medium | null |
1,838 | hey what's up guys uh this is chung here again so this time uh number 1838 frequency of the most frequent elements so this one is a little bit tricky you know even though it's a medium problem you know so we all know the frequency right of an element in an array and you're given like a array num and an integer k so in ... | Frequency of the Most Frequent Element | number-of-distinct-substrings-in-a-string | The **frequency** of an element is the number of times it occurs in an array.
You are given an integer array `nums` and an integer `k`. In one operation, you can choose an index of `nums` and increment the element at that index by `1`.
Return _the **maximum possible frequency** of an element after performing **at mos... | Calculate the prefix hashing array for s. Use the prefix hashing array to calculate the hashing value of each substring. Compare the hashing values to determine the unique substrings. There could be collisions if you use hashing, what about double hashing. | String,Trie,Rolling Hash,Suffix Array,Hash Function | Medium | null |
65 | hey everyone welcome back and let's write some more new code today so today let's solve the problem valid palindrome i'm actually going to be solving this two different ways and i think both ways are definitely going to be helpful to know in an interview setting before we start i just want to quickly mention that this ... | Valid Number | valid-number | A **valid number** can be split up into these components (in order):
1. A **decimal number** or an **integer**.
2. (Optional) An `'e'` or `'E'`, followed by an **integer**.
A **decimal number** can be split up into these components (in order):
1. (Optional) A sign character (either `'+'` or `'-'`).
2. One of the... | null | String | Hard | 8 |
434 | so a segment is defined to be 20 years sequence of non-space characters so sequence of non-space characters so sequence of non-space characters so a segment is something that is contiguous sequence of non-space contiguous sequence of non-space contiguous sequence of non-space characters so given in this example you cou... | Number of Segments in a String | number-of-segments-in-a-string | Given a string `s`, return _the number of segments in the string_.
A **segment** is defined to be a contiguous sequence of **non-space characters**.
**Example 1:**
**Input:** s = "Hello, my name is John "
**Output:** 5
**Explanation:** The five segments are \[ "Hello, ", "my ", "name ", "is ", "John "\]
**Exam... | null | String | Easy | null |
113 | Ajay Ko Hello Everyone Children's Forest Scam Vihar Difficult Challenge From This Video From Route To Subscribe Problem Subscribe And Subscribe Statement Subscribe Cr Ruby Nine Plus Go Into 22212 subscribe and subscribe The Not Give To Plus To Shreya Ghoshal Promoter Stopped To Interview for Teachers Day and ₹1000 note... | 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 |
491 | Hello friends, how are you all, hope you all are doing well. Sub sequence is a medium level question of a lead code. In this question we will have a given. We are waiting for you to tell us as many of its possible different possible non decreasing sub sequences of D given era with atlist D tu elements and return answer... | 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 |
63 | Ajay Ko Hello Everyone Welcome to Lotus Camp Where Today August 28th After Several Important And From You Want's Birthday Unique Pass Stuart Pierce Brosnan To The Number Five Robot Game Robot Setting Do Subscribe And Subscribe To Subscribe And Subscribe The Quiet Per Suno From Going Down Shift Rice to Right Subscribe P... | 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 |
697 | hey what's up guys Nick white here I detect encoding stuff on Twitch in YouTube check the description for all my information I post you know a bunch of stuff on patreon you can support me it's like 2 bucks and it helps me out a lot and as well you could reach out to me on discord or something I try and get back to ever... | Degree of an Array | degree-of-an-array | Given a non-empty array of non-negative integers `nums`, the **degree** of this array is defined as the maximum frequency of any one of its elements.
Your task is to find the smallest possible length of a (contiguous) subarray of `nums`, that has the same degree as `nums`.
**Example 1:**
**Input:** nums = \[1,2,2,3,... | Say 5 is the only element that occurs the most number of times - for example, nums = [1, 5, 2, 3, 5, 4, 5, 6]. What is the answer? | Array,Hash Table | Easy | 53 |
1,460 | let's solve lead code problem 1460 make two arrays equal by reversing sub arrays the question goes like this you are given two integer array of equal length Target and array in one step you can select any nonn empty substring of AR and reverse it you are allowed to make any number of steps return true if you can make A... | Make Two Arrays Equal by Reversing Subarrays | number-of-substrings-containing-all-three-characters | You are given two integer arrays of equal length `target` and `arr`. In one step, you can select any **non-empty subarray** of `arr` and reverse it. You are allowed to make any number of steps.
Return `true` _if you can make_ `arr` _equal to_ `target` _or_ `false` _otherwise_.
**Example 1:**
**Input:** target = \[1,... | For each position we simply need to find the first occurrence of a/b/c on or after this position. So we can pre-compute three link-list of indices of each a, b, and c. | Hash Table,String,Sliding Window | Medium | 2187 |
2 | welcome back to our gist today's question is leak code two add two numbers you're given two non-empty numbers you're given two non-empty numbers you're given two non-empty linked lists representing two non-negative integers the digits are non-negative integers the digits are non-negative integers the digits are stored ... | Add Two Numbers | add-two-numbers | You are given two **non-empty** linked lists representing two non-negative integers. The digits are stored in **reverse order**, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 ... | null | Linked List,Math,Recursion | Medium | 43,67,371,415,445,1031,1774 |
695 | hi everyone once again welcome to my channel and today we are solving a very important interview problem max area of island as you can see here the clearly the like and dislike ratio this problem is very likeable as this problem is get in many top interview companies like this you can see in last six month itself in fa... | Max Area of Island | max-area-of-island | You are given an `m x n` binary matrix `grid`. An island is a group of `1`'s (representing land) connected **4-directionally** (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.
The **area** of an island is the number of cells with a value `1` in the island.
Return _the maxim... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | 200,463,1845,2206 |
1,673 | Ajay Ko Hello friends Diwakar Deeksha from Python coding, so today we are going to solve this question of lexicographical small and sequence, what to do on a lips, so in this question you have got another one, net speech in this, three hello one two, its speed is slow. Along with this, you have got another vegetable th... | Find the Most Competitive Subsequence | find-the-most-competitive-subsequence | Given an integer array `nums` and a positive integer `k`, return _the most **competitive** subsequence of_ `nums` _of size_ `k`.
An array's subsequence is a resulting sequence obtained by erasing some (possibly zero) elements from the array.
We define that a subsequence `a` is more **competitive** than a subsequence ... | null | null | Medium | null |
832 | Loot Hi Everyone Welcome Platform Delhi Chalen Swad Account Abhinav Today Sleeping And Match That Sister's Matrix Were Observed In The Cases And The 500 Yards Side Fitting Man Suit Click Animesh Urgently Need To Take 200 Taste Change Channel Subscribe Now To is so let's look at some of the examples 100 years what was t... | Flipping an Image | binary-tree-pruning | Given an `n x n` binary matrix `image`, flip the image **horizontally**, then invert it, and return _the resulting image_.
To flip an image horizontally means that each row of the image is reversed.
* For example, flipping `[1,1,0]` horizontally results in `[0,1,1]`.
To invert an image means that each `0` is repla... | null | Tree,Depth-First Search,Binary Tree | Medium | null |
1,690 | no hello everyone it's june 11th morning session let's do this oh what is this ah nothing of concern all right let's take a look stone game oh my god this is what seven stone game number seven jeez okay alice and bob come back again alice starts first there are end stones arranging a row on each player's turn they can ... | Stone Game VII | maximum-length-of-subarray-with-positive-product | Alice and Bob take turns playing a game, with **Alice starting first**.
There are `n` stones arranged in a row. On each player's turn, they can **remove** either the leftmost stone or the rightmost stone from the row and receive points equal to the **sum** of the remaining stones' values in the row. The winner is the ... | Split the whole array into subarrays by zeroes since a subarray with positive product cannot contain any zero. If the subarray has even number of negative numbers, the whole subarray has positive product. Otherwise, we have two choices, either - remove the prefix till the first negative element in this subarray, or rem... | Array,Dynamic Programming,Greedy | Medium | null |
1,266 | Hello Hi Friends Welcome Back To Year Gone Into Solitude Problem 1266 Minimum Time Visiting All Points Will Start Looking Details Of The Problem Is Just Want To Mention That My Channel Focus Is On Helping People Were Preparing For Coding Interview Schedule Of Telephone In Java Interview Suspend My Channel Has Over 200 ... | Minimum Time Visiting All Points | minimum-time-visiting-all-points | On a 2D plane, there are `n` points with integer coordinates `points[i] = [xi, yi]`. Return _the **minimum time** in seconds to visit all the points in the order given by_ `points`.
You can move according to these rules:
* In `1` second, you can either:
* move vertically by one unit,
* move horizontally... | null | null | Easy | null |
376 | hello everyone welcome to coderscam and today we are going to cover wiggle subsequence we are given an input of an integer array nums and we have to return the longest length of wiggle subsequence so what is a wiggle subsequence it is a sequence where the difference between successive numbers strictly alternate between... | Wiggle Subsequence | wiggle-subsequence | A **wiggle sequence** is a sequence where the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with one element and a sequence with two non-equal elements are trivially wiggle sequences.
* For ... | null | Array,Dynamic Programming,Greedy | Medium | 2271 |
713 | hey everybody this is larry this is day 28 of the league code daily challenge on in september hit the like button to subscribe and join me in discord and let's try it started today's uh subway product less than k uh yeah let me know what you think about today's form so you're giving it an array of positive integers num... | Subarray Product Less Than K | subarray-product-less-than-k | Given an array of integers `nums` and an integer `k`, return _the number of contiguous subarrays where the product of all the elements in the subarray is strictly less than_ `k`.
**Example 1:**
**Input:** nums = \[10,5,2,6\], k = 100
**Output:** 8
**Explanation:** The 8 subarrays that have product less than 100 are:
... | For each j, let opt(j) be the smallest i so that nums[i] * nums[i+1] * ... * nums[j] is less than k. opt is an increasing function. | Array,Sliding Window | Medium | 152,325,560,1083,2233 |
67 | hey everyone welcome back and let's write some more neat code today so today let's solve add binary it's a simple explanation for a problem and it's an easy problem but it's got some nice little tricks to it that i think are interesting so we're given two binary strings a and b and all we want to do is return their sum... | Add Binary | add-binary | Given two binary strings `a` and `b`, return _their sum as a binary string_.
**Example 1:**
**Input:** a = "11", b = "1"
**Output:** "100"
**Example 2:**
**Input:** a = "1010", b = "1011"
**Output:** "10101"
**Constraints:**
* `1 <= a.length, b.length <= 104`
* `a` and `b` consist only of `'0'` or `'1'` chara... | null | Math,String,Bit Manipulation,Simulation | Easy | 2,43,66,1031 |
837 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem new 21 game this is a really hard problem that's probably why you're watching this video I don't know why they made this a medium problem because yeah while the coding solution to be honest isn't a lot of code it is def... | New 21 Game | most-common-word | Alice plays the following game, loosely based on the card game **"21 "**.
Alice starts with `0` points and draws numbers while she has less than `k` points. During each draw, she gains an integer number of points randomly from the range `[1, maxPts]`, where `maxPts` is an integer. Each draw is independent and the outc... | null | Hash Table,String,Counting | Easy | null |
25 | hey everyone welcome back and let's write some more neat code today let's solve reverse nodes in a k group now this is a hard problem but it's actually not as hard as you might think so we're given one linked list and we want to reverse the nodes of that linked list a at a time and then return the output so what do the... | Reverse Nodes in k-Group | reverse-nodes-in-k-group | Given the `head` of a linked list, reverse the nodes of the list `k` at a time, and return _the modified list_.
`k` is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of `k` then left-out nodes, in the end, should remain as it is.
You may not alt... | null | Linked List,Recursion | Hard | 24,528,2196 |
252 | okay so uh lead code practice time um all right so there are two goals in this video the first one is to see how to solve this problem and then we will put some code there and the other one is um we will see how to behave during recording interview um which is proper so um remember the first part to the always the firs... | Meeting Rooms | meeting-rooms | Given an array of meeting time `intervals` where `intervals[i] = [starti, endi]`, determine if a person could attend all meetings.
**Example 1:**
**Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\]
**Output:** false
**Example 2:**
**Input:** intervals = \[\[7,10\],\[2,4\]\]
**Output:** true
**Constraints:**
* ... | null | Array,Sorting | Easy | 56,253 |
150 | going on everyone so today we're looking at lead code number 150 it's a question called evaluate reverse polish notation and this is a tricky question um if you haven't seen it before or aren't familiar with the pattern but once we apply a pattern to this a certain pattern it's actually not too bad but it can be intimi... | Evaluate Reverse Polish Notation | evaluate-reverse-polish-notation | You are given an array of strings `tokens` that represents an arithmetic expression in a [Reverse Polish Notation](http://en.wikipedia.org/wiki/Reverse_Polish_notation).
Evaluate the expression. Return _an integer that represents the value of the expression_.
**Note** that:
* The valid operators are `'+'`, `'-'`, ... | null | Array,Math,Stack | Medium | 224,282 |
1,601 | Hello everyone welcome to my channel but it is not really hard this is going to be very easy just like yesterday the question is the question of back tracking but we will figure out how is the question of back tracking be they bill figure out Key Bag Tracking Any Banda How to know that this question is made from back t... | 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 |
1,563 | hey what's up guys chung here again and so this time uh let's take a look at this uh this week's uh weekly contest the last one the last problem uh one 1500 stone game number five so okay so there are like several stones arranged in a row and so basically each now each element represents the value of the stone so the r... | Stone Game V | maximum-number-of-darts-inside-of-a-circular-dartboard | There are several stones **arranged in a row**, and each stone has an associated value which is an integer given in the array `stoneValue`.
In each round of the game, Alice divides the row into **two non-empty rows** (i.e. left row and right row), then Bob calculates the value of each row which is the sum of the value... | If there is an optimal solution, you can always move the circle so that two points lie on the boundary of the circle. When the radius is fixed, you can find either 0 or 1 or 2 circles that pass two given points at the same time. Loop for each pair of points and find the center of the circle, after that count the number... | Array,Math,Geometry | Hard | null |
1,197 | so question 1197 leak goes minimum light moves so in an infinite chess board with coordinates from negative infinity to positive infinity you have a knight at square zero the knight has eight possible moves it can make as illustrated below each move is two squares in a cardinal direction then one square in an orthogona... | Minimum Knight Moves | parsing-a-boolean-expression | In an **infinite** chess board with coordinates from `-infinity` to `+infinity`, you have a **knight** at square `[0, 0]`.
A knight has 8 possible moves it can make, as illustrated below. Each move is two squares in a cardinal direction, then one square in an orthogonal direction.
Return _the minimum number of steps ... | Write a function "parse" which calls helper functions "parse_or", "parse_and", "parse_not". | String,Stack,Recursion | Hard | null |
113 | Hello Hi Everyone Welcome Introduction Na Dharai Important Problem 5 Years 2003 Problem Subscribe And Also Give All Subscribe Return All Subscribe Pimp Convenor Appointed Will Start From This Loot Subscribe Quote Number Of Paswan Life Is The Number Called To The Number Of Thursday Lips 1234 Batool Liye Century of Subsc... | 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 |
827 | Hello Hi Everyone Welcome To My Channel And Today Khayal Solving Problems Meeting Ladu Ireland Morning So This Problem Wear Giver Matrix 90 Alarm Set Change 20 The Largest Possible Subscribe Ireland School Channel Problem Half Se Liye Maximum The Big Island In The Given Due To Landslides Can Change A 100 Subscribe Chan... | Making A Large Island | expressive-words | You are given an `n x n` binary matrix `grid`. You are allowed to change **at most one** `0` to be `1`.
Return _the size of the largest **island** in_ `grid` _after applying this operation_.
An **island** is a 4-directionally connected group of `1`s.
**Example 1:**
**Input:** grid = \[\[1,0\],\[0,1\]\]
**Output:** ... | null | Array,Two Pointers,String | Medium | null |
224 | Hello friends today I'm going to solve with good problem number 224 basic calculator so we are given a string as which represents a valid expression which means that uh the expression could be used to uh which would evaluate to return a final result so what we need to do here is we need to evaluate all the values in th... | Basic Calculator | basic-calculator | Given a string `s` representing a valid expression, implement a basic calculator to evaluate it, and return _the result of the evaluation_.
**Note:** You are **not** allowed to use any built-in function which evaluates strings as mathematical expressions, such as `eval()`.
**Example 1:**
**Input:** s = "1 + 1 "
**O... | null | Math,String,Stack,Recursion | Hard | 150,227,241,282,785,2147,2328 |
1,603 | hey guys how's it going in this video i'm going to walk through this legal problem design parking system uh so this question was asked by amazon for 12 times for the past six months uh so let's dive in um so this is an object-oriented design um so this is an object-oriented design um so this is an object-oriented desig... | Design Parking System | running-sum-of-1d-array | Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size.
Implement the `ParkingSystem` class:
* `ParkingSystem(int big, int medium, int small)` Initializes object of the `ParkingSystem` class. The number of slot... | Think about how we can calculate the i-th number in the running sum from the (i-1)-th number. | Array,Prefix Sum | Easy | null |
5 | hi guys hope you're doing great our today's question is the longest palindromic substring question a very famous question only code and a medium difficulty level problem the question says given a string s find the longest palindromic substring in s you may assume that the maximum length of s is thousand so two things t... | 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 |
367 | hey guys welcome to my video series on solving lead code problems this video's problem is valid perfect square I'm solving them from scratch by the way so I'm not prepared so given a positive integral num return true if num is a perfect square or false otherwise what is a perfect square footage square is an integer tha... | Valid Perfect Square | valid-perfect-square | Given a positive integer num, return `true` _if_ `num` _is a perfect square or_ `false` _otherwise_.
A **perfect square** is an integer that is the square of an integer. In other words, it is the product of some integer with itself.
You must not use any built-in library function, such as `sqrt`.
**Example 1:**
**In... | null | Math,Binary Search | Easy | 69,633 |
134 | Hello friends today I'm going to solve liquid problem number 134 gas station in this problem we are given two areas a gas array and a cost array so a guest error represents the amount of gas present in the Ice Station so if we are at index I then the amount of gas in the eye station is gasify and similarly cost I repre... | Gas Station | gas-station | There are `n` gas stations along a circular route, where the amount of gas at the `ith` station is `gas[i]`.
You have a car with an unlimited gas tank and it costs `cost[i]` of gas to travel from the `ith` station to its next `(i + 1)th` station. You begin the journey with an empty tank at one of the gas stations.
Gi... | null | Array,Greedy | Medium | 1346 |
319 | Hello hello one torn did their digit code year her notification once again when subscribe button 1223 subscribe to whatsapp brown moderator tele list crazy tight club do subscribe oil mid on two 13 posts and value of an order for apple video android previous report Subscribe Now To Do Subscribe 2002 Subscribe Andhe Vid... | 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 |
679 | cool 679 24-game hard you have four cool 679 24-game hard you have four cool 679 24-game hard you have four cards each containing a number from one to nine you need to judge whether they could operate for multiplication division addition subtraction parentheses to get the value of 24 okay I mean there are a couple of e... | 24 Game | 24-game | You are given an integer array `cards` of length `4`. You have four cards, each containing a number in the range `[1, 9]`. You should arrange the numbers on these cards in a mathematical expression using the operators `['+', '-', '*', '/']` and the parentheses `'('` and `')'` to get the value 24.
You are restricted wi... | null | Array,Math,Backtracking | Hard | null |
1,604 | hey everybody this is larry this is me going over q2 of today's bi-weekly contest 36. of today's bi-weekly contest 36. of today's bi-weekly contest 36. this is a long problem alert using the same card or same uh alert using same keycard three or more times in a one hour period uh hit the like button hit the subscribe b... | 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 |
1,971 | Some uncle has given us basically graph is given in the form of age means we will be given two notes in between them in the further form we will be given graph okay and we will be given source note and destination will be okay so I have found out we Have to find out if any variety is possible between source node and de... | Find if Path Exists in Graph | incremental-memory-leak | There is a **bi-directional** graph with `n` vertices, where each vertex is labeled from `0` to `n - 1` (**inclusive**). The edges in the graph are represented as a 2D integer array `edges`, where each `edges[i] = [ui, vi]` denotes a bi-directional edge between vertex `ui` and vertex `vi`. Every vertex pair is connecte... | What is the upper bound for the number of seconds? Simulate the process of allocating memory. | Simulation | Medium | null |
415 | hey guys how's everything going this is jaysir who is not good algorithms today let's take a look at number four and five add strings we're given two non-negative integers we're given two non-negative integers we're given two non-negative integers number one and num2 you need to return some of them okay both are ready ... | Add Strings | add-strings | Given two non-negative integers, `num1` and `num2` represented as string, return _the sum of_ `num1` _and_ `num2` _as a string_.
You must solve the problem without using any built-in library for handling large integers (such as `BigInteger`). You must also not convert the inputs to integers directly.
**Example 1:**
... | null | Math,String,Simulation | Easy | 2,43,1031 |
931 | hey guys welcome to a new video in today's video we're going to look at lead code problem and the problem's name is minimum falling path sum so in this question we given an N into n array of integers called Matrix and we have to return the minimum sum of a falling path through the Matrix so by definition a falling path... | Minimum Falling Path Sum | maximum-frequency-stack | Given an `n x n` array of integers `matrix`, return _the **minimum sum** of any **falling path** through_ `matrix`.
A **falling path** starts at any element in the first row and chooses the element in the next row that is either directly below or diagonally left/right. Specifically, the next element from position `(ro... | null | Hash Table,Stack,Design,Ordered Set | Hard | null |
677 | in this video we're going to take a look at a legal problem called map some pairs so we're implementing the map sum class and we have three methods so the first one is going to initialize our data structure right we initialize the maps sum object and then we have another method which basically takes the key as well as ... | Map Sum Pairs | map-sum-pairs | Design a map that allows you to do the following:
* Maps a string key to a given value.
* Returns the sum of the values that have a key with a prefix equal to a given string.
Implement the `MapSum` class:
* `MapSum()` Initializes the `MapSum` object.
* `void insert(String key, int val)` Inserts the `key-val`... | null | Hash Table,String,Design,Trie | Medium | 1333 |
1,423 | what's up everyone today we're gonna go over Lee code 14:23 maximize points from over Lee code 14:23 maximize points from over Lee code 14:23 maximize points from cards so this is how I'm going to outline the video first I'm gonna go over what the question is asking then I will talk about a dynamic programming or memor... | Maximum Points You Can Obtain from Cards | maximum-number-of-occurrences-of-a-substring | There are several cards **arranged in a row**, and each card has an associated number of points. The points are given in the integer array `cardPoints`.
In one step, you can take one card from the beginning or from the end of the row. You have to take exactly `k` cards.
Your score is the sum of the points of the card... | Check out the constraints, (maxSize <=26). This means you can explore all substrings in O(n * 26). Find the Maximum Number of Occurrences of a Substring with bruteforce. | Hash Table,String,Sliding Window | Medium | null |
462 | hey everybody this is larry this is day 19th of the may leeco daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's farm minimum moves to equal array elements too so i usually stop this live so it's a little bit slow um you know feel free to fast forwar... | Minimum Moves to Equal Array Elements II | minimum-moves-to-equal-array-elements-ii | Given an integer array `nums` of size `n`, return _the minimum number of moves required to make all array elements equal_.
In one move, you can increment or decrement an element of the array by `1`.
Test cases are designed so that the answer will fit in a **32-bit** integer.
**Example 1:**
**Input:** nums = \[1,2,3... | null | Array,Math,Sorting | Medium | 296,453,2160,2290 |
667 | Hello everyone welcome to our channel tweet sunny and today and topic and two questions cancel beautiful arrangement second index number 66 and problems of medium type of write ok so let's discuss problem noida the best solution of this problem given to these tears and that they need To Construct List Which Contains An... | 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 |
235 | Early marriage I subscribed Mirzapur Road welcome notice channel today but this problem is lowest in the interest of binary search tree this very easy problem statements of taps this channel subscribe lowest in the state governments in binary search tree not to laugh and also means to define between two Notes PM Nod in... | Lowest Common Ancestor of a Binary Search Tree | lowest-common-ancestor-of-a-binary-search-tree | Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST.
According to the [definition of LCA on Wikipedia](https://en.wikipedia.org/wiki/Lowest_common_ancestor): "The lowest common ancestor is defined between two nodes `p` and `q` as the lowest node in `T` that has bo... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | 236,1190,1780,1790,1816 |
316 | Every rule in Twitter Majnu's situation ok sorry for this point of contemplation more subscribe that through this network and platform subscribe for 30 minutes must subscribe joint committee forum Lucknow can exposed poison they will learn fluid to please prescription channel to subscribe this Video plz subscribe Chann... | 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 |
932 | hey everybody this is larry this is day 28 of the lego july daily challenge hit the like button to subscribe and join me on discord let me know what you think about chase bomb the beautiful array uh i usually stop this live so if it's a little bit slow let me know or just fast forward watch on 2x whatever you need to d... | Beautiful Array | monotonic-array | An array `nums` of length `n` is **beautiful** if:
* `nums` is a permutation of the integers in the range `[1, n]`.
* For every `0 <= i < j < n`, there is no index `k` with `i < k < j` where `2 * nums[k] == nums[i] + nums[j]`.
Given the integer `n`, return _any **beautiful** array_ `nums` _of length_ `n`. There w... | null | Array | Easy | 2316 |
1,450 | okay let's go for number fourteen fifteen number of students doing homework at a given time given two integer arrays so we had two arrays there are integers start time so this is 1 this is 2 n time and given an integer curry time so when I give in Korea time which is just a number but I students started doing their hom... | Number of Students Doing Homework at a Given Time | delete-leaves-with-a-given-value | Given two integer arrays `startTime` and `endTime` and given an integer `queryTime`.
The `ith` student started doing their homework at the time `startTime[i]` and finished it at time `endTime[i]`.
Return _the number of students_ doing their homework at time `queryTime`. More formally, return the number of students wh... | Use the DFS to reconstruct the tree such that no leaf node is equal to the target. If the leaf node is equal to the target, return an empty object instead. | Tree,Depth-First Search,Binary Tree | Medium | null |
92 | hello everyone welcome to the lead code simplified and today we will simplify the problem number 92 that is uh reverse linked list 2 of lead code so read the question given the head of a single english and 2 integers left and right were left less than equals to right and reverse the nodes of the list from position left... | 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 |
343 | Do That I Don't Know English Video Latest Straight Internet Problem Gift Super Status For Deposit Soe Hain So In Danger Me Problem Solve This Problem To Give And When So Let's Mi In Teachers Paaye And Interest And Asked For Anything But Explanation Time When Know What Do You Brings Into Your Mode 500 Examples Of A Grea... | Integer Break | integer-break | Given an integer `n`, break it into the sum of `k` **positive integers**, where `k >= 2`, and maximize the product of those integers.
Return _the maximum product you can get_.
**Example 1:**
**Input:** n = 2
**Output:** 1
**Explanation:** 2 = 1 + 1, 1 \* 1 = 1.
**Example 2:**
**Input:** n = 10
**Output:** 36
**Exp... | There is a simple O(n) solution to this problem. You may check the breaking results of n ranging from 7 to 10 to discover the regularities. | Math,Dynamic Programming | Medium | 1936 |
1,688 | hi everyone welcome back to a new video today's lead code daily challenges count of matches in a tournament this is an easy level question in this question we have been given an integer n and what we have to do is we need to return the total number of teams that can be formed in a tournament by using some rules okay so... | Count of Matches in Tournament | the-most-recent-orders-for-each-product | You are given an integer `n`, the number of teams in a tournament that has strange rules:
* If the current number of teams is **even**, each team gets paired with another team. A total of `n / 2` matches are played, and `n / 2` teams advance to the next round.
* If the current number of teams is **odd**, one team ... | null | Database | Medium | 1671,1735 |
365 | reference to the less of water in a jag problem so this problem is that we are given two jacks and they have its corresponding capacity and we have three of operations one is fill any of the jacks with water and then the second one is empty any of the jugs the third one is we pull we pour water from one jack into anoth... | Water and Jug Problem | water-and-jug-problem | You are given two jugs with capacities `jug1Capacity` and `jug2Capacity` liters. There is an infinite amount of water supply available. Determine whether it is possible to measure exactly `targetCapacity` liters using these two jugs.
If `targetCapacity` liters of water are measurable, you must have `targetCapacity` li... | null | Math,Depth-First Search,Breadth-First Search | Medium | null |
849 | in this problem we have a number of chairs and some of them are occupied some of them are not occupied for example in this problem you can see we have seven chairs and there is a person sitting on this one so we will denote it by 1 this is empty so it's 0 denotes empty 1 denotes someone is sitting 4 is occupied so it's... | Maximize Distance to Closest Person | maximize-distance-to-closest-person | You are given an array representing a row of `seats` where `seats[i] = 1` represents a person sitting in the `ith` seat, and `seats[i] = 0` represents that the `ith` seat is empty **(0-indexed)**.
There is at least one empty seat, and at least one person sitting.
Alex wants to sit in the seat such that the distance b... | null | null | Medium | null |
148 | Hello friends, in today's video we will see that if we are given a single gender list then how can we sort it efficiently like here we are given a link list 31 5462 if we want to get its sorted version i.e. 5462 if we want to get its sorted version i.e. 5462 if we want to get its sorted version i.e. 1 2 3 45 6 If we ha... | Sort List | sort-list | Given the `head` of a linked list, return _the list after sorting it in **ascending order**_.
**Example 1:**
**Input:** head = \[4,2,1,3\]
**Output:** \[1,2,3,4\]
**Example 2:**
**Input:** head = \[-1,5,3,4,0\]
**Output:** \[-1,0,3,4,5\]
**Example 3:**
**Input:** head = \[\]
**Output:** \[\]
**Constraints:**
* ... | null | Linked List,Two Pointers,Divide and Conquer,Sorting,Merge Sort | Medium | 21,75,147,1992 |
202 | So hello guys, how are you all, so today the problem we are going to discuss is the 202 number problem of lead code, so what will happen in this problem is that we will not be given an n number and tell us whether that number is the happy number. Whether a number is happy or not, a number will be a happy number when th... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.