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 |
|---|---|---|---|---|---|---|---|---|
338 | That Welcome To This Trick We Are So Excited To Print To You This List To Problem Set To Spider Title Counting Pisces Then It's One Of Two Problems That You Should Learn To Solve A Specific If You're Already Passed The Winner's Pest Problem Feel Pressure On Six List Check Out What Problem Hai Store Se You Are Ashwin En... | Counting Bits | counting-bits | Given an integer `n`, return _an array_ `ans` _of length_ `n + 1` _such that for each_ `i` (`0 <= i <= n`)_,_ `ans[i]` _is the **number of**_ `1`_**'s** in the binary representation of_ `i`.
**Example 1:**
**Input:** n = 2
**Output:** \[0,1,1\]
**Explanation:**
0 --> 0
1 --> 1
2 --> 10
**Example 2:**
**Input:** n =... | You should make use of what you have produced already. Divide the numbers in ranges like [2-3], [4-7], [8-15] and so on. And try to generate new range from previous. Or does the odd/even status of the number help you in calculating the number of 1s? | Dynamic Programming,Bit Manipulation | Easy | 191 |
1,696 | hey hi everyone my name is problem uh the problem is jump game six and the core problem number is uh 1696 and it is k it came as uh liquid medium so the problem is there is a list of integer has been given and also a given integer uh so the single integer is basically if i start point out as a index zero and we can go ... | Jump Game VI | strange-printer-ii | You are given a **0-indexed** integer array `nums` and an integer `k`.
You are initially standing at index `0`. In one move, you can jump at most `k` steps forward without going outside the boundaries of the array. That is, you can jump from index `i` to any index in the range `[i + 1, min(n - 1, i + k)]` **inclusive*... | Try thinking in reverse. Given the grid, how can you tell if a colour was painted last? | Array,Graph,Topological Sort,Matrix | Hard | 664 |
1,647 | hey everybody this is Larry this is day 12 of delete code daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's forum and I'm all if you see me checking this page at the beginning of the video it's because there's this button that you can click for 10 B... | Minimum Deletions to Make Character Frequencies Unique | can-convert-string-in-k-moves | A string `s` is called **good** if there are no two different characters in `s` that have the same **frequency**.
Given a string `s`, return _the **minimum** number of characters you need to delete to make_ `s` _**good**._
The **frequency** of a character in a string is the number of times it appears in the string. F... | Observe that shifting a letter x times has the same effect of shifting the letter x + 26 times. You need to check whether k is large enough to cover all shifts with the same remainder after modulo 26. | Hash Table,String | Medium | null |
243 | welcome back everyone we're gonna be solving Lee code 243 shortest word distance so we're given an array of strings called words dict and we need to find the shortest distance between word one and word two so the example they give us is word stick is equal to this array and we are looking for coding in practice is at t... | Shortest Word Distance | shortest-word-distance | Given an array of strings `wordsDict` and two different strings that already exist in the array `word1` and `word2`, return _the shortest distance between these two words in the list_.
**Example 1:**
**Input:** wordsDict = \[ "practice ", "makes ", "perfect ", "coding ", "makes "\], word1 = "coding ", word2 = "... | null | Array,String | Easy | 244,245,2320 |
139 | hello welcome back to my channel again today we have leeco 139 word break so this question is really popular and you see a lot like often asked by facebook amazon and more let's take a look at this question so given a string s and a dictionary of string word dicks return true if s can be segmented into a space separate... | Word Break | word-break | Given a string `s` and a dictionary of strings `wordDict`, return `true` if `s` can be segmented into a space-separated sequence of one or more dictionary words.
**Note** that the same word in the dictionary may be reused multiple times in the segmentation.
**Example 1:**
**Input:** s = "leetcode ", wordDict = \[ "... | null | Hash Table,String,Dynamic Programming,Trie,Memoization | Medium | 140 |
235 | Hello friends today I'm going to solve liquid problem number 235 lowest common ancestor of a binary search tree so we know a binary search tree and it um any value to the left is less than the root node and any value to the right is greater than the root node right now we know that thing and now what is an ancestor so ... | 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 |
1,177 | hello everyone so in this video let us talk about Wonder problem from lead code the problem name is can make palindrome from substring so the problem statement goes like this that you're given a string s and an array queries where query of I is has is having three variables left eye right I and K of I what all are thes... | Can Make Palindrome from Substring | tree-diameter | You are given a string `s` and array `queries` where `queries[i] = [lefti, righti, ki]`. We may rearrange the substring `s[lefti...righti]` for each query and then choose up to `ki` of them to replace with any lowercase English letter.
If the substring is possible to be a palindrome string after the operations above, ... | Start at any node A and traverse the tree to find the furthest node from it, let's call it B. Having found the furthest node B, traverse the tree from B to find the furthest node from it, lets call it C. The distance between B and C is the tree diameter. | Tree,Depth-First Search,Breadth-First Search | Medium | 1740 |
1,029 | hey what's up guys chung here again this time let's continue our elite cold journey here let's take a look at this problem 1029 to CD scheduling smarter as easy but to me I think it's like more like a upper end a fancy question because it's not that straightforward but let's anyway let's take a look basically you're gi... | Two City Scheduling | vertical-order-traversal-of-a-binary-tree | A company is planning to interview `2n` people. Given the array `costs` where `costs[i] = [aCosti, bCosti]`, the cost of flying the `ith` person to city `a` is `aCosti`, and the cost of flying the `ith` person to city `b` is `bCosti`.
Return _the minimum cost to fly every person to a city_ such that exactly `n` people... | null | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Hard | null |
863 | This is the code for coding on Samadhi sites and in this video, Amit solves the problem and enters it. So, let's see the problem in excel, is it big and you do n't have only one take, the distance will be life or the bank is the giver in it, that the bill is there. It is okay to fill and this note is cut or made, then ... | All Nodes Distance K in Binary Tree | sum-of-distances-in-tree | Given the `root` of a binary tree, the value of a target node `target`, and an integer `k`, return _an array of the values of all nodes that have a distance_ `k` _from the target node._
You can return the answer in **any order**.
**Example 1:**
**Input:** root = \[3,5,1,6,2,0,8,null,null,7,4\], target = 5, k = 2
**O... | null | Dynamic Programming,Tree,Depth-First Search,Graph | Hard | 1021,2175 |
1,760 | So today's problem is minimum limit of balls in bag, so basically what is that we have a bag in which there are balls of some type meaning something like this bag has eight balls in this bag, four balls are ok in this bag, what can we do? What can we do in one step? We can divide the number of balls by number of balls ... | Minimum Limit of Balls in a Bag | check-array-formation-through-concatenation | You are given an integer array `nums` where the `ith` bag contains `nums[i]` balls. You are also given an integer `maxOperations`.
You can perform the following operation at most `maxOperations` times:
* Take any bag of balls and divide it into two new bags with a **positive** number of balls.
* For example, ... | Note that the distinct part means that every position in the array belongs to only one piece Note that you can get the piece every position belongs to naively | Array,Hash Table | Easy | null |
949 | welcome to september's lego challenge yesterday's problem was largest time for given digits given an array of four digits returned the largest 24 hour time that can be made the smallest 24 hour time is zero and the largest is 23.59 so zero and the largest is 23.59 so zero and the largest is 23.59 so that's like army ti... | Largest Time for Given Digits | cat-and-mouse | Given an array `arr` of 4 digits, find the latest 24-hour time that can be made using each digit **exactly once**.
24-hour times are formatted as `"HH:MM "`, where `HH` is between `00` and `23`, and `MM` is between `00` and `59`. The earliest 24-hour time is `00:00`, and the latest is `23:59`.
Return _the latest 24-h... | null | Math,Dynamic Programming,Breadth-First Search,Graph,Memoization,Game Theory | Hard | 1727 |
229 | hello um recording the rest version of the majority element version two uh with that let's begin the question I already have the solution posted in Python so if you need an explanation please take a look at that but we're going to be doing the same thing here so essentially we need um we need to have we need to data st... | Majority Element II | majority-element-ii | Given an integer array of size `n`, find all elements that appear more than `⌊ n/3 ⌋` times.
**Example 1:**
**Input:** nums = \[3,2,3\]
**Output:** \[3\]
**Example 2:**
**Input:** nums = \[1\]
**Output:** \[1\]
**Example 3:**
**Input:** nums = \[1,2\]
**Output:** \[1,2\]
**Constraints:**
* `1 <= nums.length <... | How many majority elements could it possibly have?
Do you have a better hint? Suggest it! | Array,Hash Table,Sorting,Counting | Medium | 169,1102 |
725 | Er ki aur humko hai karna hai ks possible no part have size di by one and one ba more than one ok is let two some parts b in this it is saying that whatever number of parts in this there are any parts in this The difference of should not be more than one OK like two or two cannot be more than two The parts should be in... | Split Linked List in Parts | split-linked-list-in-parts | Given the `head` of a singly linked list and an integer `k`, split the linked list into `k` consecutive linked list parts.
The length of each part should be as equal as possible: no two parts should have a size differing by more than one. This may lead to some parts being null.
The parts should be in the order of occ... | If there are N nodes in the list, and k parts, then every part has N/k elements, except the first N%k parts have an extra one. | Linked List | Medium | 61,328 |
496 | hello everyone welcome back to another Elite code problem today we're going to be doing problem 496 next greater element one and this is an easy problem technically but we're going to focus on the optimal solution for this problem so that one won't be so easy that's more like a medium or maybe a little bit tougher and ... | Next Greater Element I | next-greater-element-i | The **next greater element** of some element `x` in an array is the **first greater** element that is **to the right** of `x` in the same array.
You are given two **distinct 0-indexed** integer arrays `nums1` and `nums2`, where `nums1` is a subset of `nums2`.
For each `0 <= i < nums1.length`, find the index `j` such ... | null | Array,Hash Table,Stack,Monotonic Stack | Easy | 503,556,739,2227 |
45 | welcome back and today we will be seeing the problem jump game two this is actually very similar to the previous problem we solved that is the jump game now let's first see what this problem says okay in this problem we will be starting at the zeroth position and we have to say what is the minimum number of steps that ... | Jump Game II | jump-game-ii | You are given a **0-indexed** array of integers `nums` of length `n`. You are initially positioned at `nums[0]`.
Each element `nums[i]` represents the maximum length of a forward jump from index `i`. In other words, if you are at `nums[i]`, you can jump to any `nums[i + j]` where:
* `0 <= j <= nums[i]` and
* `i +... | null | Array,Dynamic Programming,Greedy | Medium | 55,1428,2001 |
13 | great so welcome back and this is question 13 called roman to integer now for this question we're given a table here and just indicates you know the translation of a roman numeral to a typical number and so oh and so that's exactly what we're going to be doing with this question where we're given a string as our input ... | Roman to Integer | roman-to-integer | Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`.
**Symbol** **Value**
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, `2` is written as `II` in Roman numeral, just two ones added... | Problem is simpler to solve by working the string from back to front and using a map. | Hash Table,Math,String | Easy | 12 |
37 | okay guys let's start that let's start with the thirty-seventh problem at with the thirty-seventh problem at with the thirty-seventh problem at Lincoln Sudoku solver write a program to solve a Sudoku puzzle by filling the empty cell empty sella indicated by the character dot so let's start by checking if board is equal... | Sudoku Solver | sudoku-solver | Write a program to solve a Sudoku puzzle by filling the empty cells.
A sudoku solution must satisfy **all of the following rules**:
1. Each of the digits `1-9` must occur exactly once in each row.
2. Each of the digits `1-9` must occur exactly once in each column.
3. Each of the digits `1-9` must occur exactly onc... | null | Array,Backtracking,Matrix | Hard | 36,1022 |
19 | so I will be continuing with our playlist before that hey welcome back to the channel I hope you guys are doing extremely well so the problem that we will be solving today is removing the nth node from the end so what is the problem stating it is stating that it'll be given the head of the link list and it'll also be g... | Remove Nth Node From End of List | remove-nth-node-from-end-of-list | Given the `head` of a linked list, remove the `nth` node from the end of the list and return its head.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], n = 2
**Output:** \[1,2,3,5\]
**Example 2:**
**Input:** head = \[1\], n = 1
**Output:** \[\]
**Example 3:**
**Input:** head = \[1,2\], n = 1
**Output:** \[1\]
**C... | Maintain two pointers and update one with a delay of n steps. | Linked List,Two Pointers | Medium | 528,1618,2216 |
853 | hey what's up guys this is sean here so today let's take a look at this uh problem number 853 car fleet it's a media level problem so you're giving like n cards and these end cards are going to the same direction and on a one lane road the destination is a target the miles away and each car has a constant speed here ok... | Car Fleet | most-profit-assigning-work | There are `n` cars going to the same destination along a one-lane road. The destination is `target` miles away.
You are given two integer array `position` and `speed`, both of length `n`, where `position[i]` is the position of the `ith` car and `speed[i]` is the speed of the `ith` car (in miles per hour).
A car can n... | null | Array,Two Pointers,Binary Search,Greedy,Sorting | Medium | 2180 |
942 | hey what's going on guys it's ilya bella here i record your stuff on youtube chat description for all my information i do all legal problems uh make sure you subscribe to the channel give me a big thumbs up to support it and this is called the i string match given a string s that only contains i increase or d decrease ... | DI String Match | super-palindromes | A permutation `perm` of `n + 1` integers of all the integers in the range `[0, n]` can be represented as a string `s` of length `n` where:
* `s[i] == 'I'` if `perm[i] < perm[i + 1]`, and
* `s[i] == 'D'` if `perm[i] > perm[i + 1]`.
Given a string `s`, reconstruct the permutation `perm` and return it. If there are ... | null | Math,Enumeration | Hard | null |
56 | in this video we'll go over Le code question number 56 merge intervals given an array of intervals where the I element is another array that contains the starting and ending values of that interval we need to merge all overlapping intervals and return the new result for example let's say this is the intervals array if ... | Merge Intervals | merge-intervals | Given an array of `intervals` where `intervals[i] = [starti, endi]`, merge all overlapping intervals, and return _an array of the non-overlapping intervals that cover all the intervals in the input_.
**Example 1:**
**Input:** intervals = \[\[1,3\],\[2,6\],\[8,10\],\[15,18\]\]
**Output:** \[\[1,6\],\[8,10\],\[15,18\]\... | null | Array,Sorting | Medium | 57,252,253,495,616,715,761,768,1028,2297,2319 |
18 | Hello Guys Welcome Back To Decades In This Video Bhi See The Force Hum Problem Kuch Is Remedy Ko Number-18 So Latest Video Ko Number-18 So Latest Video Ko Number-18 So Latest Video Problem Statement In This Problem Thursday Ko Switch On In Tears And Thursday Ko Switch A B C D A B SUBSCRIBE NOW TO RECEIVE NEW UPDATES UN... | 4Sum | 4sum | Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that:
* `0 <= a, b, c, d < n`
* `a`, `b`, `c`, and `d` are **distinct**.
* `nums[a] + nums[b] + nums[c] + nums[d] == target`
You may return the answer in **any order**.
**Examp... | null | Array,Two Pointers,Sorting | Medium | 1,15,454,2122 |
1,769 | hello everyone welcome to another video now in this video we are going to look at another medium level question and this is going to be like really simple because uh you know you have come to a medium level question so uh you know most of the concepts from Easy level question now but uh one thing that we need to look u... | Minimum Number of Operations to Move All Balls to Each Box | get-maximum-in-generated-array | You have `n` boxes. You are given a binary string `boxes` of length `n`, where `boxes[i]` is `'0'` if the `ith` box is **empty**, and `'1'` if it contains **one** ball.
In one operation, you can move **one** ball from a box to an adjacent box. Box `i` is adjacent to box `j` if `abs(i - j) == 1`. Note that after doing ... | Try generating the array. Make sure not to fall in the base case of 0. | Array,Dynamic Programming,Simulation | Easy | null |
695 | solve legal questions 695 max area of a island and this is a median legal question so you're giving er and basically grid and island is a group of ones representing land so one is land connected four directionally horizontal and vertical so you can only go for example like this one here you can only go here left right ... | 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 |
240 | Hello friends welcome to my channel Cod destination so as we are continuing this challenge one code one day and we are taking the topic P resarch algorithm so we already discussed I think three variant of binary search in previous days so today uh topic we are choosing is the 2D array basically we will take the questio... | Search a 2D Matrix II | search-a-2d-matrix-ii | Write an efficient algorithm that searches for a value `target` in an `m x n` integer matrix `matrix`. This matrix has the following properties:
* Integers in each row are sorted in ascending from left to right.
* Integers in each column are sorted in ascending from top to bottom.
**Example 1:**
**Input:** matri... | null | Array,Binary Search,Divide and Conquer,Matrix | Medium | 74 |
374 | hi today we'll talk about another binary search question this question is very simple and interesting that says guess number higher or lower so it's a guess game so we are going to play a guess game and the game is as follows i will pick a number from 1 to n and you have to guess which number i picked so every time you... | Guess Number Higher or Lower | guess-number-higher-or-lower | We are playing the Guess Game. The game is as follows:
I pick a number from `1` to `n`. You have to guess which number I picked.
Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess.
You call a pre-defined API `int guess(int num)`, which returns three possible re... | null | Binary Search,Interactive | Easy | 278,375,658 |
143 | hey guys welcome back to another leak code problem solving tutorial and in this tutorial I'm going to be showing you guys how to solve leak code question 143 asking us to reorder this list in this specific order uh a link list and basically we start from the front go to the end go to here and we just sort of like spide... | Reorder List | reorder-list | You are given the head of a singly linked-list. The list can be represented as:
L0 -> L1 -> ... -> Ln - 1 -> Ln
_Reorder the list to be on the following form:_
L0 -> Ln -> L1 -> Ln - 1 -> L2 -> Ln - 2 -> ...
You may not modify the values in the list's nodes. Only nodes themselves may be changed.
**Example 1:**
**... | null | Linked List,Two Pointers,Stack,Recursion | Medium | 2216 |
703 | everyone welcome back and let's write some more neat code today so today let's solve the problem k the largest element in a stream and it's marked as an easy question but i definitely feel that it's more of a medium and maybe that's why many people disliked it but we are told to design a class to find the kth largest e... | Kth Largest Element in a Stream | kth-largest-element-in-a-stream | Design a class to find the `kth` largest element in a stream. Note that it is the `kth` largest element in the sorted order, not the `kth` distinct element.
Implement `KthLargest` class:
* `KthLargest(int k, int[] nums)` Initializes the object with the integer `k` and the stream of integers `nums`.
* `int add(int... | null | null | Easy | null |
721 | hey everybody this is larry this is day 29 of the november league daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about this problem let me help you do how you know if you had any issue of this one today's problem is 721 accounts merge okay we'll see what this ... | Accounts Merge | accounts-merge | Given a list of `accounts` where each element `accounts[i]` is a list of strings, where the first element `accounts[i][0]` is a name, and the rest of the elements are **emails** representing emails of the account.
Now, we would like to merge these accounts. Two accounts definitely belong to the same person if there is... | For every pair of emails in the same account, draw an edge between those emails. The problem is about enumerating the connected components of this graph. | Array,String,Depth-First Search,Breadth-First Search,Union Find | Medium | 684,734,737 |
646 | hello everyone so in this video let us talk about one more problem from lead code the problem name is maximum length of pair chain so you are given that you have an array of n pairs now the pair consists of left of i and knight of five so that is consisting of a pair and the left device is always less than the right of... | Maximum Length of Pair Chain | maximum-length-of-pair-chain | You are given an array of `n` pairs `pairs` where `pairs[i] = [lefti, righti]` and `lefti < righti`.
A pair `p2 = [c, d]` **follows** a pair `p1 = [a, b]` if `b < c`. A **chain** of pairs can be formed in this fashion.
Return _the length longest chain which can be formed_.
You do not need to use up all the given int... | null | Array,Dynamic Programming,Greedy,Sorting | Medium | 300,491 |
203 | Dream II car has a family If I knew I was here, I would wear this warranty and solve a wrong exercise. For more detailed information, please go to the book here. I don't like it. It's mine. Go to the first sentence. First, to understand how we operate, welcome everyone to D2 of NaNa Lacoste, our 30th leg has ID 203, na... | Remove Linked List Elements | remove-linked-list-elements | Given the `head` of a linked list and an integer `val`, remove all the nodes of the linked list that has `Node.val == val`, and return _the new head_.
**Example 1:**
**Input:** head = \[1,2,6,3,4,5,6\], val = 6
**Output:** \[1,2,3,4,5\]
**Example 2:**
**Input:** head = \[\], val = 1
**Output:** \[\]
**Example 3:**... | null | Linked List,Recursion | Easy | 27,237,2216 |
1,000 | so welcome to my brand new tutorial this is problem solving and data structure and algorithm tutorial so every day we'll solve two three or four problems and up to 1,000 or 500 problems okay uh and up to 1,000 or 500 problems okay uh and up to 1,000 or 500 problems okay uh you I will cover I'm going to cover 500 to 1,0... | Minimum Cost to Merge Stones | delete-columns-to-make-sorted-iii | There are `n` piles of `stones` arranged in a row. The `ith` pile has `stones[i]` stones.
A move consists of merging exactly `k` **consecutive** piles into one pile, and the cost of this move is equal to the total number of stones in these `k` piles.
Return _the minimum cost to merge all piles of stones into one pile... | null | Array,String,Dynamic Programming | Hard | null |
6 | this is the code number six zigzag conversion so you have a string that is your input and this string you have to visualize it as this zigzag pattern so based on the input of rows that you're given so for your first input we are given a number of rows of three so that's why it's p a y and it hits three and then it's go... | 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,255 | hi this is Lee killed 12:55 and this is hi this is Lee killed 12:55 and this is hi this is Lee killed 12:55 and this is a resource allocation problem so we have our resource letters here and we want to form words with the maximum value so we can form in this case we can form both the words data and good and the words d... | Maximum Score Words Formed by Letters | reverse-subarray-to-maximize-array-value | Given a list of `words`, list of single `letters` (might be repeating) and `score` of every character.
Return the maximum score of **any** valid set of words formed by using the given letters (`words[i]` cannot be used two or more times).
It is not necessary to use all characters in `letters` and each letter can only... | What's the score after reversing a sub-array [L, R] ? It's the score without reversing it + abs(a[R] - a[L-1]) + abs(a[L] - a[R+1]) - abs(a[L] - a[L-1]) - abs(a[R] - a[R+1]) How to maximize that formula given that abs(x - y) = max(x - y, y - x) ? This can be written as max(max(a[R] - a[L - 1], a[L - 1] - a[R]) + max(a[... | Array,Math,Greedy | Hard | null |
329 | today we're gonna be working on lead code question number 329 longest increasing path in a matrix uh given i'm given an m cross n metric integers matrix return the length of the longest increasing path in matrix for each cell you can either move in four directions left right up or down you may not move diagonally or mo... | Longest Increasing Path in a Matrix | longest-increasing-path-in-a-matrix | Given an `m x n` integers `matrix`, return _the length of the longest increasing path in_ `matrix`.
From each cell, you can either move in four directions: left, right, up, or down. You **may not** move **diagonally** or move **outside the boundary** (i.e., wrap-around is not allowed).
**Example 1:**
**Input:** matr... | null | Dynamic Programming,Depth-First Search,Breadth-First Search,Graph,Topological Sort,Memoization | Hard | null |
1,716 | chi I hope that you guys are doing good now as you are scared of maths me too now it's just a simple pattern recognition and applying a bit of math that's it in all the problems which involves math if a problems involve math just find the pattern just find a simple formula I'm not saying a very hard PNC can go a bit ha... | Calculate Money in Leetcode Bank | maximum-non-negative-product-in-a-matrix | Hercy wants to save money for his first car. He puts money in the Leetcode bank **every day**.
He starts by putting in `$1` on Monday, the first day. Every day from Tuesday to Sunday, he will put in `$1` more than the day before. On every subsequent Monday, he will put in `$1` more than the **previous Monday**.
Given... | Use Dynamic programming. Keep the highest value and lowest value you can achieve up to a point. | Array,Dynamic Programming,Matrix | Medium | null |
217 | Hello everyone, Evgeniy Sulima nov is with you and today we will look at the snail problem 217 searching for a repeated value in an array and how this task was sent to us, we are given an array of integers and we must determine whether there are duplicates in this array, while we don’t care how many while we don’t care... | Contains Duplicate | contains-duplicate | Given an integer array `nums`, return `true` if any value appears **at least twice** in the array, and return `false` if every element is distinct.
**Example 1:**
**Input:** nums = \[1,2,3,1\]
**Output:** true
**Example 2:**
**Input:** nums = \[1,2,3,4\]
**Output:** false
**Example 3:**
**Input:** nums = \[1,1,1,... | null | Array,Hash Table,Sorting | Easy | 219,220 |
155 | hello everyone so today we will be solving lead good problem 155 that is minimum stack so we have to design a stack that supports push pop top and retrieving the minimum element in constant time so we have to initialize the stack object then we have got push where we will push the element Val onto our stack then we hav... | Min Stack | min-stack | Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
Implement the `MinStack` class:
* `MinStack()` initializes the stack object.
* `void push(int val)` pushes the element `val` onto the stack.
* `void pop()` removes the element on the top of the stack.
* `int top(... | Consider each node in the stack having a minimum value. (Credits to @aakarshmadhavan) | Stack,Design | Easy | 239,716 |
948 | hey guys welcome back to another video and today we're going to be solving the lead code question bag of tokens all right so in this question we have an initial power of p an initial score of zero and a bag of tokens where tokens i is the value of the ith token and a we index are starting at zero so your goal is to max... | Bag of Tokens | sort-an-array | You have an initial **power** of `power`, an initial **score** of `0`, and a bag of `tokens` where `tokens[i]` is the value of the `ith` token (0-indexed).
Your goal is to maximize your total **score** by potentially playing each token in one of two ways:
* If your current **power** is at least `tokens[i]`, you may... | null | Array,Divide and Conquer,Sorting,Heap (Priority Queue),Merge Sort,Bucket Sort,Radix Sort,Counting Sort | Medium | null |
739 | everyone welcome back to everything swift today we'll be tackling legal question 739 titled daily temperatures we're given an array of integers that represents uh daily temperatures and we're supposed to find how long does it take until the next day that it's hotter right so i think this example is pretty good to under... | 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 |
480 | hello and welcome back to the cracking Fang YouTube channel today we're solving lead code problem 480 sliding window median the median is the middle value in an ordered integer list if the size is even there is no middle value then the median is just the middle the mean of the two middle values for example array 2 3 4 ... | Sliding Window Median | sliding-window-median | The **median** is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle values.
* For examples, if `arr = [2,3,4]`, the median is `3`.
* For examples, if `arr = [1,2,3,4]`, the median is `(2 + 3) / 2 = 2.5`.
You are give... | The simplest of solutions comes from the basic idea of finding the median given a set of numbers. We know that by definition, a median is the center element (or an average of the two center elements). Given an unsorted list of numbers, how do we find the median element? If you know the answer to this question, can we e... | Array,Hash Table,Sliding Window,Heap (Priority Queue) | Hard | 295 |
1,879 | hey everybody this is larry this is me going with q4 of the bi-weekly me going with q4 of the bi-weekly me going with q4 of the bi-weekly uh contest 53 um minimum xo sum of two arrays so this one i thought it was tricky when i first look at it but the key thing is noting that n is only up to 14. um so then this becomes... | Minimum XOR Sum of Two Arrays | maximum-score-from-removing-stones | You are given two integer arrays `nums1` and `nums2` of length `n`.
The **XOR sum** of the two integer arrays is `(nums1[0] XOR nums2[0]) + (nums1[1] XOR nums2[1]) + ... + (nums1[n - 1] XOR nums2[n - 1])` (**0-indexed**).
* For example, the **XOR sum** of `[1,2,3]` and `[3,2,1]` is equal to `(1 XOR 3) + (2 XOR 2) +... | It's optimal to always remove one stone from the biggest 2 piles Note that the limits are small enough for simulation | Math,Greedy,Heap (Priority Queue) | Medium | null |
330 | Hello Everyone Welcome Page Ki Kundli Channel Problem Hai Its Title Is Packing And What It Contains Is Vivechana Sorted In Teacher Hey Number Panel In Teacher End And Fetch Elements Directions At Any Number Indore Range One Comment That This Is Just Tender For Individuals from some elements are in that it is telling th... | 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 |
199 | hey guys how's everything going this is Jay sir who is not good algorithms I'm recording this video to prepare my interview in this video I'm going to take a look at one and I binary tree right side view wow we're given a binary tree imagine myself standing on the right side of it so view the tree from right return the... | Binary Tree Right Side View | binary-tree-right-side-view | Given the `root` of a binary tree, imagine yourself standing on the **right side** of it, return _the values of the nodes you can see ordered from top to bottom_.
**Example 1:**
**Input:** root = \[1,2,3,null,5,null,4\]
**Output:** \[1,3,4\]
**Example 2:**
**Input:** root = \[1,null,3\]
**Output:** \[1,3\]
**Examp... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 116,545 |
155 | Are Hello Guys Welcome To Disrespect Interesting Problem Encoding Series Game Means Tech Web Designer Stepmother Spooch Push Pop Top In Relieving Minimum Element Inconsistent Time Malnutrition School Push Element On To The Stock Pushp Options One To Remove The Element On Of The Best Top Functions Me To The Top Elements... | Min Stack | min-stack | Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
Implement the `MinStack` class:
* `MinStack()` initializes the stack object.
* `void push(int val)` pushes the element `val` onto the stack.
* `void pop()` removes the element on the top of the stack.
* `int top(... | Consider each node in the stack having a minimum value. (Credits to @aakarshmadhavan) | Stack,Design | Easy | 239,716 |
1,732 | hello everyone welcome back here's van damson and in today's video we will tackle an interesting problem about finding the highest altitude so we are given an RI that represents the net gain in altitude between two uh points and our job is to find the maximum altitude the biker can reach so let's start our coding in Ja... | 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 |
746 | hi everyone welcome back to lead coding i am your host faraz so first of all congratulations to everyone those who have made this far into the playlist now we are actually solving questions on dynamic programming which is one of the favorite questions of interviewers so let us start solving a few questions so that we h... | Min Cost Climbing Stairs | prefix-and-suffix-search | You are given an integer array `cost` where `cost[i]` is the cost of `ith` step on a staircase. Once you pay the cost, you can either climb one or two steps.
You can either start from the step with index `0`, or the step with index `1`.
Return _the minimum cost to reach the top of the floor_.
**Example 1:**
**Input... | For a word like "test", consider "#test", "t#test", "st#test", "est#test", "test#test". Then if we have a query like prefix = "te", suffix = "t", we can find it by searching for something we've inserted starting with "t#te". | String,Design,Trie | Hard | 211 |
39 | Had happened and communication university point in android studio talking combination about time cricket batting problem if we have not subscribed it today then please like it, you can also comment, apart from this join the telegram channel. Now let's clean these media, see what you like in this, do n't forget to subsc... | Combination Sum | combination-sum | Given an array of **distinct** integers `candidates` and a target integer `target`, return _a list of all **unique combinations** of_ `candidates` _where the chosen numbers sum to_ `target`_._ You may return the combinations in **any order**.
The **same** number may be chosen from `candidates` an **unlimited number of... | null | Array,Backtracking | Medium | 17,40,77,216,254,377 |
743 | hey everyone welcome back and let's write some more neat code today so today let's solve network delay time the reason i'm solving this problem is because it's a rare problem that you actually have to use ajixtra's however you pronounce that name this algorithm it's the shortest path algorithm it's not super common on ... | Network Delay Time | closest-leaf-in-a-binary-tree | You are given a network of `n` nodes, labeled from `1` to `n`. You are also given `times`, a list of travel times as directed edges `times[i] = (ui, vi, wi)`, where `ui` is the source node, `vi` is the target node, and `wi` is the time it takes for a signal to travel from source to target.
We will send a signal from a... | Convert the tree to a general graph, and do a breadth-first search. Alternatively, find the closest leaf for every node on the path from root to target. | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
30 | um hello so today we are going to do this problem called substring with concatenation of all words um so the problem says is that we have a string and an array of words that are the same length so this is important same length here and we want to return all starting indices of s in s basically such that um those substr... | Substring with Concatenation of All Words | substring-with-concatenation-of-all-words | You are given a string `s` and an array of strings `words`. All the strings of `words` are of **the same length**.
A **concatenated substring** in `s` is a substring that contains all the strings of any permutation of `words` concatenated.
* For example, if `words = [ "ab ", "cd ", "ef "]`, then `"abcdef "`, `"abef... | null | Hash Table,String,Sliding Window | Hard | 76 |
138 | foreign problem of deep copy of a linked list which has two pointers welcome to my video let us begin we are given a linked list which has two pointers in addition to the next pointer we have an extra pointer named the random pointer we are to make a deep copy of the list it means that all the nodes will be copied into... | 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 |
72 | um hello guys so we're back in the game right um obviously as you know I started um a new job in Sydney and um it's super cool the company you know has got me in a brand new like MacBooks and this and that which I reckon is you know it's pretty dope you know brand new Mac I do like these and um I am pretty thankful rig... | Edit Distance | edit-distance | Given two strings `word1` and `word2`, return _the minimum number of operations required to convert `word1` to `word2`_.
You have the following three operations permitted on a word:
* Insert a character
* Delete a character
* Replace a character
**Example 1:**
**Input:** word1 = "horse ", word2 = "ros "
**O... | null | String,Dynamic Programming | Hard | 161,583,712,1105,2311 |
444 | hello welcome today I try to solve another L problem 444 sequence Rec construction so we are giving a array of sequences so inside of the sequence it's just a subarray so for example for this one inside the sequences there's a sub this one too yeah it means if you were to take cost two you must finish c one first so le... | Sequence Reconstruction | sequence-reconstruction | You are given an integer array `nums` of length `n` where `nums` is a permutation of the integers in the range `[1, n]`. You are also given a 2D integer array `sequences` where `sequences[i]` is a subsequence of `nums`.
Check if `nums` is the shortest possible and the only **supersequence**. The shortest **supersequen... | null | Array,Graph,Topological Sort | Medium | 210 |
1,704 | hey guys welcome back to Hustler's algorithm today we are gonna be solving this daily record challenge so determine if string halves are alike you are given a string s of event length split the string into two vowels of equal length ability with the first half and B with the second half two strings are like if they hav... | Determine if String Halves Are Alike | special-positions-in-a-binary-matrix | You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half.
Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppe... | Keep track of 1s in each row and in each column. Then while iterating over matrix, if the current position is 1 and current row as well as current column contains exactly one occurrence of 1. | Array,Matrix | Easy | null |
75 | hey what's up guys I'm Nick white that is my name you might be able to see that in my channel name or whatever but I am doing the although a coding hacker ranked problems please subscribe check the description for my information I do the premium problems on my patreon and I got a discord this problem is called sort col... | Sort Colors | sort-colors | Given an array `nums` with `n` objects colored red, white, or blue, sort them **[in-place](https://en.wikipedia.org/wiki/In-place_algorithm)** so that objects of the same color are adjacent, with the colors in the order red, white, and blue.
We will use the integers `0`, `1`, and `2` to represent the color red, white,... | A rather straight forward solution is a two-pass algorithm using counting sort. Iterate the array counting number of 0's, 1's, and 2's. Overwrite array with the total number of 0's, then 1's and followed by 2's. | Array,Two Pointers,Sorting | Medium | 148,280,324 |
1,614 | hey everybody this is larry this is me going over the weekly contest two tens uh q1 maximum nesting depth of parentheses uh so i think this is just um a normal parenthesis problem uh with stack usually implemented and you have all these things but it really just saying that what is the level within which is the max ste... | Maximum Nesting Depth of the Parentheses | maximum-nesting-depth-of-the-parentheses | A string is a **valid parentheses string** (denoted **VPS**) if it meets one of the following:
* It is an empty string `" "`, or a single character not equal to `"( "` or `") "`,
* It can be written as `AB` (`A` concatenated with `B`), where `A` and `B` are **VPS**'s, or
* It can be written as `(A)`, where `A` i... | null | null | Easy | null |
1,930 | Saurabh Essay Welcome to this video NH10 Video Will Explain The Problem Undhiyu Subscribe Medium Size Question Solve This Problem Clearly And Will Be For Developing Approach And Subscribe Media To Solve This Problem Is Going To Be Used With Which You Will Find The Number Of Subscribe The Left Side Right Side Subscribe ... | Unique Length-3 Palindromic Subsequences | maximum-number-of-consecutive-values-you-can-make | Given a string `s`, return _the number of **unique palindromes of length three** that are a **subsequence** of_ `s`.
Note that even if there are multiple ways to obtain the same subsequence, it is still only counted **once**.
A **palindrome** is a string that reads the same forwards and backwards.
A **subsequence** ... | If you can make the first x values and you have a value v, then you can make all the values ≤ v + x Sort the array of coins. You can always make the value 0 so you can start with x = 0. Process the values starting from the smallest and stop when there is a value that cannot be achieved with the current x. | Array,Greedy | Medium | 330 |
205 | hello everyone and welcome back to another leeco video so today we're going to be solving the lead code question isomorphic strings so in this question we're going to be given two strings s and t and we need to determine whether or not they are isomorphic so two strings s and t are considered to be isomorphic if all th... | Isomorphic Strings | isomorphic-strings | Given two strings `s` and `t`, _determine if they are isomorphic_.
Two strings `s` and `t` are isomorphic if the characters in `s` can be replaced to get `t`.
All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same characte... | null | Hash Table,String | Easy | 290 |
879 | hello guys welcome to deep codes and in today's video we will discuss little question 879 that says profitable scheme so guys this question is a bit difficult to understand at a far side but we will take multiple examples and multiple test cases uh so that you guys have clear understanding of what this question is tryi... | Profitable Schemes | maximize-distance-to-closest-person | There is a group of `n` members, and a list of various crimes they could commit. The `ith` crime generates a `profit[i]` and requires `group[i]` members to participate in it. If a member participates in one crime, that member can't participate in another crime.
Let's call a **profitable scheme** any subset of these cr... | null | Array | Medium | 885 |
33 | can't i just undo the rotation and search in a normal way well you can but then you will lose out a lot of time just trying to undo the rotations we will try to solve this problem using a modified version of the binary forge in the rotated array itself hello friends welcome back to study algorithms a place where i simp... | 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 |
523 | okay so lead to lead code practice time continuous separation so two goals in this video the first one is to find a solution for this specific question do some coding work and the other thing is to go over the interview process given the specific example so let's take a look at the question itself so given a list of th... | Continuous Subarray Sum | continuous-subarray-sum | Given an integer array nums and an integer k, return `true` _if_ `nums` _has a **good subarray** or_ `false` _otherwise_.
A **good subarray** is a subarray where:
* its length is **at least two**, and
* the sum of the elements of the subarray is a multiple of `k`.
**Note** that:
* A **subarray** is a contiguo... | null | Array,Hash Table,Math,Prefix Sum | Medium | 560,2119,2240 |
119 | hello and welcome to another video today we're going to be doing Pascal's triangle 2 which if you haven't done Pascal's triangle one it's basically the same thing except instead of getting one single cell we're getting a row now so given an integer row index return the row index row of the triangle and Pascal triangle ... | Pascal's Triangle II | pascals-triangle-ii | Given an integer `rowIndex`, return the `rowIndexth` (**0-indexed**) row of the **Pascal's triangle**.
In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown:
**Example 1:**
**Input:** rowIndex = 3
**Output:** \[1,3,3,1\]
**Example 2:**
**Input:** rowIndex = 0
**Output:** \[... | null | Array,Dynamic Programming | Easy | 118,2324 |
980 | A Firewall Welcome To Bank Ko DP Tubelight England T20 Beats Abe Saale Tere Ko Subscribe Video Under Subscribe Exactly One Off Kar Do Hai Zero Representatives But They Can Bhava Ko And - Preparation Of Psychotherapy That Note And - Preparation Of Psychotherapy That Note And - Preparation Of Psychotherapy That Note Book... | Unique Paths III | find-the-shortest-superstring | You are given an `m x n` integer array `grid` where `grid[i][j]` could be:
* `1` representing the starting square. There is exactly one starting square.
* `2` representing the ending square. There is exactly one ending square.
* `0` representing empty squares we can walk over.
* `-1` representing obstacles tha... | null | Array,String,Dynamic Programming,Bit Manipulation,Bitmask | Hard | null |
106 | hey so welcome back and this is another daily leeco problem so today the problem was called construct binary tree from in order in post-order traversal so let's order in post-order traversal so let's order in post-order traversal so let's go ahead and take a look so the theme of the week has been all tree problems this... | Construct Binary Tree from Inorder and Postorder Traversal | construct-binary-tree-from-inorder-and-postorder-traversal | Given two integer arrays `inorder` and `postorder` where `inorder` is the inorder traversal of a binary tree and `postorder` is the postorder traversal of the same tree, construct and return _the binary tree_.
**Example 1:**
**Input:** inorder = \[9,3,15,20,7\], postorder = \[9,15,7,20,3\]
**Output:** \[3,9,20,null,n... | null | Array,Hash Table,Divide and Conquer,Tree,Binary Tree | Medium | 105 |
1 | uh hello everyone welcome back to my channel here is vanamsen and today we are going to Taco an interesting problem from lit code the Tucson problem it's rated as an easy problem but understanding the optimal solution might be quite challenging so let's dive into it the problem statement is as follow yeah I will mark 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 |
1,727 | Hello friends welcome to my channel here I solve L Cod problems and prepare to the Cod interview today's problem number is 1727 larger submatrix with rearrangements you are given a binary Matrix of size M by n and you are allowed to rearrange The Columns of the Matrix in any order return the area of the largest submatr... | Largest Submatrix With Rearrangements | cat-and-mouse-ii | You are given a binary matrix `matrix` of size `m x n`, and you are allowed to rearrange the **columns** of the `matrix` in any order.
Return _the area of the largest submatrix within_ `matrix` _where **every** element of the submatrix is_ `1` _after reordering the columns optimally._
**Example 1:**
**Input:** matri... | Try working backward: consider all trivial states you know to be winning or losing, and work backward to determine which other states can be labeled as winning or losing. | Math,Dynamic Programming,Breadth-First Search,Graph,Memoization,Game Theory | Hard | 805,949 |
139 | welcome back to Uncle jest today's question is leak code 139 word break so you're given a string s and a dictionary of strings return true if s can be segmented into a space separated sequence of one or more dictionary words note that the same word in the dictionary may be reused multiple times in the segmentation So w... | Word Break | word-break | Given a string `s` and a dictionary of strings `wordDict`, return `true` if `s` can be segmented into a space-separated sequence of one or more dictionary words.
**Note** that the same word in the dictionary may be reused multiple times in the segmentation.
**Example 1:**
**Input:** s = "leetcode ", wordDict = \[ "... | null | Hash Table,String,Dynamic Programming,Trie,Memoization | Medium | 140 |
7 | hello friends this is a good hacker here I'm going to show you how to solve difficult coding problem reverse integer the problem description is that we need to reverse digits of an engine for example if an input number is 123 we need to return 321 if the impure lumber ism - work one two three we need to ism - work one ... | Reverse Integer | reverse-integer | Given a signed 32-bit integer `x`, return `x` _with its digits reversed_. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-231, 231 - 1]`, then return `0`.
**Assume the environment does not allow you to store 64-bit integers (signed or unsigned).**
**Example 1:**
**Input:** x = 123
... | null | Math | Medium | 8,190,2238 |
266 | testing boys colleagues uh fellow monkey lie part-time gardeners uh fellow monkey lie part-time gardeners uh fellow monkey lie part-time gardeners and computer touchers this is 266 palindrome permutation doing this in typescript i feel like uh i mean it's javascript but uh with the type the static type checking and stu... | Palindrome Permutation | palindrome-permutation | Given a string `s`, return `true` _if a permutation of the string could form a_ _**palindrome**_ _and_ `false` _otherwise_.
**Example 1:**
**Input:** s = "code "
**Output:** false
**Example 2:**
**Input:** s = "aab "
**Output:** true
**Example 3:**
**Input:** s = "carerac "
**Output:** true
**Constraints:**
... | Consider the palindromes of odd vs even length. What difference do you notice? Count the frequency of each character. If each character occurs even number of times, then it must be a palindrome. How about character which occurs odd number of times? | Hash Table,String,Bit Manipulation | Easy | 5,242,267,409 |
322 | hello everyone welcome to day 21st of march street code challenge and i hope all of you are having a great time my name is santiago deja i'm working as technical architect sd4 at adobe and here i present day 694 of daily liquid problem the question that we have in today is coin change here in this question we are given... | Coin Change | coin-change | You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money.
Return _the fewest number of coins that you need to make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `-1`.
You may a... | null | Array,Dynamic Programming,Breadth-First Search | Medium | 1025,1393,2345 |
502 | hello guys welcome to deep codes and in today's video we will discuss split code question 502 IPO so this question is a pretty much complex to understand at first such but I will make sure that I will divide this question in small bits so that it's easy for you to understand so this is some story that you are given her... | IPO | ipo | Suppose LeetCode will start its **IPO** soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before the **IPO**. Since it has limited resources, it can only finish at most `k` distinct projects before the **IPO**. Help LeetCode design... | null | Array,Greedy,Sorting,Heap (Priority Queue) | Hard | null |
1,480 | Ajay Ko Hua Hai Hello Everyone Welcome to New Video in this video is absolutely traditional problem list code problem wave problem only problem running from 10 return running here we will be told after that we will call it running return Running has to be done right, running has to be enriched Meghnad, we are given som... | Running Sum of 1d Array | movie-rating | Given an array `nums`. We define a running sum of an array as `runningSum[i] = sum(nums[0]...nums[i])`.
Return the running sum of `nums`.
**Example 1:**
**Input:** nums = \[1,2,3,4\]
**Output:** \[1,3,6,10\]
**Explanation:** Running sum is obtained as follows: \[1, 1+2, 1+2+3, 1+2+3+4\].
**Example 2:**
**Input:** ... | null | Database | Medium | null |
307 | hi everyone it's Oren today we have a problem when we are given an array let's say that array of 4 7 8 and 10 and we need to implement two functions two methods one is update and another one is sum range for the update we are given an index and we are given a new value updated value for example let's say that for index... | Range Sum Query - Mutable | range-sum-query-mutable | Given an integer array `nums`, handle multiple queries of the following types:
1. **Update** the value of an element in `nums`.
2. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`.
Implement the `NumArray` class:
* `NumArray(int[] nums)` Initi... | null | Array,Design,Binary Indexed Tree,Segment Tree | Medium | 303,308 |
231 | hello hi guys good morning welcome back to a new video in this we're going to see problem power of to it has been asked by Amazon Bloom wobi Snapchat Apple Google General Motors Uber qualcom and GP Morgan so although it marked as an easy problem but it will teach you a very important skill which is actually used in you... | Power of Two | power-of-two | Given an integer `n`, return _`true` if it is a power of two. Otherwise, return `false`_.
An integer `n` is a power of two, if there exists an integer `x` such that `n == 2x`.
**Example 1:**
**Input:** n = 1
**Output:** true
**Explanation:** 20 = 1
**Example 2:**
**Input:** n = 16
**Output:** true
**Explanation:**... | null | Math,Bit Manipulation,Recursion | Easy | 191,326,342 |
378 | hey what's up guys this is john here so today uh let's take a look at this elite code problem here uh number 378 uh case kate's smallest element in a sorted matrix okay given like an n by n made 2d matrix uh which each row and columns are else they're all sorted in a standing order basically each row and the column the... | Kth Smallest Element in a Sorted Matrix | kth-smallest-element-in-a-sorted-matrix | Given an `n x n` `matrix` where each of the rows and columns is sorted in ascending order, return _the_ `kth` _smallest element in the matrix_.
Note that it is the `kth` smallest element **in the sorted order**, not the `kth` **distinct** element.
You must find a solution with a memory complexity better than `O(n2)`.... | null | Array,Binary Search,Sorting,Heap (Priority Queue),Matrix | Medium | 373,668,719,802 |
392 | hey and welcome today we will solve is subsequence interview question let's get into it here is the first example we have a source string as ABC and the Target string is this one now we need to start removing non-matching characters start removing non-matching characters start removing non-matching characters from Targ... | Is Subsequence | is-subsequence | Given two strings `s` and `t`, return `true` _if_ `s` _is a **subsequence** of_ `t`_, or_ `false` _otherwise_.
A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i... | null | Two Pointers,String,Dynamic Programming | Easy | 808,1051 |
258 | hey everyone nitish side so let's start with the question so the question is add digits okay so you are given an integer num so you have to repeatedly add all its digit until the result has only one digit and then after that you have to return it okay so let's see with an example so let's take an example as 38 so you n... | Add Digits | add-digits | Given an integer `num`, repeatedly add all its digits until the result has only one digit, and return it.
**Example 1:**
**Input:** num = 38
**Output:** 2
**Explanation:** The process is
38 --> 3 + 8 --> 11
11 --> 1 + 1 --> 2
Since 2 has only one digit, return it.
**Example 2:**
**Input:** num = 0
**Output:** 0
*... | A naive implementation of the above process is trivial. Could you come up with other methods? What are all the possible results? How do they occur, periodically or randomly? You may find this Wikipedia article useful. | Math,Simulation,Number Theory | Easy | 202,1082,2076,2264 |
62 | hey everyone in this video we are going to look at the unique path problem in lead code so what we are given is a MN to n grid and the question is there's a robot which is at the top left corner and there's a destination which is at the bottom right corner and we have to return all the possible unique paths through whi... | Unique Paths | unique-paths | There is a robot on an `m x n` grid. The robot is initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time.
Given the two integers `m` and `n`, return _the nu... | null | Math,Dynamic Programming,Combinatorics | Medium | 63,64,174,2192 |
1,897 | hello everyone today we are going to discuss the problem redistribute characters to make all strings equal okay so the problem statement says you are given an array of strings so let's see the words this is our array of strings AB BC a BC and BC it asks us to perform this operation like pick any two distinct indices I ... | Redistribute Characters to Make All Strings Equal | maximize-palindrome-length-from-subsequences | You are given an array of strings `words` (**0-indexed**).
In one operation, pick two **distinct** indices `i` and `j`, where `words[i]` is a non-empty string, and move **any** character from `words[i]` to **any** position in `words[j]`.
Return `true` _if you can make **every** string in_ `words` _**equal** using **a... | Let's ignore the non-empty subsequence constraint. We can concatenate the two strings and find the largest palindromic subsequence with dynamic programming. Iterate through every pair of characters word1[i] and word2[j], and see if some palindrome begins with word1[i] and ends with word2[j]. This ensures that the subse... | String,Dynamic Programming | Hard | 516 |
437 | in this video we will solve path sum version 3 problem and it's one of the favorite interview questions asked by amazon so here we are given a binary tree and we have to find different paths just count of paths and not the actual paths which sum to a given value and the condition is that it should not start from root o... | Path Sum III | path-sum-iii | Given the `root` of a binary tree and an integer `targetSum`, return _the number of paths where the sum of the values along the path equals_ `targetSum`.
The path does not need to start or end at the root or a leaf, but it must go downwards (i.e., traveling only from parent nodes to child nodes).
**Example 1:**
**In... | null | Tree,Depth-First Search,Binary Tree | Medium | 112,113,666,687 |
931 | hey everybody this is Larry this is day 13 I think of the legal daily challenge hit the like button hit the Subscribe button German Discord let me know what you think about today's Farm 931 minimum falling path sum so given an N by n Matrix return the minimum some of the following path the next one that's either direct... | 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 |
34 | Hello gas myself Amrita welcome back to our channel technosis video c are going to discuss lead code problem number 34 date is to find d first and last position of element in sorted are so let's get started let's first understand d problem given and are of inteasers namas Sorted in non decreasing order find d starting ... | Find First and Last Position of Element in Sorted Array | find-first-and-last-position-of-element-in-sorted-array | Given an array of integers `nums` sorted in non-decreasing order, find the starting and ending position of a given `target` value.
If `target` is not found in the array, return `[-1, -1]`.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[5,7,7,8,8,10\], target = 8
*... | null | Array,Binary Search | Medium | 278,2165,2210 |
73 | hey everybody this is larry this is day 13 of the august eco day challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's problem and so forth so i one random note before i start is that today's august 13th 2021 i started on april 1st so that means that this is ... | 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 |
710 | hey what's up guys babybear4812 coming at you one more time problem 710 today random pick with blacklist that is uh it's currently being asked by two sigma if i remember correctly uh two sigma is a new york city kind of ai based hedge fund uh they do a lot of really cool work i'd check them out if i was you and uh this... | Random Pick with Blacklist | random-pick-with-blacklist | You are given an integer `n` and an array of **unique** integers `blacklist`. Design an algorithm to pick a random integer in the range `[0, n - 1]` that is **not** in `blacklist`. Any integer that is in the mentioned range and not in `blacklist` should be **equally likely** to be returned.
Optimize your algorithm suc... | null | null | Hard | null |
95 | hey what's up guys this is john here again so today's daily challenge problem number 95 unique binary search trees number two okay so you're giving like integer and return all this unique binary search trees right which has exactly unknowns for you of unique value from one to n return answer by any other right so this ... | Unique Binary Search Trees II | unique-binary-search-trees-ii | Given an integer `n`, return _all the structurally unique **BST'**s (binary search trees), which has exactly_ `n` _nodes of unique values from_ `1` _to_ `n`. Return the answer in **any order**.
**Example 1:**
**Input:** n = 3
**Output:** \[\[1,null,2,null,3\],\[1,null,3,2\],\[2,1,3\],\[3,1,null,null,2\],\[3,2,null,1\... | null | Dynamic Programming,Backtracking,Tree,Binary Search Tree,Binary Tree | Medium | 96,241 |
153 | hello everyone so in this video let us talk about another problem from lead Cod the problem name is find minimum in rotated sorted a okay so if you haven't checked out my video on this problem that is finding out the peak element first please go and check out that particular video it is very helpful and it will make yo... | 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 |
377 | um hello so today we are going to do this problem called combination sum um so problem is part of um august challenge so what we are asked to do is we get an array of integers and the target number and we want to return the number of possible combinations that add up to target okay um and the answer fits a 32-bit integ... | Combination Sum IV | combination-sum-iv | Given an array of **distinct** integers `nums` and a target integer `target`, return _the number of possible combinations that add up to_ `target`.
The test cases are generated so that the answer can fit in a **32-bit** integer.
**Example 1:**
**Input:** nums = \[1,2,3\], target = 4
**Output:** 7
**Explanation:**
Th... | null | Array,Dynamic Programming | Medium | 39 |
1,386 | hello everyone welcome again to my channel so today we will discuss one lead code problem 1386 that is cinema seat allocation so what is the problem statement here the problem statement is we have a cinema hall and there we have row wise seats one particular row have three seats then four seats then again three seats m... | Cinema Seat Allocation | shift-2d-grid | A cinema has `n` rows of seats, numbered from 1 to `n` and there are ten seats in each row, labelled from 1 to 10 as shown in the figure above.
Given the array `reservedSeats` containing the numbers of seats already reserved, for example, `reservedSeats[i] = [3,8]` means the seat located in row **3** and labelled with... | Simulate step by step. move grid[i][j] to grid[i][j+1]. handle last column of the grid. Put the matrix row by row to a vector. take k % vector.length and move last k of the vector to the beginning. put the vector to the matrix back the same way. | Array,Matrix,Simulation | Easy | null |
54 | hey guys today we're going to solve litika number 54 spiral matrix so we're given a matrix of m times and elements and we need to return all elements of the matrix in spiral order so we want to take like the first row then the last column and then the last row in reverse and then the first column in reverse okay so the... | 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 |
1,019 | hello everyone and welcome to coding card so in this tutorial we are going to solve one lead code problem from the topic linked list and you can see here the problem name is next greater node in a linked list so in this column we will be given one linked list and what we have to do here is for each node we have to find... | Next Greater Node In Linked List | squares-of-a-sorted-array | You are given the `head` of a linked list with `n` nodes.
For each node in the list, find the value of the **next greater node**. That is, for each node, find the value of the first node that is next to it and has a **strictly larger** value than it.
Return an integer array `answer` where `answer[i]` is the value of ... | null | Array,Two Pointers,Sorting | Easy | 88,360 |
268 | for today's algorithm we're gonna be discussing the Leech code question missing number so what is the question missing number the question is you're a given an array with the following properties we're going to call this array a the array a has the property one that the arrays of size n minus 1 for some integer n for s... | Missing Number | missing-number | Given an array `nums` containing `n` distinct numbers in the range `[0, n]`, return _the only number in the range that is missing from the array._
**Example 1:**
**Input:** nums = \[3,0,1\]
**Output:** 2
**Explanation:** n = 3 since there are 3 numbers, so all numbers are in the range \[0,3\]. 2 is the missing number... | null | Array,Hash Table,Math,Bit Manipulation,Sorting | Easy | 41,136,287,770,2107 |
1,834 | so you are given n task level from 0 to n minus 1 which is represented as 2D array and the task is uh this is known as task okay I so task of I is equal to NQ time and the processing I it means that uh the ith task will be available to process at in queue time and will take processing time to finish processing okay so ... | Single-Threaded CPU | minimum-number-of-people-to-teach | You are given `n` tasks labeled from `0` to `n - 1` represented by a 2D integer array `tasks`, where `tasks[i] = [enqueueTimei, processingTimei]` means that the `ith` task will be available to process at `enqueueTimei` and will take `processingTimei` to finish processing.
You have a single-threaded CPU... | You can just use brute force and find out for each language the number of users you need to teach Note that a user can appear in multiple friendships but you need to teach that user only once | Array,Greedy | Medium | null |
1,008 | okay today's li coding challenge custon is constructing a binary search tree from pre-order traversal we have a from pre-order traversal we have a from pre-order traversal we have a binary search tree and we have wrong pre-order traversal on top of that tree pre-order traversal on top of that tree pre-order traversal o... | Construct Binary Search Tree from Preorder Traversal | binary-tree-cameras | Given an array of integers preorder, which represents the **preorder traversal** of a BST (i.e., **binary search tree**), construct the tree and return _its root_.
It is **guaranteed** that there is always possible to find a binary search tree with the given requirements for the given test cases.
A **binary search tr... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Hard | 1021 |
225 | hello everyone welcome back uh here's van damson and today we got a really interesting coding problem that's going to deepen your understanding of basic data structure so stack and cues so we will be implementing a stack using just cues Yes you heard it right so let's quickly go over the problem we have to implement a ... | Implement Stack using Queues | implement-stack-using-queues | Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (`push`, `top`, `pop`, and `empty`).
Implement the `MyStack` class:
* `void push(int x)` Pushes element x to the top of the stack.
* `int pop()` Removes the element on the top... | null | Stack,Design,Queue | Easy | 232 |
518 | everyone welcome back and let's write some more neat code today so today let's solve the problem coin change2 we already solved the first one and i'll link that somewhere on the top right of the screen or somewhere in the description if you want to watch that video you don't have to solve it before solving this problem... | 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 |
416 | all right let's talk about partitioning called subsystem so giving a num empty array nums containing only positive integer so final array can be partitioned into two subsets such that the sum of an element in both subset is equal so this is the array and then you can partition to you one by five and eleven so they just... | Partition Equal Subset Sum | partition-equal-subset-sum | Given an integer array `nums`, return `true` _if you can partition the array into two subsets such that the sum of the elements in both subsets is equal or_ `false` _otherwise_.
**Example 1:**
**Input:** nums = \[1,5,11,5\]
**Output:** true
**Explanation:** The array can be partitioned as \[1, 5, 5\] and \[11\].
**E... | null | Array,Dynamic Programming | Medium | 698,2108,2135,2162 |
673 | A higher oil welcome to learn to repeat today will be looking at death eighth playlist change the name of problems number of longest in giving subsidies reduced to find the problem only bracelet given and different forms return the number of longest increasing subsequent where to find the number Off will be this 135 47... | Number of Longest Increasing Subsequence | number-of-longest-increasing-subsequence | Given an integer array `nums`, return _the number of longest increasing subsequences._
**Notice** that the sequence has to be **strictly** increasing.
**Example 1:**
**Input:** nums = \[1,3,5,4,7\]
**Output:** 2
**Explanation:** The two longest increasing subsequences are \[1, 3, 4, 7\] and \[1, 3, 5, 7\].
**Exampl... | null | Array,Dynamic Programming,Binary Indexed Tree,Segment Tree | Medium | 300,674 |
1,793 | hey guys this is CD and today's lead code challenge is maximum score of a good subarray so they have given you an array of integers nums and they have given you an integer you have to find the maximum score of a good sub array so for a good subar they have given you a condition and I'll explain you with an example so t... | Maximum Score of a Good Subarray | minimum-moves-to-make-array-complementary | You are given an array of integers `nums` **(0-indexed)** and an integer `k`.
The **score** of a subarray `(i, j)` is defined as `min(nums[i], nums[i+1], ..., nums[j]) * (j - i + 1)`. A **good** subarray is a subarray where `i <= k <= j`.
Return _the maximum possible **score** of a **good** subarray._
**Example 1:**... | Given a target sum x, each pair of nums[i] and nums[n-1-i] would either need 0, 1, or 2 modifications. Can you find the optimal target sum x value such that the sum of modifications is minimized? Create a difference array to efficiently sum all the modifications. | Array,Hash Table,Prefix Sum | Medium | null |
292 | uh today we're gonna be working on a lead code question number 292 Name Game oh you are playing the following name game with your friend initially there is a heap of stones on the table you and your friend uh will alternate taking turns and you go first so it's gonna be us who's gonna be taking the first turn uh on eac... | Nim Game | nim-game | You are playing the following Nim Game with your friend:
* Initially, there is a heap of stones on the table.
* You and your friend will alternate taking turns, and **you go first**.
* On each turn, the person whose turn it is will remove 1 to 3 stones from the heap.
* The one who removes the last stone is the... | If there are 5 stones in the heap, could you figure out a way to remove the stones such that you will always be the winner? | Math,Brainteaser,Game Theory | Easy | 294 |
968 | hello everyone welcome to quartus camp we are at 16th day of may elite foot challenge and the problem we are going to cover is binary tree cameras so the input given here is a binary tree and we have to return the number of cameras we have to keep in the binary tree and the rooms given are each camera at node can monit... | Binary Tree Cameras | beautiful-array | You are given the `root` of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor its parent, itself, and its immediate children.
Return _the minimum number of cameras needed to monitor all nodes of the tree_.
**Example 1:**
**Input:** root = \[0,0,null,0,0\]
**Output:** 1
**Exp... | null | Array,Math,Divide and Conquer | Medium | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.