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 |
|---|---|---|---|---|---|---|---|---|
924 | hey-ho there so let's talk about this hey-ho there so let's talk about this hey-ho there so let's talk about this question 924 minimize mail well spread we have a network of nodes may be computer nodes each node is directly connected to another node J if and only if graph IJ is equal to one so we've been given this adj... | Minimize Malware Spread | fair-candy-swap | You are given a network of `n` nodes represented as an `n x n` adjacency matrix `graph`, where the `ith` node is directly connected to the `jth` node if `graph[i][j] == 1`.
Some nodes `initial` are initially infected by malware. Whenever two nodes are directly connected, and at least one of those two nodes is infected... | null | Array,Hash Table,Binary Search,Sorting | Easy | null |
1,958 | Loot Hello Friends Today In This Video Will Discuss The First Two Problems Of Chalit From The List Code By Frequent A Hangouts Start The First President To Make Fans Is Show What Is The Chief Minister Of This Train Will Not Think What Does Not Seem To Give Subscribe Share subscribe and Anna-Dhan Hain To Amla Tubelight ... | Check if Move is Legal | ad-free-sessions | You are given a **0-indexed** `8 x 8` grid `board`, where `board[r][c]` represents the cell `(r, c)` on a game board. On the board, free cells are represented by `'.'`, white cells are represented by `'W'`, and black cells are represented by `'B'`.
Each move in this game consists of choosing a free cell and changing i... | null | Database | Easy | null |
513 | hello and welcome to another video in this video we're going to be working on find bottom left tree value and in this problem you're given the root of a binary tree and you want to return the leftmost value in the last row of the tree so the last row for this example is this so the leftmost value is one and in this exa... | Find Bottom Left Tree Value | find-bottom-left-tree-value | Given the `root` of a binary tree, return the leftmost value in the last row of the tree.
**Example 1:**
**Input:** root = \[2,1,3\]
**Output:** 1
**Example 2:**
**Input:** root = \[1,2,3,4,null,5,6,null,null,7\]
**Output:** 7
**Constraints:**
* The number of nodes in the tree is in the range `[1, 104]`.
* `-... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
459 | hello and welcome to today's daily lead code challenge today we'll be solving another question going through my thought process and then at the end of the video comparing my solution to the solution of others to see where we can improve um this my solution uh with that let's begin question 459 repeated substring patter... | Repeated Substring Pattern | repeated-substring-pattern | Given a string `s`, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.
**Example 1:**
**Input:** s = "abab "
**Output:** true
**Explanation:** It is the substring "ab " twice.
**Example 2:**
**Input:** s = "aba "
**Output:** false
**Example 3:**
... | null | String,String Matching | Easy | 28,686 |
420 | hey what's up guys chung here again so today uh let's take a look at this hard legal problem number 420 strong password checker you know this one is one of the hard problem among all the hard problems it's a very tricky one you guys can see it from the accepted percentage here right i mean this one's gonna be a pretty ... | Strong Password Checker | strong-password-checker | A password is considered strong if the below conditions are all met:
* It has at least `6` characters and at most `20` characters.
* It contains at least **one lowercase** letter, at least **one uppercase** letter, and at least **one digit**.
* It does not contain three repeating characters in a row (i.e., `"B**... | null | String,Greedy,Heap (Priority Queue) | Hard | null |
1,553 | hey everyone welcome back and let's write some more neat code today so today let's solve minimum number of days to eat n oranges so this is a pretty short problem description and the solution is actually going to be just as short but the problem is that arriving at the solution is pretty tricky at least arriving at an ... | Minimum Number of Days to Eat N Oranges | count-triplets-that-can-form-two-arrays-of-equal-xor | There are `n` oranges in the kitchen and you decided to eat some of these oranges every day as follows:
* Eat one orange.
* If the number of remaining oranges `n` is divisible by `2` then you can eat `n / 2` oranges.
* If the number of remaining oranges `n` is divisible by `3` then you can eat `2 * (n / 3)` oran... | We are searching for sub-array of length ≥ 2 and we need to split it to 2 non-empty arrays so that the xor of the first array is equal to the xor of the second array. This is equivalent to searching for sub-array with xor = 0. Keep the prefix xor of arr in another array, check the xor of all sub-arrays in O(n^2), if th... | Array,Hash Table,Math,Bit Manipulation,Prefix Sum | Medium | null |
697 | Ajay Ko Hai Okay So Let's Start Its Submission Was Given In Theory Of Native In Teachers And Worms And Give This Is Defined As A Maximum Of Frequency Of Any Us Of Any One Of Its Elements Of Tuition Want To Say Example On This If You Are Having Verse Pair Having And Anti A Are Ideals Degree Finance Maximum Frequency Of ... | 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 |
441 | hey everybody this is Larry this is July first I guess the first day of the July LICO Delhi challenge hit the like button hit the subscribe button I'm gonna try to do this every day of this month and I'm gonna do this explanation first join a discord if you want to hang out and ask more questions about this farm or the... | Arranging Coins | arranging-coins | You have `n` coins and you want to build a staircase with these coins. The staircase consists of `k` rows where the `ith` row has exactly `i` coins. The last row of the staircase **may be** incomplete.
Given the integer `n`, return _the number of **complete rows** of the staircase you will build_.
**Example 1:**
**I... | null | Math,Binary Search | Easy | null |
82 | hello everybody today we are going to be solving another problem on lead code which is remove duplicates from sorted list part two so i have uploaded the video of remove duplicates from sorted list the first one go ahead you if you want you can go ahead and check it out and today we're going to be solving the second pa... | Remove Duplicates from Sorted List II | remove-duplicates-from-sorted-list-ii | Given the `head` of a sorted linked list, _delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list_. Return _the linked list **sorted** as well_.
**Example 1:**
**Input:** head = \[1,2,3,3,4,4,5\]
**Output:** \[1,2,5\]
**Example 2:**
**Input:** head = \[1,1,1,2,3\]
**Outpu... | null | Linked List,Two Pointers | Medium | 83,1982 |
22 | Ha Guy Hello, let's create a new question by generating leads from the code, so this is the question, it is actually a question of Catalan number, given n = actually a question of Catalan number, given n = actually a question of Catalan number, given n = 3, then how many types of brackets can you make from a pair of th... | Generate Parentheses | generate-parentheses | Given `n` pairs of parentheses, write a function to _generate all combinations of well-formed parentheses_.
**Example 1:**
**Input:** n = 3
**Output:** \["((()))","(()())","(())()","()(())","()()()"\]
**Example 2:**
**Input:** n = 1
**Output:** \["()"\]
**Constraints:**
* `1 <= n <= 8` | null | String,Dynamic Programming,Backtracking | Medium | 17,20,2221 |
916 | Hello hello everyone welcome to date difficult move in today's question awards subset in this question will give into etc dish word interesting place characters amused to fit in your to-do list moving onto the your to-do list moving onto the your to-do list moving onto the presentation on that aunty let's get started r... | Word Subsets | decoded-string-at-index | You are given two string arrays `words1` and `words2`.
A string `b` is a **subset** of string `a` if every letter in `b` occurs in `a` including multiplicity.
* For example, `"wrr "` is a subset of `"warrior "` but is not a subset of `"world "`.
A string `a` from `words1` is **universal** if for every string `b` i... | null | String,Stack | Medium | null |
7 | hey everybody this is larry this is me going with q1 of the weekly contest 273 a number after double reversal so there are many ways to do this uh the way that i did it was you know try to do as fast as possible i did in 57 seconds i think i had the idea but i didn't want to prove it or like i so that's why i did it my... | 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 |
98 | I have often seen people getting confused between binary trees and binary search trees well they are same where each node can have a maximum of two children but there is a primary difference between them in a binary first tree all of the nodes on the left sub child will be smaller than the root and all of the nodes on ... | Validate Binary Search Tree | validate-binary-search-tree | Given the `root` of a binary tree, _determine if it is a valid binary search tree (BST)_.
A **valid BST** is defined as follows:
* The left subtree of a node contains only nodes with keys **less than** the node's key.
* The right subtree of a node contains only nodes with keys **greater than** the node's key.
* ... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | 94,501 |
1,711 | welcome back guys welcome to the new video of info decoder where we decode the information and gain some useful insights so today we have another problem from lead code that is count good meals so let's get started so let's read the problem first a good wool is a meal that contains exactly two different food items with... | Count Good Meals | find-valid-matrix-given-row-and-column-sums | A **good meal** is a meal that contains **exactly two different food items** with a sum of deliciousness equal to a power of two.
You can pick **any** two different foods to make a good meal.
Given an array of integers `deliciousness` where `deliciousness[i]` is the deliciousness of the `ith` item of fo... | Find the smallest rowSum or colSum, and let it be x. Place that number in the grid, and subtract x from rowSum and colSum. Continue until all the sums are satisfied. | Array,Greedy,Matrix | Medium | 1379 |
54 | doing this problem called spiral Matrix given a m cross and Matrix you don't know all elements of the Matrix in spiral order okay so I have to go to one two to three and six nine so you've got the idea how to do it is something we have to think about okay we will choose a whiteboard so let's start with the is the squar... | 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,347 | hey everybody this is Larry this is day 13th ah oh wait no this is Saturday I was going to say it's Friday the 13th but I'm doing it on Friday it is the 12th but apparently Friday the 13th is a thing or today there's no Friday the 13 happy Friday everybody or happy Saturday uh let's look at today's problem 1347 minimum... | Minimum Number of Steps to Make Two Strings Anagram | distance-to-a-cycle-in-undirected-graph | You are given two strings of the same length `s` and `t`. In one step you can choose **any character** of `t` and replace it with **another character**.
Return _the minimum number of steps_ to make `t` an anagram of `s`.
An **Anagram** of a string is a string that contains the same characters with a different (or the... | This problem can be broken down into two parts: finding the cycle, and finding the distance between each node and the cycle. How can we find the cycle? We can use DFS and keep track of the nodes we’ve seen, and the order that we see them in. Once we see a node we’ve already visited, we know that the cycle contains the ... | Depth-First Search,Breadth-First Search,Union Find,Graph | Hard | 2218 |
1,903 | hello and welcome to today's daily lead code challenge today we'll be solving question 1,93 largest odd number in string let's 1,93 largest odd number in string let's 1,93 largest odd number in string let's go over the description uh you're given a string num representing a large integer return the largest value odd in... | Largest Odd Number in String | design-most-recently-used-queue | You are given a string `num`, representing a large integer. Return _the **largest-valued odd** integer (as a string) that is a **non-empty substring** of_ `num`_, or an empty string_ `" "` _if no odd integer exists_.
A **substring** is a contiguous sequence of characters within a string.
**Example 1:**
**Input:** nu... | You can store the data in an array and apply each fetch by moving the ith element to the end of the array (i.e, O(n) per operation). A better way is to use the square root decomposition technique. You can build chunks of size sqrt(n). For each fetch operation, You can search for the chunk which has the ith element and ... | Array,Hash Table,Stack,Design,Binary Indexed Tree,Ordered Set | Medium | 146 |
410 | hello everyone so today in this video we are going to solve a question of fleet code that is split array logistim this is 409th question on lead code and this comes under hard category all right so let's start with the problem statement given an array names which consist of non-negative integers and an integer m non-ne... | Split Array Largest Sum | split-array-largest-sum | Given an integer array `nums` and an integer `k`, split `nums` into `k` non-empty subarrays such that the largest sum of any subarray is **minimized**.
Return _the minimized largest sum of the split_.
A **subarray** is a contiguous part of the array.
**Example 1:**
**Input:** nums = \[7,2,5,10,8\], k = 2
**Output:*... | null | Array,Binary Search,Dynamic Programming,Greedy | Hard | 1056,1192,2242,2330 |
455 | uh let's talk about assigned cookie so you are given two array one is trial or red the other one is cookie arrays and basically you have to fulfill this constraint and this is supposed to be uh two pointer questions and it's supposed to be easy so let me just quickly draw that one so uh i don't know this already sorry ... | Assign Cookies | assign-cookies | Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.
Each child `i` has a greed factor `g[i]`, which is the minimum size of a cookie that the child will be content with; and each cookie `j` has a size `s[j]`. If `s[j] >= g[i]`, we can assign ... | null | Array,Greedy,Sorting | Easy | null |
404 | this is one of the easier binary tree problems where we have to find the sum of all the left leaves so how we should approach this problem so a simpler version of this would be that find the sum of all the leaps in the binary tree in that case what you do you would start traversal you can pick any of the traversals of ... | Sum of Left Leaves | sum-of-left-leaves | Given the `root` of a binary tree, return _the sum of all left leaves._
A **leaf** is a node with no children. A **left leaf** is a leaf that is the left child of another node.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 24
**Explanation:** There are two left leaves in the binary tree, wit... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
312 | In this festival, many of these joints will be folded. In this work, butt balloon, the question has been asked that you have been given this B C D E F C, this balloon, you get money and you can put any of them, how do you get the recipe. If you subscribe then you get BCD money like example so friends here first of all ... | Burst Balloons | burst-balloons | You are given `n` balloons, indexed from `0` to `n - 1`. Each balloon is painted with a number on it represented by an array `nums`. You are asked to burst all the balloons.
If you burst the `ith` balloon, you will get `nums[i - 1] * nums[i] * nums[i + 1]` coins. If `i - 1` or `i + 1` goes out of bounds of the array, ... | null | Array,Dynamic Programming | Hard | 1042 |
1,679 | Loot Ko Minimum Back To Home Video Only Code 1617 No Problem Medicine At Number And K Sampras Services Given In Today's Contest Ladies Send A Contest Number-28 So Let's Get Started Your Given Number-28 So Let's Get Started Your Given Number-28 So Let's Get Started Your Given In Different Forms And Jerk One In One Opera... | 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 |
1,463 | Hello Everyone Welcome and Welcome Back to My Channel Suggestion or Winter's Shraadh Problem Bird Flu in Power in All the Video Please Like It Subscribe To My Channel Subscribers Notified When Every Post New Video Song Without Any Further Delay To Get Started Pure Problems Cherry Pick Up To Itna Heart Problem But It's ... | Cherry Pickup II | the-k-weakest-rows-in-a-matrix | You are given a `rows x cols` matrix `grid` representing a field of cherries where `grid[i][j]` represents the number of cherries that you can collect from the `(i, j)` cell.
You have two robots that can collect cherries for you:
* **Robot #1** is located at the **top-left corner** `(0, 0)`, and
* **Robot #2** is... | Sort the matrix row indexes by the number of soldiers and then row indexes. | Array,Binary Search,Sorting,Heap (Priority Queue),Matrix | Easy | null |
791 | hi everyone let's solve today's daily challenge that is custom s string so in this question you are given two strings order and S and all characters of order are unique and were sorted in some custom order previously and then here you are being told that per the characters of s so that they match the order that order w... | Custom Sort String | split-bst | You are given two strings order and s. All the characters of `order` are **unique** and were sorted in some custom order previously.
Permute the characters of `s` so that they match the order that `order` was sorted. More specifically, if a character `x` occurs before a character `y` in `order`, then `x` should occur ... | Use recursion. If root.val <= V, you split root.right into two halves, then join it's left half back on root.right. | Tree,Binary Search Tree,Recursion,Binary Tree | Medium | 450 |
110 | hello guys welcome to another interesting video in the series of coding and this time we are doing today's problem which is a part of the monthly challenge the december monthly challenge in lead code so this is the problem for today so let's get started it's called balanced binary tree and given a binary tree we have t... | Balanced Binary Tree | balanced-binary-tree | Given a binary tree, determine if it is **height-balanced**.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** true
**Example 2:**
**Input:** root = \[1,2,2,3,3,null,null,4,4\]
**Output:** false
**Example 3:**
**Input:** root = \[\]
**Output:** true
**Constraints:**
* The number of nodes ... | null | Tree,Depth-First Search,Binary Tree | Easy | 104 |
1,921 | Voice Mail Come Back Game Start No Doubt Straight Second Questions Page Contest 240 Se Z Remedy Share and Subscribe subscribe and subscribe the Channel Quad Core Values and The Thing Quad Core Values and The Thing Quad Core Values and The Thing Or Can Eliminate All The Best Celebrity In Rugged Look Forward To All... | Eliminate Maximum Number of Monsters | eliminate-maximum-number-of-monsters | You are playing a video game where you are defending your city from a group of `n` monsters. You are given a **0-indexed** integer array `dist` of size `n`, where `dist[i]` is the **initial distance** in kilometers of the `ith` monster from the city.
The monsters walk toward the city at a **constant** speed. The speed... | null | null | Medium | null |
118 | Hello everyone welcome, we are going to do video number 55 of my channel, easy level question number 18 but it is very important and sometimes it is fine in big questions, today it is an application in big questions, it goes to small ones. By becoming a part, it is okay. There is a video in the playlist of my Math whic... | Pascal's Triangle | pascals-triangle | Given an integer `numRows`, return the first numRows of **Pascal's triangle**.
In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown:
**Example 1:**
**Input:** numRows = 5
**Output:** \[\[1\],\[1,1\],\[1,2,1\],\[1,3,3,1\],\[1,4,6,4,1\]\]
**Example 2:**
**Input:** numRows = ... | null | Array,Dynamic Programming | Easy | 119 |
211 | hi everyone welcome back to the channel and today we saw the two daily challenge problem number 207 design add and so both data structure so uh this problem is basically you know um an extension of the try uh search or trial logic which we do so let me try basically we will look for a substring in an area of a string y... | Design Add and Search Words Data Structure | design-add-and-search-words-data-structure | Design a data structure that supports adding new words and finding if a string matches any previously added string.
Implement the `WordDictionary` class:
* `WordDictionary()` Initializes the object.
* `void addWord(word)` Adds `word` to the data structure, it can be matched later.
* `bool search(word)` Returns ... | You should be familiar with how a Trie works. If not, please work on this problem: Implement Trie (Prefix Tree) first. | String,Depth-First Search,Design,Trie | Medium | 208,746 |
53 | Hello gas I am just Amrita welcome if you also Vishwa tu join you can subscribe tu our channel I have already discussed some of these problems you can check date out as well so in today's video they are going to be discussing problem number 53 date is maximum time so Let first understand d problem Jivan and wait are na... | 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 |
337 | hey everyone today we are going to solve the little question house level three so the thief has found himself a new place for his thievery again there is only one entrance to this area called the loot besides the root each house has a one and only one parent house after two uh does not see I realized that all houses in... | House Robber III | house-robber-iii | The thief has found himself a new place for his thievery again. There is only one entrance to this area, called `root`.
Besides the `root`, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will automatically contact the police if ... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Medium | 198,213 |
1,887 | hello guys and welcome back to lead Logics this is the reduction operations to make an array elements equal it is a lead code medium and the number for this is 1887 and I'm sure that it will be a easy question for you if you watch the video of till the end because I am going to tell you a super simple solution for this... | Reduction Operations to Make the Array Elements Equal | minimum-degree-of-a-connected-trio-in-a-graph | Given an integer array `nums`, your goal is to make all elements in `nums` equal. To complete one operation, follow these steps:
1. Find the **largest** value in `nums`. Let its index be `i` (**0-indexed**) and its value be `largest`. If there are multiple elements with the largest value, pick the smallest `i`.
2. F... | Consider a trio with nodes u, v, and w. The degree of the trio is just degree(u) + degree(v) + degree(w) - 6. The -6 comes from subtracting the edges u-v, u-w, and v-w, which are counted twice each in the vertex degree calculation. To get the trios (u,v,w), you can iterate on u, then iterate on each w,v such that w and... | Graph | Hard | null |
998 | Hai gas welcome tu today's video and today we are going to do lead code problem 998 whose name is Maximum Binary Tree Tu, so if you have not seen this Maximum Binary Tree one then watch it first, we have already created its video because this It is a bit similar and is also connected to the problem, so let us read the ... | Maximum Binary Tree II | check-completeness-of-a-binary-tree | A **maximum tree** is a tree where every node has a value greater than any other value in its subtree.
You are given the `root` of a maximum binary tree and an integer `val`.
Just as in the [previous problem](https://leetcode.com/problems/maximum-binary-tree/), the given tree was constructed from a list `a` (`root = ... | null | Tree,Breadth-First Search,Binary Tree | Medium | null |
513 | hello welcome to my channel i'm here to do my 100 lego challenge today we have leeco 513 find bottom left tree value so let's take a look at this question so given the root of a binary tree and we turn the left most value in the last row of the tree so in this example now we know the last row is one and three and the l... | Find Bottom Left Tree Value | find-bottom-left-tree-value | Given the `root` of a binary tree, return the leftmost value in the last row of the tree.
**Example 1:**
**Input:** root = \[2,1,3\]
**Output:** 1
**Example 2:**
**Input:** root = \[1,2,3,4,null,5,6,null,null,7\]
**Output:** 7
**Constraints:**
* The number of nodes in the tree is in the range `[1, 104]`.
* `-... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
1,603 | okay so let's talk about design talking system so you have to design a property system for popping up and you have three different kinds of cars which is big medium small and you just basically just have to return if there's any spot left for the bigger and medium so this will be easy just using the uh through differen... | 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 |
455 | foreign two and three the cookie size but it's not available okay so your goal is to maximize the number of contents children and output the maximum numbers are going to be maximize three children remain satisfying the great factor with children so what we can do is um given our examples let's say two RF and after some... | Assign Cookies | assign-cookies | Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.
Each child `i` has a greed factor `g[i]`, which is the minimum size of a cookie that the child will be content with; and each cookie `j` has a size `s[j]`. If `s[j] >= g[i]`, we can assign ... | null | Array,Greedy,Sorting | Easy | null |
453 | welcome to mazelico challenge today's problem is minimum moves to equal array elements 2. given an array integer 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 one we had a list of numbers one two three we... | Minimum Moves to Equal Array Elements | minimum-moves-to-equal-array-elements | 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 `n - 1` elements of the array by `1`.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** 3
**Explanation:** Only three moves are needed (remember each move inc... | null | Array,Math | Medium | 462,2263,2273 |
326 | hello everyone welcome to my youtube channel today we will solve uh another record problem and the program is called r of three so let's look into the problem statement first what has been said there so the problem states that given an integer n and return true if it is a power of 3 otherwise return false and an intege... | Power of Three | power-of-three | Given an integer `n`, return _`true` if it is a power of three. Otherwise, return `false`_.
An integer `n` is a power of three, if there exists an integer `x` such that `n == 3x`.
**Example 1:**
**Input:** n = 27
**Output:** true
**Explanation:** 27 = 33
**Example 2:**
**Input:** n = 0
**Output:** false
**Explanat... | null | Math,Recursion | Easy | 231,342,1889 |
1,668 | hello there so today we will solve one of the problem on label related to string we need to find maximum repeating substrings so let's see what is the input and output expected so in this sequence a b c word a b if it is given we have to find how many times a b is repeating so you can see a b is repeated twice a b so o... | Maximum Repeating Substring | find-longest-awesome-substring | For a string `sequence`, a string `word` is **`k`\-repeating** if `word` concatenated `k` times is a substring of `sequence`. The `word`'s **maximum `k`\-repeating value** is the highest value `k` where `word` is `k`\-repeating in `sequence`. If `word` is not a substring of `sequence`, `word`'s maximum `k`\-repeating v... | Given the character counts, under what conditions can a palindrome be formed ? From left to right, use bitwise xor-operation to compute for any prefix the number of times modulo 2 of each digit. (mask ^= (1<<(s[i]-'0')). Expected complexity is O(n*A) where A is the alphabet (10). | Hash Table,String,Bit Manipulation | Hard | null |
231 | this is Lead Core challenge 231 the name is power of 2. giving an integer called n we have to return true if it is a power of 2. otherwise we have to return false an integer n is considered a power of 2 if there exists an integer X such that 2 to the power of x equals n example if n is 1 we can have 2 to the power of 0... | 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 everyone today we will see problem number 378 from the lead code that is kth smallest element in a sorted matrix so what's the problem uh this one is a medium level problem and we have been given an n cross and matrix where each row and column are sorted in ascending order so we have been given and sorted matrix th... | 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 |
169 | hello and welcome back to the cracking Fang YouTube channel today we are solving another easy problem for some of those people that are just joining the leak code grind it is one 69 majority element given an array of nums of size n return the majority element is the element that appears more than n minus 2 sorry n / 2 ... | Majority Element | majority-element | Given an array `nums` of size `n`, return _the majority element_.
The majority element is the element that appears more than `⌊n / 2⌋` times. You may assume that the majority element always exists in the array.
**Example 1:**
**Input:** nums = \[3,2,3\]
**Output:** 3
**Example 2:**
**Input:** nums = \[2,2,1,1,1,2,... | null | Array,Hash Table,Divide and Conquer,Sorting,Counting | Easy | 229,1102 |
16 | okay guys let's do this exchange problem at leat code r3 some closed or that given an array s often integer is 5 3 T years and s such that some s closest to a given number target return the sum of three integers you assume that each input would be exactly one would have exactly one solution so let's start over half and... | 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 |
5 | hello friends this is shravan kumar mantri welcome to our channel csc gurus moving on to the next question longest palindromic substring so the problem number five which is given in lead code so we'll see what is this longest palindromic substring and how to find we'll see the logic given a string has written the longe... | 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 |
137 | Hello Gas we are back again with our lead series and today we discuss about D single number second and medium level problem but if we talk about ourselves then Gas is going to be an easy level problem, not much, it is not a big deal, we will take questions. Let us understand that we have been given a name Shayari, you ... | Single Number II | single-number-ii | Given an integer array `nums` where every element appears **three times** except for one, which appears **exactly once**. _Find the single element and return it_.
You must implement a solution with a linear runtime complexity and use only constant extra space.
**Example 1:**
**Input:** nums = \[2,2,3,2\]
**Output:**... | null | Array,Bit Manipulation | Medium | 136,260 |
912 | hi everyone let's all today's daily challenge that is sort and array so in this question uh we just have to sort an array and we have to sort the RN o of n Log In Time complexity and with the smallest space complexity possible so there are a ton of uh sorting algorithms out there so the most popular comparison based so... | Sort an Array | random-pick-with-weight | Given an array of integers `nums`, sort the array in ascending order and return it.
You must solve the problem **without using any built-in** functions in `O(nlog(n))` time complexity and with the smallest space complexity possible.
**Example 1:**
**Input:** nums = \[5,2,3,1\]
**Output:** \[1,2,3,5\]
**Explanation:*... | null | Math,Binary Search,Prefix Sum,Randomized | Medium | 398,894,914 |
95 | hello everyone welcome to today's second of september equal challenge and today's question is unique binary search trees too in this question we are given an integer end and we need to tell the count of structurally unique binary search tree that can be formed out of all the numbers into consideration starting from 1 u... | 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 |
17 | hey there everyone welcome back to lead coding i'm your host faraz and we are solving questions on recursion so i have already uploaded two lectures on recursion if you don't have the basic idea of recursion you can go and watch those lectures and then continue with this question also in this question we will need some... | Letter Combinations of a Phone Number | letter-combinations-of-a-phone-number | Given a string containing digits from `2-9` inclusive, return all possible letter combinations that the number could represent. Return the answer in **any order**.
A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.
**Example 1:**
**Input:** di... | null | Hash Table,String,Backtracking | Medium | 22,39,401 |
274 | in this problem we are given uh the papers of some author so there is one author and let's say he has published five papers and then uh when somebody else does a research in similar area he or she will use some of the concepts of this paper and they will cite their paper as reference so let's say this author has publis... | H-Index | h-index | Given an array of integers `citations` where `citations[i]` is the number of citations a researcher received for their `ith` paper, return _the researcher's h-index_.
According to the [definition of h-index on Wikipedia](https://en.wikipedia.org/wiki/H-index): The h-index is defined as the maximum value of `h` such th... | An easy approach is to sort the array first. What are the possible values of h-index? A faster approach is to use extra space. | Array,Sorting,Counting Sort | Medium | 275 |
349 | Those Blue WhatsApp Guys Welcome Spinner Padutha and I would like to welcome all of you very much, my option was to tell the technicalities, Chamak S8 goes very much to the coordinators, finally I go to solve a problem of loot on my channel which is easy and no intermediate difficulty. There are different levels of adv... | Intersection of Two Arrays | intersection-of-two-arrays | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must be **unique** and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2\]
**Example 2:**
**Input:** nums1 = \[4,9,5\], nums2 = \... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 350,1149,1392,2190,2282 |
763 | hey everyone this is your site hope you are doing well so let's start with the question so the question is partition labels okay so you are given a string s and we want to partition the string into as many part as possible okay so that each letter appears in at most one part got it uh not that the partition is done so ... | Partition Labels | special-binary-string | You are given a string `s`. We want to partition the string into as many parts as possible so that each letter appears in at most one part.
Note that the partition is done so that after concatenating all the parts in order, the resultant string should be `s`.
Return _a list of integers representing the size of these ... | Draw a line from (x, y) to (x+1, y+1) if we see a "1", else to (x+1, y-1).
A special substring is just a line that starts and ends at the same y-coordinate, and that is the lowest y-coordinate reached.
Call a mountain a special substring with no special prefixes - ie. only at the beginning and end is the lowest y-coo... | String,Recursion | Hard | 678 |
895 | hi guys welcome to algorithms made easy in this video we'll see the question maximum frequency stack we need to implement a frequency stack which is a class that stimulates the operation of a stack like data structure and it has two functions one is push and other is pop push operation will push the integer into the st... | Maximum Frequency Stack | shortest-path-to-get-all-keys | Design a stack-like data structure to push elements to the stack and pop the most frequent element from the stack.
Implement the `FreqStack` class:
* `FreqStack()` constructs an empty frequency stack.
* `void push(int val)` pushes an integer `val` onto the top of the stack.
* `int pop()` removes and returns the... | null | Bit Manipulation,Breadth-First Search | Hard | null |
1,006 | 10:06 clumsy factorio normally the 10:06 clumsy factorio normally the 10:06 clumsy factorio normally the factorial of a positive number of positive integer n is the product of all positive integers less than or equal to n for example ya factorial of 10 is you go to you know the sort of thing and technically is called p... | Clumsy Factorial | vowel-spellchecker | The **factorial** of a positive integer `n` is the product of all positive integers less than or equal to `n`.
* For example, `factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1`.
We make a **clumsy factorial** using the integers in decreasing order by swapping out the multiply operations for a fixed rotation o... | null | Array,Hash Table,String | Medium | null |
1,673 | hello everyone today we are solving this problem find the most competitive subsequence so before discussing the problem statement let us first understand what is a subsequence so suppose we have a sequence or an array of integers or maybe characters let us say that we have this array now formally speaking a subsequence... | 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 |
1,743 | hey what's up guys this is chung here so this time on 1743 restored array from adjacent pairs um so there's like an integer array nouns that consist of unique elements so remember it has to be unique but you have forgotten it however you do remember every pair of addition adjacent elements in nums and you're given like... | Restore the Array From Adjacent Pairs | count-substrings-that-differ-by-one-character | There is an integer array `nums` that consists of `n` **unique** elements, but you have forgotten it. However, you do remember every pair of adjacent elements in `nums`.
You are given a 2D integer array `adjacentPairs` of size `n - 1` where each `adjacentPairs[i] = [ui, vi]` indicates that the elements `ui` and `vi` a... | Take every substring of s, change a character, and see how many substrings of t match that substring. Use a Trie to store all substrings of t as a dictionary. | Hash Table,String,Dynamic Programming | Medium | 2256 |
1,483 | we are given a tree with any nodes node zero is the root and we need to efficiently answer queries given node v and an integer k and can't cave ancestor of v ancestors for any vertex v ancestors is just everything on the path to the root being vertex 0 or node 0 vertex and node are the same thing and brute force is her... | Kth Ancestor of a Tree Node | rank-teams-by-votes | You are given a tree with `n` nodes numbered from `0` to `n - 1` in the form of a parent array `parent` where `parent[i]` is the parent of `ith` node. The root of the tree is node `0`. Find the `kth` ancestor of a given node.
The `kth` ancestor of a tree node is the `kth` node in the path from that node to the root no... | Build array rank where rank[i][j] is the number of votes for team i to be the j-th rank. Sort the trams by rank array. if rank array is the same for two or more teams, sort them by the ID in ascending order. | Array,Hash Table,String,Sorting,Counting | Medium | 947 |
1,032 | Hello hello friends today only discuss 2103 3369 character problem is love design algorithm tax sabsakraib skating of governor of steam mop problem to you and what is your character subscribe comment and subscribe the Channel subscribe school look here that you use Give and you can understand Android Subscribe for anyo... | Stream of Characters | satisfiability-of-equality-equations | Design an algorithm that accepts a stream of characters and checks if a suffix of these characters is a string of a given array of strings `words`.
For example, if `words = [ "abc ", "xyz "]` and the stream added the four characters (one by one) `'a'`, `'x'`, `'y'`, and `'z'`, your algorithm should detect that the suf... | null | Array,String,Union Find,Graph | Medium | null |
1,893 | hey everybody this is larry this is me going with q1 of the binary uh by weekly contest 54. uh check if all the integers in the range are covered um hit the like button hit the subscribe button join me in discord let me know what you think about this problem uh for me i thought it was pretty straightforward even if i w... | Check if All the Integers in a Range Are Covered | maximum-subarray-sum-after-one-operation | You are given a 2D integer array `ranges` and two integers `left` and `right`. Each `ranges[i] = [starti, endi]` represents an **inclusive** interval between `starti` and `endi`.
Return `true` _if each integer in the inclusive range_ `[left, right]` _is covered by **at least one** interval in_ `ranges`. Return `false`... | Think about dynamic programming Define an array dp[nums.length][2], where dp[i][0] is the max subarray sum including nums[i] and without squaring any element. dp[i][1] is the max subarray sum including nums[i] and having only one element squared. | Array,Dynamic Programming | Medium | 53 |
268 | hey guys it's all five one here and today we're going to be solving missing number in this problem we're given an array called nums and they're telling us that it contains n distinct numbers in the range of 0 to n and in the end they wanted to return the only number in the range that is missing from the array so for ex... | 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,422 | hello guys and welcome back to lead Logics this is the maximum score after splitting a string problem this is a lead code easy and the number for this is 1422 so in the given problem we are given with a string s of zeros and ones and we have to return the maximum score after splitting the string into two non-empty subs... | Maximum Score After Splitting a String | divide-array-in-sets-of-k-consecutive-numbers | Given a string `s` of zeros and ones, _return the maximum score after splitting the string into two **non-empty** substrings_ (i.e. **left** substring and **right** substring).
The score after splitting a string is the number of **zeros** in the **left** substring plus the number of **ones** in the **right** substring... | If the smallest number in the possible-to-split array is V, then numbers V+1, V+2, ... V+k-1 must contain there as well. You can iteratively find k sets and remove them from array until it becomes empty. Failure to do so would mean that array is unsplittable. | Array,Hash Table,Greedy,Sorting | Medium | 659,2261 |
208 | hey everyone today we'll be going over leode problem 208 Implement try and a try is also known as a prefix tree this is another problem off the blind 75 list which is a list of problems commonly asked during technical interviews in this problem we want to implement a prefix tree and this is a data structure which is us... | Implement Trie (Prefix Tree) | implement-trie-prefix-tree | A [**trie**](https://en.wikipedia.org/wiki/Trie) (pronounced as "try ") or **prefix tree** is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker.
Implement the Trie class:
* `Trie()` ... | null | Hash Table,String,Design,Trie | Medium | 211,642,648,676,1433,1949 |
1,839 | hey everybody this is larry this is me going with q3 of the weekly contest 238 longest sub string of all rounds in order uh hit the like button hit the subscribe button join me on discord let me know what you think about this problem but this one it's um i thought it's just so this one is very awkward for me because it... | Longest Substring Of All Vowels in Order | decode-xored-array | A string is considered **beautiful** if it satisfies the following conditions:
* Each of the 5 English vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`) must appear **at least once** in it.
* The letters must be sorted in **alphabetical order** (i.e. all `'a'`s before `'e'`s, all `'e'`s before `'i'`s, etc.).
For example... | Since that encoded[i] = arr[i] XOR arr[i+1], then arr[i+1] = encoded[i] XOR arr[i]. Iterate on i from beginning to end, and set arr[i+1] = encoded[i] XOR arr[i]. | Array,Bit Manipulation | Easy | null |
854 | hey what's up guys this is jung here again so today i'd like to talk about this 854 case similar strings it's a hard problem okay so you're given like a string two strings string a and string b and the string a and the string b are k similar for some non-negative integer k if we for some non-negative integer k if we fo... | 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 |
119 | hello everyone myself Aditi and uh today I'm going to solve lead codes another daily challenge problem in this question the question is Pascal triangle part two and in this question we are given an integer row index and we have to return the row index row of the pascals triangle which is zero indexed okay so in pascals... | 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 |
509 | Hello friends, welcome to your channel, so today is day three of our lead code challenge, so let's start. If you do not have access to our website, then you can go to our website. You can also find the link in the description. And go to this page and bookmark it. Okay, so let's move on to today's question. Today's ques... | Fibonacci Number | inorder-successor-in-bst-ii | The **Fibonacci numbers**, commonly denoted `F(n)` form a sequence, called the **Fibonacci sequence**, such that each number is the sum of the two preceding ones, starting from `0` and `1`. That is,
F(0) = 0, F(1) = 1
F(n) = F(n - 1) + F(n - 2), for n > 1.
Given `n`, calculate `F(n)`.
**Example 1:**
**Input:** n = ... | null | Tree,Binary Search Tree,Binary Tree | Medium | 285 |
1,959 | Okay, so today we will discuss this problem - Minimum Total Space Wasted with problem - Minimum Total Space Wasted with problem - Minimum Total Space Wasted with Carey Sizing Operation Problem Statement Basically it is given that we have a dynamic task and zero and Akshay name Friday, note down what should be its size ... | Minimum Total Space Wasted With K Resizing Operations | minimum-path-cost-in-a-hidden-grid | You are currently designing a dynamic array. You are given a **0-indexed** integer array `nums`, where `nums[i]` is the number of elements that will be in the array at time `i`. In addition, you are given an integer `k`, the **maximum** number of times you can **resize** the array (to **any** size).
The size of the ar... | The grid is at a maximum 100 x 100, so it is clever to assume that the robot's initial cell is grid[101][101] Run a DFS from the robot's position to make sure that you can reach the target, otherwise you should return -1. Now that you are sure you can reach the target and that you know the grid, run Dijkstra to find th... | Depth-First Search,Breadth-First Search,Graph,Heap (Priority Queue),Interactive | Medium | 865,1931 |
83 | hey guys how's everything going let's take a look at number 83 remove duplicates from sorry the list we're giving us really linked lists today to all the duplicates such as each elements appear only once ah actually we have done a more difficult one which is 82 which there is a more cast more detailed conditions for no... | Remove Duplicates from Sorted List | remove-duplicates-from-sorted-list | Given the `head` of a sorted linked list, _delete all duplicates such that each element appears only once_. Return _the linked list **sorted** as well_.
**Example 1:**
**Input:** head = \[1,1,2\]
**Output:** \[1,2\]
**Example 2:**
**Input:** head = \[1,1,2,3,3\]
**Output:** \[1,2,3\]
**Constraints:**
* The numb... | null | Linked List | Easy | 82,1982 |
468 | hi today i'm talking about leak code problem 468 validating ip addresses this is a pretty quick problem what it's asking you to do is check whether an input string is a valid ipv4 address or ipv6 and then it has descriptions of what an ipv4 address is and what an ipv6 address is and basically these descriptions are jus... | Validate IP Address | validate-ip-address | Given a string `queryIP`, return `"IPv4 "` if IP is a valid IPv4 address, `"IPv6 "` if IP is a valid IPv6 address or `"Neither "` if IP is not a correct IP of any type.
**A valid IPv4** address is an IP in the form `"x1.x2.x3.x4 "` where `0 <= xi <= 255` and `xi` **cannot contain** leading zeros. For example, `"192.16... | null | String | Medium | 752 |
1,078 | hi everyone welcome back for another video we are going to do another legal question the question is occurrences after bi-gram given two strings first and second consider occurrences in some text of the form first second third where second comes immediately after first and third comes immediately after second return ar... | Occurrences After Bigram | remove-outermost-parentheses | Given two strings `first` and `second`, consider occurrences in some text of the form `"first second third "`, where `second` comes immediately after `first`, and `third` comes immediately after `second`.
Return _an array of all the words_ `third` _for each occurrence of_ `"first second third "`.
**Example 1:**
**In... | Can you find the primitive decomposition? The number of ( and ) characters must be equal. | String,Stack | Easy | null |
1 | is the most popular Le code question to some probably because it's also question number one but this is a very important problem for not just coding and learning how to use a hatch map this is the hatch map way through a dictionary but it's also for data analytics trying to find matches through correlations and financi... | 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 |
104 | hello everyone I hope you are all doing well and this video will be solving the problem leads called 104 maximum depth and binary tree using multiple techniques so let's get started so the problem is that they give you a binary tree and they ask you to return its maximum depth and the maximum depth of the binary tree i... | Maximum Depth of Binary Tree | maximum-depth-of-binary-tree | Given the `root` of a binary tree, return _its maximum depth_.
A binary tree's **maximum depth** is the number of nodes along the longest path from the root node down to the farthest leaf node.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 3
**Example 2:**
**Input:** root = \[1,null,2\]
**... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 110,111,774,1492 |
140 | cool 140 were quick to given a non-empty cool 140 were quick to given a non-empty cool 140 were quick to given a non-empty string as in a dictionary would like containing a list of non empty words add spaces and add spaces in s to construct a sentence where each word is a valid dictionary where we turn all such possibl... | Word Break II | word-break-ii | Given a string `s` and a dictionary of strings `wordDict`, add spaces in `s` to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in **any order**.
**Note** that the same word in the dictionary may be reused multiple times in the segmentation.
**Example 1:**
**Input:... | null | Hash Table,String,Dynamic Programming,Backtracking,Trie,Memoization | Hard | 139,472 |
1,004 | hello friends now let's of the max consecutive ones three problem let's see a statement given a array a of zeros in ones we may change up to K values from 0 to 1 return the length of the longest contiguous sub array that contains only ones this is this example we can change the this 0 in this 0 to 1 sorry yeah so we ca... | Max Consecutive Ones III | least-operators-to-express-number | Given a binary array `nums` and an integer `k`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most_ `k` `0`'s.
**Example 1:**
**Input:** nums = \[1,1,1,0,0,0,1,1,1,1,0\], k = 2
**Output:** 6
**Explanation:** \[1,1,1,0,0,**1**,1,1,1,1,**1**\]
Bolded numbers were flipped from 0 to 1.... | null | Math,Dynamic Programming | Hard | null |
780 | welcome to my youtube channel um so this is my first uh youtube video solving some decode problems um this is lingual hard on the lead code um i actually picked this problem because i find this problem a bit interesting and this is one of the few problems that i actually got it right on my first try um yeah so here um ... | Reaching Points | max-chunks-to-make-sorted | Given four integers `sx`, `sy`, `tx`, and `ty`, return `true` _if it is possible to convert the point_ `(sx, sy)` _to the point_ `(tx, ty)` _through some operations__, or_ `false` _otherwise_.
The allowed operation on some point `(x, y)` is to convert it to either `(x, x + y)` or `(x + y, y)`.
**Example 1:**
**Input... | The first chunk can be found as the smallest k for which A[:k+1] == [0, 1, 2, ...k]; then we repeat this process. | Array,Stack,Greedy,Sorting,Monotonic Stack | Medium | 779 |
445 | hey guys welcome back to this problem now we're going to solve according interview problem add two numbers two this is a lead quote problem and this is going to be a linked list problem you're given two non-empty linked lists you're given two non-empty linked lists you're given two non-empty linked lists representing t... | Add Two Numbers II | add-two-numbers-ii | You are given two **non-empty** linked lists representing two non-negative integers. The most significant digit comes first 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 itsel... | null | Linked List,Math,Stack | Medium | 2,1774 |
3 | my device whatsapp welcome to the second this point solid code problem clove sachin without feeling character schedule video subscribe the channel to get the best all the planet data structure for beginners specific data structure of that so hind this problem also not to get the Longest substring without any depicting ... | Longest Substring Without Repeating Characters | longest-substring-without-repeating-characters | Given a string `s`, find the length of the **longest** **substring** without repeating characters.
**Example 1:**
**Input:** s = "abcabcbb "
**Output:** 3
**Explanation:** The answer is "abc ", with the length of 3.
**Example 2:**
**Input:** s = "bbbbb "
**Output:** 1
**Explanation:** The answer is "b ", with t... | null | Hash Table,String,Sliding Window | Medium | 159,340,1034,1813,2209 |
290 | all right let's do this problem called word pattern let's have a read even a pattern and a string as find if s follows the same pattern now what does this mean it says here follow means a full match such that there is a bijection between a ladder and pattern and a non-emptive word in Ash so let's and a non-emptive word... | Word Pattern | word-pattern | Given a `pattern` and a string `s`, find if `s` follows the same pattern.
Here **follow** means a full match, such that there is a bijection between a letter in `pattern` and a **non-empty** word in `s`.
**Example 1:**
**Input:** pattern = "abba ", s = "dog cat cat dog "
**Output:** true
**Example 2:**
**Input:*... | null | Hash Table,String | Easy | 205,291 |
1,499 | hello everyone this is DSS in today we are going to solve the 25th question of our DS sheet and the question is Max value of equation now let's look at the problem statement you are given an array points containing the coordinates of points on a 2d plane sorted by the X values where points I equals x i comma Yi such th... | Max Value of Equation | maximum-performance-of-a-team | You are given an array `points` containing the coordinates of points on a 2D plane, sorted by the x-values, where `points[i] = [xi, yi]` such that `xi < xj` for all `1 <= i < j <= points.length`. You are also given an integer `k`.
Return _the maximum value of the equation_ `yi + yj + |xi - xj|` where `|xi - xj| <= k` ... | Keep track of the engineers by their efficiency in decreasing order. Starting from one engineer, to build a team, it suffices to bring K-1 more engineers who have higher efficiencies as well as high speeds. | Array,Greedy,Sorting,Heap (Priority Queue) | Hard | 2229 |
451 | hello everyone today's questions is short characters by frequency given a string sorted in decreasing order based on the frequency of characters so now we will move to the pen and paper ok first will be understand these questions that is our questions short character by frequency means we have to sort the character ins... | Sort Characters By Frequency | sort-characters-by-frequency | Given a string `s`, sort it in **decreasing order** based on the **frequency** of the characters. The **frequency** of a character is the number of times it appears in the string.
Return _the sorted string_. If there are multiple answers, return _any of them_.
**Example 1:**
**Input:** s = "tree "
**Output:** "eer... | null | Hash Table,String,Sorting,Heap (Priority Queue),Bucket Sort,Counting | Medium | 347,387,1741 |
1,993 | everyone welcome back and let's write some more neat code today so today let's solve a problem from this morning's leak code contest operations on trees now this i would say is a difficult problem because it is quite an essay and it's really easy to make a incorrect assumption or make a mistake reading it so i would sa... | Operations on Tree | sum-of-all-subset-xor-totals | You are given a tree with `n` nodes numbered from `0` to `n - 1` in the form of a parent array `parent` where `parent[i]` is the parent of the `ith` node. The root of the tree is node `0`, so `parent[0] = -1` since it has no parent. You want to design a data structure that allows users to lock, unlock, and upgrade node... | Is there a way to iterate through all the subsets of the array? Can we use recursion to efficiently iterate through all the subsets? | Array,Math,Backtracking,Bit Manipulation,Combinatorics | Easy | null |
1,828 | problems that involve computational geometry can be quite confusing at times because when you think of a problem in terms of when you're writing code it's kind of hard to picture something with a curve when you're talking about code right things are quite straight edged or square rectangular they have tight corners rig... | Queries on Number of Points Inside a Circle | count-ways-to-distribute-candies | You are given an array `points` where `points[i] = [xi, yi]` is the coordinates of the `ith` point on a 2D plane. Multiple points can have the **same** coordinates.
You are also given an array `queries` where `queries[j] = [xj, yj, rj]` describes a circle centered at `(xj, yj)` with a radius of `rj`.
For each query `... | Try to define a recursive approach. For the ith candies, there will be one of the two following cases: If the i - 1 previous candies are already distributed into k bags for the ith candy, you can have k * dp[n - 1][k] ways to distribute the ith candy. We need then to solve the state of (n - 1, k). If the i - 1 previous... | Dynamic Programming | Hard | null |
1,032 | hello everyone welcome to my channel today i will introduce the question 1032 stream of characters and these questions ask us to design algorithm that accept the stream of characters and check if the input of character is in the array of strings words so from the example we can say here we have a list of we have array ... | Stream of Characters | satisfiability-of-equality-equations | Design an algorithm that accepts a stream of characters and checks if a suffix of these characters is a string of a given array of strings `words`.
For example, if `words = [ "abc ", "xyz "]` and the stream added the four characters (one by one) `'a'`, `'x'`, `'y'`, and `'z'`, your algorithm should detect that the suf... | null | Array,String,Union Find,Graph | Medium | null |
494 | assalamu alaikum welcome back to this video in this video we're going to solve this coding interview question Target a sum in this problem we are given an array of integers and a Target 2. we have to find out all possible combination by placing positive and negative symbol that means plus and minus symbol in front of t... | Target Sum | target-sum | You are given an integer array `nums` and an integer `target`.
You want to build an **expression** out of nums by adding one of the symbols `'+'` and `'-'` before each integer in nums and then concatenate all the integers.
* For example, if `nums = [2, 1]`, you can add a `'+'` before `2` and a `'-'` before `1` and ... | null | Array,Dynamic Programming,Backtracking | Medium | 282 |
1,910 | hello everyone welcome to another video of steam playlist and today we will see problem number 1910 of 84 which is all occurrence of a substring let's move to the problem statement what's the problem is so given two string s and part which is s and part perform the following operation on S until all occurrence of the s... | Remove All Occurrences of a Substring | check-if-binary-string-has-at-most-one-segment-of-ones | Given two strings `s` and `part`, perform the following operation on `s` until **all** occurrences of the substring `part` are removed:
* Find the **leftmost** occurrence of the substring `part` and **remove** it from `s`.
Return `s` _after removing all occurrences of_ `part`.
A **substring** is a contiguous seque... | It's guaranteed to have at least one segment The string size is small so you can count all segments of ones with no that have no adjacent ones. | String | Easy | 1999 |
1,630 | hello guys and welcome back to lead Logics this is the arithmetic Subarus problem it is a lead code medium and the number for this is 1630 so in this problem it is defined that a sequence of a number is called arithmetic if it consists of at least two elements and the uh difference between uh the every two consecutive ... | Arithmetic Subarrays | count-odd-numbers-in-an-interval-range | A sequence of numbers is called **arithmetic** if it consists of at least two elements, and the difference between every two consecutive elements is the same. More formally, a sequence `s` is arithmetic if and only if `s[i+1] - s[i] == s[1] - s[0]` for all valid `i`.
For example, these are **arithmetic** sequences:
1... | If the range (high - low + 1) is even, the number of even and odd numbers in this range will be the same. If the range (high - low + 1) is odd, the solution will depend on the parity of high and low. | Math | Easy | null |
863 | okay cool 863 over notes distant k in binary tree were given a binary would know we a target n a talking node and an integer value k we turn this all ye or I cannot read today we turn a list of all the return a list of the values of all notes that have a distant K from the talking node the ng can be returned any order ... | 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,560 | hi guys so given a non-empty array of so given a non-empty array of so given a non-empty array of non-negative integers the degree of this non-negative integers the degree of this non-negative integers the degree of this array is defined as the maximum frequency of any one of its elements so your task is to find the sm... | Most Visited Sector in a Circular Track | number-of-students-doing-homework-at-a-given-time | Given an integer `n` and an integer array `rounds`. We have a circular track which consists of `n` sectors labeled from `1` to `n`. A marathon will be held on this track, the marathon consists of `m` rounds. The `ith` round starts at sector `rounds[i - 1]` and ends at sector `rounds[i]`. For example, round 1 starts at ... | Imagine that startTime[i] and endTime[i] form an interval (i.e. [startTime[i], endTime[i]]). The answer is how many times the queryTime laid in those mentioned intervals. | Array | Easy | null |
78 | everyone welcome back and let's write some more neat code today so today let's solve the problem subsets so we are given an integer array nums and all we need to do is return every single possible subset that we could create from the input nums and we do not want to include any duplicate subsets so what is a subset wel... | Subsets | subsets | Given an integer array `nums` of **unique** elements, return _all possible_ _subsets_ _(the power set)_.
The solution set **must not** contain duplicate subsets. Return the solution in **any order**.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[\],\[1\],\[2\],\[1,2\],\[3\],\[1,3\],\[2,3\],\[1,2,3\]\]
... | null | Array,Backtracking,Bit Manipulation | Medium | 90,320,800,2109,2170 |
98 | hello everyone welcome to another one of my lead code videos and this one we'll do lead code 98 validate binary search tree so we're basically given a binary search tree or a binary tree and we need to validate if it is actually a binary search tree or not right so let's first understand what are the properties of a va... | Validate Binary Search Tree | validate-binary-search-tree | Given the `root` of a binary tree, _determine if it is a valid binary search tree (BST)_.
A **valid BST** is defined as follows:
* The left subtree of a node contains only nodes with keys **less than** the node's key.
* The right subtree of a node contains only nodes with keys **greater than** the node's key.
* ... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | 94,501 |
857 | hello guys now let's try to solve the minimum cuts at your higher care workers LZ a statement there are earn workers the ISO worker has a quality I and the minimum wage expectation which I now we want to hire exactly care workers to form a para group where higher group of care workers we must pay them according to the ... | Minimum Cost to Hire K Workers | positions-of-large-groups | There are `n` workers. You are given two integer arrays `quality` and `wage` where `quality[i]` is the quality of the `ith` worker and `wage[i]` is the minimum wage expectation for the `ith` worker.
We want to hire exactly `k` workers to form a paid group. To hire a group of `k` workers, we must pay them according to ... | null | String | Easy | 2260 |
268 | hello hi guys good morning welcome back to a new video again if you have not watched the Sunday's fourth question weekly contest then please go and watch it yesterday night uh the video is out so in this VY problem U missing numbers it has been asked by Apple alobi Microsoft Google Apple Nvidia sorry Amazon Adobe Micro... | 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 |
373 | 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 Fine K Pers With Small Sums Problem Ch Is Late In Lead Code It Is A Medium Level Problem And Has been added in a number of companies which I will be mentioning in the ... | Find K Pairs with Smallest Sums | find-k-pairs-with-smallest-sums | You are given two integer arrays `nums1` and `nums2` sorted in **ascending order** and an integer `k`.
Define a pair `(u, v)` which consists of one element from the first array and one element from the second array.
Return _the_ `k` _pairs_ `(u1, v1), (u2, v2), ..., (uk, vk)` _with the smallest sums_.
**Example 1:**... | null | Array,Heap (Priority Queue) | Medium | 378,719,2150 |
239 | In this video we will discuss the problem of sliding window maximum. In this problem you have got an interior billion and along with it you have been given the value of 1. You have to consider the window size of k like from zero to k - 1 to k tu se k. + 1 like from zero to k - 1 to k tu se k. + 1 like from zero to k - ... | Sliding Window Maximum | sliding-window-maximum | You are given an array of integers `nums`, there is a sliding window of size `k` which is moving from the very left of the array to the very right. You can only see the `k` numbers in the window. Each time the sliding window moves right by one position.
Return _the max sliding window_.
**Example 1:**
**Input:** nums... | How about using a data structure such as deque (double-ended queue)? The queue size need not be the same as the window’s size. Remove redundant elements and the queue should store only elements that need to be considered. | Array,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue | Hard | 76,155,159,265,1814 |
1,991 | hello everyone welcome to coding culture this channel will contain those programs whose explanation is either not present on youtube or the explanation is present but not up to the mark so without wasting time let's get started so today's question is actually this question was asked in today's contest on 4th september ... | Find the Middle Index in Array | league-statistics | Given a **0-indexed** integer array `nums`, find the **leftmost** `middleIndex` (i.e., the smallest amongst all the possible ones).
A `middleIndex` is an index where `nums[0] + nums[1] + ... + nums[middleIndex-1] == nums[middleIndex+1] + nums[middleIndex+2] + ... + nums[nums.length-1]`.
If `middleIndex == 0`, the lef... | null | Database | Medium | null |
1,011 | all right let's talk about capacity to ship package within d-day so ship package within d-day so ship package within d-day so this is a long description so pretty much you have to return this weight capacity of the ship they will result all the package on the conveyor belt being shipped within base days so this is the ... | Capacity To Ship Packages Within D Days | flip-binary-tree-to-match-preorder-traversal | A conveyor belt has packages that must be shipped from one port to another within `days` days.
The `ith` package on the conveyor belt has a weight of `weights[i]`. Each day, we load the ship with packages on the conveyor belt (in the order given by `weights`). We may not load more weight than the maximum weight capaci... | null | Tree,Depth-First Search,Binary Tree | Medium | null |
9 | hello and welcome to the ninth video in this leak Crete and c-sharp Series in this leak Crete and c-sharp Series in this leak Crete and c-sharp Series in this video we're going to be doing the challenge called palindrome number so let's go over to our leak code and let's get started so given an integer X return 3 if x ... | Palindrome Number | palindrome-number | Given an integer `x`, return `true` _if_ `x` _is a_ _**palindrome**__, and_ `false` _otherwise_.
**Example 1:**
**Input:** x = 121
**Output:** true
**Explanation:** 121 reads as 121 from left to right and from right to left.
**Example 2:**
**Input:** x = -121
**Output:** false
**Explanation:** From left to right, i... | Beware of overflow when you reverse the integer. | Math | Easy | 234,1375 |
1,335 | How are you all, Azamgarh Problem D Give Minimum Difficulty Offer Job Schedule, So here I zoom you in, so you pause the video and read the question once and I understand you well with this input, then it is okay. Let us see what this question is trying to say, this question is telling you that brother must have given y... | Minimum Difficulty of a Job Schedule | maximum-candies-allocated-to-k-children | You want to schedule a list of jobs in `d` days. Jobs are dependent (i.e To work on the `ith` job, you have to finish all the jobs `j` where `0 <= j < i`).
You have to finish **at least** one task every day. The difficulty of a job schedule is the sum of difficulties of each day of the `d` days. The difficulty of a da... | For a fixed number of candies c, how can you check if each child can get c candies? Use binary search to find the maximum c as the answer. | Array,Binary Search | Medium | 907,1886,2000,2027,2188,2294 |
1,984 | hello everyone welcome again to another video we have um today minimum difference between highest and lowest K scores right so basically the question is saying that we have been given a number K right and then you take um k many elements in the um you know the list that you've been given which is nums and then you find... | Minimum Difference Between Highest and Lowest of K Scores | maximum-distance-between-a-pair-of-values | You are given a **0-indexed** integer array `nums`, where `nums[i]` represents the score of the `ith` student. You are also given an integer `k`.
Pick the scores of any `k` students from the array so that the **difference** between the **highest** and the **lowest** of the `k` scores is **minimized**.
Return _the **m... | Since both arrays are sorted in a non-increasing way this means that for each value in the first array. We can find the farthest value smaller than it using binary search. There is another solution using a two pointers approach since the first array is non-increasing the farthest j such that nums2[j] ≥ nums1[i] is at l... | Array,Two Pointers,Binary Search,Greedy | Medium | 2199 |
41 | what's up everyone today we're gonna go really code 41 first missing positive now the input is going to be an array of integers and the output needs to be an integer so let's look at a few inputs and outputs so given an input of 1 to 0 we can see the first missing positive from that array is 3 so here we have a number ... | First Missing Positive | first-missing-positive | Given an unsorted integer array `nums`, return the smallest missing positive integer.
You must implement an algorithm that runs in `O(n)` time and uses constant extra space.
**Example 1:**
**Input:** nums = \[1,2,0\]
**Output:** 3
**Explanation:** The numbers in the range \[1,2\] are all in the array.
**Example 2:*... | Think about how you would solve the problem in non-constant space. Can you apply that logic to the existing space? We don't care about duplicates or non-positive integers Remember that O(2n) = O(n) | Array,Hash Table | Hard | 268,287,448,770 |
1,921 | Hi all my name is Deepak Singh and today we are going to see the lead code PD question of seventh of October and this is a very good question okay so now read the question what is that eliminate the maximum number of monster means devils we Eliminate people, means to remove, okay, if you read what is the condition, the... | Eliminate Maximum Number of Monsters | eliminate-maximum-number-of-monsters | You are playing a video game where you are defending your city from a group of `n` monsters. You are given a **0-indexed** integer array `dist` of size `n`, where `dist[i]` is the **initial distance** in kilometers of the `ith` monster from the city.
The monsters walk toward the city at a **constant** speed. The speed... | null | null | Medium | null |
937 | hey so welcome back in this another daily kill prom so today it's called reorder data in log files it's medium level problem but this one's actually a pretty good one oh I don't want to show you that just yet I would say that this one's much more like what you would expect to be seeing like on the job a lot of people t... | Reorder Data in Log Files | online-stock-span | You are given an array of `logs`. Each log is a space-delimited string of words, where the first word is the **identifier**.
There are two types of logs:
* **Letter-logs**: All words (except the identifier) consist of lowercase English letters.
* **Digit-logs**: All words (except the identifier) consist of digits... | null | Stack,Design,Monotonic Stack,Data Stream | Medium | 739 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.