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 |
|---|---|---|---|---|---|---|---|---|
435 | hey everyone today we are going to subscribe the question non-overlapping subscribe the question non-overlapping subscribe the question non-overlapping intervals so you are given array of intervals where intervals I equals dot I and I return the minimum number of intervals you need to remove to make the rest of the int... | Non-overlapping Intervals | non-overlapping-intervals | Given an array of intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping_.
**Example 1:**
**Input:** intervals = \[\[1,2\],\[2,3\],\[3,4\],\[1,3\]\]
**Output:** 1
**Explanation:** \[1,3\] can be removed ... | null | Array,Dynamic Programming,Greedy,Sorting | Medium | 452 |
363 | hey everybody this is larry this is the third day of july and therefore the third day of the july league daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's farm maximum rectangle no longer larger than k okay so i usually solve these live um and every... | Max Sum of Rectangle No Larger Than K | max-sum-of-rectangle-no-larger-than-k | Given an `m x n` matrix `matrix` and an integer `k`, return _the max sum of a rectangle in the matrix such that its sum is no larger than_ `k`.
It is **guaranteed** that there will be a rectangle with a sum no larger than `k`.
**Example 1:**
**Input:** matrix = \[\[1,0,1\],\[0,-2,3\]\], k = 2
**Output:** 2
**Explana... | null | Array,Binary Search,Dynamic Programming,Matrix,Ordered Set | Hard | null |
285 | hello welcome back in the next two videos I will talk about in order successor in BST or binary search tree this question is from Linko which is equivalent to Leo 285 that Leal question is a Leal premium question but you can go to Linko and do this for free I'm not associated with Linko and that this is not an endorsem... | Inorder Successor in BST | inorder-successor-in-bst | Given the `root` of a binary search tree and a node `p` in it, return _the in-order successor of that node in the BST_. If the given node has no in-order successor in the tree, return `null`.
The successor of a node `p` is the node with the smallest key greater than `p.val`.
**Example 1:**
**Input:** root = \[2,1,3\... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | 94,173,509 |
286 | welcome back everyone we're gonna be solving Lee code 286 walls and Gates so we're given an M by n grid called rooms initialized with three possible values negative one for a wall or an obstacle a zero for a gate and Infinity for an empty room we need to fill each empty room with the distance to its nearest gate if it'... | Walls and Gates | walls-and-gates | You are given an `m x n` grid `rooms` initialized with these three possible values.
* `-1` A wall or an obstacle.
* `0` A gate.
* `INF` Infinity means an empty room. We use the value `231 - 1 = 2147483647` to represent `INF` as you may assume that the distance to a gate is less than `2147483647`.
Fill each empt... | null | Array,Breadth-First Search,Matrix | Medium | 130,200,317,865,1036 |
141 | hello and welcome to another video in this video we're going to be working on a link list cycle and this problem you're given the head of a link list and you want to determine if the link list has a cycle and then you want to say true if it does and false if it doesn't and so you're given the head of a list then you're... | Linked List Cycle | linked-list-cycle | Given `head`, the head of a linked list, determine if the linked list has a cycle in it.
There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that tail's `next` pointer is co... | null | Hash Table,Linked List,Two Pointers | Easy | 142,202 |
378 | hey yo what's up my little coders let me show you in this tutorial how to solve the lethal question number 378 kate's smallest element in assorted matrix basically we're given an n by n matrix where each of the rows and columns are sorted in the ascending order and we need to return the gates smallest element in the ma... | 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 |
454 | el. address tutorial for basic for interface us suan us story mode of the pools of us weekly and that force one in the input and for sale in hand made for her them, etc. the one here it is one is for pure and Libra af-1 for in the hydra pure and Libra af-1 for in the hydra pure and Libra af-1 for in the hydra cell doub... | 4Sum II | 4sum-ii | Given four integer arrays `nums1`, `nums2`, `nums3`, and `nums4` all of length `n`, return the number of tuples `(i, j, k, l)` such that:
* `0 <= i, j, k, l < n`
* `nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0`
**Example 1:**
**Input:** nums1 = \[1,2\], nums2 = \[-2,-1\], nums3 = \[-1,2\], nums4 = \[0,2\]
**Ou... | null | Array,Hash Table | Medium | 18 |
31 | today we will solve leak code 31 this code demonstrates the next permutation algorithm which generates the next lexicographically greater permutation of a sequence of numbers the function NP takes a vector of integers and implements the logic it begins by finding the first index I from the right where the sequence stop... | Next Permutation | next-permutation | A **permutation** of an array of integers is an arrangement of its members into a sequence or linear order.
* For example, for `arr = [1,2,3]`, the following are all the permutations of `arr`: `[1,2,3], [1,3,2], [2, 1, 3], [2, 3, 1], [3,1,2], [3,2,1]`.
The **next permutation** of an array of integers is the next le... | null | Array,Two Pointers | Medium | 46,47,60,267,1978 |
111 | question one of leaked code minimum depth of binary tree so given a binary tree find its minimum depth the minimum depth is the number of nodes along the shortest path from root node down to the nearest leaf node a leaf is a node with no children so we have this tree here nine for example is going to be pointing its ch... | Minimum Depth of Binary Tree | minimum-depth-of-binary-tree | Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
**Note:** A leaf is a node with no children.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 2
**Example 2:**
**Input:** root = \[2... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 102,104 |
230 | welcome back everyone we're gonna be solving leeco 230 kth smallest element in the BST so we're given the root of a binary search tree and an integer K we need to return the kth smallest value one indexed of all the values of the nodes in the tree so example one right we're given this tree of three one four and two wit... | Kth Smallest Element in a BST | kth-smallest-element-in-a-bst | Given the `root` of a binary search tree, and an integer `k`, return _the_ `kth` _smallest value (**1-indexed**) of all the values of the nodes in the tree_.
**Example 1:**
**Input:** root = \[3,1,4,null,2\], k = 1
**Output:** 1
**Example 2:**
**Input:** root = \[5,3,6,2,4,null,null,1\], k = 3
**Output:** 3
**Cons... | Try to utilize the property of a BST. Try in-order traversal. (Credits to @chan13) What if you could modify the BST node's structure? The optimal runtime complexity is O(height of BST). | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | 94,671 |
252 | another day another problem solid solve hello guys I hope you are all doing well today in this video we'll show you how to solve one of the premium problem meeting rooms so let's get started so the problem gave us an array of meetings times interval consisting of start and end times and they ask us if the person can at... | Meeting Rooms | meeting-rooms | Given an array of meeting time `intervals` where `intervals[i] = [starti, endi]`, determine if a person could attend all meetings.
**Example 1:**
**Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\]
**Output:** false
**Example 2:**
**Input:** intervals = \[\[7,10\],\[2,4\]\]
**Output:** true
**Constraints:**
* ... | null | Array,Sorting | Easy | 56,253 |
785 | hello guys now I try to solve the is graph bipartite even an undirected graph return true if and only if it's a bipartite we call that a graph is bipartite if we can split its set of nodes into two dependent independent success a and B such that every edge in the graph has one node in a and an anode in P the graph is g... | Is Graph Bipartite? | basic-calculator-iii | There is an **undirected** graph with `n` nodes, where each node is numbered between `0` and `n - 1`. You are given a 2D array `graph`, where `graph[u]` is an array of nodes that node `u` is adjacent to. More formally, for each `v` in `graph[u]`, there is an undirected edge between node `u` and node `v`. The graph has ... | null | Math,String,Stack,Recursion | Hard | 224,227,781,1736 |
669 | welcome to february's leeco challenge today's problem is trim a binary search tree given the root of a binary search tree and the lowest and highest boundaries as low and high trim the tree so that all its elements lies within low and high trimming the tree should not change the relative structure of the elements that ... | Trim a Binary Search Tree | trim-a-binary-search-tree | Given the `root` of a binary search tree and the lowest and highest boundaries as `low` and `high`, trim the tree so that all its elements lies in `[low, high]`. Trimming the tree should **not** change the relative structure of the elements that will remain in the tree (i.e., any node's descendant should remain a desce... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | null |
271 | hello friends we are not employed by a fan company so let's not stop lead coding till we get there today we are going to do encode and decode strings lead code problem and as you can see this is actually a lead code premium problem if we see some of the companies who have already asked this question where i want to get... | Encode and Decode Strings | encode-and-decode-strings | Design an algorithm to encode **a list of strings** to **a string**. The encoded string is then sent over the network and is decoded back to the original list of strings.
Machine 1 (sender) has the function:
string encode(vector strs) {
// ... your code
return encoded\_string;
}
Machine 2 (receiver) has the func... | null | Array,String,Design | Medium | 38,297,443,696 |
1,799 | okay so welcome back in this another daily go prom so today it's called maximum score after n operations and it's a hard level dynamic programming problem and so basically you're given an array here with a list of like n different numbers and you want to calculate the maximum score that you can receive after like n ope... | Maximize Score After N Operations | minimum-incompatibility | You are given `nums`, an array of positive integers of size `2 * n`. You must perform `n` operations on this array.
In the `ith` operation **(1-indexed)**, you will:
* Choose two elements, `x` and `y`.
* Receive a score of `i * gcd(x, y)`.
* Remove `x` and `y` from `nums`.
Return _the maximum score you can rec... | The constraints are small enough for a backtrack solution but not any backtrack solution If we use a naive n^k don't you think it can be optimized | Array,Dynamic Programming,Bit Manipulation,Bitmask | Hard | null |
1,930 | hello and welcome to another video in this problem we're going to be working on unique link three pound dromic subsequences and in the problem you're given a string s and you want to return the number of unique P DRS of length three that are a subsequence of S note that there are multiple ways to obtain it and it's onl... | 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 |
594 | welcome to february's leeco challenge today's problem is longest harmonious subsequence we define a harmonious array as an array where the difference between its max and min is exactly one given an integer array we turn the length of its longest harmonious subsequence among all possible subsequences now subsequence is ... | Longest Harmonious Subsequence | longest-harmonious-subsequence | We define a harmonious array as an array where the difference between its maximum value and its minimum value is **exactly** `1`.
Given an integer array `nums`, return _the length of its longest harmonious subsequence among all its possible subsequences_.
A **subsequence** of array is a sequence that can be derived f... | null | Array,Hash Table,Sorting | Easy | null |
1,945 | welcome back everyone we're gonna be solving Lee code 1945 sum of digits of string after convert so we're given a string s which consists of lowercase English letters and an integer k we first need to convert that string into an integer by replacing every letter with it with its position in the alphabet so a would be 1... | Sum of Digits of String After Convert | finding-the-users-active-minutes | You are given a string `s` consisting of lowercase English letters, and an integer `k`.
First, **convert** `s` into an integer by replacing each letter with its position in the alphabet (i.e., replace `'a'` with `1`, `'b'` with `2`, ..., `'z'` with `26`). Then, **transform** the integer by replacing it with the **sum ... | Try to find the number of different minutes when action happened for each user. For each user increase the value of the answer array index which matches the UAM for this user. | Array,Hash Table | Medium | null |
706 | hey everyone welcome back and today we'll be doing another lead code problem uh 706 designer hash map this is an easy one given a hashmap without using any built-in Library uh designer hashmap built-in Library uh designer hashmap built-in Library uh designer hashmap without using any built-in hash table without using a... | Design HashMap | design-hashmap | Design a HashMap without using any built-in hash table libraries.
Implement the `MyHashMap` class:
* `MyHashMap()` initializes the object with an empty map.
* `void put(int key, int value)` inserts a `(key, value)` pair into the HashMap. If the `key` already exists in the map, update the corresponding `value`.
* ... | null | null | Easy | null |
424 | hello and welcome back Fila colors this is godman sequest and we've got another exciting coding challenge line up for you today it's going to be a fun ride so let's Dive Right In and see how it works now let's figure out the problem statement here you are given a string s and an integer K and you can choose any charact... | Longest Repeating Character Replacement | longest-repeating-character-replacement | You are given a string `s` and an integer `k`. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most `k` times.
Return _the length of the longest substring containing the same letter you can get after performing the above operations_.
... | null | Hash Table,String,Sliding Window | Medium | 340,1046,2119,2134,2319 |
7 | let us now discuss about reversing a number let's say we have a number like 1 2 3. so reversing means it should become 3 2 1. so Here If You observe 1 2 3 is nothing bad 100 plus 20 plus three so it gives 123. so here it is 300 plus 20 Plus 1. 321 so here the unit digit is 3 unit digit 10th digit 100 digit so this unit... | 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 |
133 | Jhaal Hello Hi Guys Welcome To Code Virus Today's Question Is Clone Graph In This Question Yagya One Arrested Under The Grass And Will Give Directions Mode Resident Means New Delhi Bihar Ke Mandir Force Note Anju Singh Dodiya And Travels Switch Off This Notes Hindi Graph Now Doing This Question Has Written Reddy Copy O... | Clone Graph | clone-graph | Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph.
Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph.
Each node in the graph contains a value (`int`) and a list (`List[Node]`)... | null | Hash Table,Depth-First Search,Breadth-First Search,Graph | Medium | 138,1624,1634 |
1,002 | hey there how are you I hope you're fine today we are going to learn about finding common characters in a list of words let's first look at what the question asks so we are given a list of words we simply have to find out what characters are common in each word given in the list also we have to keep in mind that how ma... | Find Common Characters | maximum-width-ramp | Given a string array `words`, return _an array of all characters that show up in all strings within the_ `words` _(including duplicates)_. You may return the answer in **any order**.
**Example 1:**
**Input:** words = \["bella","label","roller"\]
**Output:** \["e","l","l"\]
**Example 2:**
**Input:** words = \["cool"... | null | Array,Stack,Monotonic Stack | Medium | null |
1,812 | let's solve lead code 1812 determine color of a chess board Square so given a chess so the input would be coordinates of the chess board A1 for example right A1 or H3 or C7 so the first character represents the x axis right and the second character represents the y- represents the y- represents the y- axis okay so the ... | Determine Color of a Chessboard Square | reformat-phone-number | You are given `coordinates`, a string that represents the coordinates of a square of the chessboard. Below is a chessboard for your reference.
Return `true` _if the square is white, and_ `false` _if the square is black_.
The coordinate will always represent a valid chessboard square. The coordinate will always have t... | Discard all the spaces and dashes. Use a while loop. While the string still has digits, check its length and see which rule to apply. | String | Easy | null |
89 | to my legal suffering section so this problem is called the gray code great code so this problem is uh really important that because we will use these results uh in the other videos so the grade code is a binary numerical system whose word to consecutive accounts excessive other successive values differ in only one bit... | Gray Code | gray-code | An **n-bit gray code sequence** is a sequence of `2n` integers where:
* Every integer is in the **inclusive** range `[0, 2n - 1]`,
* The first integer is `0`,
* An integer appears **no more than once** in the sequence,
* The binary representation of every pair of **adjacent** integers differs by **exactly one ... | null | Math,Backtracking,Bit Manipulation | Medium | 717 |
207 | hey everyone today we'll be going over course schedule so the problem statement is as follows we have a total of num courses that we wanna tweak and they're labeled from 0 to num courses minus 1 so if I have 5 courses I want to take the courses would be labeled from 0 to 4 now some courses may have requirements so I ca... | Course Schedule | course-schedule | There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`.
* For example, the pair `[0, 1]`, indicates that to take cou... | This problem is equivalent to finding if a cycle exists in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topologica... | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 210,261,310,630 |
1,792 | hey what's up guys uh this is chung here again so uh design 1792 maximum average pass ratio okay so there's a school has a classes of students and each class will be having a final exam and you basically you're given like a 2d integer array classes here where the uh there are two elements in it the first one is the pas... | Maximum Average Pass Ratio | find-the-most-competitive-subsequence | There is a school that has classes of students and each class will be having a final exam. You are given a 2D integer array `classes`, where `classes[i] = [passi, totali]`. You know beforehand that in the `ith` class, there are `totali` total students, but only `passi` number of students will pass the exam.
You are al... | In lexicographical order, the elements to the left have higher priority than those that come after. Can you think of a strategy that incrementally builds the answer from left to right? | Array,Stack,Greedy,Monotonic Stack | Medium | 402,1159 |
45 | Hello Everyone and Welcome Back to my Channel Algorithm A Today I am going to write the code and also explain to you all the algorithm to solve this jump game part two problem which is there in lead code it is a medium level problem and we are Going to solve it using the Gerry algorithm also this problem can be conside... | 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 |
120 | hey everyone today we are going to solve the little question triangle you are given triangle array written the minimum path sum from top to bottom for each step you may move to adjacent number of the row below more formally if you are on the index I on the current row you may move to either index I or index I plus 1 on... | Triangle | triangle | Given a `triangle` array, return _the minimum path sum from top to bottom_.
For each step, you may move to an adjacent number of the row below. More formally, if you are on index `i` on the current row, you may move to either index `i` or index `i + 1` on the next row.
**Example 1:**
**Input:** triangle = \[\[2\],\[... | null | Array,Dynamic Programming | Medium | null |
1,496 | Hello everyone welcome to my channel code sari with mike so today we are going to do video number 14 of our lead code easy playlist it is a very easy question lead code number is 1496 ok the name of the question is path crossing it says that there is a given string whose The name is path, it can be either A, S, E, or T... | Path Crossing | lucky-numbers-in-a-matrix | Given a string `path`, where `path[i] = 'N'`, `'S'`, `'E'` or `'W'`, each representing moving one unit north, south, east, or west, respectively. You start at the origin `(0, 0)` on a 2D plane and walk on the path specified by `path`.
Return `true` _if the path crosses itself at any point, that is, if at any time you ... | Find out and save the minimum of each row and maximum of each column in two lists. Then scan through the whole matrix to identify the elements that satisfy the criteria. | Array,Matrix | Easy | null |
246 | hey guys how's everything going this is Jay sir who is not good at algorithms in this video I'm going to take a look at 2 4 6 struggle chromatic number this is mark an easy a struggle chromatic number is a number that looks like same we wrote it 100 degrees looked at upside down write a function to determine if a numbe... | Strobogrammatic Number | strobogrammatic-number | Given a string `num` which represents an integer, return `true` _if_ `num` _is a **strobogrammatic number**_.
A **strobogrammatic number** is a number that looks the same when rotated `180` degrees (looked at upside down).
**Example 1:**
**Input:** num = "69 "
**Output:** true
**Example 2:**
**Input:** num = "88... | null | Hash Table,Two Pointers,String | Easy | 247,248,1069 |
2,000 | I have solved over 2 000 legal problems in a year here are some tips I've learned to help you save time and leave code efficiently one focus on easies first especially for beginners often you will see mediums use easys as sub problems and hards use mediums as sub problems so it's important to Master easys first two mem... | Reverse Prefix of Word | minimum-speed-to-arrive-on-time | Given a **0-indexed** string `word` and a character `ch`, **reverse** the segment of `word` that starts at index `0` and ends at the index of the **first occurrence** of `ch` (**inclusive**). If the character `ch` does not exist in `word`, do nothing.
* For example, if `word = "abcdefd "` and `ch = "d "`, then you s... | Given the speed the trains are traveling at, can you find the total time it takes for you to arrive? Is there a cutoff where any speeds larger will always allow you to arrive on time? | Array,Binary Search | Medium | 1335,2013,2294 |
1,779 | all right guys welcome back to study plan programming skills day three we still in day three and we should be in the day four was really it's really hard to tackle all these studies plan at once so let's do the last problem in the day three then this problem is find nearest points that are the same x and y coordinates ... | Find Nearest Point That Has the Same X or Y Coordinate | hopper-company-queries-i | You are given two integers, `x` and `y`, which represent your current location on a Cartesian grid: `(x, y)`. You are also given an array `points` where each `points[i] = [ai, bi]` represents that a point exists at `(ai, bi)`. A point is **valid** if it shares the same x-coordinate or the same y-coordinate as your loca... | null | Database | Hard | 262,1785,1795,2376 |
735 | welcome to october's leeco challenge today's problem is asteroid collision you are given an array asteroids of integers representing asteroids in a row for each asteroid the absolute value represents its size and the sign represents its direction positive means the asteroid's going right and negative means the asteroid... | Asteroid Collision | asteroid-collision | We are given an array `asteroids` of integers representing asteroids in a row.
For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed.
Find out the state of the asteroids after all collisio... | Say a row of asteroids is stable. What happens when a new asteroid is added on the right? | Array,Stack | Medium | 605,2245,2317 |
133 | welcome to this video where we will learn how to clone a graph we have a graph and we are given a vertex that can reach all other vertices and we are asked to create a deep copy of the graph we have to create new vertices both by keeping the same values and the same connections to solve this problem we can think of cre... | Clone Graph | clone-graph | Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph.
Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph.
Each node in the graph contains a value (`int`) and a list (`List[Node]`)... | null | Hash Table,Depth-First Search,Breadth-First Search,Graph | Medium | 138,1624,1634 |
112 | hello there so today we will solve one of the problem on lead code problem number 112. uh it is related to path sum so you will be given a suppose a binary tree and the target sum so if the binary tree has the target sum in any of its box then you need to return true else you need to return false okay so in this case u... | Path Sum | path-sum | Given the `root` of a binary tree and an integer `targetSum`, return `true` if the tree has a **root-to-leaf** path such that adding up all the values along the path equals `targetSum`.
A **leaf** is a node with no children.
**Example 1:**
**Input:** root = \[5,4,8,11,null,13,4,7,2,null,null,null,1\], targetSum = 22... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 113,124,129,437,666 |
198 | okay let's solve leak code 198 house robber in my opinion this is such a good question to understand even though it's just an easy question you can learn so much about dynamic programming from this problem and you might already know Google really loves asking dynamic programming problems and if you want to get started ... | House Robber | house-robber | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and **it will automatically contact the police if two adjacent houses were broken into... | null | Array,Dynamic Programming | Medium | 152,213,256,276,337,600,656,740,2262 |
827 | hello and welcome back to the cracking fang youtube channel today we're going to be solving leak code problem 827 making a large island before we get into this problem i just want to say if you haven't watched my videos on either max area of an island or number of islands please go watch those videos we're going to be ... | Making A Large Island | expressive-words | You are given an `n x n` binary matrix `grid`. You are allowed to change **at most one** `0` to be `1`.
Return _the size of the largest **island** in_ `grid` _after applying this operation_.
An **island** is a 4-directionally connected group of `1`s.
**Example 1:**
**Input:** grid = \[\[1,0\],\[0,1\]\]
**Output:** ... | null | Array,Two Pointers,String | Medium | null |
168 | That In This Problem Business Convert A Number To Back Reporting Column In Excel Sheet You All Must Have Used Excel Sheet Android Columbus Rose Number One Two Three Four And When Everything Starts From Government In More BCD Withdrawal Single Digit Names Start With Eggs Paying Them All Subscribe Do a goodbye subscribe ... | Excel Sheet Column Title | excel-sheet-column-title | Given an integer `columnNumber`, return _its corresponding column title as it appears in an Excel sheet_.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
**Example 1:**
**Input:** columnNumber = 1
**Output:** "A "
**Example 2:**
**Input:** columnNumber = 28
**Output:** "AB "
**Example 3:**... | null | Math,String | Easy | 171,2304 |
297 | hello friends welcome to join our flight so today once again we are going to look at a hard level problem from lead code the problem number is 297. it's about serialized and dc realize a binary tree it's a hard problem so the description says serialization is the process of converting a data structure or object into a ... | Serialize and Deserialize Binary Tree | serialize-and-deserialize-binary-tree | Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment.
Design an algorithm to serialize and deserialize a bi... | null | String,Tree,Depth-First Search,Breadth-First Search,Design,Binary Tree | Hard | 271,449,652,765 |
65 | okay so lead code practice time so in this video there are two goals the first one is to see how to solve this problem and the second one is to see how to solve this problem properly in the interview so okay and interview so remember the first thing in the interview is to always try to understand the problem if there i... | Valid Number | valid-number | A **valid number** can be split up into these components (in order):
1. A **decimal number** or an **integer**.
2. (Optional) An `'e'` or `'E'`, followed by an **integer**.
A **decimal number** can be split up into these components (in order):
1. (Optional) A sign character (either `'+'` or `'-'`).
2. One of the... | null | String | Hard | 8 |
502 | hello everyone let's solve problem 502 that is IPO suppose lead code will start its IPO soon in order to sell a good price of its shares to venture capital it could 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 care distinct projects... | 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 |
389 | hello everyone this is our first video on this channel and today we'll be solving an easy lit code question that is find a difference the number is 389 so question says that you are given two strings s and t string s is generated by randomly shuffling string s and then add one more letter at any random position so we n... | Find the Difference | find-the-difference | You are given two strings `s` and `t`.
String `t` is generated by random shuffling string `s` and then add one more letter at a random position.
Return the letter that was added to `t`.
**Example 1:**
**Input:** s = "abcd ", t = "abcde "
**Output:** "e "
**Explanation:** 'e' is the letter that was added.
**Exam... | null | Hash Table,String,Bit Manipulation,Sorting | Easy | 136 |
885 | This problem is the third problem of the spy real matrix with l code number 885. Now, it is a medium difficulty problem. Now, what about a two-dimensional array? what about a two-dimensional array? what about a two-dimensional array? Gauss is given there again, and Laos is given the opportunity to write the number of c... | Spiral Matrix III | exam-room | You start at the cell `(rStart, cStart)` of an `rows x cols` grid facing east. The northwest corner is at the first row and column in the grid, and the southeast corner is at the last row and column.
You will walk in a clockwise spiral shape to visit every position in this grid. Whenever you move outside the grid's bo... | null | Design,Ordered Set | Medium | 879 |
304 | hi my name is and today i'm trying to solve this problem which is a zoom led code problem the question is ransom quality to the immutable the a matrix has been given to me and we'll have to handle the multiple query and the query is given as a formula top left corner top left uh coordinate and the bottom right corner c... | Range Sum Query 2D - Immutable | range-sum-query-2d-immutable | Given a 2D matrix `matrix`, handle multiple queries of the following type:
* Calculate the **sum** of the elements of `matrix` inside the rectangle defined by its **upper left corner** `(row1, col1)` and **lower right corner** `(row2, col2)`.
Implement the `NumMatrix` class:
* `NumMatrix(int[][] matrix)` Initial... | null | Array,Design,Matrix,Prefix Sum | Medium | 303,308 |
6 | in this video we'll go over leak code question number six zigzag conversion given a string and a certain number of rows we have to perform a zigzag conversion and return the result so what exactly is this zigzag conversion well let's say the string is hello world and the number of rows is three we can arrange the lette... | 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,710 | Scientist Hello How are you I am positive in good swords question is maximum unique and attract and devotion is so let's reader question you are assigned to put some amount of boxes on 21 pun Aryan today are ok sombir and number of units is ok and here Fine return on maximum total number of units that can be spotted on... | Maximum Units on a Truck | find-servers-that-handled-most-number-of-requests | You are assigned to put some amount of boxes onto **one truck**. You are given a 2D array `boxTypes`, where `boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]`:
* `numberOfBoxesi` is the number of boxes of type `i`.
* `numberOfUnitsPerBoxi` is the number of units in each box of the type `i`.
You are also given... | To speed up the next available server search, keep track of the available servers in a sorted structure such as an ordered set. To determine if a server is available, keep track of the end times for each task in a heap and add the server to the available set once the soonest task ending time is less than or equal to th... | Array,Greedy,Heap (Priority Queue),Ordered Set | Hard | null |
1,929 | welcome to my youtube channel so today we will try to do lead code 1929 problem where we'll try to solve how to concatenate errors so this one is accepted by 91 percent let's see okay so basically we have to do concatenation of arrays so if you have an input one two one what we want is we want to get one two one to one... | Concatenation of Array | maximum-value-at-a-given-index-in-a-bounded-array | Given an integer array `nums` of length `n`, you want to create an array `ans` of length `2n` where `ans[i] == nums[i]` and `ans[i + n] == nums[i]` for `0 <= i < n` (**0-indexed**).
Specifically, `ans` is the **concatenation** of two `nums` arrays.
Return _the array_ `ans`.
**Example 1:**
**Input:** nums = \[1,2,1\... | What if the problem was instead determining if you could generate a valid array with nums[index] == target? To generate the array, set nums[index] to target, nums[index-i] to target-i, and nums[index+i] to target-i. Then, this will give the minimum possible sum, so check if the sum is less than or equal to maxSum. n is... | Binary Search,Greedy | Medium | null |
394 | well you had it all figured out didn't you were told oh the number one fantasy for all those babes i see at the beach is a guy in his underwear at four in the morning illuminated by a 15-inch monitor doing c illuminated by a 15-inch monitor doing c illuminated by a 15-inch monitor doing c plus right that's exactly what... | Decode String | decode-string | Given an encoded string, return its decoded string.
The encoding rule is: `k[encoded_string]`, where the `encoded_string` inside the square brackets is being repeated exactly `k` times. Note that `k` is guaranteed to be a positive integer.
You may assume that the input string is always valid; there are no extra white... | null | String,Stack,Recursion | Medium | 471,726,1076 |
1,647 | hello everyone welcome to coding decoded my name is sanchez i am working as technical architect sd4 at adobe and here i present day 28th of june lead code challenge the problem that we have in today's minimum deletions to make character frequency unique it's a medium level question on lead code and i also feel the same... | 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 |
880 | hi guys welcome to algorithms made easy today we will be solving the question decoded string at index so let's go through the question first an encoded string s is given to find and write a decoded string to the tape the encoded string is read one character at a time and the following steps are taken if the character r... | Decoded String at Index | rectangle-area-ii | You are given an encoded string `s`. To decode the string to a tape, the encoded string is read one character at a time and the following steps are taken:
* If the character read is a letter, that letter is written onto the tape.
* If the character read is a digit `d`, the entire current tape is repeatedly written... | null | Array,Segment Tree,Line Sweep,Ordered Set | Hard | null |
451 | hi everyone welcome back to the channel and today we solve lead code daily challenge problem number 451 sort characters by frequency so it's a really easy problem to solve and we'll first check out the problem statement then we'll look into the approach which you're going to use and towards the end we'll see the code a... | 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,913 | Hello everyone welcome to my channel Codesari with Mike so today we are going to do video number 11 of the playlist of Lead Code Easy. Okay the lead code number is 1913 and it is a very simple question. The product difference between two pairs A & B & C & D is Defined as pairs A & B & C & D is D... | Maximum Product Difference Between Two Pairs | make-the-xor-of-all-segments-equal-to-zero | The **product difference** between two pairs `(a, b)` and `(c, d)` is defined as `(a * b) - (c * d)`.
* For example, the product difference between `(5, 6)` and `(2, 7)` is `(5 * 6) - (2 * 7) = 16`.
Given an integer array `nums`, choose four **distinct** indices `w`, `x`, `y`, and `z` such that the **product differ... | Let's note that for the XOR of all segments with size K to be equal to zeros, nums[i] has to be equal to nums[i+k] Basically, we need to make the first K elements have XOR = 0 and then modify them. | Array,Dynamic Programming,Bit Manipulation | Hard | null |
1,014 | so smart it's like not really fair this is 1014 best sightseeing pair don't you dare okay let's go ahead and get right into it so you're giving an integer array values where values I represents the value of the ith sightseeing spot okay so you have all these spots in the array at a certain index like an index I you hav... | Best Sightseeing Pair | k-closest-points-to-origin | You are given an integer array `values` where values\[i\] represents the value of the `ith` sightseeing spot. Two sightseeing spots `i` and `j` have a **distance** `j - i` between them.
The score of a pair (`i < j`) of sightseeing spots is `values[i] + values[j] + i - j`: the sum of the values of the sightseeing spots... | null | Array,Math,Divide and Conquer,Geometry,Sorting,Heap (Priority Queue),Quickselect | Medium | 215,347,692,1888 |
38 | this is the most confusing coding question I've ever seen the problem is called count and say and the count and say sequence is a sequence of Digit strings defined by this recursive formula count and say of one that is equal to the string of one but more generally count and say at n is the way you would say the digit s... | Count and Say | count-and-say | The **count-and-say** sequence is a sequence of digit strings defined by the recursive formula:
* `countAndSay(1) = "1 "`
* `countAndSay(n)` is the way you would "say " the digit string from `countAndSay(n-1)`, which is then converted into a different digit string.
To determine how you "say " a digit string, spli... | The following are the terms from n=1 to n=10 of the count-and-say sequence:
1. 1
2. 11
3. 21
4. 1211
5. 111221
6. 312211
7. 13112221
8. 1113213211
9. 31131211131221
10. 13211311123113112211 To generate the nth term, just count and say the n-1th term. | String | Medium | 271,443 |
1,926 | guys I'll be solving nearest exit from entrance and Maze and this is a typical um BFS question breath first um where we'll be searching our nearest neighbor with our length with size one and if it's not found and we don't encounter a row or column that meets the boundary of this Matrix then we increase our search range... | Nearest Exit from Entrance in Maze | products-price-for-each-store | You are given an `m x n` matrix `maze` (**0-indexed**) with empty cells (represented as `'.'`) and walls (represented as `'+'`). You are also given the `entrance` of the maze, where `entrance = [entrancerow, entrancecol]` denotes the row and column of the cell you are initially standing at.
In one step, you can move o... | null | Database | Easy | 1948 |
1,431 | Hello friends, welcome to the channel, this is lead code 1431, which is the number three question of lead code 75. We are preparing for 19 days in which I am making you do DA, so looking at the question, it is a very easy question, Kids with Greatest Number. Of candies, you just have to read the story, the question was... | Kids With the Greatest Number of Candies | all-ancestors-of-a-node-in-a-directed-acyclic-graph | There are `n` kids with candies. You are given an integer array `candies`, where each `candies[i]` represents the number of candies the `ith` kid has, and an integer `extraCandies`, denoting the number of extra candies that you have.
Return _a boolean array_ `result` _of length_ `n`_, where_ `result[i]` _is_ `true` _i... | Consider how reversing each edge of the graph can help us. How can performing BFS/DFS on the reversed graph help us find the ancestors of every node? | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 1912 |
240 | all right so let's talk about the social 2d metric too so you have to write an efficient algorithm and then there is a target in the metric and then you have to search for it right so here's it so this is a target so you can actually use a brutal force to traverse every single one of the columns i mean one of the cells... | 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 |
724 | hey there fellow coders welcome back to codemaster Quest I hope you are having a fantastic day because we are going to dive into another exciting problem today we are tackling the problem of finding the pivot index in an array so grab a cup of coffee sit back and let's get our code on here's the question description uh... | Find Pivot Index | find-pivot-index | Given an array of integers `nums`, calculate the **pivot index** of this array.
The **pivot index** is the index where the sum of all the numbers **strictly** to the left of the index is equal to the sum of all the numbers **strictly** to the index's right.
If the index is on the left edge of the array, then the left... | We can precompute prefix sums P[i] = nums[0] + nums[1] + ... + nums[i-1].
Then for each index, the left sum is P[i], and the right sum is P[P.length - 1] - P[i] - nums[i]. | Array,Prefix Sum | Easy | 560,2102,2369 |
1,770 | lead code challenge the problem that we have in today is maximum score from performing multiplication operation here in this question we are given two arrays nums array and multiplier array what do we need to identify the maximum score that can be generated after performing n operations and there are a few rules that a... | Maximum Score from Performing Multiplication Operations | minimum-deletions-to-make-character-frequencies-unique | You are given two **0-indexed** integer arrays `nums` and `multipliers` of size `n` and `m` respectively, where `n >= m`.
You begin with a score of `0`. You want to perform **exactly** `m` operations. On the `ith` operation (**0-indexed**) you will:
* Choose one integer `x` from **either the start or the end** of t... | As we can only delete characters, if we have multiple characters having the same frequency, we must decrease all the frequencies of them, except one. Sort the alphabet characters by their frequencies non-increasingly. Iterate on the alphabet characters, keep decreasing the frequency of the current character until it re... | String,Greedy,Sorting | Medium | 1355,2212 |
1,302 | hey what's up guys new ID here i detecting coding stuff on twitch in youtube today we're gonna be doing a tree problem called deepest leave some this medium problem it's actually a newer one got out recently and it's actually not it's pretty easy for a medium problem compared to there's an easy one like path some tree ... | Deepest Leaves Sum | delete-characters-to-make-fancy-string | Given the `root` of a binary tree, return _the sum of values of its deepest leaves_.
**Example 1:**
**Input:** root = \[1,2,3,4,5,null,6,7,null,null,null,null,8\]
**Output:** 15
**Example 2:**
**Input:** root = \[6,7,8,2,7,1,3,9,null,1,4,null,null,null,5\]
**Output:** 19
**Constraints:**
* The number of nodes i... | What's the optimal way to delete characters if three or more consecutive characters are equal? If three or more consecutive characters are equal, keep two of them and delete the rest. | String | Easy | null |
1,933 | hello so this question is check if string is decomposable into valid equal sub so what is valid equal string they have the same character same Char all right what does uh decompos mean like there must be a l of two um substr in the string if and others remaining l of three and you will only return true if you can decom... | Check if String Is Decomposable Into Value-Equal Substrings | number-of-different-integers-in-a-string | A **value-equal** string is a string where **all** characters are the same.
* For example, `"1111 "` and `"33 "` are value-equal strings.
* In contrast, `"123 "` is not a value-equal string.
Given a digit string `s`, decompose the string into some number of **consecutive value-equal** substrings where **exactly o... | Try to split the string so that each integer is in a different string. Try to remove each integer's leading zeroes and compare the strings to find how many of them are unique. | Hash Table,String | Easy | null |
74 | in this video we will solve a problem where we are given a 2d matrix or a 2d array and the numbers are sorted and we have to search in this so numbers in the rows are all sorted and so this increases in this order so 1 is the smallest then 7 it's increasing in this direction and in the next row it's more than the last ... | Search a 2D Matrix | search-a-2d-matrix | You are given an `m x n` integer matrix `matrix` with the following two properties:
* Each row is sorted in non-decreasing order.
* The first integer of each row is greater than the last integer of the previous row.
Given an integer `target`, return `true` _if_ `target` _is in_ `matrix` _or_ `false` _otherwise_.
... | null | Array,Binary Search,Matrix | Medium | 240 |
377 | hey everybody this is Larry this is day nine of the legal day challenge hopefully today's prime is slightly better than yesterday's uh weekly problem uh today's Farm is combo some four let's see which one it is I don't know there's so many of them but uh yeah okay so given the way of this thing integers nums and talkin... | 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 |
139 | Came in welcome to line repeat saturday will be looking and 10 this is absolutely challenge the name of the problem is border one this is a common problem which has been around product companies cylinder problem shatter given in this edition award containing laptop not limited to Manifest in this sentence Pet Saaf Mana... | 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 |
1,926 | hey everybody this is larry this is me going with q2 of the biweekly contest 56 nearest exit from entrance and maze so this is a very straightforward breakfast search farm definitely recommend doing you know being able to solve it because that is going to be on you know interviews is the level that everyone expects so ... | Nearest Exit from Entrance in Maze | products-price-for-each-store | You are given an `m x n` matrix `maze` (**0-indexed**) with empty cells (represented as `'.'`) and walls (represented as `'+'`). You are also given the `entrance` of the maze, where `entrance = [entrancerow, entrancecol]` denotes the row and column of the cell you are initially standing at.
In one step, you can move o... | null | Database | Easy | 1948 |
129 | hey guys welcome back today we're solving the problem some route to leave numbers we're given the root of a binary tree and this binary tree contains digits running from 0 to 9 only our task is to find the sum of the root to leave numbers like in this case we have this Leaf node 5 and we have a path running from the ro... | Sum Root to Leaf Numbers | sum-root-to-leaf-numbers | You are given the `root` of a binary tree containing digits from `0` to `9` only.
Each root-to-leaf path in the tree represents a number.
* For example, the root-to-leaf path `1 -> 2 -> 3` represents the number `123`.
Return _the total sum of all root-to-leaf numbers_. Test cases are generated so that the answer w... | null | Tree,Depth-First Search,Binary Tree | Medium | 112,124,1030 |
24 | Ko Ek Hello Guys Welcome Parivartan Se Aapne Subscribe And It's Not Removed It's Not Modified Subscribe To Hain To In Forces Loot-Loot subscribe In Forces Loot-Loot subscribe In Forces Loot-Loot subscribe Video subscribe The Video then subscribe to subscribe and subscribe the Channel that will update the future point o... | Swap Nodes in Pairs | swap-nodes-in-pairs | Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.)
**Example 1:**
**Input:** head = \[1,2,3,4\]
**Output:** \[2,1,4,3\]
**Example 2:**
**Input:** head = \[\]
**Output:** \[\... | null | Linked List,Recursion | Medium | 25,528 |
446 | welcome to september's leeco challenge today's problem is arithmetic slices 2 subsequence given an integer array nums we turn the number of all arithmetic subsequences of nums a sequence of numbers is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements ... | Arithmetic Slices II - Subsequence | arithmetic-slices-ii-subsequence | Given an integer array `nums`, return _the number of all the **arithmetic subsequences** of_ `nums`.
A sequence of numbers is called arithmetic if it consists of **at least three elements** and if the difference between any two consecutive elements is the same.
* For example, `[1, 3, 5, 7, 9]`, `[7, 7, 7, 7]`, and ... | null | Array,Dynamic Programming | Hard | 413 |
198 | hello everybody and welcome back to another video today we're going to be taking a look at leak code number 198 known as House robber now this is actually a very popular problem that's assed a lot of companies some of these companies include Google Amazon Adobe and many more now an important thing to note is a few year... | House Robber | house-robber | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and **it will automatically contact the police if two adjacent houses were broken into... | null | Array,Dynamic Programming | Medium | 152,213,256,276,337,600,656,740,2262 |
1,784 | that won't start with zero and then we have to attempt to i guess yes contains at most one contiguous segment of ones and this means contiguous blues one should i cure continuously and that should be one continuous segment opens so here are two continuous setup also uh so we will return falsies uh in example two uh yes... | Check if Binary String Has at Most One Segment of Ones | minimum-initial-energy-to-finish-tasks | Given a binary string `s` **without leading zeros**, return `true` _if_ `s` _contains **at most one contiguous segment of ones**_. Otherwise, return `false`.
**Example 1:**
**Input:** s = "1001 "
**Output:** false
**Explanation:** The ones do not form a contiguous segment.
**Example 2:**
**Input:** s = "1... | We can easily figure that the f(x) : does x solve this array is monotonic so binary Search is doable Figure a sorting pattern | Array,Greedy,Sorting | Hard | null |
1,431 | Question Bhai Kids start with the greatest number of Candice. Let's see what he is saying. Bhai, Candies is okay. Brother, every number in which there will be number of Candice will be revised. After cricket, it is okay brother, that is, two. What is three punch, one three, candies, okay, this is on zero, this is on ch... | Kids With the Greatest Number of Candies | all-ancestors-of-a-node-in-a-directed-acyclic-graph | There are `n` kids with candies. You are given an integer array `candies`, where each `candies[i]` represents the number of candies the `ith` kid has, and an integer `extraCandies`, denoting the number of extra candies that you have.
Return _a boolean array_ `result` _of length_ `n`_, where_ `result[i]` _is_ `true` _i... | Consider how reversing each edge of the graph can help us. How can performing BFS/DFS on the reversed graph help us find the ancestors of every node? | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 1912 |
968 | welcome to mazelico challenge today's problem is binary tree cameras given a binary tree we install cameras on the nodes of the tree now each camera at a node can monitor its parent itself and its immediate children now calculate the minimum number of cameras needed to monitor all the nodes of the tree so if we have th... | 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 |
870 | hey everybody this is larry this is day 24 of march nico daily challenge hit the like button to subscribe on drummond discord let me know what you think about this problem offended shovel coming to a razor b of equal size the furniture of a with respect to b is the number of indices i which is returning implementation ... | Advantage Shuffle | magic-squares-in-grid | You are given two integer arrays `nums1` and `nums2` both of the same length. The **advantage** of `nums1` with respect to `nums2` is the number of indices `i` for which `nums1[i] > nums2[i]`.
Return _any permutation of_ `nums1` _that maximizes its **advantage** with respect to_ `nums2`.
**Example 1:**
**Input:** nu... | null | Array,Math,Matrix | Medium | 1311 |
974 | Hello friends today I'm going to solve with good problem number 974 sub errorisms divisible by K so in this problem we are given an integer array nums and an integer value K we need to return the number of non-empty Subaru return the number of non-empty Subaru return the number of non-empty Subaru that have the sum div... | Subarray Sums Divisible by K | reorder-data-in-log-files | Given an integer array `nums` and an integer `k`, return _the number of non-empty **subarrays** that have a sum divisible by_ `k`.
A **subarray** is a **contiguous** part of an array.
**Example 1:**
**Input:** nums = \[4,5,0,-2,-3,1\], k = 5
**Output:** 7
**Explanation:** There are 7 subarrays with a sum divisible b... | null | Array,String,Sorting | Easy | null |
377 | The The The next question we're going to look at is combinations on distinct integers and a target interior target return D number of possible combinations come up tu target dance Okay so what we've done is tell us the number of combinations to make a four. How many combinations do we have, 1, 2 and three numbers? Here... | 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 |
849 | today I will be writing the solution for the problem maximum distance to closest person okay so it's an easy level problem so as I've already explained the logic so I'll start writing the code so first I need totally five variables so initially I'll need previous one which will be initialized as minus one and then I ne... | Maximize Distance to Closest Person | maximize-distance-to-closest-person | You are given an array representing a row of `seats` where `seats[i] = 1` represents a person sitting in the `ith` seat, and `seats[i] = 0` represents that the `ith` seat is empty **(0-indexed)**.
There is at least one empty seat, and at least one person sitting.
Alex wants to sit in the seat such that the distance b... | null | null | Medium | null |
57 | today we are going to discuss the liquid daily challenge which is insert interval uh this video will and this would be consist of this section in first section we will show the question in the second section we will show the approach and in the third section we will discuss the C plus solution now coming to question it... | Insert Interval | insert-interval | You are given an array of non-overlapping intervals `intervals` where `intervals[i] = [starti, endi]` represent the start and the end of the `ith` interval and `intervals` is sorted in ascending order by `starti`. You are also given an interval `newInterval = [start, end]` that represents the start and end of another i... | null | Array | Medium | 56,715 |
416 | hello welcome to my channel today we have leeco416 partition equal subset sum so given and non empty arrays nums containing only positive integer find if the array can be partitioned into two subsets such that the sum of uh element in both subset is equal so what's that mean is the input in this situation and we can pa... | 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 |
222 | hey guys welcome to my channel and in this video guys we are going to solve a really interesting coding interview question video which is question number 222 of lead code count complete three notes so without wasting any time further let's get started with the problem statement so basically guys the problem statement s... | Count Complete Tree Nodes | count-complete-tree-nodes | Given the `root` of a **complete** binary tree, return the number of the nodes in the tree.
According to **[Wikipedia](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled in a complete binary tree, and all nodes in the last level are as far lef... | null | Binary Search,Tree,Depth-First Search,Binary Tree | Medium | 270 |
1,748 | so this is the sum of unique elements problem on lead code and it's pretty simple uh classified isn't easy and the premise is okay given a list of numbers if something appears once uh returns of the sum of all those numbers otherwise you know ignore them and they use the word unique elements so right off the bat when i... | Sum of Unique Elements | best-team-with-no-conflicts | You are given an integer array `nums`. The unique elements of an array are the elements that appear **exactly once** in the array.
Return _the **sum** of all the unique elements of_ `nums`.
**Example 1:**
**Input:** nums = \[1,2,3,2\]
**Output:** 4
**Explanation:** The unique elements are \[1,3\], and the sum is 4.
... | First, sort players by age and break ties by their score. You can now consider the players from left to right. If you choose to include a player, you must only choose players with at least that score later on. | Array,Dynamic Programming,Sorting | Medium | null |
1,535 | That Sun should be praised by the ladies in this sense and should be boys and which is again a creation of inches. Now half an hour's time means absolutely there is a solution for this. Login is a matter of work for 200 people. So the first thing in it will be this side of a mixture, Hanuman. G A Fab Four Six Seven and... | Find the Winner of an Array Game | build-array-where-you-can-find-the-maximum-exactly-k-comparisons | Given an integer array `arr` of **distinct** integers and an integer `k`.
A game will be played between the first two elements of the array (i.e. `arr[0]` and `arr[1]`). In each round of the game, we compare `arr[0]` with `arr[1]`, the larger integer wins and remains at position `0`, and the smaller integer moves to t... | Use dynamic programming approach. Build dp table where dp[a][b][c] is the number of ways you can start building the array starting from index a where the search_cost = c and the maximum used integer was b. Recursively, solve the small sub-problems first. Optimize your answer by stopping the search if you exceeded k cha... | Dynamic Programming | Hard | null |
1,047 | Welcome all friends Adam will do this question in this video let's 1047 1000 47 question number remove all adjacent duplicates in a string ok so look at our example what is given in the input is given in the output is ka So what do I need to do, what is the right thing to do, first I should know this, now look, whateve... | Remove All Adjacent Duplicates In String | maximize-sum-of-array-after-k-negations | You are given a string `s` consisting of lowercase English letters. A **duplicate removal** consists of choosing two **adjacent** and **equal** letters and removing them.
We repeatedly make **duplicate removals** on `s` until we no longer can.
Return _the final string after all such duplicate removals have been made_... | null | Array,Greedy,Sorting | Easy | 2204 |
1,974 | all so this question is minimum time to type word using special typewriter and all right and let I'm going to explain the C in my own definition so you got a spinner something like this and um you want to type a letter then you explain this um what this called like a tool right so if you want to say oh I want to type a... | Minimum Time to Type Word Using Special Typewriter | find-customers-with-positive-revenue-this-year | There is a special typewriter with lowercase English letters `'a'` to `'z'` arranged in a **circle** with a **pointer**. A character can **only** be typed if the pointer is pointing to that character. The pointer is **initially** pointing to the character `'a'`.
Each second, you may perform one of the following operat... | null | Database | Easy | null |
7 | hello this is B Mo in our last video we solved the lead code problem to sum we solved it in an interview setting where we heard the problem we thought of ways that we could solve the problem using Brute Force approach we clarified some assumptions and asked some questions to the interviewer to let them know that our un... | 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 |
151 | let's discuss a programming question reverse words in a string so the problem statement is given an input string and we have to reverse the string word by word so in this problem we have given input a string and we have to reverse the string word by word so let's uh take few examples to understand this problem statemen... | Reverse Words in a String | reverse-words-in-a-string | Given an input string `s`, reverse the order of the **words**.
A **word** is defined as a sequence of non-space characters. The **words** in `s` will be separated by at least one space.
Return _a string of the words in reverse order concatenated by a single space._
**Note** that `s` may contain leading or trailing s... | null | Two Pointers,String | Medium | 186 |
375 | everyone welcome to my channel so in this video i'm going to cover the solution to this question and at the same time do some lab coding work i'm also going to follow the general stuff so you should follow in the coding interview when we solve this problem so let's get started before we start the real content for today... | Guess Number Higher or Lower II | guess-number-higher-or-lower-ii | We are playing the Guessing Game. The game will work as follows:
1. I pick a number between `1` and `n`.
2. You guess a number.
3. If you guess the right number, **you win the game**.
4. If you guess the wrong number, then I will tell you whether the number I picked is **higher or lower**, and you will continue gu... | The best strategy to play the game is to minimize the maximum loss you could possibly face. Another strategy is to minimize the expected loss. Here, we are interested in the first scenario. Take a small example (n = 3). What do you end up paying in the worst case? Check out this article if you're still stuck. The purel... | Math,Dynamic Programming,Game Theory | Medium | 294,374,464,658 |
26 | in this video we'll be going over remove duplicates from sorted array so given assorted array numbers remove the duplicates in place such that a new element appear only once and return the new life do not allocate extra space for another array you must do this by modifying the input array in place and over one actual m... | Remove Duplicates from Sorted Array | remove-duplicates-from-sorted-array | Given an integer array `nums` sorted in **non-decreasing order**, remove the duplicates [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm) such that each unique element appears only **once**. The **relative order** of the elements should be kept the **same**. Then return _the number of unique elements in_... | In this problem, the key point to focus on is the input array being sorted. As far as duplicate elements are concerned, what is their positioning in the array when the given array is sorted? Look at the image above for the answer. If we know the position of one of the elements, do we also know the positioning of all th... | Array,Two Pointers | Easy | 27,80 |
731 | hello friends now lessors really similar questions my calendar to in my calendar three so our employment my calendar crass system your events a new event can be added if adding the event will not cause a double booking so you see we will call a master to name the book and there have start and end time if we can book th... | My Calendar II | my-calendar-ii | You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a **triple booking**.
A **triple booking** happens when three events have some non-empty intersection (i.e., some moment is common to all the three events.).
The event can be represented as a pair of inte... | Store two sorted lists of intervals: one list will be all times that are at least single booked, and another list will be all times that are definitely double booked. If none of the double bookings conflict, then the booking will succeed, and you should update your single and double bookings accordingly. | Design,Segment Tree,Ordered Set | Medium | 729,732 |
252 | hello everyone in this video we're going to be doing leak code problem 252 which is meeting rooms so this is an easy problem and it states given an array of meeting times intervals where intervals I equals the start and end time determine if a person could attend all meetings so in example one here we have these three ... | Meeting Rooms | meeting-rooms | Given an array of meeting time `intervals` where `intervals[i] = [starti, endi]`, determine if a person could attend all meetings.
**Example 1:**
**Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\]
**Output:** false
**Example 2:**
**Input:** intervals = \[\[7,10\],\[2,4\]\]
**Output:** true
**Constraints:**
* ... | null | Array,Sorting | Easy | 56,253 |
224 | cool 2:24 basic calculator implement a cool 2:24 basic calculator implement a cool 2:24 basic calculator implement a basic calculator to you elevate a simple expression string the expression string may contain open and closing friends parentheses the plus or minus sign non-negative integers and empty spaces non-negativ... | Basic Calculator | basic-calculator | Given a string `s` representing a valid expression, implement a basic calculator to evaluate it, and return _the result of the evaluation_.
**Note:** You are **not** allowed to use any built-in function which evaluates strings as mathematical expressions, such as `eval()`.
**Example 1:**
**Input:** s = "1 + 1 "
**O... | null | Math,String,Stack,Recursion | Hard | 150,227,241,282,785,2147,2328 |
589 | what's up nerds welcome back to tee time with your favorite software engineer if you guys haven't already subscribe and join my slack channel i have the link in the description i post um leco questions every day for us to discuss and solve so today i'm going over nre tree pre-order traversal i'm nre tree pre-order trav... | N-ary Tree Preorder Traversal | n-ary-tree-preorder-traversal | Given the `root` of an n-ary tree, return _the preorder traversal of its nodes' values_.
Nary-Tree input serialization is represented in their level order traversal. Each group of children is separated by the null value (See examples)
**Example 1:**
**Input:** root = \[1,null,3,2,4,null,5,6\]
**Output:** \[1,3,5,6,2... | null | null | Easy | null |
232 | hey everyone it's Chaz welcome back to the channel we're going to do another leak code problem in this video we're looking at leak code problem 232 Implement Q using Stacks so the problem says to implement a first in first out Q using only two stacks the implemented queue should support all the functions of a normal qu... | Implement Queue using Stacks | implement-queue-using-stacks | Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (`push`, `peek`, `pop`, and `empty`).
Implement the `MyQueue` class:
* `void push(int x)` Pushes element x to the back of the queue.
* `int pop()` Removes the element from th... | null | Stack,Design,Queue | Easy | 225 |
5 | hey what's up guys Nick Boyd here I did second coding stuff on twitch and YouTube check the description for all my information and do the premium problems on my patreon and you can join my discord reach out to me I'll try and respond everyone I just woke up this is the first problem of the day longest palindrome it is ... | 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 |
106 | hey everybody this is Larry this is day 16th of the elite code daily challenge in March hit the like button hit the Subscribe button join me on Discord let me know what you think about today's prom uh oh yes which first Tracy get that 10 lead coins uh yeah all right let's get started I hope everyone's having a good wee... | 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 |
70 | hello everyone welcome back and today we are looking at question 70 which is climbing stairs so the question is straightforward they are saying that we are climbing a staircase and it takes n steps to reach the top and they are telling us that each time we can either climb one or two steps so anytime you want to make a... | Climbing Stairs | climbing-stairs | You are climbing a staircase. It takes `n` steps to reach the top.
Each time you can either climb `1` or `2` steps. In how many distinct ways can you climb to the top?
**Example 1:**
**Input:** n = 2
**Output:** 2
**Explanation:** There are two ways to climb to the top.
1. 1 step + 1 step
2. 2 steps
**Example 2:**
... | To reach nth step, what could have been your previous steps? (Think about the step sizes) | Math,Dynamic Programming,Memoization | Easy | 747,1013,1236 |
232 | hello everyone this is DSS zindabad and today we are going to discuss the daily challenge of we code which is Implement Q using Stacks let's jump into the problem statement Implement a first in first out queue using only two stacks the implemented queue should support all of the functions of a normal Q which is push Pe... | Implement Queue using Stacks | implement-queue-using-stacks | Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (`push`, `peek`, `pop`, and `empty`).
Implement the `MyQueue` class:
* `void push(int x)` Pushes element x to the back of the queue.
* `int pop()` Removes the element from th... | null | Stack,Design,Queue | Easy | 225 |
847 | hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you've not liked the video please like it subscribe to my channel and hit the bell icon so that you get notified whenever i post a new video so without any further ado let's get started prob... | Shortest Path Visiting All Nodes | shortest-path-visiting-all-nodes | You have an undirected, connected graph of `n` nodes labeled from `0` to `n - 1`. You are given an array `graph` where `graph[i]` is a list of all the nodes connected with node `i` by an edge.
Return _the length of the shortest path that visits every node_. You may start and stop at any node, you may revisit nodes mul... | null | null | Hard | null |
122 | hey everyone welcome back to take you forward so we will be continuing with dp on stocks and it is the second problem best time to buy and sell stock part two so what does the problem state you'll be given prices of stocks on each day yeah so you have been given the prices on each day now you're allowed to buy and sell... | Best Time to Buy and Sell Stock II | best-time-to-buy-and-sell-stock-ii | You are given an integer array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
On each day, you may decide to buy and/or sell the stock. You can only hold **at most one** share of the stock at any time. However, you can buy it then immediately sell it on the **same day**.
Find and return _t... | null | Array,Dynamic Programming,Greedy | Medium | 121,123,188,309,714 |
1,678 | Hello friends my name is vikas Gupta today I'm going to start a new video on to solving later problem using Java 8. so friends those who are new into javaid and don't know much about like how to use Java stream API this series will help them to understand steam API and also will help them to crack Java code interview q... | Goal Parser Interpretation | number-of-ways-to-split-a-string | You own a **Goal Parser** that can interpret a string `command`. The `command` consists of an alphabet of `"G "`, `"() "` and/or `"(al) "` in some order. The Goal Parser will interpret `"G "` as the string `"G "`, `"() "` as the string `"o "`, and `"(al) "` as the string `"al "`. The interpreted strings are then concat... | There is no way if the sum (number of '1's) is not divisible by the number of splits. So sum%3 should be 0. Preffix s1 , and suffix s3 should have sum/3 characters '1'. Follow up: Can you generalize the problem with numbers between [-10^9, 10^9] such the sum between subarrays s1, s2, s3 are the same? | Math,String | Medium | 548 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.