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 |
|---|---|---|---|---|---|---|---|---|
239 | Hello everyone, welcome to my channel, we are going to do video number 32 of this, okay and you know that we have got a very good response in the playlist with graph construction questions, so you can also explore that from the playlist, there I have explained the graph more. There are some more topics in it, just chil... | Sliding Window Maximum | sliding-window-maximum | You are given an array of integers `nums`, there is a sliding window of size `k` which is moving from the very left of the array to the very right. You can only see the `k` numbers in the window. Each time the sliding window moves right by one position.
Return _the max sliding window_.
**Example 1:**
**Input:** nums... | How about using a data structure such as deque (double-ended queue)? The queue size need not be the same as the window’s size. Remove redundant elements and the queue should store only elements that need to be considered. | Array,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue | Hard | 76,155,159,265,1814 |
473 | hey everyone today we'll be solving lead problem number 473 mati 2 sare it's a good question and has been asked to me in the Microsoft recently and it is based on the backtracking problem so let's have a look on the problem statement in this problem we will be given an iner array match sticks I is the length of the I m... | Matchsticks to Square | matchsticks-to-square | You are given an integer array `matchsticks` where `matchsticks[i]` is the length of the `ith` matchstick. You want to use **all the matchsticks** to make one square. You **should not break** any stick, but you can link them up, and each matchstick must be used **exactly one time**.
Return `true` if you can make this ... | Treat the matchsticks as an array. Can we split the array into 4 equal halves? Every matchstick can belong to either of the 4 sides. We don't know which one. Maybe try out all options! For every matchstick, we have to try out each of the 4 options i.e. which side it can belong to. We can make use of recursion for this.... | Array,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask | Medium | null |
332 | Loot Hi Everyone Welcome to my Channel Today's Date Month of June Video Channel and Problem Subscribe Channel Radhe-Radhe Problem Subscribe Channel Radhe-Radhe Problem Subscribe Channel Radhe-Radhe Problem Statement subscribe and subscribe the Channel 500 Notes Important Notes of this Year and Multiple Belt Nurses Smal... | Reconstruct Itinerary | reconstruct-itinerary | You are given a list of airline `tickets` where `tickets[i] = [fromi, toi]` represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it.
All of the tickets belong to a man who departs from `"JFK "`, thus, the itinerary must begin with `"JFK "`. If there are multiple... | null | Depth-First Search,Graph,Eulerian Circuit | Hard | 2051,2201 |
904 | hey everybody this is Larry this is day seven of delete code daily challenge hit the like button hit the Subscribe button drawing on Discord let me know what you think about today's fun oh look I haven't uh done this Farm before so yeah go Larry uh 904 fruit into baskets medium Plum you're using a farm that's a single ... | Fruit Into Baskets | leaf-similar-trees | You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by an integer array `fruits` where `fruits[i]` is the **type** of fruit the `ith` tree produces.
You want to collect as much fruit as possible. However, the owner has some strict rules that you must foll... | null | Tree,Depth-First Search,Binary Tree | Easy | null |
345 | Hello gauge my self Amrita welcome back to our channel technosij so in today's video we are going to discuss lead code problem number 345 date is reverse vowels of a string so let's get started let's first understand the problem and then we will move on to the solution. So given any string s reverse only d vowels in d ... | 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 |
806 | what's up guys what's up so uh today let's keep solving rd code 806 and before i start please subscribe to my channel and click the subscribe button and click like button and also leave a comment below okay so you are given a string s of lowercase english and ray with denoting how many uh pixel y is your case so basica... | Number of Lines To Write String | domino-and-tromino-tiling | You are given a string `s` of lowercase English letters and an array `widths` denoting **how many pixels wide** each lowercase English letter is. Specifically, `widths[0]` is the width of `'a'`, `widths[1]` is the width of `'b'`, and so on.
You are trying to write `s` across several lines, where **each line is no long... | null | Dynamic Programming | Medium | null |
144 | hello everyone in this video we're going to be going through lead code problem 144 which is binary tree pre-order which is binary tree pre-order which is binary tree pre-order traversal so given the root of a binary tree return the pre-order traversal of tree return the pre-order traversal of tree return the pre-order ... | Binary Tree Preorder Traversal | binary-tree-preorder-traversal | Given the `root` of a binary tree, return _the preorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[1,2,3\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of nodes ... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 94,255,775 |
1,954 | Hua Hai Hello Everyone Welcome To For That Suggest Or To * Solve Digit Question Number 90 and * Solve Digit Question Number 90 and * Solve Digit Question Number 90 and Develop Minimum Nine Parameters To Connect People Will Not Be To Basically A That Here May Giving His Eyes Of Garden To Me To Basically A 's Love To Fro... | Minimum Garden Perimeter to Collect Enough Apples | replace-all-digits-with-characters | In a garden represented as an infinite 2D grid, there is an apple tree planted at **every** integer coordinate. The apple tree planted at an integer coordinate `(i, j)` has `|i| + |j|` apples growing on it.
You will buy an axis-aligned **square plot** of land that is centered at `(0, 0)`.
Given an integer `neededAppl... | We just need to replace every even positioned character with the character s[i] positions ahead of the character preceding it Get the position of the preceeding character in alphabet then advance it s[i] positions and get the character at that position | String | Easy | 878 |
1,537 | That paper roadways depot but in this to-do what alarms have I set means at one point most of us have that one sentence and here is throw 8 points 3605 one to like and if to do only two okay and second element Samsung Galaxy S8 Class 9th Flash Lights And Let's See Five Camps From Others 101 But For Those Girls And Diff... | Get the Maximum Score | maximum-score-after-splitting-a-string | You are given two **sorted** arrays of distinct integers `nums1` and `nums2.`
A **valid path** is defined as follows:
* Choose array `nums1` or `nums2` to traverse (from index-0).
* Traverse the current array from left to right.
* If you are reading any value that is present in `nums1` and `nums2` you are allow... | Precompute a prefix sum of ones ('1'). Iterate from left to right counting the number of zeros ('0'), then use the precomputed prefix sum for counting ones ('1'). Update the answer. | String | Easy | null |
1,182 | hey everybody this is Larry this is um yeah well it's February 7th um yeah and we're going to do a random problem so let's go let's get to it uh yeah and today's random problem is 1182 shortest distance to Target color so what does that mean you're giving an away colors in which there three colors 1 2 and three given s... | Shortest Distance to Target Color | game-play-analysis-iv | You are given an array `colors`, in which there are three colors: `1`, `2` and `3`.
You are also given some queries. Each query consists of two integers `i` and `c`, return the shortest distance between the given index `i` and the target color `c`. If there is no solution return `-1`.
**Example 1:**
**Input:** color... | null | Database | Medium | 1181,1193 |
1,704 | Hello everyone, let's see today's question. Determine if strings are alike. This is an easy question and it will be a question of prefix even. So what is there in this? You have been given two strings and one string. If the length of the string is even, you will have two halves. You have to cut, not cut, you basically ... | Determine if String Halves Are Alike | special-positions-in-a-binary-matrix | You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half.
Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppe... | Keep track of 1s in each row and in each column. Then while iterating over matrix, if the current position is 1 and current row as well as current column contains exactly one occurrence of 1. | Array,Matrix | Easy | null |
209 | so today I'm gonna saw lead problem number to 0-9 minimum size a very saw number to 0-9 minimum size a very saw number to 0-9 minimum size a very saw it's a medium level problem and the problem is given an array of n positive integers and a positive integer us find the minimum length of a continuous salary some of whic... | Minimum Size Subarray Sum | minimum-size-subarray-sum | Given an array of positive integers `nums` and a positive integer `target`, return _the **minimal length** of a_ _subarray_ _whose sum is greater than or equal to_ `target`. If there is no such subarray, return `0` instead.
**Example 1:**
**Input:** target = 7, nums = \[2,3,1,2,4,3\]
**Output:** 2
**Explanation:** Th... | null | Array,Binary Search,Sliding Window,Prefix Sum | Medium | 76,325,718,1776,2211,2329 |
11 | in this video we'll be going over container with most water so given and non-negative integers a1 to a n non-negative integers a1 to a n non-negative integers a1 to a n where each represent a point at coordinate iai so invert and vertical lines are drawn such that two endpoints of the line i is at iai so basically at t... | Container With Most Water | container-with-most-water | You are given an integer array `height` of length `n`. There are `n` vertical lines drawn such that the two endpoints of the `ith` line are `(i, 0)` and `(i, height[i])`.
Find two lines that together with the x-axis form a container, such that the container contains the most water.
Return _the maximum amount of water... | The aim is to maximize the area formed between the vertical lines. The area of any container is calculated using the shorter line as length and the distance between the lines as the width of the rectangle.
Area = length of shorter vertical line * distance between lines
We can definitely get the maximum width ... | Array,Two Pointers,Greedy | Medium | 42 |
1,475 | hey everybody this is Larry I'm doing this problem as part of a contest so you're gonna watch me live as I go through my darts I'm coding they've been explanation near the end and for more context they'll be a link below on this actual screencast of the contest how did you do let me know you do hit the like button eith... | Final Prices With a Special Discount in a Shop | maximum-sum-bst-in-binary-tree | You are given an integer array `prices` where `prices[i]` is the price of the `ith` item in a shop.
There is a special discount for items in the shop. If you buy the `ith` item, then you will receive a discount equivalent to `prices[j]` where `j` is the minimum index such that `j > i` and `prices[j] <= prices[i]`. Oth... | Create a datastructure with 4 parameters: (sum, isBST, maxLeft, minLeft). In each node compute theses parameters, following the conditions of a Binary Search Tree. | Dynamic Programming,Tree,Depth-First Search,Binary Search Tree,Binary Tree | Hard | null |
78 | hello everyone we are solving problem number 78 subsets so this is a very important problem if you are starting a recursion or backtracking concepts so with this video we need to return all the subsets possible often given array so I will just give an example so here we have given one two three so we need to make all t... | Subsets | subsets | Given an integer array `nums` of **unique** elements, return _all possible_ _subsets_ _(the power set)_.
The solution set **must not** contain duplicate subsets. Return the solution in **any order**.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[\],\[1\],\[2\],\[1,2\],\[3\],\[1,3\],\[2,3\],\[1,2,3\]\]
... | null | Array,Backtracking,Bit Manipulation | Medium | 90,320,800,2109,2170 |
775 | hey what's up guys Nick white here I did technically stuff on twitch and YouTube check the description for all my information we do all the leak code we do all the hacker ink and stuff like that just explaining algorithms here so this problem is called global and local inversions it's one of the easier medium problems ... | Global and Local Inversions | n-ary-tree-preorder-traversal | You are given an integer array `nums` of length `n` which represents a permutation of all the integers in the range `[0, n - 1]`.
The number of **global inversions** is the number of the different pairs `(i, j)` where:
* `0 <= i < j < n`
* `nums[i] > nums[j]`
The number of **local inversions** is the number of i... | null | Stack,Tree,Depth-First Search | Easy | 144,764,776 |
21 | hi guys welcome to algorithms made easy today we will see the question merge 2 sorted list we need to merge two sorted link list and return it as a sorted list the list should be made up by splicing together the nodes of first two list in the example we are given the list 1 with the values 1 2 4 and the list 2 with val... | Merge Two Sorted Lists | merge-two-sorted-lists | You are given the heads of two sorted linked lists `list1` and `list2`.
Merge the two lists in a one **sorted** list. The list should be made by splicing together the nodes of the first two lists.
Return _the head of the merged linked list_.
**Example 1:**
**Input:** list1 = \[1,2,4\], list2 = \[1,3,4\]
**Output:**... | null | Linked List,Recursion | Easy | 23,88,148,244,1774,2071 |
465 | hey what's up guys this is john here so today i want to talk about this number 465 optimal account balancing problem here this is a hard problem but i think it's very unique heart problem you know something that i have never seen before okay so let's take a look so a group of friends went on holiday blah and someone's ... | Optimal Account Balancing | optimal-account-balancing | You are given an array of transactions `transactions` where `transactions[i] = [fromi, toi, amounti]` indicates that the person with `ID = fromi` gave `amounti $` to the person with `ID = toi`.
Return _the minimum number of transactions required to settle the debt_.
**Example 1:**
**Input:** transactions = \[\[0,1,1... | null | Array,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask | Hard | null |
433 | okay cool okay Linton 42:8 minimal okay cool okay Linton 42:8 minimal okay cool okay Linton 42:8 minimal minimum generic mutations so a gene strain can be represented by a catalog strain with choices from ACGT suppose we need to investigate a bad mutation from start to end not sure what that means yeah where one mutati... | Minimum Genetic Mutation | minimum-genetic-mutation | A gene string can be represented by an 8-character long string, with choices from `'A'`, `'C'`, `'G'`, and `'T'`.
Suppose we need to investigate a mutation from a gene string `startGene` to a gene string `endGene` where one mutation is defined as one single character changed in the gene string.
* For example, `"AAC... | null | Hash Table,String,Breadth-First Search | Medium | 127 |
1,753 | So the question first let's understand what the question is saying so you are playing a solita game with three piles of stones of size ABC so what is A B and C what are the sizes of the three piles of stones okay H turn you suck you different non Empty files: Take one turn you suck you different non Empty files: Take o... | Maximum Score From Removing Stones | path-with-minimum-effort | You are playing a solitaire game with **three piles** of stones of sizes `a`, `b`, and `c` respectively. Each turn you choose two **different non-empty** piles, take one stone from each, and add `1` point to your score. The game stops when there are **fewer than two non-empty** piles (meaning there ar... | Consider the grid as a graph, where adjacent cells have an edge with cost of the difference between the cells. If you are given threshold k, check if it is possible to go from (0, 0) to (n-1, m-1) using only edges of ≤ k cost. Binary search the k value. | Array,Binary Search,Depth-First Search,Breadth-First Search,Union Find,Heap (Priority Queue),Matrix | Medium | 794,1099 |
54 | thank you welcome back to another session on data structures and algorithms so in this session we will be solving one more problem based on Matrix so we have already solved certain kind of problems on Matrix so this problem is something which is commonly asked in many companies so if you ask me which are the companies ... | Spiral Matrix | spiral-matrix | Given an `m x n` `matrix`, return _all elements of the_ `matrix` _in spiral order_.
**Example 1:**
**Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[1,2,3,6,9,8,7,4,5\]
**Example 2:**
**Input:** matrix = \[\[1,2,3,4\],\[5,6,7,8\],\[9,10,11,12\]\]
**Output:** \[1,2,3,4,8,12,11,10,9,5,6,7\]
**Const... | Well for some problems, the best way really is to come up with some algorithms for simulation. Basically, you need to simulate what the problem asks us to do. We go boundary by boundary and move inwards. That is the essential operation. First row, last column, last row, first column and then we move inwards by 1 and th... | Array,Matrix,Simulation | Medium | 59,921 |
136 | hello everyone and welcome to python programming practice in this episode we are going to be tackling lead code number 136 single number this is classified as an easy problem and i'll start by reading the problem description here given a non-empty array of integers every a non-empty array of integers every a non-empty ... | Single Number | single-number | Given a **non-empty** array of integers `nums`, every element appears _twice_ except for one. Find that single one.
You must implement a solution with a linear runtime complexity and use only constant extra space.
**Example 1:**
**Input:** nums = \[2,2,1\]
**Output:** 1
**Example 2:**
**Input:** nums = \[4,1,2,1,2... | null | Array,Bit Manipulation | Easy | 137,260,268,287,389 |
785 | hey everybody this is Larry this is day 19. I need a family to wait to take out what date it is but on day 19 of the liko Teri challenge hit the like button hit the Subscribe button drama and Discord let me know what you think about this problem uh so yeah so today's problem is 785 it's graph bipolar so this is a very ... | Is Graph Bipartite? | basic-calculator-iii | There is an **undirected** graph with `n` nodes, where each node is numbered between `0` and `n - 1`. You are given a 2D array `graph`, where `graph[u]` is an array of nodes that node `u` is adjacent to. More formally, for each `v` in `graph[u]`, there is an undirected edge between node `u` and node `v`. The graph has ... | null | Math,String,Stack,Recursion | Hard | 224,227,781,1736 |
92 | okay reverse linked list two oh it was a long time ago that I did the reverse link list so I don't even remember okay given the head two integers left and right mm-hmm okay we only want to reverse the notes from left to right okay instead of the whole list Precision Lift position right okay in this position is one inde... | 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 |
334 | hey what's up guys this is john here so today uh let's take a look at today's challenge problem which is number 334 uh increasing triple h subsequency subsequence so you're given like an integer of a raised integer raise and you just need to return true if there exists a trip a triple indices i j and k such that there'... | Increasing Triplet Subsequence | increasing-triplet-subsequence | Given an integer array `nums`, return `true` _if there exists a triple of indices_ `(i, j, k)` _such that_ `i < j < k` _and_ `nums[i] < nums[j] < nums[k]`. If no such indices exists, return `false`.
**Example 1:**
**Input:** nums = \[1,2,3,4,5\]
**Output:** true
**Explanation:** Any triplet where i < j < k is valid.
... | null | Array,Greedy | Medium | 300,2122,2280 |
836 | Hello friends in this section we are going to discuss about one of the simplest problem Rectangle Overlap Problem Statement Given to Rectangle All visit to identify the both rectangles and life is not just a through effective return forms its government will understand our problems with Diagrams For Short Hair Second C... | Rectangle Overlap | race-car | An axis-aligned rectangle is represented as a list `[x1, y1, x2, y2]`, where `(x1, y1)` is the coordinate of its bottom-left corner, and `(x2, y2)` is the coordinate of its top-right corner. Its top and bottom edges are parallel to the X-axis, and its left and right edges are parallel to the Y-axis.
Two rectangles ove... | null | Dynamic Programming | Hard | null |
153 | welcome to this blind series of the 75 lead code question um today we are going to look at the another problem in the series which is the find minimum in the rotated sorted array okay so let's understand this problem um so it says that suppose an array of length end sorted in ascending order is rotated between the one ... | Find Minimum in Rotated Sorted Array | find-minimum-in-rotated-sorted-array | Suppose an array of length `n` sorted in ascending order is **rotated** between `1` and `n` times. For example, the array `nums = [0,1,2,4,5,6,7]` might become:
* `[4,5,6,7,0,1,2]` if it was rotated `4` times.
* `[0,1,2,4,5,6,7]` if it was rotated `7` times.
Notice that **rotating** an array `[a[0], a[1], a[2], .... | Array was originally in ascending order. Now that the array is rotated, there would be a point in the array where there is a small deflection from the increasing sequence. eg. The array would be something like [4, 5, 6, 7, 0, 1, 2]. You can divide the search space into two and see which direction to go.
Can you think ... | Array,Binary Search | Medium | 33,154 |
2 | hello and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem number two add two numbers if you haven't already seen my video about how to do the problem add strings i'd highly recommend that you go watch that video because the algorithm that we're going to use is going t... | Add Two Numbers | add-two-numbers | You are given two **non-empty** linked lists representing two non-negative integers. The digits are stored in **reverse order**, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 ... | null | Linked List,Math,Recursion | Medium | 43,67,371,415,445,1031,1774 |
395 | hey everybody this is that today I'm gonna go over the coke problem 395 finding the longest substring with at least K repeating characters so the instructions are as follows find the length of the longest substring T of a given string that consists of lowercase letters only such that every character in T appears no les... | Longest Substring with At Least K Repeating Characters | longest-substring-with-at-least-k-repeating-characters | Given a string `s` and an integer `k`, return _the length of the longest substring of_ `s` _such that the frequency of each character in this substring is greater than or equal to_ `k`.
**Example 1:**
**Input:** s = "aaabb ", k = 3
**Output:** 3
**Explanation:** The longest substring is "aaa ", as 'a' is repeated 3... | null | Hash Table,String,Divide and Conquer,Sliding Window | Medium | 2140,2209 |
446 | hey everybody this is slavy this is day seven of the lead code daily challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about today's form uh 446 arithmetic slice 2 subsequence okay let's see uh given an integer array nums we done the number of all arithmetic subsequenc... | Arithmetic Slices II - Subsequence | arithmetic-slices-ii-subsequence | Given an integer array `nums`, return _the number of all the **arithmetic subsequences** of_ `nums`.
A sequence of numbers is called arithmetic if it consists of **at least three elements** and if the difference between any two consecutive elements is the same.
* For example, `[1, 3, 5, 7, 9]`, `[7, 7, 7, 7]`, and ... | null | Array,Dynamic Programming | Hard | 413 |
763 | That will be the side related to this, so today we are going to list the default question of WhatsApp number change which are Partition Labels, Lead is available at medium level, look in the question section, once the question comes, a string gas of. Lower case English letters in the partition string into it's possible... | Partition Labels | special-binary-string | You are given a string `s`. We want to partition the string into as many parts as possible so that each letter appears in at most one part.
Note that the partition is done so that after concatenating all the parts in order, the resultant string should be `s`.
Return _a list of integers representing the size of these ... | Draw a line from (x, y) to (x+1, y+1) if we see a "1", else to (x+1, y-1).
A special substring is just a line that starts and ends at the same y-coordinate, and that is the lowest y-coordinate reached.
Call a mountain a special substring with no special prefixes - ie. only at the beginning and end is the lowest y-coo... | String,Recursion | Hard | 678 |
1,009 | Hello Hi Everyone Welcome To My Channel It's All The Problem Compliment Office Sign In Tears To Every Native Indian Have A Representation For Example Which Can Be Represented S 101 Schezwan Daddy Thanks For Thee Inco 2008 Leading Us To Implement A Representation In Changing 12021 For Example 10 Best complement was the ... | Complement of Base 10 Integer | pancake-sorting | The **complement** of an integer is the integer you get when you flip all the `0`'s to `1`'s and all the `1`'s to `0`'s in its binary representation.
* For example, The integer `5` is `"101 "` in binary and its **complement** is `"010 "` which is the integer `2`.
Given an integer `n`, return _its complement_.
**Ex... | null | Array,Two Pointers,Greedy,Sorting | Medium | null |
1,057 | hello friends today death of the Kemper spikes profit our campers represented as a 2d grid there are an Oracle and M bikes with an less oyakodon M it worker and bite is a 2d coordinate on this great our goal is to assign a bike to each other among the available bikes and the workers we choose the worker bike pair with ... | Campus Bikes | numbers-with-repeated-digits | On a campus represented on the X-Y plane, there are `n` workers and `m` bikes, with `n <= m`.
You are given an array `workers` of length `n` where `workers[i] = [xi, yi]` is the position of the `ith` worker. You are also given an array `bikes` of length `m` where `bikes[j] = [xj, yj]` is the position of the `jth` bike... | How many numbers with no duplicate digits? How many numbers with K digits and no duplicates? How many numbers with same length as N? How many numbers with same prefix as N? | Math,Dynamic Programming | Hard | null |
322 | Hai Bhai Kalyan Loot Se Hai Shri Ram Dr. Ashok Safari must be very good, gas is the question after all and defeated by this same Superintending Engineer Anil Panwar Tuesday gay question, I am going to submit the points part now, very good question If you have not seen Khairgarh before, is there any problem, it must be ... | 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,201 | hello let's do this question which i did a couple of days ago it was um a math question um plus and you'll see it's binary searches as well but let's read the question so an ugly number is a positive integer that is divisible by a b or c right so any of these numbers and it would be an ugly number given four integers n... | Ugly Number III | delete-tree-nodes | An **ugly number** is a positive integer that is divisible by `a`, `b`, or `c`.
Given four integers `n`, `a`, `b`, and `c`, return the `nth` **ugly number**.
**Example 1:**
**Input:** n = 3, a = 2, b = 3, c = 5
**Output:** 4
**Explanation:** The ugly numbers are 2, 3, 4, 5, 6, 8, 9, 10... The 3rd is 4.
**Example 2:... | Traverse the tree using depth first search. Find for every node the sum of values of its sub-tree. Traverse the tree again from the root and return once you reach a node with zero sum of values in its sub-tree. | Tree,Depth-First Search,Breadth-First Search | Medium | null |
1,734 | uh hey everybody this is larry this is me going with q3 of the leeco biweekly contest 44 decode xor permutations hit the like button hit the subscribe button join me on discord uh for me this was a very hard problem uh i think like almost a thousand people solved it to be honest i did not solve this during the contest ... | Decode XORed Permutation | bank-account-summary-ii | There is an integer array `perm` that is a permutation of the first `n` positive integers, where `n` is always **odd**.
It was encoded into another integer array `encoded` of length `n - 1`, such that `encoded[i] = perm[i] XOR perm[i + 1]`. For example, if `perm = [1,3,2]`, then `encoded = [2,1]`.
Given the `encoded`... | null | Database | Easy | null |
1,365 | gonna be solving this interview question from Lee code so basically what is this saying given the array numbers for each num sub I find out how many numbers in the array are smaller than it that is for each number of I you have to count the number of valid J's such that J is not equal to I and num sub J is less than nu... | How Many Numbers Are Smaller Than the Current Number | how-many-numbers-are-smaller-than-the-current-number | Given the array `nums`, for each `nums[i]` find out how many numbers in the array are smaller than it. That is, for each `nums[i]` you have to count the number of valid `j's` such that `j != i` **and** `nums[j] < nums[i]`.
Return the answer in an array.
**Example 1:**
**Input:** nums = \[8,1,2,2,3\]
**Output:** \[4,... | null | null | Easy | null |
48 | you all must have used image editors on your laptops and mobiles and there is a very high chance that you have rotated these images as well right but have you ever wondered what happens behind the scenes there is a problem called rotate image on lead code that actually explores the concept behind it if you want a quick... | Rotate Image | rotate-image | You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise).
You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati... | null | Array,Math,Matrix | Medium | 2015 |
1,668 | Hello hi OPD weather 1650 Singh Kushwaha rippling sub Singh so this bike is up to Lee hotspot and this question is a so request demand is hua hai ye humko friend Singh diya to sequence and this word so now this is our friends hui like the first spring here. That is BBC and the second is Leo. So first of all, I want to ... | Maximum Repeating Substring | find-longest-awesome-substring | For a string `sequence`, a string `word` is **`k`\-repeating** if `word` concatenated `k` times is a substring of `sequence`. The `word`'s **maximum `k`\-repeating value** is the highest value `k` where `word` is `k`\-repeating in `sequence`. If `word` is not a substring of `sequence`, `word`'s maximum `k`\-repeating v... | Given the character counts, under what conditions can a palindrome be formed ? From left to right, use bitwise xor-operation to compute for any prefix the number of times modulo 2 of each digit. (mask ^= (1<<(s[i]-'0')). Expected complexity is O(n*A) where A is the alphabet (10). | Hash Table,String,Bit Manipulation | Hard | null |
198 | we are given an array of integers representing the amount of money present in the house and we need to rob the maximum amount of money from these houses such that we do not rob from two adjacent houses let's look at some examples if there is only one house then we can drop whatever amount of money is present in that ho... | House Robber | house-robber | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and **it will automatically contact the police if two adjacent houses were broken into... | null | Array,Dynamic Programming | Medium | 152,213,256,276,337,600,656,740,2262 |
587 | hey what's up guys uh this is john here again so uh today's daily challenge problem number 587 erect defense so this one is like uh it's very interesting geometry problem you know um so let's see so we are given like an array of trees right and we have some uh coordinator right and then you're asked to fence the entire... | Erect the Fence | erect-the-fence | You are given an array `trees` where `trees[i] = [xi, yi]` represents the location of a tree in the garden.
Fence the entire garden using the minimum length of rope, as it is expensive. The garden is well-fenced only if **all the trees are enclosed**.
Return _the coordinates of trees that are exactly located on the f... | null | Array,Math,Geometry | Hard | 2074 |
1,675 | hi everyone welcome to my channel let's solve the problem minimize deviation in array so you are given an array of nums of any positive integers you can perform two types of operation on any element of the array any number of times so the first operation is if the number is even then we can divide it by two so for exam... | Minimize Deviation in Array | magnetic-force-between-two-balls | You are given an array `nums` of `n` positive integers.
You can perform two types of operations on any element of the array any number of times:
* If the element is **even**, **divide** it by `2`.
* For example, if the array is `[1,2,3,4]`, then you can do this operation on the last element, and the array wil... | If you can place balls such that the answer is x then you can do it for y where y < x. Similarly if you cannot place balls such that the answer is x then you can do it for y where y > x. Binary search on the answer and greedily see if it is possible. | Array,Binary Search,Sorting | Medium | 2188 |
1,520 | hey what's up guys john here again so today let's take a look at this uh let's call it problem here uh number 1520 maximum number of non overlapping substrings so this is one of uh this week's uh weekly contest problem it's a medium problem but i'm gonna give it my own upvote yeah i kind of like it so let's take a look... | Maximum Number of Non-Overlapping Substrings | number-of-steps-to-reduce-a-number-in-binary-representation-to-one | Given a string `s` of lowercase letters, you need to find the maximum number of **non-empty** substrings of `s` that meet the following conditions:
1. The substrings do not overlap, that is for any two substrings `s[i..j]` and `s[x..y]`, either `j < x` or `i > y` is true.
2. A substring that contains a certain chara... | Read the string from right to left, if the string ends in '0' then the number is even otherwise it is odd. Simulate the steps described in the binary string. | String,Bit Manipulation | Medium | 1303 |
818 | Hello friends I am a cloud Solutions architect at Microsoft and my aim is to empower every single person to be better at technical interviews keeping with that goal in mind today we are going to solve a very interesting lead code problem uh called race car and if we see this has been one of the most popular problem at ... | Race Car | similar-rgb-color | Your car starts at position `0` and speed `+1` on an infinite number line. Your car can go into negative positions. Your car drives automatically according to a sequence of instructions `'A'` (accelerate) and `'R'` (reverse):
* When you get an instruction `'A'`, your car does the following:
* `position += spee... | null | Math,String,Enumeration | Easy | null |
878 | That dubai hello morning this question ko death magical number solar description and this problem s this article e given and description fit 100 ko basically but one's you have in number which is the first 68 like number ok thank you two years and now e don't Want magical number that world cup winner multiple officer o... | Nth Magical Number | shifting-letters | A positive integer is _magical_ if it is divisible by either `a` or `b`.
Given the three integers `n`, `a`, and `b`, return the `nth` magical number. Since the answer may be very large, **return it modulo** `109 + 7`.
**Example 1:**
**Input:** n = 1, a = 2, b = 3
**Output:** 2
**Example 2:**
**Input:** n = 4, a = ... | null | Array,String | Medium | 1954 |
1,614 | okay let's do leak code uh one six one four maximum nesting depth of parenthesis in JavaScript this is a stack problem um I don't like these instructions at all what they're asking you to do is count the number uh the basically the number of Stacks that are in a sorry parentheses that are in a row that's really what th... | 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 |
378 | hello everyone so in this video we are going to solve a question complete code that is key the smallest element in a solid matrix so let's start with the problem statement given an n into n metrics where each of the row and column is sorted in ascending order return the kth smallest element in the matrix note that it i... | Kth Smallest Element in a Sorted Matrix | kth-smallest-element-in-a-sorted-matrix | Given an `n x n` `matrix` where each of the rows and columns is sorted in ascending order, return _the_ `kth` _smallest element in the matrix_.
Note that it is the `kth` smallest element **in the sorted order**, not the `kth` **distinct** element.
You must find a solution with a memory complexity better than `O(n2)`.... | null | Array,Binary Search,Sorting,Heap (Priority Queue),Matrix | Medium | 373,668,719,802 |
1,887 | hi everyone let's solve the today's lead code challenge which is reduction operation to make the array elements equal so here in this problem we are given an integer array nums and our goal is to make all the elements of nums array equal by performing these operation repeatedly in the first step what we have to do is w... | Reduction Operations to Make the Array Elements Equal | minimum-degree-of-a-connected-trio-in-a-graph | Given an integer array `nums`, your goal is to make all elements in `nums` equal. To complete one operation, follow these steps:
1. Find the **largest** value in `nums`. Let its index be `i` (**0-indexed**) and its value be `largest`. If there are multiple elements with the largest value, pick the smallest `i`.
2. F... | Consider a trio with nodes u, v, and w. The degree of the trio is just degree(u) + degree(v) + degree(w) - 6. The -6 comes from subtracting the edges u-v, u-w, and v-w, which are counted twice each in the vertex degree calculation. To get the trios (u,v,w), you can iterate on u, then iterate on each w,v such that w and... | Graph | Hard | null |
258 | um hello so today we are going to do this problem which is part of lead code daily challenge add digits so basically this problem says we get a number and we want to repeatedly add all the digits until we have only one digit um and then we return that one so for example here 38 we add the digits so 3 plus 8 that gives ... | Add Digits | add-digits | Given an integer `num`, repeatedly add all its digits until the result has only one digit, and return it.
**Example 1:**
**Input:** num = 38
**Output:** 2
**Explanation:** The process is
38 --> 3 + 8 --> 11
11 --> 1 + 1 --> 2
Since 2 has only one digit, return it.
**Example 2:**
**Input:** num = 0
**Output:** 0
*... | A naive implementation of the above process is trivial. Could you come up with other methods? What are all the possible results? How do they occur, periodically or randomly? You may find this Wikipedia article useful. | Math,Simulation,Number Theory | Easy | 202,1082,2076,2264 |
1,207 | hi everyone this is Steve Fisher here welcome to another episode of little tutorials today we are going through Lidcombe problem 12:07 unique number of Lidcombe problem 12:07 unique number of Lidcombe problem 12:07 unique number of occurrences okay before we dive deep into the problem just do me a favor and smash that ... | Unique Number of Occurrences | delete-nodes-and-return-forest | Given an array of integers `arr`, return `true` _if the number of occurrences of each value in the array is **unique** or_ `false` _otherwise_.
**Example 1:**
**Input:** arr = \[1,2,2,1,1,3\]
**Output:** true
**Explanation:** The value 1 has 3 occurrences, 2 has 2 and 3 has 1. No two values have the same number of oc... | null | Tree,Depth-First Search,Binary Tree | Medium | 2175 |
202 | welcome everyone we're going to solve Lee code problem 202 happy number where we're asked to determine if a number is happy and a happy number is a number whose sum of squares eventually equals the number one and it's not a happy number if it just Loops endlessly so read through the description we can kind of figure ou... | 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 |
34 | we would like to find the first and last position of some element in sorted array so we have a sorted array and a target that we'd like to locate if you look at example one we have target eight so that means that the first and last time that eight appears is at index three and index four so the way we're going to solve... | Find First and Last Position of Element in Sorted Array | find-first-and-last-position-of-element-in-sorted-array | Given an array of integers `nums` sorted in non-decreasing order, find the starting and ending position of a given `target` value.
If `target` is not found in the array, return `[-1, -1]`.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[5,7,7,8,8,10\], target = 8
*... | null | Array,Binary Search | Medium | 278,2165,2210 |
44 | hello and welcome to another leak code solution video this is problem number 44 Wild Card matching for this problem we're given an input string s and a pattern P Implement Wild Card pattern matching with support for question marks and stars where question mark matches any single character and stars match any sequence o... | Wildcard Matching | wildcard-matching | Given an input string (`s`) and a pattern (`p`), implement wildcard pattern matching with support for `'?'` and `'*'` where:
* `'?'` Matches any single character.
* `'*'` Matches any sequence of characters (including the empty sequence).
The matching should cover the **entire** input string (not partial).
**Exam... | null | String,Dynamic Programming,Greedy,Recursion | Hard | 10 |
128 | hey what's up guys Nick white here I do technically stuff on Twitch in YouTube check the description for all my information you can go I got Instagram disc or Twitter I'm doing two extra lis code videos on patreon now for two bucks you get all the access to that and the study guide I made and or if you can do or if you... | Longest Consecutive Sequence | longest-consecutive-sequence | Given an unsorted array of integers `nums`, return _the length of the longest consecutive elements sequence._
You must write an algorithm that runs in `O(n)` time.
**Example 1:**
**Input:** nums = \[100,4,200,1,3,2\]
**Output:** 4
**Explanation:** The longest consecutive elements sequence is `[1, 2, 3, 4]`. Therefor... | null | Array,Hash Table,Union Find | Medium | 298,2278 |
463 | Hello Hi Friends Welcome Back To Take Care Solve List To Problem So 6 3 Ireland Perimeter This Problem As Previous Last By Airplane Facebook Indore Interview Time's Understand Problems And Able To Solve This Problem So I Let's Go Enhanced Description Previous Your Governor Stop * Column Great Representing Map Where Sto... | 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 |
1,353 | Tum Hi Ho Kar Do Hello Friends Welcome to Good Night Today Going to Solve Problem No. 103 The Maximum Number of Presence Can Be Attended by Raghu Dixit Hari Typical Problem Lekin Thi Aaj Main Interviews And Midwaying This Point From Looking So Let's C problem given here were amazed lotta do subscribe the victims to val... | Maximum Number of Events That Can Be Attended | maximum-number-of-events-that-can-be-attended | You are given an array of `events` where `events[i] = [startDayi, endDayi]`. Every event `i` starts at `startDayi` and ends at `endDayi`.
You can attend an event `i` at any day `d` where `startTimei <= d <= endTimei`. You can only attend one event at any time `d`.
Return _the maximum number of events you can attend_.... | null | null | Medium | null |
974 | Open it or there will be some indivisible bike in the morning. Okay, what you have to do in this is to create an account at this time, subscribe to subscribe, like and subscribe, take more, if you want to see it, then posted here from here Subscribe to: The village Subscribe to: The village Subscribe to: The village is... | Subarray Sums Divisible by K | reorder-data-in-log-files | Given an integer array `nums` and an integer `k`, return _the number of non-empty **subarrays** that have a sum divisible by_ `k`.
A **subarray** is a **contiguous** part of an array.
**Example 1:**
**Input:** nums = \[4,5,0,-2,-3,1\], k = 5
**Output:** 7
**Explanation:** There are 7 subarrays with a sum divisible b... | null | Array,String,Sorting | Easy | null |
380 | hi everyone let's talk about today's lead code daily U challenge today uh it's about a randomized set so it's combining a set uh and it's adding a new operation uh which is get random so insert and remove are standard operations of a set but get random is not very a standard you know and so we have a new class new data... | Insert Delete GetRandom O(1) | insert-delete-getrandom-o1 | Implement the `RandomizedSet` class:
* `RandomizedSet()` Initializes the `RandomizedSet` object.
* `bool insert(int val)` Inserts an item `val` into the set if not present. Returns `true` if the item was not present, `false` otherwise.
* `bool remove(int val)` Removes an item `val` from the set if present. Retur... | null | Array,Hash Table,Math,Design,Randomized | Medium | 381 |
406 | foreign by height you are given an array of people which are the attributes of some people in a queue not necessarily in order they have not given order each people of I contains h i and k i this represents the ith person of the height h i with exactly k i other people in front who have a height greater than or equal t... | Queue Reconstruction by Height | queue-reconstruction-by-height | You are given an array of people, `people`, which are the attributes of some people in a queue (not necessarily in order). Each `people[i] = [hi, ki]` represents the `ith` person of height `hi` with **exactly** `ki` other people in front who have a height greater than or equal to `hi`.
Reconstruct and return _the queu... | What can you say about the position of the shortest person?
If the position of the shortest person is i, how many people would be in front of the shortest person? Once you fix the position of the shortest person, what can you say about the position of the second shortest person? | Array,Greedy,Binary Indexed Tree,Segment Tree,Sorting | Medium | 315 |
1,928 | for this question minimum cost to reach destination in time we are given a graph looking something like this for example these blue numbers represent the fees so if you start at node 0 and you want to get to node 5 we want to know what the main cost is to get from node 0 to android 5. and whenever we pass through a cit... | Minimum Cost to Reach Destination in Time | number-of-orders-in-the-backlog | There is a country of `n` cities numbered from `0` to `n - 1` where **all the cities are connected** by bi-directional roads. The roads are represented as a 2D integer array `edges` where `edges[i] = [xi, yi, timei]` denotes a road between cities `xi` and `yi` that takes `timei` minutes to travel. There may be multiple... | Store the backlog buy and sell orders in two heaps, the buy orders in a max heap by price and the sell orders in a min heap by price. Store the orders in batches and update the fields according to new incoming orders. Each batch should only take 1 "slot" in the heap. | Array,Heap (Priority Queue),Simulation | Medium | null |
1,626 | in this video I will discuss about liquid problem number one six two six best team with no conflicts in this program you are given a score array and you are also given an age array so what you have to find you have to form the best team with the highest possible score but there is one more condition that is a player wh... | Best Team With No Conflicts | can-make-arithmetic-progression-from-sequence | You are the manager of a basketball team. For the upcoming tournament, you want to choose the team with the highest overall score. The score of the team is the **sum** of scores of all the players in the team.
However, the basketball team is not allowed to have **conflicts**. A **conflict** exists if a younger player ... | Consider that any valid arithmetic progression will be in sorted order. Sort the array, then check if the differences of all consecutive elements are equal. | Array,Sorting | Easy | 1752 |
144 | hey guys how are you today this is the problem from lead code binary tree preorder traversal given a binary tree return the preorder traversal of its nodes values output is 1 2 3 given 1 2 3 follow-up is recursive 1 2 3 given 1 2 3 follow-up is recursive 1 2 3 given 1 2 3 follow-up is recursive solution is trivial coul... | Binary Tree Preorder Traversal | binary-tree-preorder-traversal | Given the `root` of a binary tree, return _the preorder traversal of its nodes' values_.
**Example 1:**
**Input:** root = \[1,null,2,3\]
**Output:** \[1,2,3\]
**Example 2:**
**Input:** root = \[\]
**Output:** \[\]
**Example 3:**
**Input:** root = \[1\]
**Output:** \[1\]
**Constraints:**
* The number of nodes ... | null | Stack,Tree,Depth-First Search,Binary Tree | Easy | 94,255,775 |
7 | If guys welcome to bank account letter tender list problem solving were recent s problem number st vicente teacher isko hindi problem giver sign 32bit in teacher Equal 1234 Uthwane Ke Swarna Bhujan Attendant Love You To Store 600 Cases OK End Examples Minus One Two Three Little Pigs Importance Notice - Victims Key - Pi... | 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 |
1,930 | hey everybody this is larry this is me going with q2 of the weekly contest 249 unique length 3 panodramic subsequences so basically i use greedy in this one um what does it mean to be a palindrome and what does it specifically to mean a length three palindrome right uh and this is for subsequence so for this one hit th... | Unique Length-3 Palindromic Subsequences | maximum-number-of-consecutive-values-you-can-make | Given a string `s`, return _the number of **unique palindromes of length three** that are a **subsequence** of_ `s`.
Note that even if there are multiple ways to obtain the same subsequence, it is still only counted **once**.
A **palindrome** is a string that reads the same forwards and backwards.
A **subsequence** ... | If you can make the first x values and you have a value v, then you can make all the values ≤ v + x Sort the array of coins. You can always make the value 0 so you can start with x = 0. Process the values starting from the smallest and stop when there is a value that cannot be achieved with the current x. | Array,Greedy | Medium | 330 |
1,203 | hey today I'm looking at question 12 on three sort items by groups respecting dependencies just reading the title we can see there are three key elements in this problem the items the groups that items belongs to and also the dependencies either along items or among groups we will see that later so instead of actually ... | Sort Items by Groups Respecting Dependencies | print-in-order | There are `n` items each belonging to zero or one of `m` groups where `group[i]` is the group that the `i`\-th item belongs to and it's equal to `-1` if the `i`\-th item belongs to no group. The items and the groups are zero indexed. A group can have no item belonging to it.
Return a sorted list of the items such that... | null | Concurrency | Easy | 1187 |
338 | hello everyone welcome or welcome back to my channel so today we are going to discuss another problem so problem is counting bits a very interesting problem uh we are given an integer n and we need to return an array of length n plus 1 such that for each i means from 0 till n all the numbers are i so we have to return ... | 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 |
199 | hello guys welcome to algorithms made easy today we will be discussing the question binary tree right side view in this question we are given a binary tree and we need to imagine ourselves standing on the right side of it and we need to return the value of the nodes that you see ordered from top to bottom so in the fir... | Binary Tree Right Side View | binary-tree-right-side-view | Given the `root` of a binary tree, imagine yourself standing on the **right side** of it, return _the values of the nodes you can see ordered from top to bottom_.
**Example 1:**
**Input:** root = \[1,2,3,null,5,null,4\]
**Output:** \[1,3,4\]
**Example 2:**
**Input:** root = \[1,null,3\]
**Output:** \[1,3\]
**Examp... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 116,545 |
62 | Hello hello everyone welcome back to my channel today will discuss problem complete to tunic pass inside problem number is equal to the problem statement saying everyone read that twenty-20 crossing read where is the that twenty-20 crossing read where is the that twenty-20 crossing read where is the chemical in is the ... | Unique Paths | unique-paths | There is a robot on an `m x n` grid. The robot is 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.
Given the two integers `m` and `n`, return _the nu... | null | Math,Dynamic Programming,Combinatorics | Medium | 63,64,174,2192 |
72 | hey what's up guys this is Jung here again today continue with our lead code series and today we're gonna talk about this very classic string stream problem number 72 added distance this is like a heart I would say it's a classic a typical heart problem yeah it's perfect to be marked this one as a heart because it'll b... | Edit Distance | edit-distance | Given two strings `word1` and `word2`, return _the minimum number of operations required to convert `word1` to `word2`_.
You have the following three operations permitted on a word:
* Insert a character
* Delete a character
* Replace a character
**Example 1:**
**Input:** word1 = "horse ", word2 = "ros "
**O... | null | String,Dynamic Programming | Hard | 161,583,712,1105,2311 |
301 | cool we move in whether parents who anticipated limousines in order to make their input string rotted we turn or possible result well that's a tricky one yeah well good luck Alex definitely these things are always tops I don't know cool okay I mean this is I think in gel I'm sorry I gotta think about how I'm gonna soun... | 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 |
1,603 | welcome to Pomodoro Joe for Monday May 29th 2023. today we're doing the good problem 1603 design parking system this is an easy problem design a parking system for a parking lot the parking lot has three kinds of parking spaces big medium and small with a fixed number of slots for each size implement the parking system... | Design Parking System | running-sum-of-1d-array | Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size.
Implement the `ParkingSystem` class:
* `ParkingSystem(int big, int medium, int small)` Initializes object of the `ParkingSystem` class. The number of slot... | Think about how we can calculate the i-th number in the running sum from the (i-1)-th number. | Array,Prefix Sum | Easy | null |
1,202 | That we * * * solid most language problem we * * * solid most language problem we * * * solid most language problem so in this program will give strength which consists of a series of years they take off but avoid collector's character add ok thank you any number of times what is gold channel ko subscribe And subscribe... | Smallest String With Swaps | palindrome-removal | You are given a string `s`, and an array of pairs of indices in the string `pairs` where `pairs[i] = [a, b]` indicates 2 indices(0-indexed) of the string.
You can swap the characters at any pair of indices in the given `pairs` **any number of times**.
Return the lexicographically smallest string that `s` can be chang... | Use dynamic programming. Let dp[i][j] be the solution for the sub-array from index i to index j. Notice that if we have S[i] == S[j] one transition could be just dp(i + 1, j + 1) because in the last turn we would have a palindrome and we can extend this palindrome from both sides, the other transitions are not too diff... | Array,Dynamic Programming | Hard | null |
450 | Hello ji, how are you? We have reached week 3. Let us first move towards our solution and then we will talk about the rest. Okay, yes, let's start with our question number 42. The question is 'Delete node in BST' question. Given root node BST' question. Given root node BST' question. Given root node reference of a bst ... | Delete Node in a BST | delete-node-in-a-bst | Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return _the **root node reference** (possibly updated) of the BST_.
Basically, the deletion can be divided into two stages:
1. Search for a node to remove.
2. If the node is found, delete the node.
**Example 1:**
**Inpu... | null | Tree,Binary Search Tree,Binary Tree | Medium | 791 |
304 | today we're gonna be working on late quote question number 304 uh range some query 2d immutable uh we did do a similar question where we would we had an array and we did uh implement these two functions but this time it's a 2d array and so given 2d matrix handle multiple queries of the following type calculate the sum ... | Range Sum Query 2D - Immutable | range-sum-query-2d-immutable | Given a 2D matrix `matrix`, handle multiple queries of the following type:
* Calculate the **sum** of the elements of `matrix` inside the rectangle defined by its **upper left corner** `(row1, col1)` and **lower right corner** `(row2, col2)`.
Implement the `NumMatrix` class:
* `NumMatrix(int[][] matrix)` Initial... | null | Array,Design,Matrix,Prefix Sum | Medium | 303,308 |
35 | Loot Hello Everyone Swam This Video Were Going To Discuss Search Set Position Problem Solve The Problems And How To Solve This App Mein Ek Surya Hind This Problem Were Given As Water During Winters Dravid Thursday Subscribed Did Not Want In Dowry Middle Problem Thursday Ko subscribe and subscribe the Channel Please sub... | Search Insert Position | search-insert-position | Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[1,3,5,6\], target = 5
**Output:** 2
**Exa... | null | Array,Binary Search | Easy | 278 |
221 | hello so today we are doing this problem called maximal square and the problem is says that we get a 2d binary matrix filled with zeros and ones and we want to find the largest square that contains only ones and we enter it in its area so for example with this matrix here we have the largest square Norris Square so the... | Maximal Square | maximal-square | Given an `m x n` binary `matrix` filled with `0`'s and `1`'s, _find the largest square containing only_ `1`'s _and return its area_.
**Example 1:**
**Input:** matrix = \[\[ "1 ", "0 ", "1 ", "0 ", "0 "\],\[ "1 ", "0 ", "1 ", "1 ", "1 "\],\[ "1 ", "1 ", "1 ", "1 ", "1 "\],\[ "1 ", "0 ", "0 ", "1 ", "0 "\]\]
**Output:*... | null | Array,Dynamic Programming,Matrix | Medium | 85,769,1312,2200 |
86 | today well does this problem called partition list and the problem says we get a linkedlist in the bubble X and when a partition is said that all nodes less than X come before note C greater than or equal to X and we should preserve the original relative order of the notes in each of the two partitions which means basi... | 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 |
1,233 | all right so hello and welcome here we are another question try to get it going here um take a moment to make sure the audio is working is my audio okay I think so yeah I think the mic is it's got a lot of gain on it hello take a moment make sure y good all right um this is going to be actually yeah excuse me oh it's d... | Remove Sub-Folders from the Filesystem | number-of-ships-in-a-rectangle | Given a list of folders `folder`, return _the folders after removing all **sub-folders** in those folders_. You may return the answer in **any order**.
If a `folder[i]` is located within another `folder[j]`, it is called a **sub-folder** of it.
The format of a path is one or more concatenated strings of the form: `'/... | Use divide and conquer technique. Divide the query rectangle into 4 rectangles. Use recursion to continue with the rectangles that has ships only. | Array,Divide and Conquer,Interactive | Hard | null |
523 | hey everybody this is Larry this is Day 26 of the leeco daily challenge hit the like button and the Subscribe button uh join me on Discord let me know what you think about today's problem uh let's see no bonus points and also to my uh on my uh to all my people out there who uh celebrate uh Happy Diwali uh hopefully I d... | 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 |
838 | Hello everyone welcome back to channels so today we are going to discuss the next problem there is a problem in liquid sewing challenge there are some dominoes so this is a very sticky problem so it is on track ok so one but let's read that blot statement and dominoes Channel line and half inch dominoes politically air... | Push Dominoes | design-linked-list | There are `n` dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to the left or to the right.
After each second, each domino that is falling to the left pushes the adjacent domino on the left. Similarly, the dominoes falling to the righ... | null | Linked List,Design | Medium | 1337 |
282 | hello everyone I hope you are doing well so in this video we're going to discuss Geeks for geeks problem of the day and today's problem is expression card operators and it is a hard level problem so if by the end of this video you find that this video was helpful for you or if you were able to derive any value from thi... | Expression Add Operators | expression-add-operators | Given a string `num` that contains only digits and an integer `target`, return _**all possibilities** to insert the binary operators_ `'+'`_,_ `'-'`_, and/or_ `'*'` _between the digits of_ `num` _so that the resultant expression evaluates to the_ `target` _value_.
Note that operands in the returned expressions **shoul... | Note that a number can contain multiple digits. Since the question asks us to find all of the valid expressions, we need a way to iterate over all of them. (Hint: Recursion!) We can keep track of the expression string and evaluate it at the very end. But that would take a lot of time. Can we keep track of the expressio... | Math,String,Backtracking | Hard | 150,224,227,241,494 |
149 | hey what's up guys this is john here so today uh let's take a look at this 149 uh max points on the line uh this one got a lot of downloads i don't know why maybe it's because the edge cases maybe okay so given like endpoints on a 2d plane find the maximum number of points that lie on the same straight line okay so for... | 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 |
830 | yeah hi hello everyone I'm a programmer today I will introduce to you a math problem with the following words: the you a math problem with the following words: the you a math problem with the following words: the positions of large groups of detailed problems in a string s of characters Usually these characters will fo... | Positions of Large Groups | largest-triangle-area | In a string `s` of lowercase letters, these letters form consecutive groups of the same character.
For example, a string like `s = "abbxxxxzyy "` has the groups `"a "`, `"bb "`, `"xxxx "`, `"z "`, and `"yy "`.
A group is identified by an interval `[start, end]`, where `start` and `end` denote the start and end indice... | null | Array,Math,Geometry | Easy | 1018 |
332 | everyone welcome back and let's write some more neat code today so today let's solve the problem reconstruct itinerary this is a pretty difficult problem but it's doable if you have a good understanding of graphs and graph traversals especially dfs which we're going to be using in this problem but we're given a list of... | Reconstruct Itinerary | reconstruct-itinerary | You are given a list of airline `tickets` where `tickets[i] = [fromi, toi]` represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it.
All of the tickets belong to a man who departs from `"JFK "`, thus, the itinerary must begin with `"JFK "`. If there are multiple... | null | Depth-First Search,Graph,Eulerian Circuit | Hard | 2051,2201 |
926 | Hello friends today I'm going to solve with code problem number 926 flip string to monotones increasing so what's a monotone increasing string well in a binary string a monotone increasing string consists of zeros followed by ones so it could only have zeros or it could only have ones if it has both of them then zeros ... | Flip String to Monotone Increasing | find-and-replace-pattern | A binary string is monotone increasing if it consists of some number of `0`'s (possibly none), followed by some number of `1`'s (also possibly none).
You are given a binary string `s`. You can flip `s[i]` changing it from `0` to `1` or from `1` to `0`.
Return _the minimum number of flips to make_ `s` _monotone increa... | null | Array,Hash Table,String | Medium | null |
475 | hi uh today is uh today's task is hitters um let me quickly read the question and I'll talk s for okay so this the first one we have houses this is the houses positions of houses and heaters so we need to find a radius for the heater so do should be covered for here we have two uh it should be also minimum for here if ... | Heaters | heaters | Winter is coming! During the contest, your first job is to design a standard heater with a fixed warm radius to warm all the houses.
Every house can be warmed, as long as the house is within the heater's warm radius range.
Given the positions of `houses` and `heaters` on a horizontal line, return _the minimum radius ... | null | Array,Two Pointers,Binary Search,Sorting | Medium | null |
532 | Hello Hi Everyone Welcome To My Channel It's All The Problem K Deputy Years In 3D Song Boys Are In Tears And Cheers K Number Of Units K Difficulties In A K Depression Interior True Lies Between 09 - K Pati To Take Lies Between 09 - K Pati To Take Lies Between 09 - K Pati To Take You Will Solve This Problem For Example ... | 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 |
982 | yeah so I just farm 982 trip proposed with bid wise and you go to see her and I kind of had this Ncube solution to her kind of optimize to do it by using C even which is kind of fun but it kind of amusing in a different way but definitely then that's something that uh you know I was happy with were proud of and also I ... | Triples with Bitwise AND Equal To Zero | minimum-increment-to-make-array-unique | Given an integer array nums, return _the number of **AND triples**_.
An **AND triple** is a triple of indices `(i, j, k)` such that:
* `0 <= i < nums.length`
* `0 <= j < nums.length`
* `0 <= k < nums.length`
* `nums[i] & nums[j] & nums[k] == 0`, where `&` represents the bitwise-AND operator.
**Example 1:**
... | null | Array,Greedy,Sorting,Counting | Medium | 2329 |
523 | Hello Everyone, English video question is given in it, we have to return true if continuous morning, what is morning in this, then what will be our morning in this is continuous element of D. When we sum its element of size, then we understand this question of k's multiple of k. To give an example, this is the sum of t... | 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 |
1,456 | good morning welcome back to the next video so firstly before moving on to this problem if you have been watching our videos for the last one month just try this problem if you're not able to solve this just let me know in the comments below you should be able to at least think okay maybe you think okay it's being appl... | Maximum Number of Vowels in a Substring of Given Length | find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance | Given a string `s` and an integer `k`, return _the maximum number of vowel letters in any substring of_ `s` _with length_ `k`.
**Vowel letters** in English are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`.
**Example 1:**
**Input:** s = "abciiidef ", k = 3
**Output:** 3
**Explanation:** The substring "iii " contains 3 vow... | Use Floyd-Warshall's algorithm to compute any-point to any-point distances. (Or can also do Dijkstra from every node due to the weights are non-negative). For each city calculate the number of reachable cities within the threshold, then search for the optimal city. | Dynamic Programming,Graph,Shortest Path | Medium | 2171 |
236 | in this video we are going to talk about lowest common ancestor for binary tree it's a medium problem but it's a kind of an easy problem it's not that difficult we have solved similar kind of problems in the previous video so that problem was Finding lowest common in sister in a binary Source tree here it's a binary tr... | Lowest Common Ancestor of a Binary Tree | lowest-common-ancestor-of-a-binary-tree | Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
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 both `p` and `q` as... | null | Tree,Depth-First Search,Binary Tree | Medium | 235,1190,1354,1780,1790,1816,2217 |
290 | Hi gas welcome and welcome back to my channel so today our problem is word pattern so what have we given in this problem statement here we have been given two strings pattern and string s what we have to do here is to find your The pattern follows here, follow means that there should be a complete match, the pattern of... | 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 |
498 | hello and welcome back to the cracking fang youtube channel today we're going to be solving leak code problem 498 diagonal traverse given an m by n matrix matte return an array of all the elements of the array in a diagonal order so if we see this matrix here we want to traverse starting at the top left we want to go 1... | Diagonal Traverse | diagonal-traverse | Given an `m x n` matrix `mat`, return _an array of all the elements of the array in a diagonal order_.
**Example 1:**
**Input:** mat = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[1,2,4,7,5,3,6,8,9\]
**Example 2:**
**Input:** mat = \[\[1,2\],\[3,4\]\]
**Output:** \[1,2,3,4\]
**Constraints:**
* `m == mat.leng... | null | Array,Matrix,Simulation | Medium | 2197 |
498 | welcome back to algojs today's question is leak code 498 diagonal traverse so given an m by m matrix matte return an array of all the elements of the array in a diagonal order so we have a 2d matrix here we need to return in the order of one two four seven five three six eight and nine there's a positive diagonal throu... | Diagonal Traverse | diagonal-traverse | Given an `m x n` matrix `mat`, return _an array of all the elements of the array in a diagonal order_.
**Example 1:**
**Input:** mat = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[1,2,4,7,5,3,6,8,9\]
**Example 2:**
**Input:** mat = \[\[1,2\],\[3,4\]\]
**Output:** \[1,2,3,4\]
**Constraints:**
* `m == mat.leng... | null | Array,Matrix,Simulation | Medium | 2197 |
258 | Hello everyone welcome to me channel question is a big question very good in this you can learn a lot of things ok the name of the question is @ we will make it in two ways name of the question is @ we will make it in two ways name of the question is @ we will make it in two ways first of all the simplest one which is ... | Add Digits | add-digits | Given an integer `num`, repeatedly add all its digits until the result has only one digit, and return it.
**Example 1:**
**Input:** num = 38
**Output:** 2
**Explanation:** The process is
38 --> 3 + 8 --> 11
11 --> 1 + 1 --> 2
Since 2 has only one digit, return it.
**Example 2:**
**Input:** num = 0
**Output:** 0
*... | A naive implementation of the above process is trivial. Could you come up with other methods? What are all the possible results? How do they occur, periodically or randomly? You may find this Wikipedia article useful. | Math,Simulation,Number Theory | Easy | 202,1082,2076,2264 |
61 | hey everyone it's sorin today we are going to solve rotate Leist problem so the problem is we are given a head of the link at list and we need to rotate the Leist to the right by K places so and we are given this example in this example we have 1 two 2 3 4 five and in the first iteration we are rotating five and then w... | Rotate List | rotate-list | Given the `head` of a linked list, rotate the list to the right by `k` places.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], k = 2
**Output:** \[4,5,1,2,3\]
**Example 2:**
**Input:** head = \[0,1,2\], k = 4
**Output:** \[2,0,1\]
**Constraints:**
* The number of nodes in the list is in the range `[0, 500]`.
* ... | null | Linked List,Two Pointers | Medium | 189,725 |
416 | hey everyone welcome back and let's write some more neat code today so today let's solve partition equal subset sum so this is a pretty interesting problem so we're given a non-empty array of nums containing non-empty array of nums containing non-empty array of nums containing only positive integers we want to know if ... | Partition Equal Subset Sum | partition-equal-subset-sum | Given an integer array `nums`, return `true` _if you can partition the array into two subsets such that the sum of the elements in both subsets is equal or_ `false` _otherwise_.
**Example 1:**
**Input:** nums = \[1,5,11,5\]
**Output:** true
**Explanation:** The array can be partitioned as \[1, 5, 5\] and \[11\].
**E... | null | Array,Dynamic Programming | Medium | 698,2108,2135,2162 |
509 | welcome to april's lego challenge today's problem is fibonacci number the fibonacci numbers uh form a sequence called the fibonacci sequence such that each number is the sum of the preceding ones starting from zero and one so that is if it's n equal n is zero then our answer is going to be zero if n is one it's going t... | 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 |
399 | Hello Everyone Welcome to Me Channel Playlist of Questions Many people have commented on this and people are linking it because I have explained the graph in a very basic way, even if you are a beginner then you will understand, okay why did you start, not all this Have also done it directly, you can start the graph fr... | Evaluate Division | evaluate-division | You are given an array of variable pairs `equations` and an array of real numbers `values`, where `equations[i] = [Ai, Bi]` and `values[i]` represent the equation `Ai / Bi = values[i]`. Each `Ai` or `Bi` is a string that represents a single variable.
You are also given some `queries`, where `queries[j] = [Cj, Dj]` rep... | Do you recognize this as a graph problem? | Array,Depth-First Search,Breadth-First Search,Union Find,Graph,Shortest Path | Medium | null |
1,436 | hey everybody this is Larry I'm doing this problem as part of a contest so you're gonna watch me live as I go through my darts I'm coding they've been explanation near the end and for more context they'll be a link below on this actual screen cats of the contest how did you do let me know you do hit the like button eit... | Destination City | get-watched-videos-by-your-friends | You are given the array `paths`, where `paths[i] = [cityAi, cityBi]` means there exists a direct path going from `cityAi` to `cityBi`. _Return the destination city, that is, the city without any path outgoing to another city._
It is guaranteed that the graph of paths forms a line without any loop, therefore, there wil... | Do BFS to find the kth level friends. Then collect movies saw by kth level friends and sort them accordingly. | Array,Hash Table,Breadth-First Search,Sorting | Medium | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.