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 |
|---|---|---|---|---|---|---|---|---|
443 | Hello friends, welcome to your day 40 and at the beginning of the challenge, let's go straight to the screen and start today's question. Okay, so the number of today's question is 443. Okay, the name of the question is String Compression String. Okay, so basically what do we have to do in the question, let us understan... | String Compression | string-compression | Given an array of characters `chars`, compress it using the following algorithm:
Begin with an empty string `s`. For each group of **consecutive repeating characters** in `chars`:
* If the group's length is `1`, append the character to `s`.
* Otherwise, append the character followed by the group's length.
The co... | How do you know if you are at the end of a consecutive group of characters? | Two Pointers,String | Medium | 38,271,604,1241 |
235 | um hello so today we are going to do this problem lowest common ancestor of binary century which is part of the code daily challenge so we have a bst and we want to find the lowest common ancestor um of two nodes that we get in the input and the lca is just the lowest possible parent of both um and bst is a binary tree... | 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 |
143 | hello everyone it's really good to see you here so today we are going to solve a lead code problem which is reorder list so what we have given a linked list and we have in the form let's suppose l0 l1 till ll then what we have to do is the first element should be l0 then the second element should be ln and then the thi... | Reorder List | reorder-list | You are given the head of a singly linked-list. The list can be represented as:
L0 -> L1 -> ... -> Ln - 1 -> Ln
_Reorder the list to be on the following form:_
L0 -> Ln -> L1 -> Ln - 1 -> L2 -> Ln - 2 -> ...
You may not modify the values in the list's nodes. Only nodes themselves may be changed.
**Example 1:**
**... | null | Linked List,Two Pointers,Stack,Recursion | Medium | 2216 |
1,827 | there are some problems where half of the problem or the understanding of the problem is sifting through the information that seems kind of misleading or information that isn't exactly very helpful or not helpful enough to solving the problem and this is kind of one of those problems that i think of so we're given the ... | Minimum Operations to Make the Array Increasing | invalid-tweets | You are given an integer array `nums` (**0-indexed**). In one operation, you can choose an element of the array and increment it by `1`.
* For example, if `nums = [1,2,3]`, you can choose to increment `nums[1]` to make `nums = [1,**3**,3]`.
Return _the **minimum** number of operations needed to make_ `nums` _**stri... | null | Database | Easy | null |
1,239 | everyone with Calvin here so let's discuss about weekly contest 163rd question maximum length of a continent string with unique character so we are given a array of string and then we can cut any of the string inside the array and but we still need to result in a unique character inside the concat string so we need to ... | Maximum Length of a Concatenated String with Unique Characters | largest-1-bordered-square | You are given an array of strings `arr`. A string `s` is formed by the **concatenation** of a **subsequence** of `arr` that has **unique characters**.
Return _the **maximum** possible length_ of `s`.
A **subsequence** is an array that can be derived from another array by deleting some or no elements without changing ... | For each square, know how many ones are up, left, down, and right of this square. You can find it in O(N^2) using dynamic programming. Now for each square ( O(N^3) ), we can evaluate whether that square is 1-bordered in O(1). | Array,Dynamic Programming,Matrix | Medium | null |
300 | Hello everyone welcome to my channel good story with mike so today you are going to do video number 11 of DP concepts okay and before starting some speech you are a very simple statement but very powerful statement do it so hard that everywhere People in your circle should discuss, is n't it? Everyone starts aspiring a... | Longest Increasing Subsequence | longest-increasing-subsequence | Given an integer array `nums`, return _the length of the longest **strictly increasing**_ _**subsequence**_.
**Example 1:**
**Input:** nums = \[10,9,2,5,3,7,101,18\]
**Output:** 4
**Explanation:** The longest increasing subsequence is \[2,3,7,101\], therefore the length is 4.
**Example 2:**
**Input:** nums = \[0,1,... | null | Array,Binary Search,Dynamic Programming | Medium | 334,354,646,673,712,1766,2096,2234 |
52 | hello let's try to solve another lead code problem number 52 increase the two so this is totally the same as increase one yeah if you didn't detect my increase one video I suggest you check that because my code is totally based on that yes so I'm not going to explain the algorithm I'm not going to explain the descripti... | N-Queens II | n-queens-ii | The **n-queens** puzzle is the problem of placing `n` queens on an `n x n` chessboard such that no two queens attack each other.
Given an integer `n`, return _the number of distinct solutions to the **n-queens puzzle**_.
**Example 1:**
**Input:** n = 4
**Output:** 2
**Explanation:** There are two distinct solutions ... | null | Backtracking | Hard | 51 |
257 | we are given a binary tree and we need to find out all the root two leaf paths we know that a binary tree is a tree in which each node can have at most two children that is each node can have at most a left child and their right child in a tree the topmost node or the node that doesn't have any parent is called the roo... | Binary Tree Paths | binary-tree-paths | Given the `root` of a binary tree, return _all root-to-leaf paths in **any order**_.
A **leaf** is a node with no children.
**Example 1:**
**Input:** root = \[1,2,3,null,5\]
**Output:** \[ "1->2->5 ", "1->3 "\]
**Example 2:**
**Input:** root = \[1\]
**Output:** \[ "1 "\]
**Constraints:**
* The number of nodes ... | null | String,Backtracking,Tree,Depth-First Search,Binary Tree | Easy | 113,1030,2217 |
322 | hey everyone welcome back and let's write some more neat code today let's solve another classic dynamic programming problem coin change and we get a pretty simple uh description so we're given a list of coins of different values and we're also given a total amount of money that we want to sum up to but we want to use t... | Coin Change | coin-change | You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money.
Return _the fewest number of coins that you need to make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `-1`.
You may a... | null | Array,Dynamic Programming,Breadth-First Search | Medium | 1025,1393,2345 |
1,996 | This is a very interesting problem to be solved and the name of the problem is, if you beat the number then I have brought it very well. To understand the problem, you should understand that what kind of ghee is there in our body and in this simple vegetable. We will explain that if the definition of key takes the numb... | The Number of Weak Characters in the Game | number-of-ways-to-rearrange-sticks-with-k-sticks-visible | You are playing a game that contains multiple characters, and each of the characters has **two** main properties: **attack** and **defense**. You are given a 2D integer array `properties` where `properties[i] = [attacki, defensei]` represents the properties of the `ith` character in the game.
A character is said to be... | Is there a way to build the solution from a base case? How many ways are there if we fix the position of one stick? | Math,Dynamic Programming,Combinatorics | Hard | null |
77 | hello everyone welcome to my programming Club today we will be solving another daily read for Challenge and the challenge name is combinations so the challenge statement is like this given point dealers and NK return all the possible combinations of K numbers Frozen from the range 1 to 1 you may return the answer in an... | Combinations | combinations | Given two integers `n` and `k`, return _all possible combinations of_ `k` _numbers chosen from the range_ `[1, n]`.
You may return the answer in **any order**.
**Example 1:**
**Input:** n = 4, k = 2
**Output:** \[\[1,2\],\[1,3\],\[1,4\],\[2,3\],\[2,4\],\[3,4\]\]
**Explanation:** There are 4 choose 2 = 6 total combin... | null | Backtracking | Medium | 39,46 |
122 | what's up nerds welcome back to t time with your favorite software engineer so i actually broke my monitor with the webcam so that's why i've been gone so long but i finally got it fixed so i also got a new desk that's why it looks different um so today i'm gonna be going over best time to buy and sell stock too but fi... | 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 |
797 | hello all uh welcome to another lead code problem so today we are going to solve a graph based problem which is 797 all passed from source to Target so if I read the problem description it's a given a direct graph with nodes and from within nodes level from 0 to n minus 1 when all possible parts are 0 to n minus 1 so y... | All Paths From Source to Target | rabbits-in-forest | Given a directed acyclic graph (**DAG**) of `n` nodes labeled from `0` to `n - 1`, find all possible paths from node `0` to node `n - 1` and return them in **any order**.
The graph is given as follows: `graph[i]` is a list of all nodes you can visit from node `i` (i.e., there is a directed edge from node `i` to node `... | null | Array,Hash Table,Math,Greedy | Medium | null |
1,894 | hey everybody this is larry this is miko with q2 of the biweekly contest 54. uh find the student that will replace the chalk hit the like button hit the subscribe button join me in discord if you like it um if not that's fine too but you know i got nothing to say about that one uh okay so for this prom you know you may... | Find the Student that Will Replace the Chalk | merge-strings-alternately | There are `n` students in a class numbered from `0` to `n - 1`. The teacher will give each student a problem starting with the student number `0`, then the student number `1`, and so on until the teacher reaches the student number `n - 1`. After that, the teacher will restart the process, starting with the student numb... | Use two pointers, one pointer for each string. Alternately choose the character from each pointer, and move the pointer upwards. | Two Pointers,String | Easy | 281 |
791 | hello everyone so I'll be solving a medium lead code problem today called custom sort string so let's read the question first you are given two strings order and S all the characters of order are unique and were sorted in some custom order previously so we are given two string order and S and it says that order has uni... | Custom Sort String | split-bst | You are given two strings order and s. All the characters of `order` are **unique** and were sorted in some custom order previously.
Permute the characters of `s` so that they match the order that `order` was sorted. More specifically, if a character `x` occurs before a character `y` in `order`, then `x` should occur ... | Use recursion. If root.val <= V, you split root.right into two halves, then join it's left half back on root.right. | Tree,Binary Search Tree,Recursion,Binary Tree | Medium | 450 |
228 | welcome to october's leeco challenge today's problem is summary ranges you are given a sorted unique integer array nums return the smallest sorted list of ranges that cover all the numbers in the array exactly so for instance if we had this example here we're going to return zero to two because that covers zero one two... | 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 |
260 | hey everyone welcome to lead code 260 single number three so we'll be given an array of integers in which all numbers appear twice except two numbers that appear only once we have to find these two numbers and return them for example in this particular array the numbers that appear only once are three and five so we ha... | Single Number III | single-number-iii | Given an integer array `nums`, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in **any order**.
You must write an algorithm that runs in linear runtime complexity and uses only constant extra space.
... | null | Array,Bit Manipulation | Medium | 136,137 |
212 | hello guys now it hurts of the word search to profit let's see the province statement give a 2d boat and a list of words from the dictionary find all words in the port each word must be contracted from letters of sequentially agency sell well agency cells are those horizontally all virtually never there same letter cel... | Word Search II | word-search-ii | Given an `m x n` `board` of characters and a list of strings `words`, return _all words on the board_.
Each word must 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 in a word.
**Exampl... | You would need to optimize your backtracking to pass the larger test. Could you stop backtracking earlier? If the current candidate does not exist in all words' prefix, you could stop backtracking immediately. What kind of data structure could answer such query efficiently? Does a hash table work? Why or why not? How a... | Array,String,Backtracking,Trie,Matrix | Hard | 79,1022,1433 |
435 | welcome back to outgod.js today's welcome back to outgod.js today's welcome back to outgod.js today's question is elite code 435 non-overlapping intervals non-overlapping intervals non-overlapping intervals so you're given an array of intervals where interval i is equal to start i and i return the minimum number of 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 |
140 | hey what's up guys Chung here so today let's talk about this is problem number 140 a word break - yeah this one is 140 a word break - yeah this one is 140 a word break - yeah this one is marked as hard yeah I would say it's between the heart and the medium yeah it's not that extreme hard but it got some tricky point an... | Word Break II | word-break-ii | Given a string `s` and a dictionary of strings `wordDict`, add spaces in `s` to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in **any order**.
**Note** that the same word in the dictionary may be reused multiple times in the segmentation.
**Example 1:**
**Input:... | null | Hash Table,String,Dynamic Programming,Backtracking,Trie,Memoization | Hard | 139,472 |
1,689 | all right let's talk about partitioning into minimum number of a decimal binary number so this binary number is uh a digit that is either zero or one so uh without any leading zero so uh these are that's a binary number and this or not it's because they are some integer which is not zero or one right so you are given a... | 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 |
316 | hello guys welcome back to tech dose and in this video we will see the remove duplicate letters problem which is from lead code number 316 and the data structure involved is a monotonic stack so before looking at the problem statement i would like to announce about our dsa live training program which is a three months ... | 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 |
29 | hey guys let's take a look at number 29 divided two integers we need to divide we need to create our own division divide division yeah without using multiplication division and operator and mod operator yeah this R is naive approach is just keep doing subtraction right I'm not sure whether they pass or not the time lim... | Divide Two Integers | divide-two-integers | Given two integers `dividend` and `divisor`, divide two integers **without** using multiplication, division, and mod operator.
The integer division should truncate toward zero, which means losing its fractional part. For example, `8.345` would be truncated to `8`, and `-2.7335` would be truncated to `-2`.
Return _the... | null | Math,Bit Manipulation | Medium | null |
322 | hey what's up YouTube Welcome to another video so I'm not sure if I uploaded this before I definitely have this video in Spanish but I went and watch it in Spanish and definitely I did not like the explanation that I had before so I'm going to redo this video and hopefully uh clear some things up uh so the problem is c... | Coin Change | coin-change | You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money.
Return _the fewest number of coins that you need to make up that amount_. If that amount of money cannot be made up by any combination of the coins, return `-1`.
You may a... | null | Array,Dynamic Programming,Breadth-First Search | Medium | 1025,1393,2345 |
41 | Hello everybody welcome back to hike my name is panel Jan and today we will solve the question first missing positive we will first of all try to understand the question then we'll try to understand the approach to solve it and finally we will code it in so look at the entire video watch the entire video end to end so ... | 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 |
740 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem delete and earn and before we get into it i want to mention that this problem is actually very similar to another problem that we've solved on this channel called house robber it might not seem like it but when you do k... | 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 |
92 | See, we are going to ask questions in this video. Lead Code 92 Reverse Link List 2 questions which are going to be a bit complex. If you are feeling lazy or sleepy then do not watch the video. Watch it only when you are active. Because you will not understand otherwise I am telling you so the story is something like th... | Reverse Linked List II | reverse-linked-list-ii | Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], left = 2, right = 4
**Output:** \[1,4,3,2,5\]
**Example 2:**
**I... | null | Linked List | Medium | 206 |
94 | hey guys persistent programmer here and welcome back to my channel so in this channel we solve a lot of algorithms and go over legal questions so if you haven't subscribed already go ahead and hit the subscribe button smash that like button because that helps me create this content for you guys so without further ado l... | Binary Tree Inorder Traversal | binary-tree-inorder-traversal | Given the `root` of a binary tree, return _the inorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[1,3,2\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of nodes i... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 98,144,145,173,230,272,285,758,799 |
463 | in this problem you are given a grid and that grid cells represent either a piece of land or water so uh inside the grid one will denote land and zero will denote water so this is a binary grid and outside the grid everything is water and there is just one piece of land and it's clearly mentioned in this question that ... | Island Perimeter | island-perimeter | You are given `row x col` `grid` representing a map where `grid[i][j] = 1` represents land and `grid[i][j] = 0` represents water.
Grid cells are connected **horizontally/vertically** (not diagonally). The `grid` is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells)... | null | Array,Depth-First Search,Breadth-First Search,Matrix | Easy | 695,733,1104 |
137 | how's it doing Mondays so in this video discuss about this problem single number two given a non empty array of integers every element appears three times except for one which are B's exactly ones fine it's single one note 0 algorithm should have a linear and time complexity and could you implement it without using an ... | Single Number II | single-number-ii | Given an integer array `nums` where every element appears **three times** except for one, which appears **exactly once**. _Find the single element and return it_.
You must implement a solution with a linear runtime complexity and use only constant extra space.
**Example 1:**
**Input:** nums = \[2,2,3,2\]
**Output:**... | null | Array,Bit Manipulation | Medium | 136,260 |
1,932 | hello everyone uh today we are going to look at another lead code problem which is uh category of art where we need to merge a PST into single BST so BS is basically binary service tree so we know that binary search history is something where everything in the left is less than the root node and then everything on the ... | Merge BSTs to Create Single BST | grand-slam-titles | You are given `n` **BST (binary search tree) root nodes** for `n` separate BSTs stored in an array `trees` (**0-indexed**). Each BST in `trees` has **at most 3 nodes**, and no two roots have the same value. In one operation, you can:
* Select two **distinct** indices `i` and `j` such that the value stored at one of ... | null | Database | Medium | null |
1,929 | hi my name is david today we're going to do number 1929 concatenation of array and we're going to be solving this in javascript so we have a function that wants to get concatenation and then take some nums here we see is an array of nums and here's the example and it wants us to return a new array where it just concate... | 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 |
1,312 | Hello Hi Everyone Welcome Back To My YouTube Channel Su Again Be Destructive Avatar Difficult Questions Minimum Installation Steps To Make A Simple Improve Special Public Number One Two Three For Lips Expert Mr Topic Company Hi How To Do And You Must Need To Find The Number Of Little Boy Doing A B A That Deep Sleep And... | Minimum Insertion Steps to Make a String Palindrome | count-artifacts-that-can-be-extracted | Given a string `s`. In one step you can insert any character at any index of the string.
Return _the minimum number of steps_ to make `s` palindrome.
A **Palindrome String** is one that reads the same backward as well as forward.
**Example 1:**
**Input:** s = "zzazz "
**Output:** 0
**Explanation:** The string "zz... | Check if each coordinate of each artifact has been excavated. How can we do this quickly without iterating over the dig array every time? Consider marking all excavated cells in a 2D boolean array. | Array,Hash Table,Simulation | Medium | 221 |
1,008 | Hua Tha Hello Viewers Welcome Back to My Channel Thank You Doing Great Job Done Please Do Subscribe My Favorite Playlist Cover Various Categories of Problem Subscribe and Research Dynamic Programming Benefits on Please Aadhe Problem Subscribe Video Subscribe Free Mode on Traversal Preorder Traversal Basically Veer subs... | Construct Binary Search Tree from Preorder Traversal | binary-tree-cameras | Given an array of integers preorder, which represents the **preorder traversal** of a BST (i.e., **binary search tree**), construct the tree and return _its root_.
It is **guaranteed** that there is always possible to find a binary search tree with the given requirements for the given test cases.
A **binary search tr... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Hard | 1021 |
662 | hey what's up guys it's Nick white and I do tech and coding stuff on twitch and YouTube and I do and check at the description for everything else I do all of the LICO problems I got a ton of them up on my youtube channel so please go check those out if you want these explain to you trying to get a job at Google guys so... | Maximum Width of Binary Tree | maximum-width-of-binary-tree | Given the `root` of a binary tree, return _the **maximum width** of the given tree_.
The **maximum width** of a tree is the maximum **width** among all levels.
The **width** of one level is defined as the length between the end-nodes (the leftmost and rightmost non-null nodes), where the null nodes between the end-no... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
659 | To Jhal Ajay, Hey Guys, once again welcome all of you to your YouTube channel TLC. There is a very interesting question in today's video and the question is very important. It is from Interview Perspective Study. A small thing before starting the video. Do not subscribe the channel, press the bell icon notification, Bi... | Split Array into Consecutive Subsequences | split-array-into-consecutive-subsequences | You are given an integer array `nums` that is **sorted in non-decreasing order**.
Determine if it is possible to split `nums` into **one or more subsequences** such that **both** of the following conditions are true:
* Each subsequence is a **consecutive increasing sequence** (i.e. each integer is **exactly one** m... | null | Array,Hash Table,Greedy,Heap (Priority Queue) | Medium | 347,1422 |
509 | hey everyone welcome back and today I'll be doing another lead code 509 Fibonacci number and easy one a very famous One the Fibonacci number commonly denoted as FN from a sequence called Fibonacci Sequence such that each number is the sum of the two preceding ones starting from zero and one that is like this and now we... | Fibonacci Number | inorder-successor-in-bst-ii | The **Fibonacci numbers**, commonly denoted `F(n)` form a sequence, called the **Fibonacci sequence**, such that each number is the sum of the two preceding ones, starting from `0` and `1`. That is,
F(0) = 0, F(1) = 1
F(n) = F(n - 1) + F(n - 2), for n > 1.
Given `n`, calculate `F(n)`.
**Example 1:**
**Input:** n = ... | null | Tree,Binary Search Tree,Binary Tree | Medium | 285 |
7 | hey guys in here and we're doing a easy problem on Lee code the seventh problem reverse integer and it is indeed quite easy so it gives us an input of say one two three and we just need to return three two one but this is an integer so we can't just reverse the string but we can convert that integer into a string and t... | 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 |
20 | hey everyone welcome back to the channel i hope you guys are doing extremely well so today we will be talking about balanced brackets basically you will be given a string which contains brackets of six kinds one is this kind that is the opening bracket this is the corresponding closing of that this is another type and ... | Valid Parentheses | valid-parentheses | Given a string `s` containing just the characters `'('`, `')'`, `'{'`, `'}'`, `'['` and `']'`, determine if the input string is valid.
An input string is valid if:
1. Open brackets must be closed by the same type of brackets.
2. Open brackets must be closed in the correct order.
3. Every close bracket has a corres... | An interesting property about a valid parenthesis expression is that a sub-expression of a valid expression should also be a valid expression. (Not every sub-expression) e.g.
{ { } [ ] [ [ [ ] ] ] } is VALID expression
[ [ [ ] ] ] is VALID sub-expression
{ } [ ] is VALID sub-express... | String,Stack | Easy | 22,32,301,1045,2221 |
93 | hello and welcome to this video on the implementation of an algorithm on how to restore IP addresses from a given string we will start by discussing the problem statement and the input and output of a function the problem statement is to take a string as input which represents a number and restore all possible valid IP... | Restore IP Addresses | restore-ip-addresses | A **valid IP address** consists of exactly four integers separated by single dots. Each integer is between `0` and `255` (**inclusive**) and cannot have leading zeros.
* For example, `"0.1.2.201 "` and `"192.168.1.1 "` are **valid** IP addresses, but `"0.011.255.245 "`, `"192.168.1.312 "` and `"192.168@1.1 "` are **... | null | String,Backtracking | Medium | 752 |
97 | hey everybody this is Larry this is day 25 of the league of daily challenge hit the like button hit the Subscribe button join me on Discord whoops what did I click on join me on Discord let me know what you think about today's poem uh yeah okay today's firm is interleaving string number 97 I give an S1 S2 S3 fine weath... | Interleaving String | interleaving-string | Given strings `s1`, `s2`, and `s3`, find whether `s3` is formed by an **interleaving** of `s1` and `s2`.
An **interleaving** of two strings `s` and `t` is a configuration where `s` and `t` are divided into `n` and `m` substrings respectively, such that:
* `s = s1 + s2 + ... + sn`
* `t = t1 + t2 + ... + tm`
* `|... | null | String,Dynamic Programming | Medium | null |
906 | welcome to maisley code challenge today's problem is super palindromes let's say a positive integer is a super palindrome if it is a palindrome meaning it's the same forwards and backwards and it's also a square of a palindrome now given two positive integers left and right represented as strings return the number of s... | Super Palindromes | walking-robot-simulation | Let's say a positive integer is a **super-palindrome** if it is a palindrome, and it is also the square of a palindrome.
Given two positive integers `left` and `right` represented as strings, return _the number of **super-palindromes** integers in the inclusive range_ `[left, right]`.
**Example 1:**
**Input:** left ... | null | Array,Simulation | Medium | 2178 |
134 | i'm just preparing to record this video and yeah i'm ready all right let's get started welcome to this video in this video we're going to solve this coding interview question gash station in this problem you are given to every cash and cost the cash array represent the amount of cash is station hedge and the cost array... | Gas Station | gas-station | There are `n` gas stations along a circular route, where the amount of gas at the `ith` station is `gas[i]`.
You have a car with an unlimited gas tank and it costs `cost[i]` of gas to travel from the `ith` station to its next `(i + 1)th` station. You begin the journey with an empty tank at one of the gas stations.
Gi... | null | Array,Greedy | Medium | 1346 |
88 | hey everyone welcome back and let's write some more neat code today so today let's look at leak code 88 merge sorted array so we're given two input arrays nums one and nums two and we wanna take nums 2 and then merge it into nums 1 into 1 sorted array now lucky for us we are guaranteed that there is enough space in num... | Merge Sorted Array | merge-sorted-array | You are given two integer arrays `nums1` and `nums2`, sorted in **non-decreasing order**, and two integers `m` and `n`, representing the number of elements in `nums1` and `nums2` respectively.
**Merge** `nums1` and `nums2` into a single array sorted in **non-decreasing order**.
The final sorted array should not be re... | You can easily solve this problem if you simply think about two elements at a time rather than two arrays. We know that each of the individual arrays is sorted. What we don't know is how they will intertwine. Can we take a local decision and arrive at an optimal solution? If you simply consider one element each at a ti... | Array,Two Pointers,Sorting | Easy | 21,1019,1028 |
459 | hi all welcome to learn code repeat so today we will be looking at day three of the september lead code challenge so the problem is repeated substring pattern let's look into the problem so the problem is uh repeated substring pattern given a non-empty string pattern given a non-empty string pattern given a non-empty s... | Repeated Substring Pattern | repeated-substring-pattern | Given a string `s`, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.
**Example 1:**
**Input:** s = "abab "
**Output:** true
**Explanation:** It is the substring "ab " twice.
**Example 2:**
**Input:** s = "aba "
**Output:** false
**Example 3:**
... | null | String,String Matching | Easy | 28,686 |
665 | hi everyone today we are going to solve the lead code question non-decreasing the lead code question non-decreasing the lead code question non-decreasing array so you are given array Norms with n integers your task is to check if it could become non-decreasing by modifying could become non-decreasing by modifying could... | Non-decreasing Array | non-decreasing-array | Given an array `nums` with `n` integers, your task is to check if it could become non-decreasing by modifying **at most one element**.
We define an array is non-decreasing if `nums[i] <= nums[i + 1]` holds for every `i` (**0-based**) such that (`0 <= i <= n - 2`).
**Example 1:**
**Input:** nums = \[4,2,3\]
**Output:... | null | Array | Medium | 2205 |
200 | question 200 of leap code number of islands given an m by n 2d binary grid which represents a map of ones land and xero's water return the number of islands so an island is surrounded by water and is formed by connecting adjacent land horizontally or vertically you may assume all four edges of the grid are all surround... | Number of Islands | number-of-islands | Given an `m x n` 2D binary grid `grid` which represents a map of `'1'`s (land) and `'0'`s (water), return _the number of islands_.
An **island** is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
**Exampl... | null | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | 130,286,305,323,694,695,2035,2103 |
894 | hey everyone today we are going to solve the little question or possible for binary tweets so you are given and return a list of all possible for binary three ways and nodes each node of each tree in the answer must have node bar equals zero so each element of the answer is a root node of one possible three you may ret... | All Possible Full Binary Trees | random-pick-with-blacklist | Given an integer `n`, return _a list of all possible **full binary trees** with_ `n` _nodes_. Each node of each tree in the answer must have `Node.val == 0`.
Each element of the answer is the root node of one possible tree. You may return the final list of trees in **any order**.
A **full binary tree** is a binary tr... | null | Hash Table,Math,Binary Search,Sorting,Randomized | Hard | 398,912,2107 |
1,857 | Hello everybody welcome back to my channel uh today let's start a hard question so that is the largest color value in a directed graph so description is too long so I will just use this example one to illustrate so here that there are five notes Here one from zero to four and for each node it has a color for example th... | Largest Color Value in a Directed Graph | largest-color-value-in-a-directed-graph | There is a **directed graph** of `n` colored nodes and `m` edges. The nodes are numbered from `0` to `n - 1`.
You are given a string `colors` where `colors[i]` is a lowercase English letter representing the **color** of the `ith` node in this graph (**0-indexed**). You are also given a 2D array `edges` where `edges[j]... | null | null | Hard | null |
91 | The person starts disassembling and the instructor is nearby subscribe unit 2.2 subscribe nearby subscribe unit 2.2 subscribe nearby subscribe unit 2.2 subscribe button under subscribe Video subscribe ki 3222 sex 992 to decoded to benefits 2012latest video0 ab zid bcd na dhone subscribe Video subscribe and subscribe th... | 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,962 | all right we are doing this problem called remove stones to minimize the total that's our read you are given a zero index integer a pi Square Pi Supply represents the number of stores in the ith pile and an integer K you should apply the following operation exactly three times remove any file and remove okay so basical... | Remove Stones to Minimize the Total | single-threaded-cpu | You are given a **0-indexed** integer array `piles`, where `piles[i]` represents the number of stones in the `ith` pile, and an integer `k`. You should apply the following operation **exactly** `k` times:
* Choose any `piles[i]` and **remove** `floor(piles[i] / 2)` stones from it.
**Notice** that you can apply the ... | To simulate the problem we first need to note that if at any point in time there are no enqueued tasks we need to wait to the smallest enqueue time of a non-processed element We need a data structure like a min-heap to support choosing the task with the smallest processing time from all the enqueued tasks | Array,Sorting,Heap (Priority Queue) | Medium | 2176 |
1,200 | it's an easy problem it's said uh we'll be given an array of integers and the output is going to be the pair of minimum uh difference so here actually the difference is one so uh the output is going to be the all the pairs of which have difference one and here is another example in this case it have a difference the mi... | Minimum Absolute Difference | remove-interval | Given an array of **distinct** integers `arr`, find all pairs of elements with the minimum absolute difference of any two elements.
Return a list of pairs in ascending order(with respect to pairs), each pair `[a, b]` follows
* `a, b` are from `arr`
* `a < b`
* `b - a` equals to the minimum absolute difference o... | Solve the problem for every interval alone. Divide the problem into cases according to the position of the two intervals. | Array | Medium | null |
315 | so hey there everyone welcome back I hope you all are doing extremely well so in the latest video we have seen this easy problem how my numbers are smaller than the current number so in this video we are going to solve this problem count of smaller numbers after Self write for example we are given an integer array nump... | Count of Smaller Numbers After Self | count-of-smaller-numbers-after-self | Given an integer array `nums`, return _an integer array_ `counts` _where_ `counts[i]` _is the number of smaller elements to the right of_ `nums[i]`.
**Example 1:**
**Input:** nums = \[5,2,6,1\]
**Output:** \[2,1,1,0\]
**Explanation:**
To the right of 5 there are **2** smaller elements (2 and 1).
To the right of 2 the... | null | Array,Binary Search,Divide and Conquer,Binary Indexed Tree,Segment Tree,Merge Sort,Ordered Set | Hard | 327,406,493,1482,2280 |
344 | hello everyone this is rajat welcome to the boss coder YouTube channel so today we are going to solve this problem reverse scen so let's see the problem statement so in the problem you are given a stren however in the form of an aing for example let's say the string is hello then you are given like this so this is the ... | Reverse String | reverse-string | Write a function that reverses a string. The input string is given as an array of characters `s`.
You must do this by modifying the input array [in-place](https://en.wikipedia.org/wiki/In-place_algorithm) with `O(1)` extra memory.
**Example 1:**
**Input:** s = \["h","e","l","l","o"\]
**Output:** \["o","l","l","e","h... | The entire logic for reversing a string is based on using the opposite directional two-pointer approach! | Two Pointers,String,Recursion | Easy | 345,541 |
1,614 | so this is the lead code question 1614 maximum less than depth of parents parentheses we're gonna check uh the maximum of depth of uh strength now to start off we need to create a integer where we initialize the maximum number of that to zero uh Max depth we're going to label as zero right now we're going to increment ... | Maximum Nesting Depth of the Parentheses | maximum-nesting-depth-of-the-parentheses | A string is a **valid parentheses string** (denoted **VPS**) if it meets one of the following:
* It is an empty string `" "`, or a single character not equal to `"( "` or `") "`,
* It can be written as `AB` (`A` concatenated with `B`), where `A` and `B` are **VPS**'s, or
* It can be written as `(A)`, where `A` i... | null | null | Easy | null |
1,850 | hi uh today we'll solve the problem 1850 minimum adjacent swaps to reach the kth uh smallest number so what i will be explaining is one uh the problem statement we'll go through few examples and then we'll discuss about the solution and then we'll go ahead to the implementation okay let's move to the problem quickly so... | Minimum Adjacent Swaps to Reach the Kth Smallest Number | minimum-length-of-string-after-deleting-similar-ends | You are given a string `num`, representing a large integer, and an integer `k`.
We call some integer **wonderful** if it is a **permutation** of the digits in `num` and is **greater in value** than `num`. There can be many wonderful integers. However, we only care about the **smallest-valued** ones.
* For example, ... | If both ends have distinct characters, no more operations can be made. Otherwise, the only operation is to remove all of the same characters from both ends. We will do this as many times as we can. Note that if the length is equal 1 the answer is 1 | Two Pointers,String | Medium | null |
232 | welcome back everyone we're gonna be solving leeco 232 Implement a queue using stacks and I actually had this question as in um as an Amazon interview question I want to interviewed with them last year so definitely it's definitely a good one to know um so all right so they want us to implement a first in first out cue... | 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 |
353 | hello everyone welcome to clean coder youtube channel if you are new to this channel i will highly recommend you to subscribe to my channel as i make content related to software engineering system design and data structures and algorithms today we are going to solve this lead code problem number 353 the name of the pro... | Design Snake Game | design-snake-game | Design a [Snake game](https://en.wikipedia.org/wiki/Snake_(video_game)) that is played on a device with screen size `height x width`. [Play the game online](http://patorjk.com/games/snake/) if you are not familiar with the game.
The snake is initially positioned at the top left corner `(0, 0)` with a length of `1` uni... | null | Array,Design,Queue,Matrix | Medium | null |
404 | Hello hello everybody welcome to my channel and solve the problems of vivo starting this problem i have created a facebook group for my channel you can join the group like water will travel aproducer iss saal bhi problem find the some of all left lips in a group In The Mystery Solve Entry Between Is Like Three Starting... | Sum of Left Leaves | sum-of-left-leaves | Given the `root` of a binary tree, return _the sum of all left leaves._
A **leaf** is a node with no children. A **left leaf** is a leaf that is the left child of another node.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 24
**Explanation:** There are two left leaves in the binary tree, wit... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
1,822 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem sine of the product of an array it's May 1st so you know they are going to give us an easy question but be careful because this easy problem is actually a little bit trickier than it might seem at first I actually did g... | Sign of the Product of an Array | longest-palindromic-subsequence-ii | There is a function `signFunc(x)` that returns:
* `1` if `x` is positive.
* `-1` if `x` is negative.
* `0` if `x` is equal to `0`.
You are given an integer array `nums`. Let `product` be the product of all values in the array `nums`.
Return `signFunc(product)`.
**Example 1:**
**Input:** nums = \[-1,-2,-3,-4,... | As with any good dp problem that uses palindromes, try building the palindrome from the edges The prime point is to check that no two adjacent characters are equal, so save the past character while building the palindrome. | String,Dynamic Programming | Medium | 516 |
70 | Hello everyone welcome to my channel ok so we have who asked this question Amazon Microsoft Adobe Flipkart Siemens or it is maintained graphics also first say Oyo ok so by looking at the input and output of the question let us understand what the question is trying to say. It is given in the question that you must have... | 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 |
129 | it's another binary tree problem and if you love solving binary tree problems and if you love recursion then you will love this problem so it says that you have to find the sum of root to leaf numbers not rootly paths so every leaf denotes a path from root to leaf you don't have to add the sum of the digits but you hav... | 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 |
48 | foreign happy New Year today I'm going to cover a lead code problem number 48 rotate image so we're given an N by n 2D Matrix such as this and we have to rotate it by 90 degrees clockwise so as you can see this Matrix rotated 90 degrees turns into this um I just want to go over my problem solving process the first iter... | 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 |
815 | cool 8:15 bus routes we have a list man cool 8:15 bus routes we have a list man cool 8:15 bus routes we have a list man nice when I heard that now I feel like maybe this is gonna be another graph firm and I really don't want to do three graph forms no world or and he's not like you know should have a low down but I gue... | Bus Routes | champagne-tower | You are given an array `routes` representing bus routes where `routes[i]` is a bus route that the `ith` bus repeats forever.
* For example, if `routes[0] = [1, 5, 7]`, this means that the `0th` bus travels in the sequence `1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> ...` forever.
You will start at the bus stop `source` (You... | null | Dynamic Programming | Medium | 1385 |
1,404 | are you ill no just feeling a bit off in this question we're given a binary representation of an integer and we wish to return the number of steps to reduce to 1 under the following rules if the current number is even you have to divide it by two if the current number is odd you have to add one to it we know that binar... | Number of Steps to Reduce a Number in Binary Representation to One | print-immutable-linked-list-in-reverse | Given the binary representation of an integer as a string `s`, return _the number of steps to reduce it to_ `1` _under the following rules_:
* If the current number is even, you have to divide it by `2`.
* If the current number is odd, you have to add `1` to it.
It is guaranteed that you can always reac... | null | Linked List,Two Pointers,Stack,Recursion | Medium | null |
783 | welcome back friends today we are going to solve lead code problem minimum distance between vst nodes so before we start looking the details into this problem i just want to mention that i often create lead code solution videos in java j2 technology as well as java j2e interview helpful videos for junior and mid-level ... | Minimum Distance Between BST Nodes | search-in-a-binary-search-tree | Given the `root` of a Binary Search Tree (BST), return _the minimum difference between the values of any two different nodes in the tree_.
**Example 1:**
**Input:** root = \[4,2,6,1,3\]
**Output:** 1
**Example 2:**
**Input:** root = \[1,0,48,null,null,12,49\]
**Output:** 1
**Constraints:**
* The number of nodes... | null | Tree,Binary Search Tree,Binary Tree | Easy | 270,784 |
252 | welcome back for another video we are going to do another deco question the question is 2 5 2 meeting lungs given a array of meeting time intervals where intervals i is star i and i determine if a person could attend all meetings example 1 intervals is 0 30 5 10 15 20 the output is false example 2 intervals is 7 10 2 4... | 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 |
713 | welcome to september's leeco challenge today's problem is sub array product less than k you are given an array of positive integers nums count and print the number of contiguous sub arrays where the product of all elements in the sub array is less than k i don't think we actually need to print the subarrays but we need... | Subarray Product Less Than K | subarray-product-less-than-k | Given an array of integers `nums` and an integer `k`, return _the number of contiguous subarrays where the product of all the elements in the subarray is strictly less than_ `k`.
**Example 1:**
**Input:** nums = \[10,5,2,6\], k = 100
**Output:** 8
**Explanation:** The 8 subarrays that have product less than 100 are:
... | For each j, let opt(j) be the smallest i so that nums[i] * nums[i+1] * ... * nums[j] is less than k. opt is an increasing function. | Array,Sliding Window | Medium | 152,325,560,1083,2233 |
83 | welcome back everyone we're gonna be solving Lee code 83 remove duplicates from a sorted list so we're given a head of assorted linked list we need to delete all duplicates such that each element appears only once and we need to return the linked list sorted as well so we can do this in place uh because it's sorted so ... | Remove Duplicates from Sorted List | remove-duplicates-from-sorted-list | Given the `head` of a sorted linked list, _delete all duplicates such that each element appears only once_. Return _the linked list **sorted** as well_.
**Example 1:**
**Input:** head = \[1,1,2\]
**Output:** \[1,2\]
**Example 2:**
**Input:** head = \[1,1,2,3,3\]
**Output:** \[1,2,3\]
**Constraints:**
* The numb... | null | Linked List | Easy | 82,1982 |
68 | Hello gas welcome to me YouTube channel, so today we are going to solve problem 68 text justice, so here it is hard level problem and dislike ratio is also more in it because this problem is a little understanding problem, rest of the question is easy, not hard. Okay, so let's see, so what is this question about, I hav... | Text Justification | text-justification | Given an array of strings `words` and a width `maxWidth`, format the text such that each line has exactly `maxWidth` characters and is fully (left and right) justified.
You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces `' '` when necessary so that ea... | null | Array,String,Simulation | Hard | 1714,2260 |
791 | Welcome to One Arena, today we are doing question number 791 and in this question we will see the problem. What is the problem saying? By saying that we have been given two strings one named order and one named S. The name of the problem is Custom Sort String So in the order we have been given a string in which we have... | Custom Sort String | split-bst | You are given two strings order and s. All the characters of `order` are **unique** and were sorted in some custom order previously.
Permute the characters of `s` so that they match the order that `order` was sorted. More specifically, if a character `x` occurs before a character `y` in `order`, then `x` should occur ... | Use recursion. If root.val <= V, you split root.right into two halves, then join it's left half back on root.right. | Tree,Binary Search Tree,Recursion,Binary Tree | Medium | 450 |
1,696 | everyone welcome back and let's write some more neat code today so today let's solve jump game seven and this is pretty similar to the other jump games that you might have already solved so the main difference with this problem between the other ones is that in this case we're given a range of jumps we can do so before... | Jump Game VI | strange-printer-ii | You are given a **0-indexed** integer array `nums` and an integer `k`.
You are initially standing at index `0`. In one move, you can jump at most `k` steps forward without going outside the boundaries of the array. That is, you can jump from index `i` to any index in the range `[i + 1, min(n - 1, i + k)]` **inclusive*... | Try thinking in reverse. Given the grid, how can you tell if a colour was painted last? | Array,Graph,Topological Sort,Matrix | Hard | 664 |
523 | hey guys how's everything going this is Jay sir who is not the good algorithms I'm making these videos to prepare my interview next month in this video I'm going to take a look at five to three continuous uh barista or given a list I'm not negative it might be zero but a members and a target integer okay it might be - ... | Continuous Subarray Sum | continuous-subarray-sum | Given an integer array nums and an integer k, return `true` _if_ `nums` _has a **good subarray** or_ `false` _otherwise_.
A **good subarray** is a subarray where:
* its length is **at least two**, and
* the sum of the elements of the subarray is a multiple of `k`.
**Note** that:
* A **subarray** is a contiguo... | null | Array,Hash Table,Math,Prefix Sum | Medium | 560,2119,2240 |
315 | What happened if this welcome to back run loot soiled note problem counter small numbers after sales do subscribe like and share the video key notification for future videos a suddhen kuch nahi job type hot and say that your ribbon in danger in that and you how to Return New Account Are Lakhan Terrace The Property Wher... | Count of Smaller Numbers After Self | count-of-smaller-numbers-after-self | Given an integer array `nums`, return _an integer array_ `counts` _where_ `counts[i]` _is the number of smaller elements to the right of_ `nums[i]`.
**Example 1:**
**Input:** nums = \[5,2,6,1\]
**Output:** \[2,1,1,0\]
**Explanation:**
To the right of 5 there are **2** smaller elements (2 and 1).
To the right of 2 the... | null | Array,Binary Search,Divide and Conquer,Binary Indexed Tree,Segment Tree,Merge Sort,Ordered Set | Hard | 327,406,493,1482,2280 |
290 | Everyone Welcome to Difficult Silent Test Questions Board Pattern Alerts Frequently Benefit and Spring Dale Senior Scientific Air Pollution Patton Hair Fall Means Fool Maths David Warner Letter Important Alone in This World Spring Boot Depression subscribe Video give subscribe diy ocean now half losp. net it's too time... | 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 |
202 | hello friends in this video we will see lead code problem number 202 and it's called happy number so why is it called happy number i don't know but the concept of happy number or rather it's called be happy number where b denotes the base of the number and we are generally concerned with base 10 so in our case we are c... | Happy Number | happy-number | Write an algorithm to determine if a number `n` is happy.
A **happy number** is a number defined by the following process:
* Starting with any positive integer, replace the number by the sum of the squares of its digits.
* Repeat the process until the number equals 1 (where it will stay), or it **loops endlessly ... | null | Hash Table,Math,Two Pointers | Easy | 141,258,263,2076 |
171 | uh hey everybody this is larry uh this is me doing day 10 of the august dairy challenge uh let's get right to it uh hit the like button into the subscriber and join me on discord uh excel sheet column number given a column title as up appear in a sales sheet returns corresponding card number okay that seems to make sen... | Excel Sheet Column Number | excel-sheet-column-number | Given a string `columnTitle` that represents the column title as appears in an Excel sheet, return _its corresponding column number_.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
**Example 1:**
**Input:** columnTitle = "A "
**Output:** 1
**Example 2:**
**Input:** columnTitle = "AB "
**Ou... | null | Math,String | Easy | 168,2304 |
376 | 28 Welcome to Take Good Bye Nivedita Ants Video We are going to solve Dil Subsequence So given in this problem statement that here you have been given a puzzle and it has been said that you have to find Dil Length of the Longest Vikal Subsequence of the Names So We are all fine, it's new, it's fine and this is the will... | Wiggle Subsequence | wiggle-subsequence | A **wiggle sequence** is a sequence where the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with one element and a sequence with two non-equal elements are trivially wiggle sequences.
* For ... | null | Array,Dynamic Programming,Greedy | Medium | 2271 |
12 | That's a Hello Hi Guys Welcome Back to the Video Today is Question and Central to Mind Question Located in The Roman Reigns and Represented by Seven Different Symbols I B X L C D M Spotting Balance R15 to Zu-Zu Glasses Video and Roman 2ND Year Zu-Zu Glasses Video and Roman 2ND Year Zu-Zu Glasses Video and Roman 2ND Yea... | Integer to Roman | integer-to-roman | Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`.
**Symbol** **Value**
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, `2` is written as `II` in Roman numeral, just two one's adde... | null | Hash Table,Math,String | Medium | 13,273 |
149 | hi everyone so following us all the code daily challenge problem number 149 Max points on a line so the given problem statement is given in area of points where points of I is x i comma y I basically these two are the coordinates of our point uh represents a point on the X Y Line written maximum number of points that l... | Max Points on a Line | max-points-on-a-line | Given an array of `points` where `points[i] = [xi, yi]` represents a point on the **X-Y** plane, return _the maximum number of points that lie on the same straight line_.
**Example 1:**
**Input:** points = \[\[1,1\],\[2,2\],\[3,3\]\]
**Output:** 3
**Example 2:**
**Input:** points = \[\[1,1\],\[3,2\],\[5,3\],\[4,1\]... | null | Array,Hash Table,Math,Geometry | Hard | 356,2287 |
103 | hello everyone welcome to our channel two bits in this video we will discuss a medium level lead code question zigzag level audio traverse we are given a root of the tree and we need to return the zigzag level order travels now what is zigzag so the question says that we need to go from left to right for the first leve... | Binary Tree Zigzag Level Order Traversal | binary-tree-zigzag-level-order-traversal | Given the `root` of a binary tree, return _the zigzag level order traversal of its nodes' values_. (i.e., from left to right, then right to left for the next level and alternate between).
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[3\],\[20,9\],\[15,7\]\]
**Example 2:**
**Input:** roo... | null | Tree,Breadth-First Search,Binary Tree | Medium | 102 |
71 | what's up guys I'm Tiffany land I do hacker rank and neek code question tutorials as well as just general programming tutorial so check out my channel and subscribe if you haven't already today I'm going over simple Python link oh it's a medium problem the description reads given in absolute path oops for a file unix-s... | Simplify Path | simplify-path | Given a string `path`, which is an **absolute path** (starting with a slash `'/'`) to a file or directory in a Unix-style file system, convert it to the simplified **canonical path**.
In a Unix-style file system, a period `'.'` refers to the current directory, a double period `'..'` refers to the directory up a level,... | null | String,Stack | Medium | null |
828 | hello guys welcome back to Tech dose and in this video we will see the count unique characters of all substrings of a given string problem which is from lead code number 828 so this is a substring count or a window count type problem before looking at the problem statement I would like to announce about our live interv... | Count Unique Characters of All Substrings of a Given String | chalkboard-xor-game | Let's define a function `countUniqueChars(s)` that returns the number of unique characters on `s`.
* For example, calling `countUniqueChars(s)` if `s = "LEETCODE "` then `"L "`, `"T "`, `"C "`, `"O "`, `"D "` are the unique characters since they appear only once in `s`, therefore `countUniqueChars(s) = 5`.
Given a ... | null | Array,Math,Bit Manipulation,Brainteaser,Game Theory | Hard | null |
79 | well while you thought you could go to your google interview and not study word search you'd think hey of course there's some sort of search engine so of course you would want to know how to search stuff except that when you go here you find out what companies actually asked this question in the past say six months you... | 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 |
290 | hello guys welcome to code enzyme and in this video we are going to discuss the problem 290 word pattern of lead code in this playlist I upload daily Solutions of late word problems so if you are interested you can subscribe now so let's read the problem statement given a pattern and a string as find if as follows the ... | 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 |
301 | right so today I'm gonna try to talk about 301 removing violet purposes basically we have a string input with purposes and some non professor's characters with which we don't really care about in the end I guess so the question asked us to do is to remove the minimum number of invalid parentheses to make the stream val... | Remove Invalid Parentheses | remove-invalid-parentheses | Given a string `s` that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.
Return _a list of **unique strings** that are valid with the minimum number of removals_. You may return the answer in **any order**.
**Example 1:**
**Input:** s = "()())() "
**... | Since we don't know which of the brackets can possibly be removed, we try out all the options! We can use recursion to try out all possibilities for the given expression. For each of the brackets, we have 2 options:
We keep the bracket and add it to the expression that we are building on the fly during recursion.... | String,Backtracking,Breadth-First Search | Hard | 20,2095 |
66 | Hello everyone, Evgeniy Sulima nov is with you and today we will look at the problem years code number 66 plus 1 according to the conditions of this problem we are given a non-empty array of problem we are given a non-empty array of problem we are given a non-empty array of integers which is a positive integer and we m... | Plus One | plus-one | You are given a **large integer** represented as an integer array `digits`, where each `digits[i]` is the `ith` digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading `0`'s.
Increment the large integer by one and re... | null | Array,Math | Easy | 43,67,369,1031 |
744 | Hello everyone welcome back to me channel once again so here we are going to talk about the problem of late code daily challenge and today's problem is also lift code easy problem missing okay whose name is finance give smallest letter target this question first we People, let me tell you a simple approach which will b... | Find Smallest Letter Greater Than Target | network-delay-time | You are given an array of characters `letters` that is sorted in **non-decreasing order**, and a character `target`. There are **at least two different** characters in `letters`.
Return _the smallest character in_ `letters` _that is lexicographically greater than_ `target`. If such a character does not exist, return t... | We visit each node at some time, and if that time is better than the fastest time we've reached this node, we travel along outgoing edges in sorted order. Alternatively, we could use Dijkstra's algorithm. | Depth-First Search,Breadth-First Search,Graph,Heap (Priority Queue),Shortest Path | Medium | 2151,2171 |
1,582 | hello guys and welcome back to Le Logics this is the special positions in a binary Matrix problem this is a lead code easy and the number for this is 1582 so in the given problem we are having an b m cross and binary Matrix mat and we have to return the number of spe special positions in the binary Matrix mat now let's... | Special Positions in a Binary Matrix | design-browser-history | Given an `m x n` binary matrix `mat`, return _the number of special positions in_ `mat`_._
A position `(i, j)` is called **special** if `mat[i][j] == 1` and all other elements in row `i` and column `j` are `0` (rows and columns are **0-indexed**).
**Example 1:**
**Input:** mat = \[\[1,0,0\],\[0,0,1\],\[1,0,0\]\]
**O... | Use two stack one for back history and one for forward history and simulate the functions. Can you do faster by using different data structure ? | Array,Linked List,Stack,Design,Doubly-Linked List,Data Stream | Medium | null |
146 | hello everyone welcome back to my channel this is stacy today we are going to look at number 146 problem lru cache before we jump into the problem let's look at some pre-info the problem let's look at some pre-info the problem let's look at some pre-info that would help us to understand it better first what is a cache ... | LRU Cache | lru-cache | Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**.
Implement the `LRUCache` class:
* `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`.
* `int get(int key)` Return the valu... | null | Hash Table,Linked List,Design,Doubly-Linked List | Medium | 460,588,604,1903 |
142 | Most of the defeats will be good, they will be dry in this, they will have learned a lot, they must have been doing as I was telling, then definitely there will be a lot of good motivation and confidence in them. When Bigg Boss, I have watched many editions of Bigg Boss and have watched many series till now. And whatsa... | 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 |
210 | hello there today I'm looking at the question 210 course a schedule 2 which can potentially be a follow-up to can potentially be a follow-up to can potentially be a follow-up to question 207 course is scheduled for this one 207 all the question is asking is about feasibility so we want to determine whether it's true or... | Course Schedule II | course-schedule-ii | There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`.
* For example, the pair `[0, 1]`, indicates that to take cou... | This problem is equivalent to finding the topological order in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topolo... | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 207,269,310,444,630,1101,2220 |
438 | okay so today's second question is 438 find or anagram in a string so anagram is basically a string with its characters shuffled around randomly shuffled around so given a string s and then dung every string P what we need to do is find the starting indices of peas and grams in s so i guess s should be at least a longe... | 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 |
160 | all right this lead code question is called intersection of two linked lists it says write a program to find the node at which the intersection of two singly linked lists begins for example the following two linked lists so here we have one and here we have another they begin to intersect at node c1 then they give us a... | 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 |
1,992 | welcome back everyone we're going to be solving leeco in 1992 find all groups of Farmland so we're given a zero indexed M by n binary Matrix called land where zero represents a hectare of forested land and a one represents a hectare of farmland to keep the land organized there are designated rectangular areas of hectar... | Find All Groups of Farmland | sort-linked-list-already-sorted-using-absolute-values | You are given a **0-indexed** `m x n` binary matrix `land` where a `0` represents a hectare of forested land and a `1` represents a hectare of farmland.
To keep the land organized, there are designated rectangular areas of hectares that consist **entirely** of farmland. These rectangular areas are called **groups**. N... | The nodes with positive values are already in the correct order. Nodes with negative values need to be moved to the front. Nodes with negative values are in reversed order. | Linked List,Two Pointers,Sorting | Medium | 148 |
190 | Today we will solve the next problem of Blind 75, whose name is Reverse Bits. So first of all let's see its problem statement. Problem statement has given this reverse beat journey and we have to reverse its bits. Okay, so like this is an example of how. Let's take some small example. Yes, look like this, so if I liste... | Reverse Bits | reverse-bits | Reverse bits of a given 32 bits unsigned integer.
**Note:**
* Note that in some languages, such as Java, there is no unsigned integer type. In this case, both input and output will be given as a signed integer type. They should not affect your implementation, as the integer's internal binary representation is the s... | null | Divide and Conquer,Bit Manipulation | Easy | 7,191,2238 |
438 | Hello hi guys in this video we will question find all gram sunscreen gram hota agar subscribe meaning as I tell you babes page 232 koi aisi jesse sub character like video this has been done with this you will come only this and want and anything else would be dig IG TC Chandra is also there so I also got Shehzada still... | 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,870 | Hello friends, today we are going to solve another new problem of rate court which is 1870. Let us first understand its question. Here we have been given an award which presents that for moving my office from home. How much time does it take and we have to change trains in sequence to reach the office, so for this we c... | 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 |
1,493 | hey everyone welcome back today we are going to solve problem number 1493 longest sub array of once after deleting one element first we will see the explanation of the problem statement in the logic on the core now let's dive into the solution so in this problem we are given a nums array which has zeros and ones so the... | Longest Subarray of 1's After Deleting One Element | frog-position-after-t-seconds | Given a binary array `nums`, you should delete one element from it.
Return _the size of the longest non-empty subarray containing only_ `1`_'s in the resulting array_. Return `0` if there is no such subarray.
**Example 1:**
**Input:** nums = \[1,1,0,1\]
**Output:** 3
**Explanation:** After deleting the number in pos... | Use a variation of DFS with parameters 'curent_vertex' and 'current_time'. Update the probability considering to jump to one of the children vertices. | Tree,Depth-First Search,Breadth-First Search,Graph | Hard | null |
1,015 | hey everybody this is larry this is day 30 of the december legal dairy challenge two more days till the end of the year uh let me know what you think how you did how you do uh hit the like button hit the subscribe button drop me a discord let me know what you think about today's problem smallest integer divisible by k ... | Smallest Integer Divisible by K | smallest-integer-divisible-by-k | Given a positive integer `k`, you need to find the **length** of the **smallest** positive integer `n` such that `n` is divisible by `k`, and `n` only contains the digit `1`.
Return _the **length** of_ `n`. If there is no such `n`, return -1.
**Note:** `n` may not fit in a 64-bit signed integer.
**Example 1:**
**In... | null | null | Medium | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.