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 |
|---|---|---|---|---|---|---|---|---|
336 | hello everyone welcome to think then code today we will be solving the problem palindrome pairs given the list of unique words written all pairs of the distinct indices i form a j in the given list so that the concatenation of two words that is words of five plus word of j is a palindrome quite a straightforward questi... | Palindrome Pairs | palindrome-pairs | You are given a **0-indexed** array of **unique** strings `words`.
A **palindrome pair** is a pair of integers `(i, j)` such that:
* `0 <= i, j < words.length`,
* `i != j`, and
* `words[i] + words[j]` (the concatenation of the two strings) is a palindrome.
Return _an array of all the **palindrome pairs** of_ `... | null | Array,Hash Table,String,Trie | Hard | 5,214,2237 |
1,366 | hey folks welcome back to another video today we're looking at question 1366 rank teams by votes the way we'll be approaching this problem is by using a 2d array to store all of the Rhymes that we see in all of the words that are given to us and then once we have that we start that to make sure it's arranged according ... | Rank Teams by Votes | first-unique-number | In a special ranking system, each voter gives a rank from highest to lowest to all teams participating in the competition.
The ordering of teams is decided by who received the most position-one votes. If two or more teams tie in the first position, we consider the second position to resolve the conflict, if they tie a... | Use doubly Linked list with hashmap of pointers to linked list nodes. add unique number to the linked list. When add is called check if the added number is unique then it have to be added to the linked list and if it is repeated remove it from the linked list if exists. When showFirstUnique is called retrieve the head ... | Array,Hash Table,Design,Queue,Data Stream | Medium | null |
1 | Hello everyone let's lead code problem number one tu sum today return indices of d tu number true date give add up tu target and question what is an important thing ki humors zoom date h input what have exactly one solution so exactly one solution will remain so What has to be done in this how, we understand through th... | 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 |
316 | all right let's talk about remove duplicate later so given the string edge remove duplicate layers so that every layer appears once and only once you must make sure your result is the smallest in as a graphical order among all possible results so let's just for example p c a p right so if you look at this example and y... | Remove Duplicate Letters | remove-duplicate-letters | Given a string `s`, remove duplicate letters so that every letter appears once and only once. You must make sure your result is **the smallest in lexicographical order** among all possible results.
**Example 1:**
**Input:** s = "bcabc "
**Output:** "abc "
**Example 2:**
**Input:** s = "cbacdcbc "
**Output:** "a... | Greedily try to add one missing character. How to check if adding some character will not cause problems ? Use bit-masks to check whether you will be able to complete the sub-sequence if you add the character at some index i. | String,Stack,Greedy,Monotonic Stack | Medium | 2157 |
1,027 | hello everyone welcome back here is vanamsen and today we are going to solve another interesting problem from leadco's longest arithmetic subsequence so this is a medium difficulty problem and uh it tests your understanding of dynamic program so let's jump into a problem so the problem provides us an array of integer n... | Longest Arithmetic Subsequence | sum-of-even-numbers-after-queries | Given an array `nums` of integers, return _the length of the longest arithmetic subsequence in_ `nums`.
**Note** that:
* A **subsequence** is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.
* A sequence `seq` is arithmetic if `s... | null | Array,Simulation | Medium | null |
567 | yo what's up nerds welcome back to t-time with your favorite software t-time with your favorite software t-time with your favorite software engineer if you guys haven't already check out my channel subscribe i post elite code problems a few times a week um i've never been gone super busy with work and stuff but so toda... | Permutation in String | permutation-in-string | Given two strings `s1` and `s2`, return `true` _if_ `s2` _contains a permutation of_ `s1`_, or_ `false` _otherwise_.
In other words, return `true` if one of `s1`'s permutations is the substring of `s2`.
**Example 1:**
**Input:** s1 = "ab ", s2 = "eidbaooo "
**Output:** true
**Explanation:** s2 contains one permuta... | Obviously, brute force will result in TLE. Think of something else. How will you check whether one string is a permutation of another string? One way is to sort the string and then compare. But, Is there a better way? If one string is a permutation of another string then they must one common metric. What is that? Both ... | Hash Table,Two Pointers,String,Sliding Window | Medium | 76,438 |
1,334 | Yes, this time we will solve net code problem 1339. This problem is related to a graph. 4 What this problem wants. Ah, what kind of solution does it want? Let's try to understand the problem a little. It is a graph problem. 4 Yes, it is out of stock and this graph is Let's say there is an undirected graph. Well, the te... | Find the City With the Smallest Number of Neighbors at a Threshold Distance | find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance | There are `n` cities numbered from `0` to `n-1`. Given the array `edges` where `edges[i] = [fromi, toi, weighti]` represents a bidirectional and weighted edge between cities `fromi` and `toi`, and given the integer `distanceThreshold`.
Return the city with the smallest number of cities that are reachable through some ... | null | null | Medium | null |
326 | so hello guys today we will be solving yet another problem of lead goal which is power of 3 and in this question we are given an integer n and we have to return true if it is a power of 3 otherwise we have to return false so like examples we have n equals to 27 so if we divide 27 by 3 we will be getting 9 and then when... | 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 |
127 | hey what's up guys this is chung so today number 127 word letter so you're given like two words at the beginning word and end word and a dictionary word list and you need to return the shortest transformation sequence from the beginning word to the end word and you could you allow you only allowed to change one letter ... | Word Ladder | word-ladder | A **transformation sequence** from word `beginWord` to word `endWord` using a dictionary `wordList` is a sequence of words `beginWord -> s1 -> s2 -> ... -> sk` such that:
* Every adjacent pair of words differs by a single letter.
* Every `si` for `1 <= i <= k` is in `wordList`. Note that `beginWord` does not need ... | null | Hash Table,String,Breadth-First Search | Hard | 126,433 |
1,941 | Lead Code 1941 Check IF the characters have equal number of alphabets saying that you will be given a string which contains all the characters in it and the alphabets of all of them should be in economy as it is written here now A C B C A B C There are characters, their occurrence is two A's, that is, every element is ... | Check if All Characters Have Equal Number of Occurrences | minimum-number-of-operations-to-make-string-sorted | Given a string `s`, return `true` _if_ `s` _is a **good** string, or_ `false` _otherwise_.
A string `s` is **good** if **all** the characters that appear in `s` have the **same** number of occurrences (i.e., the same frequency).
**Example 1:**
**Input:** s = "abacbc "
**Output:** true
**Explanation:** The character... | Note that the operations given describe getting the previous permutation of s To solve this problem you need to solve every suffix separately | Math,String,Combinatorics | Hard | null |
1,397 | hey what's up guys this is chung here so today let's take a look at this 1397 find all good streams so this one is a pretty hard problem and this is like a follow-up follow-up follow-up problem after after yesterday's problem which is number one three night two so and this problem is another problem also need to use th... | Find All Good Strings | search-suggestions-system | Given the strings `s1` and `s2` of size `n` and the string `evil`, return _the number of **good** strings_.
A **good** string has size `n`, it is alphabetically greater than or equal to `s1`, it is alphabetically smaller than or equal to `s2`, and it does not contain the string `evil` as a substring. Since the answer ... | Brute force is a good choice because length of the string is ≤ 1000. Binary search the answer. Use Trie data structure to store the best three matching. Traverse the Trie. | Array,String,Trie | Medium | null |
48 | below let's try to solve a little problems today we are going to solve number 48 rotate image so we are giving a 2d Matrix representing a image the theory means by 90 degrees clockwise so the clockwise is like this yeah like the clockwise rotation to 90 degrees yeah for example this is one two three after 90 degrees of... | Rotate Image | rotate-image | You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise).
You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati... | null | Array,Math,Matrix | Medium | 2015 |
1,679 | That guys welcome to take a dime Nivedita and in this video we are going to solve the max number of contacts What is the problem that we have given you one adams and 1 inch here and there, okay what do we have to do na total If we want to open the number of maximum number of operations here then we have to call K and K... | 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 |
412 | so in this video we'll go through a basic Lee code question classified it's easy it's fizzbuzz show every 1/3 of it easy it's fizzbuzz show every 1/3 of it easy it's fizzbuzz show every 1/3 of it so running through the problem we have write a program now puts the string representation of numbers from 1 to n but for mul... | Fizz Buzz | fizz-buzz | Given an integer `n`, return _a string array_ `answer` _(**1-indexed**) where_:
* `answer[i] == "FizzBuzz "` if `i` is divisible by `3` and `5`.
* `answer[i] == "Fizz "` if `i` is divisible by `3`.
* `answer[i] == "Buzz "` if `i` is divisible by `5`.
* `answer[i] == i` (as a string) if none of the above condit... | null | Math,String,Simulation | Easy | 1316 |
1,026 | hello everyone this is DSS zindabad and today we are going to discuss the Le Cod daily challenge the problem is maximum difference between node and ancestor so let's jump into the problem statement given the root of a binary tree find the maximum value V for which there exist different nodes A and B where V is equals t... | Maximum Difference Between Node and Ancestor | string-without-aaa-or-bbb | Given the `root` of a binary tree, find the maximum value `v` for which there exist **different** nodes `a` and `b` where `v = |a.val - b.val|` and `a` is an ancestor of `b`.
A node `a` is an ancestor of `b` if either: any child of `a` is equal to `b` or any child of `a` is an ancestor of `b`.
**Example 1:**
**Input... | null | String,Greedy | Medium | null |
414 | maximum number in this array so if the third maximum number doesn't exist then just return the maximum number so let's say they have given an array 3 2 1. so if you see first Maximum number is 3 here so let's say Max 1 equal to 3. the second maximum number over here is 3 2 1 2 is the second maximum number and third max... | Third Maximum Number | third-maximum-number | Given an integer array `nums`, return _the **third distinct maximum** number in this array. If the third maximum does not exist, return the **maximum** number_.
**Example 1:**
**Input:** nums = \[3,2,1\]
**Output:** 1
**Explanation:**
The first distinct maximum is 3.
The second distinct maximum is 2.
The third distin... | null | Array,Sorting | Easy | 215 |
804 | Are Hello Guys Welcome To Misunderstandings Switch Settings Mode On The Road To The Number Of District Subscribe To 210 Verification Tab * Returned 210 Verification Tab * Returned 210 Verification Tab * Returned District Number Of Moscow Due Dates All The Best All District Values Internal On The Best All District Val... | Unique Morse Code Words | rotated-digits | International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows:
* `'a'` maps to `".- "`,
* `'b'` maps to `"-... "`,
* `'c'` maps to `"-.-. "`, and so on.
For convenience, the full table for the `26` letters of the English alphabet is given below:
\[ ... | null | Math,Dynamic Programming | Medium | null |
849 | hey guys welcome back to another video and today we're going to be solving the leak code question maximize distance to the closest person all right so in this question we're given an area representing of a row of seats where seats i equals one represents that a person is sitting in the eighth seat and if seats i is equ... | 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 |
985 | foreign this is Larry this is day 20 yeah 20th 21st of the deco day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's problem so yeah I hope you liked the intro I was at the Yankee game maybe obviously uh and we're uh if you watch baseball let me know but... | Sum of Even Numbers After Queries | bag-of-tokens | You are given an integer array `nums` and an array `queries` where `queries[i] = [vali, indexi]`.
For each query `i`, first, apply `nums[indexi] = nums[indexi] + vali`, then print the sum of the even values of `nums`.
Return _an integer array_ `answer` _where_ `answer[i]` _is the answer to the_ `ith` _query_.
**Exam... | null | Array,Two Pointers,Greedy,Sorting | Medium | null |
41 | hi everyone this is amandra I'm back with another lead code problem today we are solving the hard uh complexity problem which is lead code 41 for First missing positive number so the what the problem States is given an unsorted integer array nums return the smallest missing positive integer it means that we are um prov... | 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 |
833 | okay so let's look at question 833 find and replace in string it's a medium question and let's start reading it so you're given a zero index string s that you must perform k replacement operations on the replacement operations are given as three zero indexed parallel arrays indices sources and targets all of length k t... | Find And Replace in String | bus-routes | You are given a **0-indexed** string `s` that you must perform `k` replacement operations on. The replacement operations are given as three **0-indexed** parallel arrays, `indices`, `sources`, and `targets`, all of length `k`.
To complete the `ith` replacement operation:
1. Check if the **substring** `sources[i]` oc... | null | Array,Hash Table,Breadth-First Search | Hard | null |
752 | all right let's talk about the open lock so you are given the four superior wheels and for your single slot i mean you do have 10 possibility uh 10 number you can actually rotate right so that's basically let me enter that one so you have like four position you can actually rotate let's start right so uh this is gonna ... | Open the Lock | ip-to-cidr | You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: `'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'`. The wheels can rotate freely and wrap around: for example we can turn `'9'` to be `'0'`, or `'0'` to be `'9'`. Each move consists of turning one wheel one slot.
The lock initially starts... | Convert the ip addresses to and from (long) integers. You want to know what is the most addresses you can put in this block starting from the "start" ip, up to n. It is the smallest between the lowest bit of start and the highest bit of n. Then, repeat this process with a new start and n. | String,Bit Manipulation | Medium | 93,468 |
278 | foreign project s our project versions foreign and normally projects bad version in the East bad version true or false and the specific project if the project is bad false determinant if the project is not bad okay so in the given functions is foreign okay in the wildlife good projects bad versions so one plus six quar... | First Bad Version | first-bad-version | You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.
Suppose you have `n` versions `[1, 2, ..., n]` an... | null | Binary Search,Interactive | Easy | 34,35,374 |
389 | welcome to september's lee code challenge today's problem is find the difference given two strings s and t which consists of only lowercase letters string t is generated by randomly shuffling string s and then adding one more letter at a random position find that letter that was added in t how do we solve this couple a... | 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 |
173 | hey what's up guys this is juan here again so today let's take a look at uh today's daily challenge which is number 173 binary search tree iterator so the problem says implement a binary surgery iterator that represents an iterate over the in other traverse right so not in other traverse means the uh you know left midd... | Binary Search Tree Iterator | binary-search-tree-iterator | Implement the `BSTIterator` class that represents an iterator over the **[in-order traversal](https://en.wikipedia.org/wiki/Tree_traversal#In-order_(LNR))** of a binary search tree (BST):
* `BSTIterator(TreeNode root)` Initializes an object of the `BSTIterator` class. The `root` of the BST is given as part of the co... | null | Stack,Tree,Design,Binary Search Tree,Binary Tree,Iterator | Medium | 94,251,281,284,285,1729 |
74 | today we're looking at lead code number 74. it's called search a 2d matrix and this problem can be a little tricky when you go for the optimal solution so we'll go over a brute force solution we'll look at a very brute force solution we'll look at a semi-optimal solution we'll look at a semi-optimal solution we'll look... | 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 |
295 | Hey everyone, from today we are starting a new play, hit, why is it called priority, this is a question van of hip and this is personally my favorite topic Median from data stream code number 295 is a hard level question and but I guarantee that I will make this question very easy for you, okay, so let's see who asked ... | Find Median from Data Stream | find-median-from-data-stream | The **median** is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two middle values.
* For example, for `arr = [2,3,4]`, the median is `3`.
* For example, for `arr = [2,3]`, the median is `(2 + 3) / 2 = 2.5`.
Implement the M... | null | Two Pointers,Design,Sorting,Heap (Priority Queue),Data Stream | Hard | 480,1953,2207 |
290 | Hello gaze my self amrita welcome back to our channel technosij so in today's video see are going to discuss problem based on strings so see are going to solve lead code problem number 29 date is word pattern so let's get started let's first understand the problem so given Un pattern and un string s find if s follows t... | 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,642 | hey what's up guys this is john here again so uh let's take a look at another weekly contest problem uh number 1642 for this building you can reach okay so you're given like an integer of array uh heights and some bricks and some ladders and you need to start your journey from building zero to the third to the furthest... | Furthest Building You Can Reach | water-bottles | You are given an integer array `heights` representing the heights of buildings, some `bricks`, and some `ladders`.
You start your journey from building `0` and move to the next building by possibly using bricks or ladders.
While moving from building `i` to building `i+1` (**0-indexed**),
* If the current building'... | Simulate the process until there are not enough empty bottles for even one full bottle of water. | Math,Simulation | Easy | null |
142 | foreign hi this is Topher with the lonely Dash and today we're going over lead code question 142 linked list cycle 2 which states given the head of a linked list return the node where the cycle begins if there is no cycle return null there's a cycle in a linked list if there is some node in that list that can be reache... | Linked List Cycle II | linked-list-cycle-ii | Given the `head` of a linked list, return _the node where the cycle begins. If there is no cycle, return_ `null`.
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 ta... | null | Hash Table,Linked List,Two Pointers | Medium | 141,287 |
485 | hey everyone welcome back and today we'll be doing another lead code 485 Max consecutive ones an easy one given a binary array nums return the maximum number of conjunctive ones in the array so we have to just return the maximum consecutive ones in the array that are present so there are many methods to do this but wha... | Max Consecutive Ones | max-consecutive-ones | Given a binary array `nums`, return _the maximum number of consecutive_ `1`_'s in the array_.
**Example 1:**
**Input:** nums = \[1,1,0,1,1,1\]
**Output:** 3
**Explanation:** The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s is 3.
**Example 2:**
**Input:** nums = ... | You need to think about two things as far as any window is concerned. One is the starting point for the window. How do you detect that a new window of 1s has started? The next part is detecting the ending point for this window.
How do you detect the ending point for an existing window? If you figure these two things... | Array | Easy | 487,1046,1542,1999 |
1,849 | hey everybody this is larry this is me going with q2 of the weekly contest 239 uh splitting a string into descending consecutive values hit the like button hit the subscribe button join me on discord let me know what you think about this problem so this one was a let's just say it's very hard for q2 to be honest um and... | Splitting a String Into Descending Consecutive Values | maximum-absolute-sum-of-any-subarray | You are given a string `s` that consists of only digits.
Check if we can split `s` into **two or more non-empty substrings** such that the **numerical values** of the substrings are in **descending order** and the **difference** between numerical values of every two **adjacent** **substrings** is equal to `1`.
* Fo... | What if we asked for maximum sum, not absolute sum? It's a standard problem that can be solved by Kadane's algorithm. The key idea is the max absolute sum will be either the max sum or the min sum. So just run kadane twice, once calculating the max sum and once calculating the min sum. | Array,Dynamic Programming | Medium | 53 |
129 | Loot Hello Friends Solar Discus Band Problem Doctor Problem Yes-Yes Sumru To-Do Problem Doctor Problem Yes-Yes Sumru To-Do Problem Doctor Problem Yes-Yes Sumru To-Do List Number Problem God Does Not Give The Root Of Binary Tree Contents From You Know No Root To Lift The Representation President Top Root Password But No... | 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 |
67 | hi everyone welcome back to the channel and today we'll solve the code daily challenge problem number 67 add binary the problem is going to be very simple and the question is really easy to solve so given two binary strings A and B return there some as binary strings so uh what we need to do is we will be given two str... | Add Binary | add-binary | Given two binary strings `a` and `b`, return _their sum as a binary string_.
**Example 1:**
**Input:** a = "11", b = "1"
**Output:** "100"
**Example 2:**
**Input:** a = "1010", b = "1011"
**Output:** "10101"
**Constraints:**
* `1 <= a.length, b.length <= 104`
* `a` and `b` consist only of `'0'` or `'1'` chara... | null | Math,String,Bit Manipulation,Simulation | Easy | 2,43,66,1031 |
1,578 | Hello everyone, today we will do question number 5 of Greedy Playlist. Okay, the name of the question is Minimum Time You Make Rope. Let's see what is the color output. Okay, so look, the input will be given in such a way that you will be given a color named Oh, what does it mean? That these are the colors of the ballo... | Minimum Time to Make Rope Colorful | apples-oranges | Alice has `n` balloons arranged on a rope. You are given a **0-indexed** string `colors` where `colors[i]` is the color of the `ith` balloon.
Alice wants the rope to be **colorful**. She does not want **two consecutive balloons** to be of the same color, so she asks Bob for help. Bob can remove some balloons from the ... | null | Database | Medium | null |
1,977 | hey everybody this is larry this is me going with q4 of the biweekly contest 59 number of ways to separate numbers hit the like button hit the subscribe button join me on discord let me know what you think about this problem and so forth uh but also if you had trouble with it come to our discord come hang out come chat... | Number of Ways to Separate Numbers | minimum-interval-to-include-each-query | You wrote down many **positive** integers in a string called `num`. However, you realized that you forgot to add commas to seperate the different numbers. You remember that the list of integers was **non-decreasing** and that **no** integer had leading zeros.
Return _the **number of possible lists of integers** that y... | Is there a way to order the intervals and queries such that it takes less time to query? Is there a way to add and remove intervals by going from the smallest query to the largest query to find the minimum size? | Array,Binary Search,Line Sweep,Sorting,Heap (Priority Queue) | Hard | null |
237 | today we will see how to delete a node in a linked list and there is a trick here that you are not given pointer to the head of the list if you are given a pointer to the head of the list and you are given a node or node pointer what you can do is that you start from head start traversing the list using this next point... | Delete Node in a Linked List | delete-node-in-a-linked-list | There is a singly-linked list `head` and we want to delete a node `node` in it.
You are given the node to be deleted `node`. You will **not be given access** to the first node of `head`.
All the values of the linked list are **unique**, and it is guaranteed that the given node `node` is not the last node in the linke... | null | Linked List | Easy | 203 |
1,878 | hey what's up guys uh this is chung here so today uh lead code number 1878 get biggest three rhombus sums in the grid um so this one you know okay you're given like m times and uh integer matrix grid right so a run by sum is like a sum basically it's just a rotate it's a square right which is being rotated 45 degrees r... | Get Biggest Three Rhombus Sums in a Grid | check-if-array-is-sorted-and-rotated | You are given an `m x n` integer matrix `grid`.
A **rhombus sum** is the sum of the elements that form **the** **border** of a regular rhombus shape in `grid`. The rhombus must have the shape of a square rotated 45 degrees with each of the corners centered in a grid cell. Below is an image of four valid rhombus ... | Brute force and check if it is possible for a sorted array to start from each position. | Array | Easy | 2243 |
1,744 | hey what's up guys this is chung so today let's take a look at this week's weekly contest problem 1744. can you eat your favorite candy on your favorite day this one got a lot of downloads because the description is kind of a little bit confusing and they're like a lot of edge cases so you're given like a zero index ar... | Can You Eat Your Favorite Candy on Your Favorite Day? | number-of-ways-to-form-a-target-string-given-a-dictionary | You are given a **(0-indexed)** array of positive integers `candiesCount` where `candiesCount[i]` represents the number of candies of the `ith` type you have. You are also given a 2D array `queries` where `queries[i] = [favoriteTypei, favoriteDayi, dailyCapi]`.
You play a game with the following rules:
* You start ... | For each index i, store the frequency of each character in the ith row. Use dynamic programing to calculate the number of ways to get the target string using the frequency array, | Array,String,Dynamic Programming | Hard | null |
45 | five jump game tool we're given array of non-negative integers here we are non-negative integers here we are non-negative integers here we are initially position at the first index and each name any the array represents your maximum jump land at that position so well like at this position I can jump to here or here my ... | 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 |
384 | uh today we're gonna be working on it code question number 384 shuffle and array uh given an integer array nums i design an algorithm to randomly shuffle the array all permutations of the array should be equally likely as a result of the shuffling uh implement the solution class solution and area numbers and it is goin... | Shuffle an Array | shuffle-an-array | Given an integer array `nums`, design an algorithm to randomly shuffle the array. All permutations of the array should be **equally likely** as a result of the shuffling.
Implement the `Solution` class:
* `Solution(int[] nums)` Initializes the object with the integer array `nums`.
* `int[] reset()` Resets the arr... | The solution expects that we always use the original array to shuffle() else some of the test cases fail. (Credits; @snehasingh31) | Array,Math,Randomized | Medium | null |
1,763 | let's solve lead code 1763 longest n substring so the question goes like this given a string you given a string some we'll take an examp first example which is y capital y a z a capital A Y so given any string you need to find the longest substring out of this that includes the upper case and lower case of all the char... | Longest Nice Substring | all-valid-triplets-that-can-represent-a-country | A string `s` is **nice** if, for every letter of the alphabet that `s` contains, it appears **both** in uppercase and lowercase. For example, `"abABB "` is nice because `'A'` and `'a'` appear, and `'B'` and `'b'` appear. However, `"abA "` is not because `'b'` appears, but `'B'` does not.
Given a string `s`, return _th... | null | Database | Easy | null |
452 | That plane today we are so late but we dance to you Valve number 452 points Minimum number of yours to the best All the best in that What are the tables in it And Hardik is the front side That ad is spread from starting till 10 That The deposit is fine and can serve two values and we have to and can serve two values ... | Minimum Number of Arrows to Burst Balloons | minimum-number-of-arrows-to-burst-balloons | There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array `points` where `points[i] = [xstart, xend]` denotes a balloon whose **horizontal diameter** stretches between `xstart` and `xend`. You do not know the exact y-coordinates of the ball... | null | Array,Greedy,Sorting | Medium | 253,435 |
235 | hello everyone uh welcome to code hub today let us solve our lead code daily challenge and the problem is lowest common ancestor of a binary search tree when a bst find the lowest common ancestor node 2 of two given nodes in the bst according to the definition of lca the lowest camera common ancestor is defined between... | Lowest Common Ancestor of a Binary Search Tree | lowest-common-ancestor-of-a-binary-search-tree | Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST.
According to the [definition of LCA on Wikipedia](https://en.wikipedia.org/wiki/Lowest_common_ancestor): "The lowest common ancestor is defined between two nodes `p` and `q` as the lowest node in `T` that has bo... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | 236,1190,1780,1790,1816 |
834 | Hello everyone, so today we are going to do question number 7 of our graph playlist, okay and the question is hard level, I will tell you a very important story, okay the name of the question is sum of distance, it is good, always Google must have given this, give undirected correct tree. Zero to van is also one thing.... | Sum of Distances in Tree | ambiguous-coordinates | There is an undirected connected tree with `n` nodes labeled from `0` to `n - 1` and `n - 1` edges.
You are given the integer `n` and the array `edges` where `edges[i] = [ai, bi]` indicates that there is an edge between nodes `ai` and `bi` in the tree.
Return an array `answer` of length `n` where `answer[i]` is the s... | null | String,Backtracking | Medium | null |
1,673 | hey there everyone welcome back to lead coding in this video we will be looking at the solution to the problem number two of lead code weekly contest 217 name of the problem is find the most comparative subsequence given an integer array nums and a positive integer k return the most comparative subsequence of nums of s... | 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 |
587 | hey everybody this is Larry this is day 18. of the Lego day challenge hit the like button hit the Subscribe button join me on day 19 whoops uh of the Lego day challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about this problem so I have solved this before um yeah you ... | Erect the Fence | erect-the-fence | You are given an array `trees` where `trees[i] = [xi, yi]` represents the location of a tree in the garden.
Fence the entire garden using the minimum length of rope, as it is expensive. The garden is well-fenced only if **all the trees are enclosed**.
Return _the coordinates of trees that are exactly located on the f... | null | Array,Math,Geometry | Hard | 2074 |
198 | hello welcome back to my channel today we have leeco 198 house robber so this question is really popular and one of the simple dynamic programming and it's easy to understand so let's take a look at this question so the basic idea is now we have input of string input of integer so this is array of integer and every ind... | 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 |
108 | Let's start basically our next question is how is it created and similarly when we have in order and post order travels life and you want to convert it into binary then first of all we see it i.e. sorted we see its property i.e. sorted we see its property i.e. sorted we see its property and its Here the reverse is goin... | Convert Sorted Array to Binary Search Tree | convert-sorted-array-to-binary-search-tree | Given an integer array `nums` where the elements are sorted in **ascending order**, convert _it to a_ **_height-balanced_** _binary search tree_.
**Example 1:**
**Input:** nums = \[-10,-3,0,5,9\]
**Output:** \[0,-3,9,-10,null,5\]
**Explanation:** \[0,-10,5,null,-3,null,9\] is also accepted:
**Example 2:**
**Input... | null | Array,Divide and Conquer,Tree,Binary Search Tree,Binary Tree | Easy | 109 |
1,869 | Hello Hi Friends Welcome Back Today We Are Going To Solid Problem 1969 Longer Country Affected Segments Of 108 If You Have Any Positive subscribe To My Channel Please subscribe My Channel Now It's Not Good Videos Related To Java J2ee Interview Preparation And According Solutions And Its True Sense Please subscribe To M... | Longer Contiguous Segments of Ones than Zeros | longer-contiguous-segments-of-ones-than-zeros | Given a binary string `s`, return `true` _if the **longest** contiguous segment of_ `1`'_s is **strictly longer** than the **longest** contiguous segment of_ `0`'_s in_ `s`, or return `false` _otherwise_.
* For example, in `s = "110100010 "` the longest continuous segment of `1`s has length `2`, and the longest cont... | null | null | Easy | null |
269 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem alien dictionary and yes this is another problem from the blind 75 list this is the problem 32 a graph problem alien dictionary i've been wanting to do this problem for so long now and we're finally doing it because now... | Alien Dictionary | alien-dictionary | There is a new alien language that uses the English alphabet. However, the order among the letters is unknown to you.
You are given a list of strings `words` from the alien language's dictionary, where the strings in `words` are **sorted lexicographically** by the rules of this new language.
Return _a string of the u... | null | Array,String,Depth-First Search,Breadth-First Search,Graph,Topological Sort | Hard | 210 |
1,026 | hello guys and welcome back to lead Logics this is the maximum difference between the node and the ancestor problem from Bad Code this is a lead code medium and the number for this is 1026 so let's start with the question so in the given question we are have we are having the root of a binary tree and we have to find t... | Maximum Difference Between Node and Ancestor | string-without-aaa-or-bbb | Given the `root` of a binary tree, find the maximum value `v` for which there exist **different** nodes `a` and `b` where `v = |a.val - b.val|` and `a` is an ancestor of `b`.
A node `a` is an ancestor of `b` if either: any child of `a` is equal to `b` or any child of `a` is an ancestor of `b`.
**Example 1:**
**Input... | null | String,Greedy | Medium | null |
4 | you hey what's up guys Andrew here today we're going to be covering the next question from leaked code question number four which is the median of two sorted arrays so given two sort of sorted arrays number one and numbers two of size m and n respectively they want you to find the median of these two sorted arrays and ... | Median of Two Sorted Arrays | median-of-two-sorted-arrays | Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays.
The overall run time complexity should be `O(log (m+n))`.
**Example 1:**
**Input:** nums1 = \[1,3\], nums2 = \[2\]
**Output:** 2.00000
**Explanation:** merged array = \[1,2,3\] and median is ... | null | Array,Binary Search,Divide and Conquer | Hard | null |
421 | hello guys welcome back to take those and in this video we will see the maximum zor of two numbers in an array the prerequisite before solving this problem is to watch my video on try if you already know that then you can proceed with this video it is from the topic of bit manipulation and this is from our techno's 100... | Maximum XOR of Two Numbers in an Array | maximum-xor-of-two-numbers-in-an-array | Given an integer array `nums`, return _the maximum result of_ `nums[i] XOR nums[j]`, where `0 <= i <= j < n`.
**Example 1:**
**Input:** nums = \[3,10,5,25,2,8\]
**Output:** 28
**Explanation:** The maximum result is 5 XOR 25 = 28.
**Example 2:**
**Input:** nums = \[14,70,53,83,49,91,36,80,92,51,66,70\]
**Output:** 1... | null | Array,Hash Table,Bit Manipulation,Trie | Medium | 1826 |
438 | hey what's up guys Nick white here I detect OD stuff on twitching YouTube check the description for all my information I explained all the algorithms from problems on sites likely code and hacker rank playlist if you want to check those out this is a problem called find all anagrams in a string it's 438 it's got a bunc... | Find All Anagrams in a String | find-all-anagrams-in-a-string | Given two strings `s` and `p`, return _an array of all the start indices of_ `p`_'s anagrams in_ `s`. You may return the answer in **any order**.
An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
**Example 1:**
*... | null | Hash Table,String,Sliding Window | Medium | 242,567 |
1,689 | hello viewers welcome to coding interviews channel hope you are doing great if you haven't subscribed to the channel yet please go ahead and subscribe i have created bunch of playlists to cover various categories of problems such as bfs dfs dynamic programming please check them out i have uploaded the code for this pro... | Partitioning Into Minimum Number Of Deci-Binary Numbers | detect-pattern-of-length-m-repeated-k-or-more-times | A decimal number is called **deci-binary** if each of its digits is either `0` or `1` without any leading zeros. For example, `101` and `1100` are **deci-binary**, while `112` and `3001` are not.
Given a string `n` that represents a positive decimal integer, return _the **minimum** number of positive **deci-binary** n... | Use a three-layer loop to check all possible patterns by iterating through all possible starting positions, all indexes less than m, and if the character at the index is repeated k times. | Array,Enumeration | Easy | 1764 |
1,802 | hello and welcome to another Elite code problem so today we're going to be doing the promo of the day for June 10th and it's going to be quite an interesting problem and it's going to be there's going to be a decent amount of like correct indexing so if you're practicing correct indexing an array you're figuring out ex... | Maximum Value at a Given Index in a Bounded Array | number-of-students-unable-to-eat-lunch | You are given three positive integers: `n`, `index`, and `maxSum`. You want to construct an array `nums` (**0-indexed**) that satisfies the following conditions:
* `nums.length == n`
* `nums[i]` is a **positive** integer where `0 <= i < n`.
* `abs(nums[i] - nums[i+1]) <= 1` where `0 <= i < n-1`.
* The sum of a... | Simulate the given in the statement Calculate those who will eat instead of those who will not. | Array,Stack,Queue,Simulation | Easy | 2195 |
228 | hey guys let's look at 228 summary ranges given a sorted integer array without duplicates return the summary of its ranges so we're getting like 0 1 2 4 5 7 we should output 0 from 0 to 2 4 5 2 5 7 its it seems very simple it's it is seems very simple mm-hmm we're going to seems very simple mm-hmm we're going to seems ... | Summary Ranges | summary-ranges | You are given a **sorted unique** integer array `nums`.
A **range** `[a,b]` is the set of all integers from `a` to `b` (inclusive).
Return _the **smallest sorted** list of ranges that **cover all the numbers in the array exactly**_. That is, each element of `nums` is covered by exactly one of the ranges, and there is... | null | Array | Easy | 163,352 |
32 | hello and welcome in this video we are going to solve problem number 32 update code that is longest valid parenthesis so in this problem we have to find the longest valid parenthesis among given set of N Things like we can see that we have written some examples already here so you can see that these four are the only v... | Longest Valid Parentheses | longest-valid-parentheses | Given a string containing just the characters `'('` and `')'`, return _the length of the longest valid (well-formed) parentheses_ _substring_.
**Example 1:**
**Input:** s = "(() "
**Output:** 2
**Explanation:** The longest valid parentheses substring is "() ".
**Example 2:**
**Input:** s = ")()()) "
**Output:** ... | null | String,Dynamic Programming,Stack | Hard | 20 |
119 | hello everyone and welcome back to my channel this is vishwanji pewdie and i'm glad that you are here today we'll be solving leak code problem number 119 pascal's triangle iii given an integer row index return the row indexed row of the pascal's triangle notice that the row index starts from zero so here we have a gif ... | 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 |
1,870 | okay so minimum speed to arrive on time and I think um a problem bch Rel one of the most important then so um you are given a floating Point number hour representing the amount of time you have to reach the office so uh to commute to the office you must take in TRS in sequential order you are also given an integer at a... | Minimum Speed to Arrive on Time | minimum-speed-to-arrive-on-time | You are given a floating-point number `hour`, representing the amount of time you have to reach the office. To commute to the office, you must take `n` trains in sequential order. You are also given an integer array `dist` of length `n`, where `dist[i]` describes the distance (in kilometers) of the `ith` train ride.
E... | null | null | Medium | null |
740 | okay so our lead code 740 they need an on I hope you have gone through the problem statement by yourself but I haven't got it yeah it's just make it simple to understand let's assume in an array area is one yes I have any means of one and one then two then four five and six so now if I take one then they have to remove... | Delete and Earn | delete-and-earn | You are given an integer array `nums`. You want to maximize the number of points you get by performing the following operation any number of times:
* Pick any `nums[i]` and delete it to earn `nums[i]` points. Afterwards, you must delete **every** element equal to `nums[i] - 1` and **every** element equal to `nums[i]... | If you take a number, you might as well take them all. Keep track of what the value is of the subset of the input with maximum M when you either take or don't take M. | Array,Hash Table,Dynamic Programming | Medium | 198 |
208 | Jhal Hello friends welcome to your help lives on the go into ki last day problem thing se important problem in the Video then subscribe to subscribe our Channel Please subscribe Thanks subscribe this Video not installed The Video then subscribe Hello friends welcome to your best and avoid deposit This year Internet Mar... | 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 |
118 | hey guys so today i'll be talking about the lead code problem pascal's triangle which gives the number of rows as an argument and expects us to return the pattern of the pascal triangle so it's basically a bicycle triangle is basically a 2d array and it will be generated based on the number of rows so how is the pascal... | 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 |
890 | My channel is called Maximum Channel Singh Quotes and today's list question is find and replace pattern basically a the word and put it in the pattern, so tell me which words are in this pattern. Okay, so which is this pattern? Also, this was also the same button media, so if the birthday of the same pattern is a patte... | Find and Replace Pattern | lemonade-change | Given a list of strings `words` and a string `pattern`, return _a list of_ `words[i]` _that match_ `pattern`. You may return the answer in **any order**.
A word matches the pattern if there exists a permutation of letters `p` so that after replacing every letter `x` in the pattern with `p(x)`, we get the desired word.... | null | Array,Greedy | Easy | null |
208 | hello everyone welcome back to coding intuition today we are going to solve Implement try question on lead code so in this question we have to implement a try so let us first understand what I wrote try data structure is basically let's suppose you have so many strings for example here we have taken three strings and l... | 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 |
261 | hello everyone today i will introduce the question 261 graph valid trim and this question is very classical and used to check if the graph have a circle so let's take a look on the description here we have a graph with a node enabled from zero to n minus one whereas we have array of edges to tell us the connection betw... | Graph Valid Tree | graph-valid-tree | You have a graph of `n` nodes labeled from `0` to `n - 1`. You are given an integer n and a list of `edges` where `edges[i] = [ai, bi]` indicates that there is an undirected edge between nodes `ai` and `bi` in the graph.
Return `true` _if the edges of the given graph make up a valid tree, and_ `false` _otherwise_.
**... | Given n = 5 and edges = [[0, 1], [1, 2], [3, 4]], what should your return? Is this case a valid tree? According to the definition of tree on Wikipedia: “a tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles is a tree.” | Depth-First Search,Breadth-First Search,Union Find,Graph | Medium | 207,323,871 |
249 | Hello Hi Guys, in this video Amazon will do this group shift string will be visible, I have asked the question that we have to group similar typing together that this Singh Amar Rachna stem cell therapy was done till the minute or is it visible inside them, I would have taken out all these plots. And let's try to under... | Group Shifted Strings | group-shifted-strings | We can shift a string by shifting each of its letters to its successive letter.
* For example, `"abc "` can be shifted to be `"bcd "`.
We can keep shifting the string to form a sequence.
* For example, we can keep shifting `"abc "` to form the sequence: `"abc " -> "bcd " -> ... -> "xyz "`.
Given an array of str... | null | Array,Hash Table,String | Medium | 49 |
309 | hello and welcome to my channel so today let's look at uh today's daily challenging question 309 best time to buy and sell stock with the cooldown you are given prices where price is the price of a given stock on the iphd and then find the maximum profit you can achieve you may complete as many transaction transactions... | Best Time to Buy and Sell Stock with Cooldown | best-time-to-buy-and-sell-stock-with-cooldown | You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the following restrictions:
* After you sell your stock, yo... | null | Array,Dynamic Programming | Medium | 121,122 |
163 | 163 missing ranges on liquid okay let's run to the question is saying you are giving an inclusive range lower and upper and assorted unique integer array noms where all elements are in the inclusive range and number x is considered missing if x is in the range lower to upper and x is not in nums return the smallest sor... | Missing Ranges | missing-ranges | You are given an inclusive range `[lower, upper]` and a **sorted unique** integer array `nums`, where all elements are in the inclusive range.
A number `x` is considered **missing** if `x` is in the range `[lower, upper]` and `x` is not in `nums`.
Return _the **smallest sorted** list of ranges that **cover every miss... | null | Array | Easy | 228 |
263 | hey everybody welcome back and today we'll be doing another lead code 263 ugly number this is an easy one and a green number is a positive integers whose prime factors are limited to two three five limited to given this is like saying that it they are just made up of these three numbers given an integer and return true... | Ugly Number | ugly-number | An **ugly number** is a positive integer whose prime factors are limited to `2`, `3`, and `5`.
Given an integer `n`, return `true` _if_ `n` _is an **ugly number**_.
**Example 1:**
**Input:** n = 6
**Output:** true
**Explanation:** 6 = 2 \* 3
**Example 2:**
**Input:** n = 1
**Output:** true
**Explanation:** 1 has n... | null | Math | Easy | 202,204,264 |
884 | welcome back friends today we are going to solve lead code problem 1598 uncommon words from two sentences uh before we start looking the details i just want to mention that if you are a java developer and if you are preparing for uh phone screening as well as the coding interviews then please subscribe to this channel ... | Uncommon Words from Two Sentences | k-similar-strings | A **sentence** is a string of single-space separated words where each word consists only of lowercase letters.
A word is **uncommon** if it appears exactly once in one of the sentences, and **does not appear** in the other sentence.
Given two **sentences** `s1` and `s2`, return _a list of all the **uncommon words**_.... | null | String,Breadth-First Search | Hard | 770 |
1,510 | hey everybody this is larry this is day 25 of the october lego daily challenge uh hit the like button hit the subscribe button join me on discord let me know what you think about today's farm stone game four alice and bob takes a uh takes turns ring of game and alice goes first okay any non-zero square number any non-z... | Stone Game IV | find-lucky-integer-in-an-array | Alice and Bob take turns playing a game, with Alice starting first.
Initially, there are `n` stones in a pile. On each player's turn, that player makes a _move_ consisting of removing **any** non-zero **square number** of stones in the pile.
Also, if a player cannot make a move, he/she loses the game.
Given a positi... | Count the frequency of each integer in the array. Get all lucky numbers and return the largest of them. | Array,Hash Table,Counting | Easy | null |
141 | in this video we're going to take a look at a legal problem called linguist cycle number one as well as we're also going to take a look at link list cycle number two so the first question asks us to uh check to see if a link list has a cycle and basically to determine if linked list has a cycle we just see if the tail ... | 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 |
1,277 | hello and welcome back to recording and this general we discuss problems which are frequently asked in programming interviews today we are going to solve the problem comes some medicines with all ones the problem statement is we are given a matrix of n cross n dimension that is Rho cross column and it consists of only ... | Count Square Submatrices with All Ones | largest-multiple-of-three | Given a `m * n` matrix of ones and zeros, return how many **square** submatrices have all ones.
**Example 1:**
**Input:** matrix =
\[
\[0,1,1,1\],
\[1,1,1,1\],
\[0,1,1,1\]
\]
**Output:** 15
**Explanation:**
There are **10** squares of side 1.
There are **4** squares of side 2.
There is **1** square of side 3.... | A number is a multiple of three if and only if its sum of digits is a multiple of three. Use dynamic programming. To find the maximum number, try to maximize the number of digits of the number. Sort the digits in descending order to find the maximum number. | Array,Dynamic Programming,Greedy | Hard | null |
63 | hello everyone in this video we will do lead code number 63 which is unique bats - this is a follow-up of number 62 which - this is a follow-up of number 62 which - this is a follow-up of number 62 which I also have a video on so if you haven't watched that number 62 which is unique paths one or just unique paths then ... | Unique Paths II | unique-paths-ii | You are given an `m x n` integer array `grid`. There is a robot initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time.
An obstacle and space are marked as ... | The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be
if obstacleGrid[i][j] is not an obstacle
... | Array,Dynamic Programming,Matrix | Medium | 62,1022 |
427 | hey guys we shall saw another problem on lead code now the given problem is given n cross and N star and Matrix grade of zeros and ones only so they have given us with a Matrix and cross n that is nothing but Square Matrix it either contains 0 or 1. only the binary values and we want to represent this grid with a quadr... | Construct Quad Tree | construct-quad-tree | Given a `n * n` matrix `grid` of `0's` and `1's` only. We want to represent `grid` with a Quad-Tree.
Return _the root of the Quad-Tree representing_ `grid`.
A Quad-Tree is a tree data structure in which each internal node has exactly four children. Besides, each node has two attributes:
* `val`: True if the node r... | null | null | Medium | null |
91 | hey everyone today we are going to solve the question de code ways okay so let me explain with this example to 2215 we need to count a number of ways to decode input string with one digit or two digits little by little so that's why I felt like I need a memo to keep results and I started to think about the dynamic prog... | Decode Ways | decode-ways | A message containing letters from `A-Z` can be **encoded** into numbers using the following mapping:
'A' -> "1 "
'B' -> "2 "
...
'Z' -> "26 "
To **decode** an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For examp... | null | String,Dynamic Programming | Medium | 639,2091 |
1,010 | hey guys how's it going so welcome to adrian tuition air and today we'll be solving record question 1010 which is uh pair of forms with tulip total duration divisible by 60 so let's get into it so in this question what has been asked is that uh they have given that here you are given a list of songs where the ielts son... | Pairs of Songs With Total Durations Divisible by 60 | powerful-integers | You are given a list of songs where the `ith` song has a duration of `time[i]` seconds.
Return _the number of pairs of songs for which their total duration in seconds is divisible by_ `60`. Formally, we want the number of indices `i`, `j` such that `i < j` with `(time[i] + time[j]) % 60 == 0`.
**Example 1:**
**Input... | null | Hash Table,Math | Medium | null |
79 | hello friends now let's solve the word search purple is firstly a statement given to the boat in the word find if the word exists in the grid the world can be constructed from letters all the sequentially agencies so well agency cell are those horizontally or vertically Newbery the same letter cell may not be used more... | Word Search | word-search | Given an `m x n` grid of characters `board` and a string `word`, return `true` _if_ `word` _exists in the grid_.
The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.
**Example 1:**... | null | Array,Backtracking,Matrix | Medium | 212 |
1,007 | hey everybody this is larry this is day 19 of the october lead code daily challenge uh hit the like button hit the subscribe button join me in discord let me know what you think uh today's problem is minimum domino rotation for equal row so okay in the world dynamo dominos uh a sub i and b sub i is the top half of the ... | Minimum Domino Rotations For Equal Row | numbers-with-same-consecutive-differences | In a row of dominoes, `tops[i]` and `bottoms[i]` represent the top and bottom halves of the `ith` domino. (A domino is a tile with two numbers from 1 to 6 - one on each half of the tile.)
We may rotate the `ith` domino, so that `tops[i]` and `bottoms[i]` swap values.
Return the minimum number of rotations so that all... | null | Backtracking,Breadth-First Search | Medium | null |
1,394 | Hello guys me myself amrita welcome back to our channel technologies so if you are new to this channel this is lead code series in which we are solving lead code problems and if you vishwa you join you can subscribe to our channel so no let move ahead Let's solve today's problem is problem number one three nine four da... | Find Lucky Integer in an Array | find-lucky-integer-in-an-array | Given an array of integers `arr`, a **lucky integer** is an integer that has a frequency in the array equal to its value.
Return _the largest **lucky integer** in the array_. If there is no **lucky integer** return `-1`.
**Example 1:**
**Input:** arr = \[2,2,3,4\]
**Output:** 2
**Explanation:** The only lucky number... | null | null | Easy | null |
53 | foreign welcome back to the DSA class today we are going to be solving another important question from the interview perspective called as maximum sub array which is again a lead code question number 53 okay now why I have picked this question is through this question you will also be introduced to an algorithm which i... | 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 |
1,519 | It is given in the form of a vector. Okay, here we have a 2D vector. So, this is also a series. If there are two notes inside our tree and if it is possible between them, then we have to move one forward inside one edge vector. Then I will be given a vector, okay, and here we have another value called N. This is basica... | Number of Nodes in the Sub-Tree With the Same Label | minimum-subsequence-in-non-increasing-order | You are given a tree (i.e. a connected, undirected graph that has no cycles) consisting of `n` nodes numbered from `0` to `n - 1` and exactly `n - 1` `edges`. The **root** of the tree is the node `0`, and each node of the tree has **a label** which is a lower-case character given in the string `labels` (i.e. The node w... | Sort elements and take each element from the largest until accomplish the conditions. | Array,Greedy,Sorting | Easy | 2316 |
938 | welcome to the another episode of techne interview live Cody today we are gonna be talking about one of the questions about like binary search tree and this is firmly the code question number nine 38 which is relatively new and yeah let's get into it so what's last question here let's just read through it given the roo... | Range Sum of BST | numbers-at-most-n-given-digit-set | Given the `root` node of a binary search tree and two integers `low` and `high`, return _the sum of values of all nodes with a value in the **inclusive** range_ `[low, high]`.
**Example 1:**
**Input:** root = \[10,5,15,3,7,null,18\], low = 7, high = 15
**Output:** 32
**Explanation:** Nodes 7, 10, and 15 are in the ra... | null | Array,Math,Binary Search,Dynamic Programming | Hard | null |
162 | hey everybody this is larry this is july 13th the 13th day of the league code daily challenge uh hit the like button is a subscriber and join me on discord let me know what you think about today's farm so my setup is from a different room and i'm trying these airpods instead of my usual mic setup so let me know what yo... | Find Peak Element | find-peak-element | A peak element is an element that is strictly greater than its neighbors.
Given a **0-indexed** integer array `nums`, find a peak element, and return its index. If the array contains multiple peaks, return the index to **any of the peaks**.
You may imagine that `nums[-1] = nums[n] = -∞`. In other words, an element is... | null | Array,Binary Search | Medium | 882,2047,2273,2316 |
148 | hello welcome to my channel and i'm here to do my 100 lego challenge today we have liquor 148 sort list so given a hat of the linked list we turn the list after sorting it in ascendant order so now we take a look at the example in here the top is the input list and we just output to 1 2 3 4 in this ascending order what... | Sort List | sort-list | Given the `head` of a linked list, return _the list after sorting it in **ascending order**_.
**Example 1:**
**Input:** head = \[4,2,1,3\]
**Output:** \[1,2,3,4\]
**Example 2:**
**Input:** head = \[-1,5,3,4,0\]
**Output:** \[-1,0,3,4,5\]
**Example 3:**
**Input:** head = \[\]
**Output:** \[\]
**Constraints:**
* ... | null | Linked List,Two Pointers,Divide and Conquer,Sorting,Merge Sort | Medium | 21,75,147,1992 |
661 | hey everyone let's all the today's lead code challenge which is lead code 661 image smoother in this problem we are given an image represented by this Matrix and we have to do the smoothing of this image so for the smoothing we are using a three cross three filter it means that for every I J cell we will do the smoothi... | Image Smoother | image-smoother | An **image smoother** is a filter of the size `3 x 3` that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding cells (i.e., the average of the nine cells in the blue smoother). If one or more of the surrounding cells of a cell is not present, we do not consider it ... | null | Array,Matrix | Easy | null |
1,971 | hello so let's talk about the fine if paths exist in graph so you are giving them bi-directional graph and also the them bi-directional graph and also the them bi-directional graph and also the vertices and also the source and the destination so you want to find out if there is a path uh you can achieve from source to ... | Find if Path Exists in Graph | incremental-memory-leak | There is a **bi-directional** graph with `n` vertices, where each vertex is labeled from `0` to `n - 1` (**inclusive**). The edges in the graph are represented as a 2D integer array `edges`, where each `edges[i] = [ui, vi]` denotes a bi-directional edge between vertex `ui` and vertex `vi`. Every vertex pair is connecte... | What is the upper bound for the number of seconds? Simulate the process of allocating memory. | Simulation | Medium | null |
1,171 | Hello everyone welcome back, today we will solve another new problem which is very interesting, okay you will get to learn a lot, basically today we will cover two concepts, okay one is the one given in the question, off course and similar thing array. Okay, so let's go to the white board and try to decode this problem... | Remove Zero Sum Consecutive Nodes from Linked List | shortest-path-in-binary-matrix | Given the `head` of a linked list, we repeatedly delete consecutive sequences of nodes that sum to `0` until there are no such sequences.
After doing so, return the head of the final linked list. You may return any such answer.
(Note that in the examples below, all sequences are serializations of `ListNode` objects.)... | Do a breadth first search to find the shortest path. | Array,Breadth-First Search,Matrix | Medium | null |
661 | hey everybody this is larry hit the like button hit the subscribe button let me know how you doing this problem i'm going to solve it live right about now excuse me uh 661 image smooth uh smoover uh given the 2d integer matrix m representing a great scale of an image you need to design a smoother to make the gradient o... | Image Smoother | image-smoother | An **image smoother** is a filter of the size `3 x 3` that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding cells (i.e., the average of the nine cells in the blue smoother). If one or more of the surrounding cells of a cell is not present, we do not consider it ... | null | Array,Matrix | Easy | null |
112 | all right this lead code question is called path sum it says given a binary tree and a sum determine if the tree has a root to leaf path such that adding up all the values along the path equals the given some note a leaf is a node with no children so with the example they give they're saying the target is 22 and we're ... | 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 |
1,286 | uh hey everybody this is larry this is day 13 of the august leeco challenge uh hit the like button hit the subscribe button join me on discord and let me know what you think uh so today's problem is uh combination iterator um innovative combination i and depending on your language this actually um it changes how you wo... | Iterator for Combination | constrained-subsequence-sum | Design the `CombinationIterator` class:
* `CombinationIterator(string characters, int combinationLength)` Initializes the object with a string `characters` of **sorted distinct** lowercase English letters and a number `combinationLength` as arguments.
* `next()` Returns the next combination of length `combinationL... | Use dynamic programming. Let dp[i] be the solution for the prefix of the array that ends at index i, if the element at index i is in the subsequence. dp[i] = nums[i] + max(0, dp[i-k], dp[i-k+1], ..., dp[i-1]) Use a heap with the sliding window technique to optimize the dp. | Array,Dynamic Programming,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue | Hard | null |
1,859 | a sentence is also a kind of string right and when you are given a sentence what is the best way that you can separate two different words it is not the punctuation marks it's not the full stop it's not even the capital letters what is the most basic thing that is the space between two words right that is how you ident... | Sorting the Sentence | change-minimum-characters-to-satisfy-one-of-three-conditions | A **sentence** is a list of words that are separated by a single space with no leading or trailing spaces. Each word consists of lowercase and uppercase English letters.
A sentence can be **shuffled** by appending the **1-indexed word position** to each word then rearranging the words in the sentence.
* For example... | Iterate on each letter in the alphabet, and check the smallest number of operations needed to make it one of the following: the largest letter in a and smaller than the smallest one in b, vice versa, or let a and b consist only of this letter. For the first 2 conditions, take care that you can only change characters to... | Hash Table,String,Counting,Prefix Sum | Medium | null |
1,675 | hello everyone hope you all are doing well so i am back with another daily challenge and it is late call number 1675 minimize deviation in error it is a high level problem and i also feel the same and it is quite interesting problem it takes some mathematical concept okay mathematical observation unit okay so let's go ... | Minimize Deviation in Array | magnetic-force-between-two-balls | You are given an array `nums` of `n` positive integers.
You can perform two types of operations on any element of the array any number of times:
* If the element is **even**, **divide** it by `2`.
* For example, if the array is `[1,2,3,4]`, then you can do this operation on the last element, and the array wil... | If you can place balls such that the answer is x then you can do it for y where y < x. Similarly if you cannot place balls such that the answer is x then you can do it for y where y > x. Binary search on the answer and greedily see if it is possible. | Array,Binary Search,Sorting | Medium | 2188 |
1,081 | hello guys welcome back to the channel today we are solving another lead code problem that is 1081 smallest subsequence of distinct character before jumping into the solution I would highly recommend you should read the problem statement on your own and give at least 15 to 30 minutes to this problem so let's get right ... | Smallest Subsequence of Distinct Characters | video-stitching | Given a string `s`, return _the_ _lexicographically smallest_ _subsequence_ _of_ `s` _that contains all the distinct characters of_ `s` _exactly once_.
**Example 1:**
**Input:** s = "bcabc "
**Output:** "abc "
**Example 2:**
**Input:** s = "cbacdcbc "
**Output:** "acdb "
**Constraints:**
* `1 <= s.length <=... | What if we sort the intervals? Considering the sorted intervals, how can we solve the problem with dynamic programming? Let's consider a DP(pos, limit) where pos represents the position of the current interval we are gonna take the decision and limit is the current covered area from [0 - limit]. This DP returns the mi... | Array,Dynamic Programming,Greedy | Medium | null |
915 | hello everyone welcome to quartus camp we are 22nd day of july elite code challenge and the problem we are going to cover in this video is partition array into disjoint intervals so it is an interesting problem where the input given here is an integer array nouns and we have to return the size of the left array we have... | Partition Array into Disjoint Intervals | generate-random-point-in-a-circle | Given an integer array `nums`, partition it into two (contiguous) subarrays `left` and `right` so that:
* Every element in `left` is less than or equal to every element in `right`.
* `left` and `right` are non-empty.
* `left` has the smallest possible size.
Return _the length of_ `left` _after such a partitioni... | null | Math,Geometry,Rejection Sampling,Randomized | Medium | 914 |
1,832 | hello guys my name is arsala and welcome back to my channel and today we are going to solve a new lead code question that is check if the sentence is pancrum so how we are going to solve this question I will be explaining it to you and just before starting solving this question guys do subscribe to the channel hit the ... | Check if the Sentence Is Pangram | minimum-operations-to-make-a-subsequence | A **pangram** is a sentence where every letter of the English alphabet appears at least once.
Given a string `sentence` containing only lowercase English letters, return `true` _if_ `sentence` _is a **pangram**, or_ `false` _otherwise._
**Example 1:**
**Input:** sentence = "thequickbrownfoxjumpsoverthelazydog "
**O... | The problem can be reduced to computing Longest Common Subsequence between both arrays. Since one of the arrays has distinct elements, we can consider that these elements describe an arrangement of numbers, and we can replace each element in the other array with the index it appeared at in the first array. Then the pro... | Array,Hash Table,Binary Search,Greedy | Hard | null |
1,041 | we're going to take a look at a legal problem called robot bounded in circle so given or on a infinite plane a robot initially stands at zero and faces north so the robot can receive one of the three direct three instructions so g basically goes straight one unit l basically turn left 90 degree r basically turn right 9... | Robot Bounded In Circle | available-captures-for-rook | On an infinite plane, a robot initially stands at `(0, 0)` and faces north. Note that:
* The **north direction** is the positive direction of the y-axis.
* The **south direction** is the negative direction of the y-axis.
* The **east direction** is the positive direction of the x-axis.
* The **west direction**... | null | Array,Matrix,Simulation | Easy | null |
160 | hey guys welcome to another easy leaker question today we're going to solve leak code 160 intersection of two linked lists so this question gives you two simply linked lists and those links list intersect at a certain node and then you should find that node and return it so um i'm going to talk about three solutions i'... | Intersection of Two Linked Lists | intersection-of-two-linked-lists | Given the heads of two singly linked-lists `headA` and `headB`, return _the node at which the two lists intersect_. If the two linked lists have no intersection at all, return `null`.
For example, the following two linked lists begin to intersect at node `c1`:
The test cases are generated such that there are no cycle... | null | Hash Table,Linked List,Two Pointers | Easy | 599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.