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 |
|---|---|---|---|---|---|---|---|---|
675 | Hello and welcome to this problem Top Stories Appointment Lutb School of Language Subscribe Loot-Loot Subscribe Language Subscribe Loot-Loot Subscribe Language Subscribe Loot-Loot Subscribe Don't forget to subscribe the channel Quote Raw September Maze Review this plant At this time Country Because of sunlight Sandalwo... | Cut Off Trees for Golf Event | cut-off-trees-for-golf-event | You are asked to cut off all the trees in a forest for a golf event. The forest is represented as an `m x n` matrix. In this matrix:
* `0` means the cell cannot be walked through.
* `1` represents an empty cell that can be walked through.
* A number greater than `1` represents a tree in a cell that can be walked... | null | Array,Breadth-First Search,Heap (Priority Queue),Matrix | Hard | null |
63 | hello guys so today we're gonna be doing Elite code 63 unique paths 2 is a relatively simple question nothing too hard uh I guess if you have a bit difficulty with um DP it might be a bit hard other than that it's nothing too difficult but let's look at the question uh you are given an M by an integer array grid this i... | 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 |
1 | Howdy Folks today we're going to look at uh some leak code problems I've started off well some I'm going to go over one we start I'm starting off with lead code problem one called two sum this isn't marked as an easy problem um I've actually already submitted a solution to it but we're going to go over it again so this... | Two Sum | two-sum | Given an array of integers `nums` and an integer `target`, return _indices of the two numbers such that they add up to `target`_.
You may assume that each input would have **_exactly_ one solution**, and you may not use the _same_ element twice.
You can return the answer in any order.
**Example 1:**
**Input:** nums... | A really brute force way would be to search for all possible pairs of numbers but that would be too slow. Again, it's best to try out brute force solutions for just for completeness. It is from these brute force solutions that you can come up with optimizations. So, if we fix one of the numbers, say x, we have to scan ... | Array,Hash Table | Easy | 15,18,167,170,560,653,1083,1798,1830,2116,2133,2320 |
1,706 | Hello Gas, you want to move to Lucknow, see what is the basic thing here, whenever you move here at every point of time, you have to keep three things in mind, first of all, what if you drop the ball from here. Okay, in the ball drop in this column, now in which direction is the diagonal made in this column and the dia... | Where Will the Ball Fall | min-cost-to-connect-all-points | You have a 2-D `grid` of size `m x n` representing a box, and you have `n` balls. The box is open on the top and bottom sides.
Each cell in the box has a diagonal board spanning two corners of the cell that can redirect a ball to the right or to the left.
* A board that redirects the ball to the right spans the top... | Connect each pair of points with a weighted edge, the weight being the manhattan distance between those points. The problem is now the cost of minimum spanning tree in graph with above edges. | Array,Union Find,Minimum Spanning Tree | Medium | 2287 |
32 | all right good evening everybody and welcome to the video this video we are gonna solve a lead code problem this is categorized as a hard problem okay so this is actually difficult and it has been asked in amazon and facebook interviews several times so the problem that we are about to solve and under understand is pro... | 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 |
1,032 | hey what's up guys this is zhong and so this time i want to talk about this problem uh 1032 stream of characters actually this problem is today's daily challenge and actually it's kind of rare to see a heart problem in the daily challenge that's why i decided to uh to talk about this problem with you guys you know so t... | Stream of Characters | satisfiability-of-equality-equations | Design an algorithm that accepts a stream of characters and checks if a suffix of these characters is a string of a given array of strings `words`.
For example, if `words = [ "abc ", "xyz "]` and the stream added the four characters (one by one) `'a'`, `'x'`, `'y'`, and `'z'`, your algorithm should detect that the suf... | null | Array,String,Union Find,Graph | Medium | null |
923 | hello everyone welcome to day 6 of april liquid challenge and i hope all of you are having a great time my name is anthony deja i'm working as senior software developer for at adobe and first of all i would like to urge you guys again in case you haven't seen google interview experience of the page godrai yet please gu... | 3Sum With Multiplicity | super-egg-drop | Given an integer array `arr`, and an integer `target`, return the number of tuples `i, j, k` such that `i < j < k` and `arr[i] + arr[j] + arr[k] == target`.
As the answer can be very large, return it **modulo** `109 + 7`.
**Example 1:**
**Input:** arr = \[1,1,2,2,3,3,4,4,5,5\], target = 8
**Output:** 20
**Explanatio... | null | Math,Binary Search,Dynamic Programming | Hard | 2031 |
237 | okay let's talk about they didn't know in the link list so this function is really bad so what you actually need to do is you change the node value and redirect your next pointer to the next pointer so imagine you don't have this anymore so the value becomes actually one and the next point actually directly here so if ... | 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,406 | Hello everyone welcome you are going to do video number 35 of my channel and I again remind that my playlist of DP concession questions has been given you can refer that also where you will be learning DP from the very scratch okay and today's The question is liquid number one 406 hard mark da but it is a very simple r... | Stone Game III | subtract-the-product-and-sum-of-digits-of-an-integer | Alice and Bob continue their games with piles of stones. There are several stones **arranged in a row**, and each stone has an associated value which is an integer given in the array `stoneValue`.
Alice and Bob take turns, with Alice starting first. On each player's turn, that player can take `1`, `2`, or `3` stones f... | How to compute all digits of the number ? Use modulus operator (%) to compute the last digit. Generalise modulus operator idea to compute all digits. | Math | Easy | null |
1,610 | hello today we are going to discuss this question max and more of visible points and this question has come up in companies like google and that is for 10 times so let's see what is this question is talking about so in this question we have given points with position we have location with position x and position y and ... | Maximum Number of Visible Points | xor-operation-in-an-array | You are given an array `points`, an integer `angle`, and your `location`, where `location = [posx, posy]` and `points[i] = [xi, yi]` both denote **integral coordinates** on the X-Y plane.
Initially, you are facing directly east from your position. You **cannot move** from your position, but you can **rotate**. In othe... | Simulate the process, create an array nums and return the Bitwise XOR of all elements of it. | Math,Bit Manipulation | Easy | null |
225 | hello everyone so in this video let us talk about the problem from lead code the problem name is you have to implement a stack using a queue now uh what you can understand is like first of all understand what is the stack what's the queue so these are two different data structures stack is that first in and last out an... | Implement Stack using Queues | implement-stack-using-queues | Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (`push`, `top`, `pop`, and `empty`).
Implement the `MyStack` class:
* `void push(int x)` Pushes element x to the top of the stack.
* `int pop()` Removes the element on the top... | null | Stack,Design,Queue | Easy | 232 |
336 | hello everyone welcome to codex camp we are 13th day of june leeco challenge and the problem we are going to cover in this video is palindrome pairs so here the input given is a list of strings and we need to return the listing list of integers where if we combine any two words in the list that forms a palindrome so le... | 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,696 | july the 8th all right today's go on the first finish the challenge and then we'll go back to yesterday's problem and then uh go through the top-down approach and trying to see the top-down approach and trying to see the top-down approach and trying to see where do we not get it right maybe we can try top-down approach... | 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 |
131 | Jhaal Hello Everyone Welcome and Welcome Back to My Channel Short Love You Want To Another Problem But Before Moving Forward A Good Night Video Please Like And Subscribe My Channel So That You Get Notified When Ever Nutrition New Video Features Positive Written Setting Show The Problem Sparing Room Partition in solving... | Palindrome Partitioning | palindrome-partitioning | Given a string `s`, partition `s` such that every substring of the partition is a **palindrome**. Return _all possible palindrome partitioning of_ `s`.
**Example 1:**
**Input:** s = "aab"
**Output:** \[\["a","a","b"\],\["aa","b"\]\]
**Example 2:**
**Input:** s = "a"
**Output:** \[\["a"\]\]
**Constraints:**
* `1... | null | String,Dynamic Programming,Backtracking | Medium | 132,1871 |
1,333 | hello viewers welcome to my channel I am back with another problem from lead code today we are going to look at the problem number one three filter response by vegan-friendly price filter response by vegan-friendly price filter response by vegan-friendly price and distance so given an array restaurants where restaurant... | Filter Restaurants by Vegan-Friendly, Price and Distance | sort-the-jumbled-numbers | Given the array `restaurants` where `restaurants[i] = [idi, ratingi, veganFriendlyi, pricei, distancei]`. You have to filter the restaurants using three filters.
The `veganFriendly` filter will be either _true_ (meaning you should only include restaurants with `veganFriendlyi` set to true) or _false_ (meaning you can ... | Map the original numbers to new numbers by the mapping rule and sort the new numbers. To maintain the same relative order for equal mapped values, use the index in the original input array as a tiebreaker. | Array,Sorting | Medium | 677 |
1,624 | so let's look at this problem largest substring between two equal characters so as the question says we need to find a largest substring which is between any two equal characters and these we do not have to include these two equal character in the length so one basic approach which comes to mind is using the Brute Forc... | Largest Substring Between Two Equal Characters | clone-binary-tree-with-random-pointer | Given a string `s`, return _the length of the longest substring between two equal characters, excluding the two characters._ If there is no such substring return `-1`.
A **substring** is a contiguous sequence of characters within a string.
**Example 1:**
**Input:** s = "aa "
**Output:** 0
**Explanation:** The optim... | Traverse the tree, keep a hashtable with you and create a nodecopy for each node in the tree. Start traversing the original tree again and connect the left, right and random pointers in the cloned tree the same way as the original tree with the help of the hashtable. | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 133,138,1634 |
57 | 200 Hello friends, welcome to the new video of the text, today you are blind 7588, we had kept Amar Jain Travels in dresses and the incident is a slightly extended form of the same, the question is, if you read it by crossing it, then do it, according to the letters, let me explain with an example, then the real thing.... | Insert Interval | insert-interval | You are given an array of non-overlapping intervals `intervals` where `intervals[i] = [starti, endi]` represent the start and the end of the `ith` interval and `intervals` is sorted in ascending order by `starti`. You are also given an interval `newInterval = [start, end]` that represents the start and end of another i... | null | Array | Medium | 56,715 |
1,680 | Hello Hi Guys Welcome To Record Weakness See In This Video Will See The Question Contamination Of Visitors Binary Number One Individual And Decimal Value Of The History For Getting A Representation In Order To It's A Representation 123 1010 So And 114 Rates On 's Ninth Example S12 This is - 's Ninth Example S12 This is... | Concatenation of Consecutive Binary Numbers | count-all-possible-routes | Given an integer `n`, return _the **decimal value** of the binary string formed by concatenating the binary representations of_ `1` _to_ `n` _in order, **modulo**_ `109 + 7`.
**Example 1:**
**Input:** n = 1
**Output:** 1
**Explanation: ** "1 " in binary corresponds to the decimal value 1.
**Example 2:**
**Input:**... | Use dynamic programming to solve this problem with each state defined by the city index and fuel left. Since the array contains distinct integers fuel will always be spent in each move and so there can be no cycles. | Array,Dynamic Programming,Memoization | Hard | null |
141 | hello everyone welcome to date hold of a very lit code challenge and today's question is linked list cycle in this question you are given a linked list and you need to tell whether a cycle exists in that linked list or not if it exists you return true from it if it doesn't return false from it how do you interpret uh t... | 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,346 | all right let's jump in today we're gonna go over leak code 1346 check if in and it's double exists the problem states given an array of integers check if there exists two integers and such that n is the double of em and it goes a little bit more formally over there I won't go over that let's take a look at the constra... | Check If N and Its Double Exist | maximize-the-topmost-element-after-k-moves | Given an array `arr` of integers, check if there exist two indices `i` and `j` such that :
* `i != j`
* `0 <= i, j < arr.length`
* `arr[i] == 2 * arr[j]`
**Example 1:**
**Input:** arr = \[10,2,5,3\]
**Output:** true
**Explanation:** For i = 0 and j = 2, arr\[i\] == 10 == 2 \* 5 == 2 \* arr\[j\]
**Example 2:**... | For each index i, how can we check if nums[i] can be present at the top of the pile or not after k moves? For which conditions will we end up with an empty pile? | Array,Greedy | Medium | 134 |
345 | from the given string we need to reverse the positions of vowels in this case we have a i n o as vowels to reverse their positions we will use two pointers I and J on both sides of the string we will move these pointers on either sides till the pointer finds a vowel when both the pointers find vowels we will swap them ... | Reverse Vowels of a String | reverse-vowels-of-a-string | Given a string `s`, reverse only all the vowels in the string and return it.
The vowels are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`, and they can appear in both lower and upper cases, more than once.
**Example 1:**
**Input:** s = "hello"
**Output:** "holle"
**Example 2:**
**Input:** s = "leetcode"
**Output:** "leotc... | null | Two Pointers,String | Easy | 344,1089 |
52 | hello everyone welcome to quartus camp we are 29th day of may lead code challenge and the problem we are going to cover in this video is yen queens 2. so if you remember on 22nd may let go challenge they have asked us the question of yen queens which is very similar to this question actually this is the parent question... | 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 |
1,726 | Yes, hello, this is Nagopari from Live Coding. Today, I will solve problem number 1726, Tippleweed same product. Yes, the difficulty level of the problem is medium and the problem was taken from Litcode. It has 500 likes and about 20 dislikes. First of all, it is a bear called Nums. Lee comes in. Four numbers are rando... | Tuple with Same Product | coordinate-with-maximum-network-quality | Given an array `nums` of **distinct** positive integers, return _the number of tuples_ `(a, b, c, d)` _such that_ `a * b = c * d` _where_ `a`_,_ `b`_,_ `c`_, and_ `d` _are elements of_ `nums`_, and_ `a != b != c != d`_._
**Example 1:**
**Input:** nums = \[2,3,4,6\]
**Output:** 8
**Explanation:** There are 8 valid tup... | The constraints are small enough to consider every possible coordinate and calculate its quality. | Array,Enumeration | Medium | null |
1,539 | hi guys welcome to algorithms made easy today we will solve the question kth missing positive number given an array of positive integers sorted in strictly increasing order and an integer k we need to find the kth positive integer that is missing from the array in the first example we are given a few numbers which are ... | Kth Missing Positive Number | diagonal-traverse-ii | Given an array `arr` of positive integers sorted in a **strictly increasing order**, and an integer `k`.
Return _the_ `kth` _**positive** integer that is **missing** from this array._
**Example 1:**
**Input:** arr = \[2,3,4,7,11\], k = 5
**Output:** 9
**Explanation:** The missing positive integers are \[1,5,6,8,9,10... | Notice that numbers with equal sums of row and column indexes belong to the same diagonal. Store them in tuples (sum, row, val), sort them, and then regroup the answer. | Array,Sorting,Heap (Priority Queue) | Medium | null |
25 | not so common but very good programming question for software engineering or data science interviews is reversing nodes in a k group so you have a linked list and you have a size of a group that you want to or the question the prompt wants you to use to take every group in that linked list and reverse those groups with... | Reverse Nodes in k-Group | reverse-nodes-in-k-group | Given the `head` of a linked list, reverse the nodes of the list `k` at a time, and return _the modified list_.
`k` is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of `k` then left-out nodes, in the end, should remain as it is.
You may not alt... | null | Linked List,Recursion | Hard | 24,528,2196 |
1,780 | so hello everyone in this video i will be explaining the problem check if number is a sum of powers of three and this is a really easy problem like if you do it using recursion and the approach i am going to tell you and the code i am writing is going to be really easily understandable l and very much intuitive okay so... | Check if Number is a Sum of Powers of Three | lowest-common-ancestor-of-a-binary-tree-ii | Given an integer `n`, return `true` _if it is possible to represent_ `n` _as the sum of distinct powers of three._ Otherwise, return `false`.
An integer `y` is a power of three if there exists an integer `x` such that `y == 3x`.
**Example 1:**
**Input:** n = 12
**Output:** true
**Explanation:** 12 = 31 + 32
**Examp... | Traverse the graph visiting root, left, root, right, root to make an Euler Path Return the node (LCA) that is at the lowest depth between p and q in the Euler Path | Tree,Depth-First Search,Binary Tree | Medium | 235,236,1790,1816 |
238 | before we start to solve this problem observe that for any element in the given array the product of all elements except itself is actually product of elements from the left side multiplied by the product of elements from the right side now to solve this problem we will first have a variable to store the product from t... | Product of Array Except Self | product-of-array-except-self | Given an integer array `nums`, return _an array_ `answer` _such that_ `answer[i]` _is equal to the product of all the elements of_ `nums` _except_ `nums[i]`.
The product of any prefix or suffix of `nums` is **guaranteed** to fit in a **32-bit** integer.
You must write an algorithm that runs in `O(n)` time and without... | null | Array,Prefix Sum | Medium | 42,152,265,2267 |
468 | loot hariballabh loop slow let's go to today's julie this problem to today's problems regarding validate ip address to release to function witch can check weather in fighting spirit ipv4 address and wait ipv6 ras and fearless of three four five six 2856 withdrawal nikli represented in decimal will consist After And Dec... | Validate IP Address | validate-ip-address | Given a string `queryIP`, return `"IPv4 "` if IP is a valid IPv4 address, `"IPv6 "` if IP is a valid IPv6 address or `"Neither "` if IP is not a correct IP of any type.
**A valid IPv4** address is an IP in the form `"x1.x2.x3.x4 "` where `0 <= xi <= 255` and `xi` **cannot contain** leading zeros. For example, `"192.16... | null | String | Medium | 752 |
253 | hello welcome back and today we're going to be doing weekly premium daily problem 253 meeting rooms 2. and so this problem is given an array of meeting time intervals where intervals I start end return the minimum number of conference rooms required and so you're given some intervals where you have to have these meetin... | Meeting Rooms II | meeting-rooms-ii | Given an array of meeting time intervals `intervals` where `intervals[i] = [starti, endi]`, return _the minimum number of conference rooms required_.
**Example 1:**
**Input:** intervals = \[\[0,30\],\[5,10\],\[15,20\]\]
**Output:** 2
**Example 2:**
**Input:** intervals = \[\[7,10\],\[2,4\]\]
**Output:** 1
**Constr... | Think about how we would approach this problem in a very simplistic way. We will allocate rooms to meetings that occur earlier in the day v/s the ones that occur later on, right? If you've figured out that we have to sort the meetings by their start time, the next thing to think about is how do we do the allocation? Th... | Array,Two Pointers,Greedy,Sorting,Heap (Priority Queue) | Medium | 56,252,452,1184 |
20 | what's going on everyone so today we're going to be doing lead code number 20. it's called valid parentheses it's a pretty classic one you'll see this a lot floating around and it's a good pattern to be familiar with because there's a lot of other questions that deal with a similar pattern and so you can also see that ... | 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 |
1,588 | hey guys today we're going to solve lead gun number 1588 sum of all odd length sub arrays so we're given an array and we need to return the sum of all odd length sub arrays of r okay so while the brute force solution would just be going literally through every odd length sub array like doing it manually and taking the ... | Sum of All Odd Length Subarrays | sum-of-all-odd-length-subarrays | Given an array of positive integers `arr`, return _the sum of all possible **odd-length subarrays** of_ `arr`.
A **subarray** is a contiguous subsequence of the array.
**Example 1:**
**Input:** arr = \[1,4,2,5,3\]
**Output:** 58
**Explanation:** The odd-length subarrays of arr and their sums are:
\[1\] = 1
\[4\] = 4... | null | null | Easy | null |
56 | in this video we're going to take a look at a legal problem called merge intervals so we're given an array of intervals where intervals at i is equal to start at i and i so if for each interval we're going to have our start time and the end time and we want to merge all the overlapping intervals um and return an array ... | Merge Intervals | merge-intervals | Given an array of `intervals` where `intervals[i] = [starti, endi]`, merge all overlapping intervals, and return _an array of the non-overlapping intervals that cover all the intervals in the input_.
**Example 1:**
**Input:** intervals = \[\[1,3\],\[2,6\],\[8,10\],\[15,18\]\]
**Output:** \[\[1,6\],\[8,10\],\[15,18\]\... | null | Array,Sorting | Medium | 57,252,253,495,616,715,761,768,1028,2297,2319 |
1,845 | A big welcome has happened, welcome to my channel, it's all the problem, seat reservation manager, suit design assistant manager, seat state of incident data number, one to end implement, seat manager plus, the problem in the seat, tractor chief manager, number of seats in his life and its number. From one to and all s... | Seat Reservation Manager | largest-submatrix-with-rearrangements | Design a system that manages the reservation state of `n` seats that are numbered from `1` to `n`.
Implement the `SeatManager` class:
* `SeatManager(int n)` Initializes a `SeatManager` object that will manage `n` seats numbered from `1` to `n`. All seats are initially available.
* `int reserve()` Fetches the **sm... | For each column, find the number of consecutive ones ending at each position. For each row, sort the cumulative ones in non-increasing order and "fit" the largest submatrix. | Array,Greedy,Sorting,Matrix | Medium | 695 |
541 | Have let's all recent version of river system problem here instead of celebrating a complete spring which version more to river in strips size festivals this size tube school for next9news subscribe must subscribe to 310 west indies a grade two swords with output tax First to pims pe gaur se series had won that this co... | Reverse String II | reverse-string-ii | Given a string `s` and an integer `k`, reverse the first `k` characters for every `2k` characters counting from the start of the string.
If there are fewer than `k` characters left, reverse all of them. If there are less than `2k` but greater than or equal to `k` characters, then reverse the first `k` characters and l... | null | Two Pointers,String | Easy | 344,557 |
939 | Hello Hi Friends Welcome Back To Days Before Going To Solve Plate Problem 939 Minimum Area Rectangle Aa Before Start Looking Into Its Problems And Its Of Examples And Solution Is Just Want To Mention The My Channel Is Dedicated To Helping People Were Preparing For Coding Interviews And Java Interviews And My Channel Ha... | Minimum Area Rectangle | valid-permutations-for-di-sequence | You are given an array of points in the **X-Y** plane `points` where `points[i] = [xi, yi]`.
Return _the minimum area of a rectangle formed from these points, with sides parallel to the X and Y axes_. If there is not any such rectangle, return `0`.
**Example 1:**
**Input:** points = \[\[1,1\],\[1,3\],\[3,1\],\[3,3\]... | null | Dynamic Programming | Hard | null |
401 | all right we have lead code 401 the binary watch so I binary watch has a layer four LEDs on the top um to represent the hours and six lets on the bottom to represent the minutes each leg represents a zero or one with the least significant bit on there on the right for example we have the below binary watch reads 451. s... | Binary Watch | binary-watch | A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent the minutes (0-59). Each LED represents a zero or one, with the least significant bit on the right.
* For example, the below binary watch reads `"4:51 "`.
Given an integer `turnedOn` which represents the number... | Simplify by seeking for solutions that involve comparing bit counts. Consider calculating all possible times for comparison purposes. | Backtracking,Bit Manipulation | Easy | 17,191 |
263 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem ugly number we're given an integer n and we want to return true if n is an ugly number and if it's not an ugly number we return false what exactly is an ugly number well it's a positive integer whose prime factors are l... | 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 |
1,360 | welcome back everyone we're going to be solving leeco 1360 number of days between two dates so they want us to write a program which will count the number of days between two given dates in the format of year month day so I guess this question would just depend on your interviewer whether or not they want you to you kn... | Number of Days Between Two Dates | maximum-length-of-a-concatenated-string-with-unique-characters | Write a program to count the number of days between two dates.
The two dates are given as strings, their format is `YYYY-MM-DD` as shown in the examples.
**Example 1:**
**Input:** date1 = "2019-06-29", date2 = "2019-06-30"
**Output:** 1
**Example 2:**
**Input:** date1 = "2020-01-15", date2 = "2019-12-31"
**Output:... | You can try all combinations and keep mask of characters you have. You can use DP. | Array,String,Backtracking,Bit Manipulation | Medium | null |
453 | Hello Hi Friends Welcome Back Today We Are Going To Solve Supreme Court Problem 1231 Minimum Most Two Equal Elements Such This Question Was Previously Liked Or Share And Indore Interview Sir Yes Sorry For Window And Looked Into The Details Of The Problems I Want To Mention That IF One Create Latest Solutions Videos to ... | Minimum Moves to Equal Array Elements | minimum-moves-to-equal-array-elements | Given an integer array `nums` of size `n`, return _the minimum number of moves required to make all array elements equal_.
In one move, you can increment `n - 1` elements of the array by `1`.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** 3
**Explanation:** Only three moves are needed (remember each move inc... | null | Array,Math | Medium | 462,2263,2273 |
237 | hi guys welcome back to the channel I know nobody asked for this but I'm here back again trying to make your day much worse to be honest but trust me this question definitely make you smile because this is one of the most interesting questions in lead code okay let's jump into this it's lead code 237 and it's say delet... | 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 |
692 | hello everyone let's try to be a cheat code ninja today this problem has been asked recently in the Amazon and Facebook interviews let's look at it we are given a list of strengths and an integer K and we have to return the K most frequent strings we have to sort the words by frequency in descending order and in case t... | Top K Frequent Words | top-k-frequent-words | Given an array of strings `words` and an integer `k`, return _the_ `k` _most frequent strings_.
Return the answer **sorted** by **the frequency** from highest to lowest. Sort the words with the same frequency by their **lexicographical order**.
**Example 1:**
**Input:** words = \[ "i ", "love ", "leetcode ", "i ", "... | null | Hash Table,String,Trie,Sorting,Heap (Priority Queue),Bucket Sort,Counting | Medium | 347,1014,1919 |
1,685 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem sum of absolute differences in a sorted array we're given an integer array that is pretty much sorted in increasing order or at least non decreasing order and that's going to be very important for this problem so don't ... | Sum of Absolute Differences in a Sorted Array | stone-game-v | You are given an integer array `nums` sorted in **non-decreasing** order.
Build and return _an integer array_ `result` _with the same length as_ `nums` _such that_ `result[i]` _is equal to the **summation of absolute differences** between_ `nums[i]` _and all the other elements in the array._
In other words, `result[i... | We need to try all possible divisions for the current row to get the max score. As calculating all possible divisions will lead us to calculate some sub-problems more than once, we need to think of dynamic programming. | Array,Math,Dynamic Programming,Game Theory | Hard | 909,1240,1522,1617,1788,1808,2002,2156 |
212 | we're going to take a look at a legal problem called word search number two so given a m times n board of characters and a list of strings which is words return all the words that are on the board so each word must be construct from letters or sequentially adjacent cells where adjacent cells are horizontally or vertica... | 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 |
1,008 | hi everyone and welcome to my channel if you're new welcome if you're back welcome back just like every other day we're going to start with a wildlife wild fact and today we're talking about cheetahs are the fastest land mammal reaching speeds of 60 miles per hour in just about three seconds while racing at full speed ... | 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 |
1,507 | hey guys welcome to a new video in today's video we're going to look at a lead chord problem and the problems name is reformatted so in this question you're given a string variable date which is of this format so our task is to convert the input date into the format year hyphen month hyphen day so let's take the first ... | Reformat Date | check-if-there-is-a-valid-path-in-a-grid | Given a `date` string in the form `Day Month Year`, where:
* `Day` is in the set `{ "1st ", "2nd ", "3rd ", "4th ", ..., "30th ", "31st "}`.
* `Month` is in the set `{ "Jan ", "Feb ", "Mar ", "Apr ", "May ", "Jun ", "Jul ", "Aug ", "Sep ", "Oct ", "Nov ", "Dec "}`.
* `Year` is in the range `[1900, 2100]`.
Conve... | Start DFS from the node (0, 0) and follow the path till you stop. When you reach a cell and cannot move anymore check that this cell is (m - 1, n - 1) or not. | Array,Depth-First Search,Breadth-First Search,Union Find,Matrix | Medium | null |
143 | hi everyone before I solve this question so now I have a 196 subscribers so please subscribe my channel and help me to reach the 200 subscribers so today's question is below the list so you are given the head of um single readings list the list can be represented as so this is a fast note this is the second note and uh... | 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,438 | While the remaining longest continuous absorption saliva difference loom and fold to elements give no importance and no subscribe and Sauvy basically required to all elements in that and as they can see a doubt that such start from 8am benefit consider to so limited 120 Soudha Obscene difference between 6 m still love ... | Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | find-the-team-size | Given an array of integers `nums` and an integer `limit`, return the size of the longest **non-empty** subarray such that the absolute difference between any two elements of this subarray is less than or equal to `limit`_._
**Example 1:**
**Input:** nums = \[8,2,4,7\], limit = 4
**Output:** 2
**Explanation:** All su... | null | Database | Easy | null |
1,422 | hello viewers welcome back to my channel I hope you are enjoying all the problems that I am uploading if you haven't subscribed to my channel yet please go ahead and subscribe and also share among your friends so today's problem from read Kody's maximum score after splitting a strength given a string of s of zeros and ... | Maximum Score After Splitting a String | divide-array-in-sets-of-k-consecutive-numbers | Given a string `s` of zeros and ones, _return the maximum score after splitting the string into two **non-empty** substrings_ (i.e. **left** substring and **right** substring).
The score after splitting a string is the number of **zeros** in the **left** substring plus the number of **ones** in the **right** substring... | If the smallest number in the possible-to-split array is V, then numbers V+1, V+2, ... V+k-1 must contain there as well. You can iteratively find k sets and remove them from array until it becomes empty. Failure to do so would mean that array is unsplittable. | Array,Hash Table,Greedy,Sorting | Medium | 659,2261 |
680 | welcome to tim's leco challenge this problem is called valid palindrome 2. given a string s return true if this s can be a palindrome after deleting at most one character from it now palindrome we know something is a palindrome if it is the same forwards and backwards with found valid palindrome one what we would do is... | Valid Palindrome II | valid-palindrome-ii | Given a string `s`, return `true` _if the_ `s` _can be palindrome after deleting **at most one** character from it_.
**Example 1:**
**Input:** s = "aba "
**Output:** true
**Example 2:**
**Input:** s = "abca "
**Output:** true
**Explanation:** You could delete the character 'c'.
**Example 3:**
**Input:** s = "a... | null | Two Pointers,String,Greedy | Easy | 125,1178 |
316 | Mera Device Welcome Back To My Channel In This Video Were Going To Solve Remove Duplicate Latest So What Is The Giver Statement Hair Ji Bane Tasty Gas Remove Duplicate Latest Soda Every Letter Of You Want And Only Once You Must Make Sure Result Is The Smallest In Risk Graphical Order Salt All Possible Results Switch Pr... | 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 |
230 | Today our given 52 is the date smallest element in a binary search tree and let us see a little bit about this problem. First of all is it a medium type of problem and we are saying that given d root is given root over binary search history and what should we do. I have given a wait, I have to find out the field smalle... | Kth Smallest Element in a BST | kth-smallest-element-in-a-bst | Given the `root` of a binary search tree, and an integer `k`, return _the_ `kth` _smallest value (**1-indexed**) of all the values of the nodes in the tree_.
**Example 1:**
**Input:** root = \[3,1,4,null,2\], k = 1
**Output:** 1
**Example 2:**
**Input:** root = \[5,3,6,2,4,null,null,1\], k = 3
**Output:** 3
**Cons... | Try to utilize the property of a BST. Try in-order traversal. (Credits to @chan13) What if you could modify the BST node's structure? The optimal runtime complexity is O(height of BST). | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | 94,671 |
741 | Hello everyone welcome tu gold shop my name is himanshu you are watching lecture 16 of d series dp pyaar hai so let's start [ d series dp pyaar hai so let's start [ d series dp pyaar hai so let's start so see friend the name of our today's question is friend it is a very standard question and very simple company This i... | Cherry Pickup | cherry-pickup | You are given an `n x n` `grid` representing a field of cherries, each cell is one of three possible integers.
* `0` means the cell is empty, so you can pass through,
* `1` means the cell contains a cherry that you can pick up and pass through, or
* `-1` means the cell contains a thorn that blocks your way.
Ret... | null | Array,Dynamic Programming,Matrix | Hard | 64,174,2189 |
1,198 | Hello gas welcome back to solve the program 98 Find the smallest common element in all the races within all the races which are 2D are shorted in strictly increasing order return ok so let's see from the example so first what is given in the example I second When I went to check in Arhar, there is no van here, so I wil... | Find Smallest Common Element in All Rows | unpopular-books | Given an `m x n` matrix `mat` where every row is sorted in **strictly** **increasing** order, return _the **smallest common element** in all rows_.
If there is no common element, return `-1`.
**Example 1:**
**Input:** mat = \[\[1,2,3,4,5\],\[2,4,5,8,10\],\[3,5,7,9,11\],\[1,3,5,7,9\]\]
**Output:** 5
**Example 2:**
... | null | Database | Medium | null |
37 | Hello friends welcome to Deco DS I will teach you problem solving and logic building let's start so in the question it is written Write program to solve suk puzzle by filling the M cells ok suk solution must satisfy the following rule ok ch of the digits Two must have only one in row OK Four digits two must have only o... | Sudoku Solver | sudoku-solver | Write a program to solve a Sudoku puzzle by filling the empty cells.
A sudoku solution must satisfy **all of the following rules**:
1. Each of the digits `1-9` must occur exactly once in each row.
2. Each of the digits `1-9` must occur exactly once in each column.
3. Each of the digits `1-9` must occur exactly onc... | null | Array,Backtracking,Matrix | Hard | 36,1022 |
167 | hey everyone today we're taking a look at two sum two which is the same problem as to some just the regular except the input array is sorted um so we have a one index array of integers sorted in and it says non-decreasing but this just and it says non-decreasing but this just and it says non-decreasing but this just me... | Two Sum II - Input Array Is Sorted | two-sum-ii-input-array-is-sorted | Given a **1-indexed** array of integers `numbers` that is already **_sorted in non-decreasing order_**, find two numbers such that they add up to a specific `target` number. Let these two numbers be `numbers[index1]` and `numbers[index2]` where `1 <= index1 < index2 <= numbers.length`.
Return _the indices of the two n... | null | Array,Two Pointers,Binary Search | Medium | 1,653,1083 |
1,733 | hey everybody this is larry this is q2 of the bi-weekly contest 44 minimum q2 of the bi-weekly contest 44 minimum q2 of the bi-weekly contest 44 minimum number of people to teach uh so this one was tricky for me um i had to oh i had the wrong answer because i did not um yeah so there's just a couple of test cases um an... | Minimum Number of People to Teach | maximum-number-of-visible-points | On a social network consisting of `m` users and some friendships between users, two users can communicate with each other if they know a common language.
You are given an integer `n`, an array `languages`, and an array `friendships` where:
* There are `n` languages numbered `1` through `n`,
* `languages[i]` is th... | Sort the points by polar angle with the original position. Now only a consecutive collection of points would be visible from any coordinate. We can use two pointers to keep track of visible points for each start point For handling the cyclic condition, it’d be helpful to append the point list to itself after sorting. | Array,Math,Geometry,Sliding Window,Sorting | Hard | null |
126 | hey what's up guys uh this is chung here again so this time today's daily challenge problem number 126 word lighter number two right so this one is very pretty very classic one so basically this time our task is to transform uh the word from the beginning word to the n word right and then we can only trans uh transform... | Word Ladder II | word-ladder-ii | 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,Backtracking,Breadth-First Search | Hard | 127,2276 |
1,897 | hello all so we are going to solve today's lead code problem redistribute characters to make all strings equal so this is an easy problem but it's a tricky one so we need to understand this question thoroughly otherwise we won't be able to solve it so let's see so the question is redistribute characters to make all str... | Redistribute Characters to Make All Strings Equal | maximize-palindrome-length-from-subsequences | You are given an array of strings `words` (**0-indexed**).
In one operation, pick two **distinct** indices `i` and `j`, where `words[i]` is a non-empty string, and move **any** character from `words[i]` to **any** position in `words[j]`.
Return `true` _if you can make **every** string in_ `words` _**equal** using **a... | Let's ignore the non-empty subsequence constraint. We can concatenate the two strings and find the largest palindromic subsequence with dynamic programming. Iterate through every pair of characters word1[i] and word2[j], and see if some palindrome begins with word1[i] and ends with word2[j]. This ensures that the subse... | String,Dynamic Programming | Hard | 516 |
38 | day 18th of October lead code challenge the problem that we have in today is count and say here in this question you given an integer n what you need to do you need to return the nth term in the count and say sequence and now you're going to ask me how do we generate this count and say sequence I'll be talking about it... | Count and Say | count-and-say | The **count-and-say** sequence is a sequence of digit strings defined by the recursive formula:
* `countAndSay(1) = "1 "`
* `countAndSay(n)` is the way you would "say " the digit string from `countAndSay(n-1)`, which is then converted into a different digit string.
To determine how you "say " a digit string, spli... | The following are the terms from n=1 to n=10 of the count-and-say sequence:
1. 1
2. 11
3. 21
4. 1211
5. 111221
6. 312211
7. 13112221
8. 1113213211
9. 31131211131221
10. 13211311123113112211 To generate the nth term, just count and say the n-1th term. | String | Medium | 271,443 |
104 | this is uh another binary tree problem here you are given a binary tree and you have to find the maximum depth of binary tree so clearly if you have a binary tree like that so depth here means uh how deep you can go maybe there was a node here also so in that case this is the deepest path the leaf that is farthest from... | Maximum Depth of Binary Tree | maximum-depth-of-binary-tree | Given the `root` of a binary tree, return _its maximum depth_.
A binary tree's **maximum depth** is the number of nodes along the longest path from the root node down to the farthest leaf node.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 3
**Example 2:**
**Input:** root = \[1,null,2\]
**... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 110,111,774,1492 |
63 | hello everyone welcome to day 20 of my elite code challenge and i hope all of you are having a great time my name is sanchez i am working as technical architect sd4 at adobe and here i present day 693 of daily record problem the question that we have in today's unique paths 2. here in this question we are given a great... | 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 |
24 | Hello Hi Everyone Welcome To My Channel It's All The Problem Swapna And SIM Players During This Website Does In Notes And It Is Not Modified Values In Delhi Only It Is Not Modified Values In Delhi Only It Is Not Modified Values In Delhi Only Notes Of Which Aims To Her Left For This Is The Writer Of The Does Not S... | Swap Nodes in Pairs | swap-nodes-in-pairs | Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.)
**Example 1:**
**Input:** head = \[1,2,3,4\]
**Output:** \[2,1,4,3\]
**Example 2:**
**Input:** head = \[\]
**Output:** \[\... | null | Linked List,Recursion | Medium | 25,528 |
525 | has been asked by Facebook Amazon Microsoft Apple Google Adobe Yahoo and phone P hi guys good morning welcome back to a new video I hope that you guys are doing good again firstly apologies the video is 5 hours late and uh please ignore my occurrence also I not even washed my face since morning because I have meeting a... | Contiguous Array | contiguous-array | Given a binary array `nums`, return _the maximum length of a contiguous subarray with an equal number of_ `0` _and_ `1`.
**Example 1:**
**Input:** nums = \[0,1\]
**Output:** 2
**Explanation:** \[0, 1\] is the longest contiguous subarray with an equal number of 0 and 1.
**Example 2:**
**Input:** nums = \[0,1,0\]
**O... | null | Array,Hash Table,Prefix Sum | Medium | 325 |
111 | all right let's talk about minimum death of binary tree so this question is pretty much like a maximum death of binary tree so if you didn't watch the video just go back to my channel and watch it so you need to find the shortest path from the frontal route no down to the nearest leaf right so this is pretty straight f... | Minimum Depth of Binary Tree | minimum-depth-of-binary-tree | Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
**Note:** A leaf is a node with no children.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 2
**Example 2:**
**Input:** root = \[2... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 102,104 |
1,869 | Hello hello meaning people I am Aayushi Raw and welcome to my channel in this peer winters solution work to-do list 240 seconds solution work to-do list 240 seconds solution work to-do list 240 seconds weekly contest forest problem a that if you come to my channel play list a moment subscribe button press the bell icon... | 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 |
1,344 | Hello Abhi Badi Welcome to my channel today for 2nd Problems Angle Between Hands of a Luck for Giving to Hand Shower and Minutes Returns The Smaller Angle in Degrees from Between the Power and Minute Hand Shoulder Hindi Example of Baghavan President Raghavendra Minute Is 32.the Angle President Raghavendra Minute Is 32.... | Angle Between Hands of a Clock | maximum-equal-frequency | Given two numbers, `hour` and `minutes`, return _the smaller angle (in degrees) formed between the_ `hour` _and the_ `minute` _hand_.
Answers within `10-5` of the actual value will be accepted as correct.
**Example 1:**
**Input:** hour = 12, minutes = 30
**Output:** 165
**Example 2:**
**Input:** hour = 3, minutes ... | Keep track of the min and max frequencies. The number to be eliminated must have a frequency of 1, same as the others or the same +1. | Array,Hash Table | Hard | null |
84 | oh you guys miss to the 84th problematical largest rectangle in histogram given and non-negative histogram given and non-negative histogram given and non-negative integers representing the issue round bar height where the width of each bar is 1 find the area of the largest rectangle in this row we have to calculate the... | Largest Rectangle in Histogram | largest-rectangle-in-histogram | Given an array of integers `heights` representing the histogram's bar height where the width of each bar is `1`, return _the area of the largest rectangle in the histogram_.
**Example 1:**
**Input:** heights = \[2,1,5,6,2,3\]
**Output:** 10
**Explanation:** The above is a histogram where width of each bar is 1.
The l... | null | Array,Stack,Monotonic Stack | Hard | 85,1918 |
170 | so hello everyone welcome to this video and in this video i will be explaining the problem to some the third variation of the twosome problem and it is a data structure design problem and definitely not a easy one so in this video first i will explain you uh this data structure thing so that you will never face any pro... | Two Sum III - Data structure design | two-sum-iii-data-structure-design | Design a data structure that accepts a stream of integers and checks if it has a pair of integers that sum up to a particular value.
Implement the `TwoSum` class:
* `TwoSum()` Initializes the `TwoSum` object, with an empty array initially.
* `void add(int number)` Adds `number` to the data structure.
* `boolean... | null | Array,Hash Table,Two Pointers,Design,Data Stream | Easy | 1,288,653 |
373 | hi guys good morning welcome back to the new video and oh God like a legit the concept that you're gonna be applied is very easy and very standard but how to reach by as a hotel why it is being applied how to think of that's super trick in this problem although it's a medium problem but I will put this problem in a med... | Find K Pairs with Smallest Sums | find-k-pairs-with-smallest-sums | You are given two integer arrays `nums1` and `nums2` sorted in **ascending order** and an integer `k`.
Define a pair `(u, v)` which consists of one element from the first array and one element from the second array.
Return _the_ `k` _pairs_ `(u1, v1), (u2, v2), ..., (uk, vk)` _with the smallest sums_.
**Example 1:**... | null | Array,Heap (Priority Queue) | Medium | 378,719,2150 |
1 | we're given an array of integers and we want to return indices of the two elements that add up to Target 2 and seven add up to our Target 9 so we return the indices for 2 and 7even which are 0 and 1 there's exactly one solution and we cannot use the same element twice we're given an array of numbers but the underlying ... | Two Sum | two-sum | Given an array of integers `nums` and an integer `target`, return _indices of the two numbers such that they add up to `target`_.
You may assume that each input would have **_exactly_ one solution**, and you may not use the _same_ element twice.
You can return the answer in any order.
**Example 1:**
**Input:** nums... | A really brute force way would be to search for all possible pairs of numbers but that would be too slow. Again, it's best to try out brute force solutions for just for completeness. It is from these brute force solutions that you can come up with optimizations. So, if we fix one of the numbers, say x, we have to scan ... | Array,Hash Table | Easy | 15,18,167,170,560,653,1083,1798,1830,2116,2133,2320 |
1,854 | There are many types of 'H' in the bay of 'Pentum'. If There are many types of 'H' in the bay of 'Pentum'. If There are many types of 'H' in the bay of 'Pentum'. If you are preparing for technical interview then you must read about it. Understand the meaning of 'La'. What is the meaning of 'Sp'? Understand the meaning ... | Maximum Population Year | maximum-population-year | You are given a 2D integer array `logs` where each `logs[i] = [birthi, deathi]` indicates the birth and death years of the `ith` person.
The **population** of some year `x` is the number of people alive during that year. The `ith` person is counted in year `x`'s population if `x` is in the **inclusive** range `[birthi... | null | null | Easy | null |
51 | let's solve legal question 51 and queens it's a hard legal question and queen's puzzle is the problem of placing n queens on a m plus n chess board such that no two queens attack each other giving an integer n so like it gives you or n that's basically meaning the border will be m multiples and basically four by four r... | N-Queens | n-queens | 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 _all distinct solutions to the **n-queens puzzle**_. You may return the answer in **any order**.
Each solution contains a distinct board configuration of the n-... | null | Array,Backtracking | Hard | 52,1043 |
389 | Hello everyone, today we are going to discuss the problem of liquid in Badri, those who have the problem are friends, what is it that we will get two sticks and take tet-one and that we will get two sticks and take tet-one and that we will get two sticks and take tet-one and tet-two because there will always be more th... | 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 |
313 | welcome to joey's dynamic programming tutorial in this video let's look into a lead good problem super ugly numbers i bet that this problem will be fun to solve and will definitely up your game when it comes to cracking technical interviews before i move to the problem statement i humbly request you to subscribe to my ... | Super Ugly Number | super-ugly-number | A **super ugly number** is a positive integer whose prime factors are in the array `primes`.
Given an integer `n` and an array of integers `primes`, return _the_ `nth` _**super ugly number**_.
The `nth` **super ugly number** is **guaranteed** to fit in a **32-bit** signed integer.
**Example 1:**
**Input:** n = 12, ... | null | Array,Hash Table,Math,Dynamic Programming,Heap (Priority Queue) | Medium | 264 |
414 | Hello Everyone Today Maximum Number Question Number has already been asked, so today we will first ask what is this question Life and wait Earns Return D Third Dusting Maximum Number in D This Are If D Third Maximum Country Note Exist Return D Maximum Number So the purpose of this is that we have to return the third ma... | 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 |
41 | Hey everyone, it's financier, I hope people are well, having fun, healthy, they must be preparing for the placement, because you placement is very close to many people, okay and there are lots of questions, keep running in the mind that brother, we have not been prepared. For the same reason, I am making a complete pla... | 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 |
532 | welcome to october's lego challenge today's problem is k diff pairs in an array given an array of integers and an integer k we turn the number of unique cadif pairs in the array a case of pair is an integer pair where all i and j are within o of n i does not equal j and b minus a equals k i don't know why they had to m... | K-diff Pairs in an Array | k-diff-pairs-in-an-array | Given an array of integers `nums` and an integer `k`, return _the number of **unique** k-diff pairs in the array_.
A **k-diff** pair is an integer pair `(nums[i], nums[j])`, where the following are true:
* `0 <= i, j < nums.length`
* `i != j`
* `nums[i] - nums[j] == k`
**Notice** that `|val|` denotes the absol... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Medium | 530,2116,2150 |
491 | hey everyone welcome to techwide in this video we are going to see problem number 491 non-decreasing subsequence on lead 491 non-decreasing subsequence on lead 491 non-decreasing subsequence on lead code here we are given an array of different elements okay so we need to find a subsequence of elements so subsequence in... | Non-decreasing Subsequences | increasing-subsequences | Given an integer array `nums`, return _all the different possible non-decreasing subsequences of the given array with at least two elements_. You may return the answer in **any order**.
**Example 1:**
**Input:** nums = \[4,6,7,7\]
**Output:** \[\[4,6\],\[4,6,7\],\[4,6,7,7\],\[4,7\],\[4,7,7\],\[6,7\],\[6,7,7\],\[7,7\]... | null | Array,Hash Table,Backtracking,Bit Manipulation | Medium | 646 |
63 | hello on take enthusiastic hear in this video we'll solve another lead code problem number 63 unique parts to this is a minor variation of unique paths 1 that problem so I will add the link of this video into the description if you want to take a look at that video at the beginning so the main difference between the pr... | 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 |
115 | That if in this video we will find out how many districts are washed with the subsequent, so like if I tell you Sindhu ABCD is very simple, 416 is the least on its whole, how come it is so simple, tell me the whole husband, in every house there are only two black and With the fodder, now this is the A of the school and... | Distinct Subsequences | distinct-subsequences | Given two strings `s` and `t`, return _the number of distinct_ **_subsequences_** _of_ `s` _which equals_ `t`.
The test cases are generated so that the answer fits on a 32-bit signed integer.
**Example 1:**
**Input:** s = "rabbbit ", t = "rabbit "
**Output:** 3
**Explanation:**
As shown below, there are 3 ways you... | null | String,Dynamic Programming | Hard | 2115 |
338 | hello everyone welcome back today we will be solving one lead code question number of one bits write a function that take the binary representation of an unsigned integer and return the number of one bit it has note that in some languages such as Java there is no unsigned integer types in this case the input will be gi... | Counting Bits | counting-bits | Given an integer `n`, return _an array_ `ans` _of length_ `n + 1` _such that for each_ `i` (`0 <= i <= n`)_,_ `ans[i]` _is the **number of**_ `1`_**'s** in the binary representation of_ `i`.
**Example 1:**
**Input:** n = 2
**Output:** \[0,1,1\]
**Explanation:**
0 --> 0
1 --> 1
2 --> 10
**Example 2:**
**Input:** n =... | You should make use of what you have produced already. Divide the numbers in ranges like [2-3], [4-7], [8-15] and so on. And try to generate new range from previous. Or does the odd/even status of the number help you in calculating the number of 1s? | Dynamic Programming,Bit Manipulation | Easy | 191 |
1,870 | So hello gas, today is 26th July and as I had promised that the suggestion is going to come, so today also I am going to post the solution, today first give me the question of lead code, it is 1870 minimum speed, you error on time, so in this question, simply explain. I am wondering what is happening is that there is 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 |
3 | hello my friends my name is Alexander barmin and this is my new YouTube show lead code with me where we solve lead code challenges don't forget to subscribe to my channel give me a like and write a comment so what's in the agenda for today we have a sliding window problem but we're going to tackle gracefully let's get ... | Longest Substring Without Repeating Characters | longest-substring-without-repeating-characters | Given a string `s`, find the length of the **longest** **substring** without repeating characters.
**Example 1:**
**Input:** s = "abcabcbb "
**Output:** 3
**Explanation:** The answer is "abc ", with the length of 3.
**Example 2:**
**Input:** s = "bbbbb "
**Output:** 1
**Explanation:** The answer is "b ", with t... | null | Hash Table,String,Sliding Window | Medium | 159,340,1034,1813,2209 |
1,290 | this is the solution to LICO problem 1290 convert binary number in a linked list to integer so listed as an easy problem okay given a head which is a reference node to a singly linked list the value of each node in the linked list is either 0 or 1 the linked list holds the binary representation of a number returned the... | Convert Binary Number in a Linked List to Integer | make-array-strictly-increasing | Given `head` which is a reference node to a singly-linked list. The value of each node in the linked list is either `0` or `1`. The linked list holds the binary representation of a number.
Return the _decimal value_ of the number in the linked list.
The **most significant bit** is at the head of the linked list.
**E... | Use dynamic programming. The state would be the index in arr1 and the index of the previous element in arr2 after sorting it and removing duplicates. | Array,Binary Search,Dynamic Programming | Hard | null |
67 | Hello Hi Guys Welcome To Lut Gayi Thi Today Will Go Through The Day In Your Problems From July Decoding Challenge And Finally Please Like Video And Don't Forget To Subscribe To Our Channel And Updates That Give Into Binary Springs Will Need To Return Dasham With This Also Aware Is Tring And Very Naughty And Contain Onl... | 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 |
102 | hello friends today we will look at problem number 102 on lead code which is binary tree level order traversal in this problem you are given this tree as shown in the example and you have to return the level order traversal of its node nodes values from left to right level by level and as you can see this is a medium l... | Binary Tree Level Order Traversal | binary-tree-level-order-traversal | Given the `root` of a binary tree, return _the level order traversal of its nodes' values_. (i.e., from left to right, level by level).
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[3\],\[9,20\],\[15,7\]\]
**Example 2:**
**Input:** root = \[1\]
**Output:** \[\[1\]\]
**Example 3:**
**I... | null | Tree,Breadth-First Search,Binary Tree | Medium | 103,107,111,314,637,764,1035 |
382 | झाल झाल झालूट उडे we are going to discuss list लूट उडे we are going to discuss list लूट उडे we are going to discuss list friend no problem Video Channel for watching this Video give list will discuss example2 Give one to three keys and life is the question loss to return random valid have to generator and well-being ha... | Linked List Random Node | linked-list-random-node | Given a singly linked list, return a random node's value from the linked list. Each node must have the **same probability** of being chosen.
Implement the `Solution` class:
* `Solution(ListNode head)` Initializes the object with the head of the singly-linked list `head`.
* `int getRandom()` Chooses a node randoml... | null | Linked List,Math,Reservoir Sampling,Randomized | Medium | 398 |
216 | Hello everyone welcome to Kota, my name is Himanshu and you are watching the lecture, I will give the equation for 12th head, so let's start Today we are going to do combination free, whoever does not know, I am telling him that we will see, okay No, you are there, from the same, we have started these sub-series, are t... | Combination Sum III | combination-sum-iii | Find all valid combinations of `k` numbers that sum up to `n` such that the following conditions are true:
* Only numbers `1` through `9` are used.
* Each number is used **at most once**.
Return _a list of all possible valid combinations_. The list must not contain the same combination twice, and the combinations... | null | Array,Backtracking | Medium | 39 |
80 | hello so today is day four we are sewing actually I am solving remove duplicates from sorted array 80s let's go question this is the first time I'm looking at it right now and yeah I will follow the uh old way like the I will just solve it as if I'm in an interview yeah and if you want me to update this style maybe onl... | Remove Duplicates from Sorted Array II | remove-duplicates-from-sorted-array-ii | Given an integer array `nums` sorted in **non-decreasing order**, remove some duplicates [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm) such that each unique element appears **at most twice**. The **relative order** of the elements should be kept the **same**.
Since it is impossible to change the len... | null | Array,Two Pointers | Medium | 26 |
1,997 | hey what's up guys sorry i saw this 1997 first day where you have been in all routes oh so this problem is very interesting and uh yeah basically uh there are other rooms by the way hope you guys subscribe to my channel so learn rooms you need to visit this label from zero to end energy is label uh one enable and you g... | First Day Where You Have Been in All the Rooms | next-palindrome-using-same-digits | There are `n` rooms you need to visit, labeled from `0` to `n - 1`. Each day is labeled, starting from `0`. You will go in and visit one room a day.
Initially on day `0`, you visit room `0`. The **order** you visit the rooms for the coming days is determined by the following **rules** and a given **0-indexed** array `... | Is it possible to swap one character in the first half of the palindrome to make the next one? Are there different cases for when the length is odd and even? | Two Pointers,String | Hard | 556,564 |
52 | hey what's up guys uh it's chung here again so uh so this time today's daily challenge problem right it's number 52 and queens number two so this one actually is very similar it's almost the same as the end queen number one the only difference is that you know in queen number one we need to return the arrangement right... | 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 |
1,665 | Hi everyone welcome to lip programming in this video available discuss if you consider it important now then tell me this thing minimum definitely crispy ghanta soya which causes heart problem back once you understand by the sister again examples for the answer is translated in exams preparation After verses in electri... | Minimum Initial Energy to Finish Tasks | diameter-of-n-ary-tree | You are given an array `tasks` where `tasks[i] = [actuali, minimumi]`:
* `actuali` is the actual amount of energy you **spend to finish** the `ith` task.
* `minimumi` is the minimum amount of energy you **require to begin** the `ith` task.
For example, if the task is `[10, 12]` and your current energy is `11`, yo... | For the node i, calculate the height of each of its children and keep the first and second maximum heights (max1_i , max2_i). Check all nodes and return max( 2 + max1_i + max2_i ). | Tree,Depth-First Search | Medium | 543 |
86 | Hello everyone welcome to my channel and today we will give question number 22 of July challenge so question is partition list medium level question only read the question we are given a head given d head of un english and un value x partition its Sach date all notes less dene Given here and what is this Jaay means les... | Partition List | partition-list | Given the `head` of a linked list and a value `x`, partition it such that all nodes **less than** `x` come before nodes **greater than or equal** to `x`.
You should **preserve** the original relative order of the nodes in each of the two partitions.
**Example 1:**
**Input:** head = \[1,4,3,2,5,2\], x = 3
**Output:**... | null | Linked List,Two Pointers | Medium | 2265 |
658 | problem 658 find key closest filaments we'll go through the question uh here so given a sorted integer array and two integer KNX return K closest integer to X in the array the result should also be sorted in ascending order okay so an integer a is closer to X than n integer B if uh the absolute difference of uh a and x... | Find K Closest Elements | find-k-closest-elements | Given a **sorted** integer array `arr`, two integers `k` and `x`, return the `k` closest integers to `x` in the array. The result should also be sorted in ascending order.
An integer `a` is closer to `x` than an integer `b` if:
* `|a - x| < |b - x|`, or
* `|a - x| == |b - x|` and `a < b`
**Example 1:**
**Input:... | null | Array,Two Pointers,Binary Search,Sorting,Heap (Priority Queue) | Medium | 374,375,719 |
1,037 | all right let's talk about a valid boomerang so you're given the array of points where points i equal to x i y i represent a point on x y plane so you have to return true if there is a point of bone marrow so bermudge's set of three points that are all distinct and not in the straight line right so this is actually a m... | Valid Boomerang | minimum-number-of-k-consecutive-bit-flips | Given an array `points` where `points[i] = [xi, yi]` represents a point on the **X-Y** plane, return `true` _if these points are a **boomerang**_.
A **boomerang** is a set of three points that are **all distinct** and **not in a straight line**.
**Example 1:**
**Input:** points = \[\[1,1\],\[2,3\],\[3,2\]\]
**Output... | null | Array,Bit Manipulation,Sliding Window,Prefix Sum | Hard | 319,2286 |
6 | cool number six AG conversion the string paypal is high what just like a sponsored form anybody the string is written in assists AK pattern on a given number goes like this you may want to display this pattern in a fixed plan for better legibility something like that and we'd put and then we buy line and you have some ... | Zigzag Conversion | zigzag-conversion | The string `"PAYPALISHIRING "` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S I I G
Y I R
And then read line by line: `"PAHNAPLSIIGYIR "`
Write the code that will take a string and make this co... | null | String | Medium | null |
18 | hi everyone today we will be discussing another lead cube problem which is for some so in this you are given a list of numbers such as 1 0 minus 2 and you're also given a variable which is Target and you have to check if four unique elements of this list equal the sum of them is equal to the Target um so basically nums... | 4Sum | 4sum | Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that:
* `0 <= a, b, c, d < n`
* `a`, `b`, `c`, and `d` are **distinct**.
* `nums[a] + nums[b] + nums[c] + nums[d] == target`
You may return the answer in **any order**.
**Examp... | null | Array,Two Pointers,Sorting | Medium | 1,15,454,2122 |
211 | okay so lead code practice time in this video there are two goals so the first one is to see how to solve this problem and put in some solid code and the other one is to see how to behave during a real interview what is the process we need to follow during a real coding interview so let's get started remember always th... | Design Add and Search Words Data Structure | design-add-and-search-words-data-structure | Design a data structure that supports adding new words and finding if a string matches any previously added string.
Implement the `WordDictionary` class:
* `WordDictionary()` Initializes the object.
* `void addWord(word)` Adds `word` to the data structure, it can be matched later.
* `bool search(word)` Returns ... | You should be familiar with how a Trie works. If not, please work on this problem: Implement Trie (Prefix Tree) first. | String,Depth-First Search,Design,Trie | Medium | 208,746 |
665 | okay let's talk about non-decreasing okay let's talk about non-decreasing okay let's talk about non-decreasing array so you are given the integer array and then you compute the value and which is not decreasing right but you can delete at most one element or modify and modify the element okay so it's pretty straightfor... | 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 |
388 | now is coding cat today we are solving legal question 338 longest absolute file path so in this question we are given an input string representing a file system and the goal is to find out what's the longest absolute file path embedded in the string in order to solve the problem the most important thing is to understan... | Longest Absolute File Path | longest-absolute-file-path | Suppose we have a file system that stores both files and directories. An example of one system is represented in the following picture:
Here, we have `dir` as the only directory in the root. `dir` contains two subdirectories, `subdir1` and `subdir2`. `subdir1` contains a file `file1.ext` and subdirectory `subsubdir1`.... | null | String,Stack,Depth-First Search | Medium | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.