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 |
|---|---|---|---|---|---|---|---|---|
718 | hey guys let's take a look at this seven one eight maximum length of repeated sub-array I've seen this problem before sub-array I've seen this problem before sub-array I've seen this problem before but I don't remember how it can I solve it I remember just something like dynamic programming okay next okay let's look at... | Maximum Length of Repeated Subarray | maximum-length-of-repeated-subarray | Given two integer arrays `nums1` and `nums2`, return _the maximum length of a subarray that appears in **both** arrays_.
**Example 1:**
**Input:** nums1 = \[1,2,3,2,1\], nums2 = \[3,2,1,4,7\]
**Output:** 3
**Explanation:** The repeated subarray with maximum length is \[3,2,1\].
**Example 2:**
**Input:** nums1 = \[0... | Use dynamic programming. dp[i][j] will be the answer for inputs A[i:], B[j:]. | Array,Binary Search,Dynamic Programming,Sliding Window,Rolling Hash,Hash Function | Medium | 209,2051 |
304 | hello everyone welcome to kodus camp so today we are the 12th day of may lead code challenge and the problem we are going to cover is range sum query 2d immutable so the input given here is a two dimensional matrix and we have to implement two functions first one is num matrix where we have to initialize our data struc... | 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 |
680 | okay let's solve today's second question valley pollen john - given an empty valley pollen john - given an empty valley pollen john - given an empty string s you may delete at most on one character see whether you can make it a partner or not palindrome is a sequence of characters which reads the cell backwards and for... | 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 |
1,814 | hi everyone so welcome back to a new video today's lead code daily challenges count nice pairs in an array this is a medium level question in this question we have been given an array nums which will contain non- negative integers and will contain non- negative integers and will contain non- negative integers and we ha... | Count Nice Pairs in an Array | jump-game-vi | You are given an array `nums` that consists of non-negative integers. Let us define `rev(x)` as the reverse of the non-negative integer `x`. For example, `rev(123) = 321`, and `rev(120) = 21`. A pair of indices `(i, j)` is **nice** if it satisfies all of the following conditions:
* `0 <= i < j < nums.length`
* `nu... | Let dp[i] be "the maximum score to reach the end starting at index i". The answer for dp[i] is nums[i] + max{dp[i+j]} for 1 <= j <= k. That gives an O(n*k) solution. Instead of checking every j for every i, keep track of the largest dp[i] values in a heap and calculate dp[i] from right to left. When the largest value i... | Array,Dynamic Programming,Queue,Sliding Window,Heap (Priority Queue),Monotonic Queue | Medium | 239,2001 |
19 | hi guys welcome to the channel so today's question is remove an eighth note from the end of the list given a linked list remove the eighth note from the end of the list and we need to return its head so suppose we again with the linked list and our n is two so we need to remove four from the list and we need to return ... | Remove Nth Node From End of List | remove-nth-node-from-end-of-list | Given the `head` of a linked list, remove the `nth` node from the end of the list and return its head.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], n = 2
**Output:** \[1,2,3,5\]
**Example 2:**
**Input:** head = \[1\], n = 1
**Output:** \[\]
**Example 3:**
**Input:** head = \[1,2\], n = 1
**Output:** \[1\]
**C... | Maintain two pointers and update one with a delay of n steps. | Linked List,Two Pointers | Medium | 528,1618,2216 |
718 | in this video we're going to take a look at a legal problem called maximal length of repeated sub array so given two integer arrays nums 1 and nums 2 return the maximum length of a sub array that appears in both arrays so you can see here we have an example one so we have nums one which is this array right here and num... | Maximum Length of Repeated Subarray | maximum-length-of-repeated-subarray | Given two integer arrays `nums1` and `nums2`, return _the maximum length of a subarray that appears in **both** arrays_.
**Example 1:**
**Input:** nums1 = \[1,2,3,2,1\], nums2 = \[3,2,1,4,7\]
**Output:** 3
**Explanation:** The repeated subarray with maximum length is \[3,2,1\].
**Example 2:**
**Input:** nums1 = \[0... | Use dynamic programming. dp[i][j] will be the answer for inputs A[i:], B[j:]. | Array,Binary Search,Dynamic Programming,Sliding Window,Rolling Hash,Hash Function | Medium | 209,2051 |
51 | hello folks welcome back to the channel it's been hope you all are doing great today we are going to discuss a new problem called NQ uh this is one of the hardest problem in cleaning code so let's dive into the problem first of all what is Q do you know tune moves in the chessboard basically you have queue it can move ... | 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 |
133 | hi everyone it's cin today we have a problem when we are given a note in a connected undirected graph and we need to return a deep copy of the graph so each note in the graph is has value and also it has a list of the neighboring noes okay let's take this example let's say that we have this undirected graph 1 2 3 4 and... | Clone Graph | clone-graph | Given a reference of a node in a **[connected](https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph)** undirected graph.
Return a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) (clone) of the graph.
Each node in the graph contains a value (`int`) and a list (`List[Node]`)... | null | Hash Table,Depth-First Search,Breadth-First Search,Graph | Medium | 138,1624,1634 |
268 | what's up guys it's David Ilan here today we are gonna be going over 268 missing number on leak code this has to do with arrays so the description reads given an array containing n distinct numbers taken from 0 2 and find the one that is missing from the array so we know that there's going to be a number missing from t... | Missing Number | missing-number | Given an array `nums` containing `n` distinct numbers in the range `[0, n]`, return _the only number in the range that is missing from the array._
**Example 1:**
**Input:** nums = \[3,0,1\]
**Output:** 2
**Explanation:** n = 3 since there are 3 numbers, so all numbers are in the range \[0,3\]. 2 is the missing number... | null | Array,Hash Table,Math,Bit Manipulation,Sorting | Easy | 41,136,287,770,2107 |
332 | Hello hello guys welcome back to tech division in this video you will see here constructed in every problem which from list on day 26th June challenge saw it every basic elements plan route ok so let's know problem statement in this problem departs from Saudi Arabia on Thursday And Constraints Thursday Example2 Represe... | 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 |
69 | hey everyone welcome back and let's write some more neat code today so today let's solve the problems square root of x we're given a non-negative integer X x we're given a non-negative integer X x we're given a non-negative integer X and we want to return the square root of x rounded down to the nearest integer so for ... | Sqrt(x) | sqrtx | Given a non-negative integer `x`, return _the square root of_ `x` _rounded down to the nearest integer_. The returned integer should be **non-negative** as well.
You **must not use** any built-in exponent function or operator.
* For example, do not use `pow(x, 0.5)` in c++ or `x ** 0.5` in python.
**Example 1:**
... | Try exploring all integers. (Credits: @annujoshi) Use the sorted property of integers to reduced the search space. (Credits: @annujoshi) | Math,Binary Search | Easy | 50,367 |
759 | hey everybody this is Larry this is January 18th and uh or yeah today I should be doing the day 19th of the legal day challenge but it comes up in 40 minutes but I actually have to go out for dinner so I figured uh but I do have a little bit of time for some reason so I think I'm just going to do it in reverse which is... | Employee Free Time | set-intersection-size-at-least-two | We are given a list `schedule` of employees, which represents the working time for each employee.
Each employee has a list of non-overlapping `Intervals`, and these intervals are in sorted order.
Return the list of finite intervals representing **common, positive-length free time** for _all_ employees, also in sorted... | null | Array,Greedy,Sorting | Hard | null |
326 | what's up everybody ajit mahajan here and welcome back to yet another youtube video in today's video we'll be solving another lead quote question number 326 also called as power of three it has also been asked in day 27 of a pre-lead code challenge so let's get pre-lead code challenge so let's get pre-lead code challen... | Power of Three | power-of-three | Given an integer `n`, return _`true` if it is a power of three. Otherwise, return `false`_.
An integer `n` is a power of three, if there exists an integer `x` such that `n == 3x`.
**Example 1:**
**Input:** n = 27
**Output:** true
**Explanation:** 27 = 33
**Example 2:**
**Input:** n = 0
**Output:** false
**Explanat... | null | Math,Recursion | Easy | 231,342,1889 |
1,074 | hey everybody this is larry uh hit the like button the subscriber enjoyment disco let me know what you think about today's farm it is day 18 of the july leco daily challenge and farm is number of sub matrix c's that's some to target i hope everyone had a great weekend i'm back to new york as you can see in the backgrou... | Number of Submatrices That Sum to Target | high-five | Given a `matrix` and a `target`, return the number of non-empty submatrices that sum to target.
A submatrix `x1, y1, x2, y2` is the set of all cells `matrix[x][y]` with `x1 <= x <= x2` and `y1 <= y <= y2`.
Two submatrices `(x1, y1, x2, y2)` and `(x1', y1', x2', y2')` are different if they have some coordinate that is... | How can we solve the problem if we have just one student? Given an student sort their grades and get the top 5 average. Generalize the idea to do it for many students. | Array,Hash Table,Sorting | Easy | null |
350 | so we will look at intersection of two arrays two and the question is given two integer arrays numbers one and nums two return an array of the intersection each element in the result must appear as many times as it shows in both arrays and you may return the result in any order and we have an example here so if we have... | Intersection of Two Arrays II | intersection-of-two-arrays-ii | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must appear as many times as it shows in both arrays and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2,2\]
**Example 2:**
**I... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 349,1044,1392,2282 |
204 | foreign hello everyone and welcome back to another video So today we're going to be solving the lead code question count primes question number two through four all right so given an integer and return the number of prime numbers that are strictly less than n so for example we have the number 10 so the numbers we can c... | Count Primes | count-primes | Given an integer `n`, return _the number of prime numbers that are strictly less than_ `n`.
**Example 1:**
**Input:** n = 10
**Output:** 4
**Explanation:** There are 4 prime numbers less than 10, they are 2, 3, 5, 7.
**Example 2:**
**Input:** n = 0
**Output:** 0
**Example 3:**
**Input:** n = 1
**Output:** 0
**Co... | Let's start with a isPrime function. To determine if a number is prime, we need to check if it is not divisible by any number less than n. The runtime complexity of isPrime function would be O(n) and hence counting the total prime numbers up to n would be O(n2). Could we do better? As we know the number must not be div... | Array,Math,Enumeration,Number Theory | Medium | 263,264,279 |
1,704 | hello introduction to the video my name is Cameron I'm a graduate Apprentice software engineer currently studying at Glasgow University and I'm using this video as a way to sort of rubber ducky debug a l code problem just attempt to solve it and hopefully it's useful to some on here so the problem going to be attempted... | 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 |
1,816 | let's say we have the input string my name Jeff and we want to turn it into my name because our k equals 2 we can first split my name Jeff to get each word on its own we split by the space so we break at these two points giving my name Jeff then we can splice the array that we just got up till K getting the first two v... | Truncate Sentence | lowest-common-ancestor-of-a-binary-tree-iv | A **sentence** is a list of words that are separated by a single space with no leading or trailing spaces. Each of the words consists of **only** uppercase and lowercase English letters (no punctuation).
* For example, `"Hello World "`, `"HELLO "`, and `"hello world hello world "` are all sentences.
You are given a... | Starting from the root, traverse the left and the right subtrees, checking if one of the nodes exist there. If one of the subtrees doesn't contain any given node, the LCA can be the node returned from the other subtree If both subtrees contain nodes, the LCA node is the current node. | Tree,Depth-First Search,Binary Tree | Medium | 235,236,1218,1780,1790,1816 |
1,678 | that can interpret the string command in the string in the graph the command consists the string consists of an alphabet g open and closed round braces and or within round braces a l and a word in from order okay the gold passer will interpret g okay as the string g around basis as the spring go okay and within around ... | Goal Parser Interpretation | number-of-ways-to-split-a-string | You own a **Goal Parser** that can interpret a string `command`. The `command` consists of an alphabet of `"G "`, `"() "` and/or `"(al) "` in some order. The Goal Parser will interpret `"G "` as the string `"G "`, `"() "` as the string `"o "`, and `"(al) "` as the string `"al "`. The interpreted strings are then concat... | There is no way if the sum (number of '1's) is not divisible by the number of splits. So sum%3 should be 0. Preffix s1 , and suffix s3 should have sum/3 characters '1'. Follow up: Can you generalize the problem with numbers between [-10^9, 10^9] such the sum between subarrays s1, s2, s3 are the same? | Math,String | Medium | 548 |
1,235 | welcome to august leeco challenge this problem is called maximum profit and job scheduling we have end jobs where every job is scheduled to be done from start time to end time i obtaining a profit of profit i you're given a start time and time profit arrays return the maximum profit you can take such that there are no ... | Maximum Profit in Job Scheduling | maximum-profit-in-job-scheduling | We have `n` jobs, where every job is scheduled to be done from `startTime[i]` to `endTime[i]`, obtaining a profit of `profit[i]`.
You're given the `startTime`, `endTime` and `profit` arrays, return the maximum profit you can take such that there are no two jobs in the subset with overlapping time range.
If you choose... | null | null | Hard | null |
450 | hi everyone it's sorin today we have a problem when we are given a binary search tree and the key and we need to remove from the binary search tree a node with that key so for example in this case we are giving this binary tree and the key is equals to three right and we are removing three and we get this binary tree u... | 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 |
470 | welcome to august lee code challenge today's problem is implement rand 10 using rand 7. given a function ran 7 which generates a uniform random integer in the range of 1 to 7 write a function rand 10 which generates a random integer in the range of 1 to 10. do not use any random libraries and they give us some examples... | Implement Rand10() Using Rand7() | implement-rand10-using-rand7 | Given the **API** `rand7()` that generates a uniform random integer in the range `[1, 7]`, write a function `rand10()` that generates a uniform random integer in the range `[1, 10]`. You can only call the API `rand7()`, and you shouldn't call any other API. Please **do not** use a language's built-in random API.
Each ... | null | null | Medium | null |
1,637 | hi everyone welcome back to the channel and today we're going to solve lead code daily challenge problem number 1,637 widest vertical area between two 1,637 widest vertical area between two 1,637 widest vertical area between two points containing no points so we're going to first look into the problem statement then we... | Widest Vertical Area Between Two Points Containing No Points | string-compression-ii | Given `n` `points` on a 2D plane where `points[i] = [xi, yi]`, Return _the **widest vertical area** between two points such that no points are inside the area._
A **vertical area** is an area of fixed-width extending infinitely along the y-axis (i.e., infinite height). The **widest vertical area** is the one with the ... | Use dynamic programming. The state of the DP can be the current index and the remaining characters to delete. Having a prefix sum for each character can help you determine for a certain character c in some specific range, how many characters you need to delete to merge all occurrences of c in that range. | String,Dynamic Programming | Hard | null |
279 | hello everyone welcome to day 14 of october lead code challenge and today's question is perfect square in this question we are given an integer n we need to return the least number of perfect square numbers that are need to be clubbed together so as to sum up to n and let's take an example here the value of n that is g... | Perfect Squares | perfect-squares | Given an integer `n`, return _the least number of perfect square numbers that sum to_ `n`.
A **perfect square** is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, `1`, `4`, `9`, and `16` are perfect squares while `3` and `11` are not.
**Example ... | null | Math,Dynamic Programming,Breadth-First Search | Medium | 204,264 |
859 | hey everybody this is larry this is day 12 of the leeco daily challenge hit the like button hit the subscriber and join me in discord i hope today i'll recover from yesterday's uh just tiredness um so i am doing this live so sometimes i don't get it all like immediately all the time as opposed to explanation video i al... | Buddy Strings | design-circular-deque | Given two strings `s` and `goal`, return `true` _if you can swap two letters in_ `s` _so the result is equal to_ `goal`_, otherwise, return_ `false`_._
Swapping letters is defined as taking two indices `i` and `j` (0-indexed) such that `i != j` and swapping the characters at `s[i]` and `s[j]`.
* For example, swappi... | null | Array,Linked List,Design,Queue | Medium | 860,1767 |
496 | hello friends now let's of the next greater element one problem is firstly a statement you are given to a race without duplicates numbers 1 in numbers to where numbers wants elements are subsets of numbers to find all the next greater numbers phone numbers ones elements in a corresponding place of numbers to the next g... | Next Greater Element I | next-greater-element-i | The **next greater element** of some element `x` in an array is the **first greater** element that is **to the right** of `x` in the same array.
You are given two **distinct 0-indexed** integer arrays `nums1` and `nums2`, where `nums1` is a subset of `nums2`.
For each `0 <= i < nums1.length`, find the index `j` such ... | null | Array,Hash Table,Stack,Monotonic Stack | Easy | 503,556,739,2227 |
118 | hello everyone out there welcome to solve it out this is Annie here and today I was solving the pascals triangle in JavaScript so thought to make a video out of it and share it with you guys so here you can see this is the Pascal's triangle a question here the DSA question that is given an integer num rows return the f... | Pascal's Triangle | pascals-triangle | Given an integer `numRows`, return the first numRows of **Pascal's triangle**.
In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown:
**Example 1:**
**Input:** numRows = 5
**Output:** \[\[1\],\[1,1\],\[1,2,1\],\[1,3,3,1\],\[1,4,6,4,1\]\]
**Example 2:**
**Input:** numRows = ... | null | Array,Dynamic Programming | Easy | 119 |
225 | hello everyone today we're going to discuss the input daily challenge the problem segment is implement stack using queues here we have to implement the last in first out step using only queues okay the implemented stack should support all the functions of normal stack like push operation top open empty operations so fi... | 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 |
392 | hello and welcome to another video today we're going to be working on is subsequence and in this problem you're given two strings s and t and you want to return true if s is a subsequence of T and A subsequence is a string that's formed by the original string by deleting some characters without Distributing the relativ... | Is Subsequence | is-subsequence | Given two strings `s` and `t`, return `true` _if_ `s` _is a **subsequence** of_ `t`_, or_ `false` _otherwise_.
A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i... | null | Two Pointers,String,Dynamic Programming | Easy | 808,1051 |
942 | hello in this video we are going to discuss the lead code problem number 942 d a string match the word d i means D for decrease the value right B for decrease same way I for increase what they will give you an string right a string input is a string right they will give you and string yes what the string contains only ... | DI String Match | super-palindromes | A permutation `perm` of `n + 1` integers of all the integers in the range `[0, n]` can be represented as a string `s` of length `n` where:
* `s[i] == 'I'` if `perm[i] < perm[i + 1]`, and
* `s[i] == 'D'` if `perm[i] > perm[i + 1]`.
Given a string `s`, reconstruct the permutation `perm` and return it. If there are ... | null | Math,Enumeration | Hard | null |
725 | welcome to september's leeco challenge this problem is called split linked list in parts given the head of a singly linked list and an integer k split the linked list into k consecutive linked list parts the length of each part should be as equal as possible no two parts should have a size differing by more than one th... | Split Linked List in Parts | split-linked-list-in-parts | Given the `head` of a singly linked list and an integer `k`, split the linked list into `k` consecutive linked list parts.
The length of each part should be as equal as possible: no two parts should have a size differing by more than one. This may lead to some parts being null.
The parts should be in the order of occ... | If there are N nodes in the list, and k parts, then every part has N/k elements, except the first N%k parts have an extra one. | Linked List | Medium | 61,328 |
1,670 | Whatever is ready, weather repairing is a little bit, this is the third question for you, goodbye little child artist design front medium, so now what will we do in it, we have to make improvements in it, what should be inside it, you can make friendship with the front, make the officers happy with this also. If I am a... | Design Front Middle Back Queue | patients-with-a-condition | Design a queue that supports `push` and `pop` operations in the front, middle, and back.
Implement the `FrontMiddleBack` class:
* `FrontMiddleBack()` Initializes the queue.
* `void pushFront(int val)` Adds `val` to the **front** of the queue.
* `void pushMiddle(int val)` Adds `val` to the **middle** of the queu... | null | Database | Easy | null |
6 | hey everyone welcome back to my YouTube channel today we're solving another lead code challenge lead code 6 zigzag conversion will be given a string which we have to print in a zigzag fashion and then read it line by line and return the resulting string for this one I'll be using two different approaches to solve the p... | 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 |
35 | hello today we are going to solve swords insert position problem on youth code which is a problem about 3500 code so angles problem we are basic living in a sorted array in which in the description they have specified that they won't be able to be any duplicated values in an area and we are also given a target value th... | 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 |
1,725 | all right let's talk about the number of rectangles that can form the largest square so you are given a reverse window and for a single eye you go to li wi and it is representative and with that so you want to while you want to return the number of rectangles that can make a square with the side of the length of max le... | Number Of Rectangles That Can Form The Largest Square | number-of-sets-of-k-non-overlapping-line-segments | You are given an array `rectangles` where `rectangles[i] = [li, wi]` represents the `ith` rectangle of length `li` and width `wi`.
You can cut the `ith` rectangle to form a square with a side length of `k` if both `k <= li` and `k <= wi`. For example, if you have a rectangle `[4,6]`, you can cut it to get a square wit... | Try to use dynamic programming where the current index and remaining number of line segments to form can describe any intermediate state. To make the computation of each state in constant time, we could add another flag to the state that indicates whether or not we are in the middle of placing a line (placed start poin... | Math,Dynamic Programming | Medium | null |
991 | Hello Gaye 11th Mein Dubey Will Be Discussing Question Don't forget to subscribe and subscribe Twitter The Video then subscribe to the Big Ronit Tours from subscribe and subscribe The last pressure Yen trying to reach is back to change The operation Let's see how record Subscribe Appointed - Festivals and my tab Trying... | Broken Calculator | array-of-doubled-pairs | There is a broken calculator that has the integer `startValue` on its display initially. In one operation, you can:
* multiply the number on display by `2`, or
* subtract `1` from the number on display.
Given two integers `startValue` and `target`, return _the minimum number of operations needed to display_ `targ... | null | Array,Hash Table,Greedy,Sorting | Medium | 2117 |
622 | Hello guys welcome to your words made easy my name is the wall and today will be discussing design circular given in this question Thursday subscribe and subscribe the Channel subscribe to subscribe and subscribe the Channel Please subscribe this Video Now why before moving into the implementation Partners pe luta stan... | Design Circular Queue | design-circular-queue | Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle, and the last position is connected back to the first position to make a circle. It is also called "Ring Buffer ".
One of the benefits of th... | null | null | Medium | null |
455 | hey everyone welcome back to the channel today we're going to be solving a problem on lead code the question is assigned cookies so the question says assume you're an awesome parent and want to give your children some cookies but you should give each child at most one cookie each child I has a grade factor of G of I wh... | Assign Cookies | assign-cookies | Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.
Each child `i` has a greed factor `g[i]`, which is the minimum size of a cookie that the child will be content with; and each cookie `j` has a size `s[j]`. If `s[j] >= g[i]`, we can assign ... | null | Array,Greedy,Sorting | Easy | null |
337 | hello and welcome to another Elite code problem today we're going to be doing problem number 337 House robber 3 the Final house travel problem there might be some more but it's probably I'm gonna All I'm gonna do for this uh series and so the variation of this problem is we have a thief again there is an entrance now c... | House Robber III | house-robber-iii | The thief has found himself a new place for his thievery again. There is only one entrance to this area, called `root`.
Besides the `root`, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will automatically contact the police if ... | null | Dynamic Programming,Tree,Depth-First Search,Binary Tree | Medium | 198,213 |
136 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem single number we're given a non-empty array of we're given a non-empty array of we're given a non-empty array of integers nums and we're told that every single element in this array appears exactly twice except for one ... | 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 |
71 | hey guys let's take a look at number 71 simplified path we're giving an absolute pack for a file simplify it convert it to the canonical path a period your friends current secretary double period moves to the top upper level and we should return the canonical path always begin with the slash their own must be only one ... | Simplify Path | simplify-path | Given a string `path`, which is an **absolute path** (starting with a slash `'/'`) to a file or directory in a Unix-style file system, convert it to the simplified **canonical path**.
In a Unix-style file system, a period `'.'` refers to the current directory, a double period `'..'` refers to the directory up a level,... | null | String,Stack | Medium | null |
153 | hey folks welcome back to another video today we're looking at question 153 find minimum in rotated array the way we'll be approaching this problem is by using a binary search but there are a few conditions that are associated with that just to get the final uh the minimum element so let's jump right in the first thing... | 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 |
948 | hey everybody this is larry this is me going over day 24th 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 prom which is the bag of tokens you're given an initial powers of p and a score of zero and a back took and you could pay f... | Bag of Tokens | sort-an-array | You have an initial **power** of `power`, an initial **score** of `0`, and a bag of `tokens` where `tokens[i]` is the value of the `ith` token (0-indexed).
Your goal is to maximize your total **score** by potentially playing each token in one of two ways:
* If your current **power** is at least `tokens[i]`, you may... | null | Array,Divide and Conquer,Sorting,Heap (Priority Queue),Merge Sort,Bucket Sort,Radix Sort,Counting Sort | Medium | null |
1,376 | hello and welcome back to the cracking fang youtube channel today we're going to be solving lead code problem 1376 time needed to inform all employees a company has n employees with unique id for each employee from zero to n minus 1. the head of the company is the one with head id each employee has a direct manager in ... | Time Needed to Inform All Employees | time-needed-to-inform-all-employees | A company has `n` employees with a unique ID for each employee from `0` to `n - 1`. The head of the company is the one with `headID`.
Each employee has one direct manager given in the `manager` array where `manager[i]` is the direct manager of the `i-th` employee, `manager[headID] = -1`. Also, it is guaranteed that th... | null | null | Medium | null |
972 | cool 1972 equal rational numbers come in strings SNT each of which represent non-negative SNT each of which represent non-negative SNT each of which represent non-negative rational number we turn true if and only if they represent the same number the string may use for M is used to denote that became part of a tional n... | Equal Rational Numbers | knight-dialer | Given two strings `s` and `t`, each of which represents a non-negative rational number, return `true` if and only if they represent the same number. The strings may use parentheses to denote the repeating part of the rational number.
A **rational number** can be represented using up to three parts: , , and a . The num... | null | Dynamic Programming | Medium | null |
279 | oh this question is perfect square so you are giving the integer and so you have to return the base number of perfect square uh let's sum up to the n so the perfect square represents 1 4 9 16 and so on right so imagine there's an index that is not perfect square then definitely the value is not going to be what uh so y... | Perfect Squares | perfect-squares | Given an integer `n`, return _the least number of perfect square numbers that sum to_ `n`.
A **perfect square** is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, `1`, `4`, `9`, and `16` are perfect squares while `3` and `11` are not.
**Example ... | null | Math,Dynamic Programming,Breadth-First Search | Medium | 204,264 |
1,727 | hi friends uh welcome to followup uh in this video we're going to look at problem 1727 largest submetric with rearrangements so our strategy will be a combination of sorting and a flavor of dynamic programming so we are going to first look at the problem dest and then we look at the analysis or algorithm and finally we... | Largest Submatrix With Rearrangements | cat-and-mouse-ii | You are given a binary matrix `matrix` of size `m x n`, and you are allowed to rearrange the **columns** of the `matrix` in any order.
Return _the area of the largest submatrix within_ `matrix` _where **every** element of the submatrix is_ `1` _after reordering the columns optimally._
**Example 1:**
**Input:** matri... | Try working backward: consider all trivial states you know to be winning or losing, and work backward to determine which other states can be labeled as winning or losing. | Math,Dynamic Programming,Breadth-First Search,Graph,Memoization,Game Theory | Hard | 805,949 |
1,354 | Ajay Ko Hello Everyone Welcome to Lotus Temple in the World Today Reminded After Minutes From Multiple Subscribe Must Subscribe Prithvi Singh and First Intact Sun Robbie Williams Target Are Isi Channel Ko Subscribe And subscribe The Amazing Subscribe to A 100 Dresses and Attractive Figure Planning To Conv Withdrawal su... | Construct Target Array With Multiple Sums | find-players-with-zero-or-one-losses | You are given an array `target` of n integers. From a starting array `arr` consisting of `n` 1's, you may perform the following procedure :
* let `x` be the sum of all elements currently in your array.
* choose index `i`, such that `0 <= i < n` and set the value of `arr` at index `i` to `x`.
* You may repeat thi... | Count the number of times a player loses while iterating through the matches. | Array,Hash Table,Sorting,Counting | Medium | 236 |
1,525 | Everyone welcome to my channel its all the problem is 1525 number of good based on split string so in this problem it is give one spring tools and have to speed string into subscribe And subscribe The Amazing possible fluid ago a sec that apps bba so how many Total Possible Springs Weekend With First Weekend Hair Secon... | Number of Good Ways to Split a String | queries-on-a-permutation-with-key | You are given a string `s`.
A split is called **good** if you can split `s` into two non-empty strings `sleft` and `sright` where their concatenation is equal to `s` (i.e., `sleft + sright = s`) and the number of distinct letters in `sleft` and `sright` is the same.
Return _the number of **good splits** you can make ... | Create the permutation P=[1,2,...,m], it could be a list for example. For each i, find the position of queries[i] with a simple scan over P and then move this to the beginning. | Array,Binary Indexed Tree,Simulation | Medium | null |
470 | hi guys welcome to algorithms made easy today we will go through the day 28 problem from obviously coding challenge implement random 10 function using random 7 function please like the video and if you are new don't forget to subscribe to our channel so that you never miss any update given a function which generates a ... | Implement Rand10() Using Rand7() | implement-rand10-using-rand7 | Given the **API** `rand7()` that generates a uniform random integer in the range `[1, 7]`, write a function `rand10()` that generates a uniform random integer in the range `[1, 10]`. You can only call the API `rand7()`, and you shouldn't call any other API. Please **do not** use a language's built-in random API.
Each ... | null | null | Medium | null |
1,319 | Hello hello guys welcome back to take devotion in this video you will see the number operations to make network connectivity problem from that list number 1319 and strong Rahul Gautam so let's posted problem statement in this problem during computers number 102 - 1800 made this network computers number 102 - 1800 made ... | Number of Operations to Make Network Connected | unique-number-of-occurrences | There are `n` computers numbered from `0` to `n - 1` connected by ethernet cables `connections` forming a network where `connections[i] = [ai, bi]` represents a connection between computers `ai` and `bi`. Any computer can reach any other computer directly or indirectly through the network.
You are given an initial com... | Find the number of occurrences of each element in the array using a hash map. Iterate through the hash map and check if there is a repeated value. | Array,Hash Table | Easy | null |
222 | hey everybody this is Larry this is day 15 Midway through the November liquor day challenge hit the like button hit the Subscribe and join me on Discord let me know what you think about this problem and you know everything else I guess whatever you like to ask um today's problem is 222 count complete three notes okay s... | Count Complete Tree Nodes | count-complete-tree-nodes | Given the `root` of a **complete** binary tree, return the number of the nodes in the tree.
According to **[Wikipedia](http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees)**, every level, except possibly the last, is completely filled in a complete binary tree, and all nodes in the last level are as far lef... | null | Binary Search,Tree,Depth-First Search,Binary Tree | Medium | 270 |
891 | hello and welcome back to the cracking Fang YouTube channel it has been a while I have not touched lead code for a long time and let's see if I can dust off my skills and put out a video so today we're going to be solving lead code problem 891 time based key Value Store design a time-based key value data design a time-... | Sum of Subsequence Widths | score-after-flipping-matrix | The **width** of a sequence is the difference between the maximum and minimum elements in the sequence.
Given an array of integers `nums`, return _the sum of the **widths** of all the non-empty **subsequences** of_ `nums`. Since the answer may be very large, return it **modulo** `109 + 7`.
A **subsequence** is a sequ... | null | Array,Greedy,Bit Manipulation,Matrix | Medium | 2268 |
1,283 | hey everybody this is larry this is day six of the leeco november challenge hit the like button hit the subscribe button join me in discord let me know what you think about this farm looks like a mafi problem find the smallest divisor given a threshold okay criminal number and threshold positive and divide it all the w... | Find the Smallest Divisor Given a Threshold | reformat-date | Given an array of integers `nums` and an integer `threshold`, we will choose a positive integer `divisor`, divide all the array by it, and sum the division's result. Find the **smallest** `divisor` such that the result mentioned above is less than or equal to `threshold`.
Each result of the division is rounded to the ... | Handle the conversions of day, month and year separately. Notice that days always have a two-word ending, so if you erase the last two characters of this days you'll get the number. | String | Easy | null |
806 | hello quick introduction to the video my name is Cameron I'm a graduate Apprentice software engineer currently studying at Glasgow University and I'm using this video as a way to sort of rubber ducky debug a elak code problem just attempt to solve it talk through my thought process and hopefully it's just so to someone... | 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 |
997 | maybe hello there so today is day 10 of the Meili coding challenge questions so far the question has largely remained to be easy but tomorrow we are getting into the 11th day so into the middle of them once hopefully tomorrow we can have something that's a little bit more challenging today is still a relatively easy qu... | Find the Town Judge | find-the-town-judge | In a town, there are `n` people labeled from `1` to `n`. There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
1. The town judge trusts nobody.
2. Everybody (except for the town judge) trusts the town judge.
3. There is exactly one person that satisfies properties **... | null | null | Easy | null |
1,331 | hello friends today we can discuss this question from the latest read good bye we click on text 18 problem number 1 3 1 rank transform of an arrow so question statement states that you are given an array as an input and you have to output an edit in which each index define the rank of that element the how can we define... | Rank Transform of an Array | path-with-maximum-gold | Given an array of integers `arr`, replace each element with its rank.
The rank represents how large the element is. The rank has the following rules:
* Rank is an integer starting from 1.
* The larger the element, the larger the rank. If two elements are equal, their rank must be the same.
* Rank should be as s... | Use recursion to try all such paths and find the one with the maximum value. | Array,Backtracking,Matrix | Medium | null |
120 | hi guys welcome to tech geek so today i am here to share the solution of another medium problem that's triangle so this is elite code medium version basically asked in interviews of radius service based on product based company for product base it's basically asked in the first round um so let's see what the solution i... | Triangle | triangle | Given a `triangle` array, return _the minimum path sum from top to bottom_.
For each step, you may move to an adjacent number of the row below. More formally, if you are on index `i` on the current row, you may move to either index `i` or index `i + 1` on the next row.
**Example 1:**
**Input:** triangle = \[\[2\],\[... | null | Array,Dynamic Programming | Medium | null |
142 | hi all welcome to learn code repeat so today's problem is list cycle which is a cycle detection problem and we'll be solving this using floyd's cycle detection algorithm it's also called as tortoise and the hair algorithm so let's first look into the problem so the problem says given a linked list return the node where... | Linked List Cycle II | linked-list-cycle-ii | Given the `head` of a linked list, return _the node where the cycle begins. If there is no cycle, return_ `null`.
There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that ta... | null | Hash Table,Linked List,Two Pointers | Medium | 141,287 |
1,446 | Loot Hello Everyone Welcome Back To My Channel Today We Are Going To Solve Neither Problem Is Which Give Correct Is This Problem The To Find The Power Of String Events Near To Power Of The Power Of Power Maximum 90 Mean That You Have Only One Unique And The Thing Which Will Be The Will Do Subscribe To Comments Feed To ... | Consecutive Characters | angle-between-hands-of-a-clock | The **power** of the string is the maximum length of a non-empty substring that contains only one unique character.
Given a string `s`, return _the **power** of_ `s`.
**Example 1:**
**Input:** s = "leetcode "
**Output:** 2
**Explanation:** The substring "ee " is of length 2 with the character 'e' only.
**Example ... | The tricky part is determining how the minute hand affects the position of the hour hand. Calculate the angles separately then find the difference. | Math | Medium | null |
261 | all right so let's talk about the value tree so you're giving a graph of node and then you want to return to if the edges of the given graph make up the value tree so uh if a tree is like this it's definitely okay so you return true if you connect like if there's a cycle right um you want to return false so for example... | Graph Valid Tree | graph-valid-tree | You have a graph of `n` nodes labeled from `0` to `n - 1`. You are given an integer n and a list of `edges` where `edges[i] = [ai, bi]` indicates that there is an undirected edge between nodes `ai` and `bi` in the graph.
Return `true` _if the edges of the given graph make up a valid tree, and_ `false` _otherwise_.
**... | Given n = 5 and edges = [[0, 1], [1, 2], [3, 4]], what should your return? Is this case a valid tree? According to the definition of tree on Wikipedia: “a tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles is a tree.” | Depth-First Search,Breadth-First Search,Union Find,Graph | Medium | 207,323,871 |
783 | Hello friends today I am going to solve liquid problem number 783 minimum distance between BST notes so in this problem we are given the root of a binary search tree and we need to find the minimum distance between the values of any two nodes in the tree and the two nodes should be different and it's also not specified... | Minimum Distance Between BST Nodes | search-in-a-binary-search-tree | Given the `root` of a Binary Search Tree (BST), return _the minimum difference between the values of any two different nodes in the tree_.
**Example 1:**
**Input:** root = \[4,2,6,1,3\]
**Output:** 1
**Example 2:**
**Input:** root = \[1,0,48,null,null,12,49\]
**Output:** 1
**Constraints:**
* The number of nodes... | null | Tree,Binary Search Tree,Binary Tree | Easy | 270,784 |
56 | hello and welcome today we are doing a question from weak code called merge intervals it's a medium let's get started given a collection of intervals merge all overlapping intervals example one given the input 1 3 2 6 8 10 15 18 we output 1 6 8 10 15 18. so 8 10 15 18 stayed as is they don't overlap with anything so th... | 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,585 | hey what's up guys this is chung here so today uh let's take a look at this a weekly contest the last heart problem uh which is number 1585 check if string is transformable with substring sword operations this is a hard problem yeah i think it's really tricky problem it is hard i mean even though the coding part is not... | Check If String Is Transformable With Substring Sort Operations | the-kth-factor-of-n | Given two strings `s` and `t`, transform string `s` into string `t` using the following operation any number of times:
* Choose a **non-empty** substring in `s` and sort it in place so the characters are in **ascending order**.
* For example, applying the operation on the underlined substring in `"14234 "` res... | The factors of n will be always in the range [1, n]. Keep a list of all factors sorted. Loop i from 1 to n and add i if n % i == 0. Return the kth factor if it exist in this list. | Math | Medium | null |
1,544 | uh hey everybody this is larry this is me going over q1 of the recently go contest make the string great uh so yeah so the idea here is just that uh for me i just did it greedy uh and then the thing is that when you combine 2 j or remove two adjacent characters you keep doing it right uh so the natural um the natural a... | Make The String Great | count-good-nodes-in-binary-tree | Given a string `s` of lower and upper case English letters.
A good string is a string which doesn't have **two adjacent characters** `s[i]` and `s[i + 1]` where:
* `0 <= i <= s.length - 2`
* `s[i]` is a lower-case letter and `s[i + 1]` is the same letter but in upper-case or **vice-versa**.
To make the string go... | Use DFS (Depth First Search) to traverse the tree, and constantly keep track of the current path maximum. | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | null |
171 | welcome my friends to joey's tech in this video we are going to solve a lead code problem which is excel sheet column number the problem is fun to solve so without further ado let's now take a look at its problem statement you are given a string column title this column title string represents the column names or colum... | Excel Sheet Column Number | excel-sheet-column-number | Given a string `columnTitle` that represents the column title as appears in an Excel sheet, return _its corresponding column number_.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
**Example 1:**
**Input:** columnTitle = "A "
**Output:** 1
**Example 2:**
**Input:** columnTitle = "AB "
**Ou... | null | Math,String | Easy | 168,2304 |
126 | hi guys welcome to tech geek so today we are back with another daily challenge problem the problem for today is word ladder 2 so if you have done the word latter one you must be aware of how this question goes on so if not then give it a try this is elite good hard question he could have 126 basically it's quite hard t... | 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,791 | all right so this question is find center of the star gra so basically given to the array to find where's the center of the graph so look at the diagram so now you when we look at the diagram right the two is the center so we return two so how do we find it we look at the you know the interval you know piece by piece s... | Find Center of Star Graph | richest-customer-wealth | There is an undirected **star** graph consisting of `n` nodes labeled from `1` to `n`. A star graph is a graph where there is one **center** node and **exactly** `n - 1` edges that connect the center node with every other node.
You are given a 2D integer array `edges` where each `edges[i] = [ui, vi]` indicates that th... | Calculate the wealth of each customer Find the maximum element in array. | Array,Matrix | Easy | null |
1,091 | lead code practice so in this video there are two goals the first goal is to see how to solve this problem and the second goal is to see how you should behave in a real interview so let's get started remember in a real interview the first step is always try to understand the problem if there is anything unclear please ... | Shortest Path in Binary Matrix | maximum-average-subtree | Given an `n x n` binary matrix `grid`, return _the length of the shortest **clear path** in the matrix_. If there is no clear path, return `-1`.
A **clear path** in a binary matrix is a path from the **top-left** cell (i.e., `(0, 0)`) to the **bottom-right** cell (i.e., `(n - 1, n - 1)`) such that:
* All the visite... | Can you find the sum of values and the number of nodes for every sub-tree ? Can you find the sum of values and the number of nodes for a sub-tree given the sum of values and the number of nodes of it's left and right sub-trees ? Use depth first search to recursively find the solution for the children of a node then use... | Tree,Depth-First Search,Binary Tree | Medium | 2126 |
448 | numbers disappeared in an array giving an array norms of n integers their nums i is in the range from 1 to n return an array of all the integers in the array from inclusive one to inclusive end that do not appear in the norms so basically it's a very easy question the question is saying okay this is the array that's gi... | Find All Numbers Disappeared in an Array | find-all-numbers-disappeared-in-an-array | Given an array `nums` of `n` integers where `nums[i]` is in the range `[1, n]`, return _an array of all the integers in the range_ `[1, n]` _that do not appear in_ `nums`.
**Example 1:**
**Input:** nums = \[4,3,2,7,8,2,3,1\]
**Output:** \[5,6\]
**Example 2:**
**Input:** nums = \[1,1\]
**Output:** \[2\]
**Constrain... | This is a really easy problem if you decide to use additional memory. For those trying to write an initial solution using additional memory, think counters! However, the trick really is to not use any additional space than what is already available to use. Sometimes, multiple passes over the input array help find the s... | Array,Hash Table | Easy | 41,442,2107,2305 |
1,295 | in this video I'm going to discuss in the following rules and there is no such index in these necessary like minus one minus two which are invalid we do need to think about those so if you go to an example test case you can understand the problem more easily suppose one answer is 0 1 2 3 4 and the index that is go1 2 1... | Find Numbers with Even Number of Digits | minimum-garden-perimeter-to-collect-enough-apples | Given an array `nums` of integers, return how many of them contain an **even number** of digits.
**Example 1:**
**Input:** nums = \[12,345,2,6,7896\]
**Output:** 2
**Explanation:**
12 contains 2 digits (even number of digits).
345 contains 3 digits (odd number of digits).
2 contains 1 digit (odd number of digits).... | Find a formula for the number of apples inside a square with a side length L. Iterate over the possible lengths of the square until enough apples are collected. | Math,Binary Search | Medium | null |
72 | hi guys welcome to the channel this is wagga we're going to do another liquid question and the question and question today is number 72 at the distance you're given two words you're supposed to convert word one into what two and the number of operations you can use is um the number of things you can do is insert a char... | 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 |
1,838 | Hello everyone welcome to my channel code sir with mike so today we are going to do video number 13 of our playlist of sliding window mechanism ok for now forget that this is the problem of sliding window we will figure out ourselves how this The problem of sliding window is ok, it is medium marked but it is called mul... | Frequency of the Most Frequent Element | number-of-distinct-substrings-in-a-string | The **frequency** of an element is the number of times it occurs in an array.
You are given an integer array `nums` and an integer `k`. In one operation, you can choose an index of `nums` and increment the element at that index by `1`.
Return _the **maximum possible frequency** of an element after performing **at mos... | Calculate the prefix hashing array for s. Use the prefix hashing array to calculate the hashing value of each substring. Compare the hashing values to determine the unique substrings. There could be collisions if you use hashing, what about double hashing. | String,Trie,Rolling Hash,Suffix Array,Hash Function | Medium | null |
1,992 | welcome back guys now let's see the second question of bi-weekly contest second question of bi-weekly contest second question of bi-weekly contest 60 uh like first of all i will explain the question what the question is like we are given certain ones and certain zeros in a matrix and there is and if one is present then... | Find All Groups of Farmland | sort-linked-list-already-sorted-using-absolute-values | You are given a **0-indexed** `m x n` binary matrix `land` where a `0` represents a hectare of forested land and a `1` represents a hectare of farmland.
To keep the land organized, there are designated rectangular areas of hectares that consist **entirely** of farmland. These rectangular areas are called **groups**. N... | The nodes with positive values are already in the correct order. Nodes with negative values need to be moved to the front. Nodes with negative values are in reversed order. | Linked List,Two Pointers,Sorting | Medium | 148 |
785 | and so today we are looking at leap code number 785 is graph by part type and this is a very popular question we can see that facebook in the last six months has asked it 16 times ebay bite dance amazon and uh so yeah let's get into it so is graph bipartite first we got to figure out what is a bipartite graph so given ... | 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 |
690 | hi let's talk about employee importance so you are given a data structure of employee information which include the employee unique id their importance value and your direct subordinate id so this is employee class which is this and you are given the list of employee so you do you need to find out the total given integ... | Employee Importance | employee-importance | You have a data structure of employee information, including the employee's unique ID, importance value, and direct subordinates' IDs.
You are given an array of employees `employees` where:
* `employees[i].id` is the ID of the `ith` employee.
* `employees[i].importance` is the importance value of the `ith` employ... | null | Hash Table,Depth-First Search,Breadth-First Search | Medium | 339 |
486 | um hello so today we are going to do this problem which is part of Fleet code daily challenge predict the winner um so basically here we have an array of numbers and we have two players that are playing a game um player one and player two we just give them those names and um they take turns and we are told that player ... | Predict the Winner | predict-the-winner | You are given an integer array `nums`. Two players are playing a game with this array: player 1 and player 2.
Player 1 and player 2 take turns, with player 1 starting first. Both players start the game with a score of `0`. At each turn, the player takes one of the numbers from either end of the array (i.e., `nums[0]` ... | null | Array,Math,Dynamic Programming,Recursion,Game Theory | Medium | 464 |
303 | hello and welcome well continuation press add patterns with the range sum query immutable which is quite a mouthful so um we are giving an integer array of norms and we want to calculate the sum of elements the sum of the element of numbers between the given indices and we can say that we are given the number minus 2 0... | Range Sum Query - Immutable | range-sum-query-immutable | Given an integer array `nums`, handle multiple queries of the following type:
1. Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`.
Implement the `NumArray` class:
* `NumArray(int[] nums)` Initializes the object with the integer array `nums`.
* ... | null | Array,Design,Prefix Sum | Easy | 304,307,325 |
279 | hi let's solve today's daily challenge that is perfect squares in this question we are given an integer n and we need to return the least number of perfect square numbers so what is perfect square they have defined here but we know what a perfect square is basically consider all the numbers from 1 to n and square them ... | Perfect Squares | perfect-squares | Given an integer `n`, return _the least number of perfect square numbers that sum to_ `n`.
A **perfect square** is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, `1`, `4`, `9`, and `16` are perfect squares while `3` and `11` are not.
**Example ... | null | Math,Dynamic Programming,Breadth-First Search | Medium | 204,264 |
1,335 | hello friends today let's show minimum difficulty of a job schedule so we are given a list of jobs and we want to finish it using d-days finish it using d-days finish it using d-days we have some construct constraints the first thing that we must divide these drops in the order so that means we cannot for this example ... | Minimum Difficulty of a Job Schedule | maximum-candies-allocated-to-k-children | You want to schedule a list of jobs in `d` days. Jobs are dependent (i.e To work on the `ith` job, you have to finish all the jobs `j` where `0 <= j < i`).
You have to finish **at least** one task every day. The difficulty of a job schedule is the sum of difficulties of each day of the `d` days. The difficulty of a da... | For a fixed number of candies c, how can you check if each child can get c candies? Use binary search to find the maximum c as the answer. | Array,Binary Search | Medium | 907,1886,2000,2027,2188,2294 |
1,372 | hello everyone so in this video let us talk about one more medial problem from lead code the problem name is longest zigzag path in a binary tree so problem statement goes like this that you're given a root of the binary tree don't worry I will show you with an example as well but a zigzag path for a binary tree is def... | Longest ZigZag Path in a Binary Tree | check-if-it-is-a-good-array | You are given the `root` of a binary tree.
A ZigZag path for a binary tree is defined as follow:
* Choose **any** node in the binary tree and a direction (right or left).
* If the current direction is right, move to the right child of the current node; otherwise, move to the left child.
* Change the direction f... | Eq. ax+by=1 has solution x, y if gcd(a,b) = 1. Can you generalize the formula?. Check Bézout's lemma. | Array,Math,Number Theory | Hard | null |
105 | That hey guys welcome to taste mulayam nivedita and in this video we are going to solve the problem statement of construct mind retreat the giver is here you have been given a pre-order of binary tree these pre-order of binary tree these pre-order of binary tree these orders have been placed ok and you have been told t... | Construct Binary Tree from Preorder and Inorder Traversal | construct-binary-tree-from-preorder-and-inorder-traversal | Given two integer arrays `preorder` and `inorder` where `preorder` is the preorder traversal of a binary tree and `inorder` is the inorder traversal of the same tree, construct and return _the binary tree_.
**Example 1:**
**Input:** preorder = \[3,9,20,15,7\], inorder = \[9,3,15,20,7\]
**Output:** \[3,9,20,null,null,... | null | Array,Hash Table,Divide and Conquer,Tree,Binary Tree | Medium | 106 |
1,281 | all right so we got another leak code for you here uh this is 1281. subtract the product and sum of digits of an integer all right so it says given an integer n return the difference between the product of its digit and the sum of its digits so basically they're going to give us this integer here um and then we are goi... | Subtract the Product and Sum of Digits of an Integer | can-make-palindrome-from-substring | Given an integer number `n`, return the difference between the product of its digits and the sum of its digits.
**Example 1:**
**Input:** n = 234
**Output:** 15
**Explanation:**
Product of digits = 2 \* 3 \* 4 = 24
Sum of digits = 2 + 3 + 4 = 9
Result = 24 - 9 = 15
**Example 2:**
**Input:** n = 4421
**Output:**... | Since we can rearrange the substring, all we care about is the frequency of each character in that substring. How to find the character frequencies efficiently ? As a preprocess, calculate the accumulate frequency of all characters for all prefixes of the string. How to check if a substring can be changed to a palindro... | Hash Table,String,Bit Manipulation,Prefix Sum | Medium | 2165 |
48 | everyone welcome back and let's write some more neat code today we're given an n by n matrix so this time it's a square matrix for sure representing some image and we want to rotate that image by 90 degrees clockwise and we are required to do this in place so we cannot allocate more memory we can't just make a copy of ... | Rotate Image | rotate-image | You are given an `n x n` 2D `matrix` representing an image, rotate the image by **90** degrees (clockwise).
You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm), which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotati... | null | Array,Math,Matrix | Medium | 2015 |
1,007 | what's up guys how's it going today we're going to be going over another interview question today our interview question is called minimum domino rotation for equal row and this is the question that's currently being asked by google right now okay guys so today the interview question we're going to be going over is cal... | Minimum Domino Rotations For Equal Row | numbers-with-same-consecutive-differences | In a row of dominoes, `tops[i]` and `bottoms[i]` represent the top and bottom halves of the `ith` domino. (A domino is a tile with two numbers from 1 to 6 - one on each half of the tile.)
We may rotate the `ith` domino, so that `tops[i]` and `bottoms[i]` swap values.
Return the minimum number of rotations so that all... | null | Backtracking,Breadth-First Search | Medium | null |
150 | Are Hello Guys Welcome To The Video Serious When Coding Luta Problem Solve Evaluator Reverse Order Situation Half Velvet The Value Of Merit In Expression But Not In The Normal Station In The River Pollution Water Pollution In The Morning Prayers For Simple Language Normal Rate Is That Options and Friends and Family Sup... | Evaluate Reverse Polish Notation | evaluate-reverse-polish-notation | You are given an array of strings `tokens` that represents an arithmetic expression in a [Reverse Polish Notation](http://en.wikipedia.org/wiki/Reverse_Polish_notation).
Evaluate the expression. Return _an integer that represents the value of the expression_.
**Note** that:
* The valid operators are `'+'`, `'-'`, ... | null | Array,Math,Stack | Medium | 224,282 |
535 | hey everyone welcome back and let's write some more neat code today so today let's solve a very popular interview question i've actually been asked this question in a phone interview it's called encode and decode tiny url and the good thing about it is it's actually pretty easy so it's definitely a good problem to unde... | Encode and Decode TinyURL | encode-and-decode-tinyurl | > Note: This is a companion problem to the [System Design](https://leetcode.com/discuss/interview-question/system-design/) problem: [Design TinyURL](https://leetcode.com/discuss/interview-question/124658/Design-a-URL-Shortener-(-TinyURL-)-System/).
TinyURL is a URL shortening service where you enter a URL such as `htt... | null | Hash Table,String,Design,Hash Function | Medium | null |
1,630 | hi guys so today's question is medium complexity that is so this has been solved and the number of test cases passes 102 and this is the redeemable complexity quotient so let me take to the proper description a sequence of number is called automatically which consists of at least two elements and difference between Dev... | Arithmetic Subarrays | count-odd-numbers-in-an-interval-range | A sequence of numbers is called **arithmetic** if it consists of at least two elements, and the difference between every two consecutive elements is the same. More formally, a sequence `s` is arithmetic if and only if `s[i+1] - s[i] == s[1] - s[0]` for all valid `i`.
For example, these are **arithmetic** sequences:
1... | If the range (high - low + 1) is even, the number of even and odd numbers in this range will be the same. If the range (high - low + 1) is odd, the solution will depend on the parity of high and low. | Math | Easy | null |
352 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem data stream as disjoint intervals this problem is tricky Dicky but it's definitely not a hard problem in my opinion but that's okay because there are probably medium problems that actually do qualify as hard problems th... | Data Stream as Disjoint Intervals | data-stream-as-disjoint-intervals | Given a data stream input of non-negative integers `a1, a2, ..., an`, summarize the numbers seen so far as a list of disjoint intervals.
Implement the `SummaryRanges` class:
* `SummaryRanges()` Initializes the object with an empty stream.
* `void addNum(int value)` Adds the integer `value` to the stream.
* `int... | null | Binary Search,Design,Ordered Set | Hard | 228,436,715 |
472 | good evening everyone today we are going to do the daily lead code challenge of 27 January 2023 that is question number 472 concatenated words we are given an array of strings without duplicates and we have to return all concatenated words in the given list and what is the concatenated word it is defined as a string th... | Concatenated Words | concatenated-words | Given an array of strings `words` (**without duplicates**), return _all the **concatenated words** in the given list of_ `words`.
A **concatenated word** is defined as a string that is comprised entirely of at least two shorter words (not necesssarily distinct) in the given array.
**Example 1:**
**Input:** words = \... | null | Array,String,Dynamic Programming,Depth-First Search,Trie | Hard | 140 |
1,748 | elements that appear exactly once in the other so return some of all the unique elements of columns so RN will contain duplicate elements so you just need to neglect those elements so yeah you could see in this example two and two are duplicates so they're not unique let's say you will not count them for example the on... | Sum of Unique Elements | best-team-with-no-conflicts | You are given an integer array `nums`. The unique elements of an array are the elements that appear **exactly once** in the array.
Return _the **sum** of all the unique elements of_ `nums`.
**Example 1:**
**Input:** nums = \[1,2,3,2\]
**Output:** 4
**Explanation:** The unique elements are \[1,3\], and the sum is 4.
... | First, sort players by age and break ties by their score. You can now consider the players from left to right. If you choose to include a player, you must only choose players with at least that score later on. | Array,Dynamic Programming,Sorting | Medium | null |
228 | hello guys welcome to my YouTube channel today we are going to show that daily need for Challenge and ask for the challenge here go ahead use the level problem summary ranges so let's read the problem statement you are given a sorted unique integer array nums now make nums very given name who sorted a range a b is set ... | Summary Ranges | summary-ranges | You are given a **sorted unique** integer array `nums`.
A **range** `[a,b]` is the set of all integers from `a` to `b` (inclusive).
Return _the **smallest sorted** list of ranges that **cover all the numbers in the array exactly**_. That is, each element of `nums` is covered by exactly one of the ranges, and there is... | null | Array | Easy | 163,352 |
315 | Hello everyone welcome back, so suddenly Agni-Pawan himself is going to discuss, there Agni-Pawan himself is going to discuss, there Agni-Pawan himself is going to discuss, there is a problem in the record height range, account of roll numbers after safe and basically this is the problem, what to do in this problem, we... | Count of Smaller Numbers After Self | count-of-smaller-numbers-after-self | Given an integer array `nums`, return _an integer array_ `counts` _where_ `counts[i]` _is the number of smaller elements to the right of_ `nums[i]`.
**Example 1:**
**Input:** nums = \[5,2,6,1\]
**Output:** \[2,1,1,0\]
**Explanation:**
To the right of 5 there are **2** smaller elements (2 and 1).
To the right of 2 the... | null | Array,Binary Search,Divide and Conquer,Binary Indexed Tree,Segment Tree,Merge Sort,Ordered Set | Hard | 327,406,493,1482,2280 |
162 | today we'll be going over the cone number 162 would just find peak element so it's a peak element is an element that's great events neighbors given an input array num swear nuns at eyes Uncle Tom's and I plus one find a peak element and returns index the array may contain well so Peaks and in that case return the index... | Find Peak Element | find-peak-element | A peak element is an element that is strictly greater than its neighbors.
Given a **0-indexed** integer array `nums`, find a peak element, and return its index. If the array contains multiple peaks, return the index to **any of the peaks**.
You may imagine that `nums[-1] = nums[n] = -∞`. In other words, an element is... | null | Array,Binary Search | Medium | 882,2047,2273,2316 |
219 | hey folks welcome back to another video today we'll be looking at question 219 contains duplicates two the way we will be approaching this problem is by initializing a hash set and the hassle will keep a track of the k most recent elements that we have seen from the indexed um index element that we are examining right ... | Contains Duplicate II | contains-duplicate-ii | Given an integer array `nums` and an integer `k`, return `true` _if there are two **distinct indices**_ `i` _and_ `j` _in the array such that_ `nums[i] == nums[j]` _and_ `abs(i - j) <= k`.
**Example 1:**
**Input:** nums = \[1,2,3,1\], k = 3
**Output:** true
**Example 2:**
**Input:** nums = \[1,0,1,1\], k = 1
**Outp... | null | Array,Hash Table,Sliding Window | Easy | 217,220 |
215 | hi everyone before I solve the question today so thank you for watching my video so finally I got the 160 subscribers so I remember at the end of November I reached the 100 subscribers so since then just four months I got 60 new subscribers yeah um it was her actually I expected because uh for the first two months um I... | Kth Largest Element in an Array | kth-largest-element-in-an-array | Given an integer array `nums` and an integer `k`, return _the_ `kth` _largest element in the array_.
Note that it is the `kth` largest element in the sorted order, not the `kth` distinct element.
You must solve it in `O(n)` time complexity.
**Example 1:**
**Input:** nums = \[3,2,1,5,6,4\], k = 2
**Output:** 5
**Ex... | null | Array,Divide and Conquer,Sorting,Heap (Priority Queue),Quickselect | Medium | 324,347,414,789,1014,2113,2204,2250 |
1,186 | hi everyone let's discuss about weekly contest 153 third question so maximum sapere with one deletion so we are given an array of integer and with being asked to return the maximum sum of the non empty sub-array with option to delete empty sub-array with option to delete empty sub-array with option to delete one elemen... | Maximum Subarray Sum with One Deletion | building-h2o | Given an array of integers, return the maximum sum for a **non-empty** subarray (contiguous elements) with at most one element deletion. In other words, you want to choose a subarray and optionally delete one element from it so that there is still at least one element left and the sum of the remaining elements is maxim... | null | Concurrency | Medium | null |
349 | hey everybody this is Larry I hit the like button hit the subscribe button let me know how you're doing this farm I'm gonna stop alive right about now yeah so in this section of two arrays 3:49 given in this section of two arrays 3:49 given in this section of two arrays 3:49 given to a waist right up function to comple... | Intersection of Two Arrays | intersection-of-two-arrays | Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must be **unique** and you may return the result in **any order**.
**Example 1:**
**Input:** nums1 = \[1,2,2,1\], nums2 = \[2,2\]
**Output:** \[2\]
**Example 2:**
**Input:** nums1 = \[4,9,5\], nums2 = \... | null | Array,Hash Table,Two Pointers,Binary Search,Sorting | Easy | 350,1149,1392,2190,2282 |
1,047 | okay so let's talk about removal adjacent duplicating the screen so you are giving a shooting s consists of lowercase english later so duplicate removal consists of choosing adjacent and equal later and remove them so basically it's likely so i'm going to draw diagram and then here's it so we already know this to be al... | Remove All Adjacent Duplicates In String | maximize-sum-of-array-after-k-negations | You are given a string `s` consisting of lowercase English letters. A **duplicate removal** consists of choosing two **adjacent** and **equal** letters and removing them.
We repeatedly make **duplicate removals** on `s` until we no longer can.
Return _the final string after all such duplicate removals have been made_... | null | Array,Greedy,Sorting | Easy | 2204 |
1,684 | hey there guys this is code tutorial for you back with another leode problem this one's called count the number of consistent strings it says you're given a string alloud consisting of distinct characters and an array of string words a string is consistent of all characters in The String appear in the string allowed re... | Count the Number of Consistent Strings | find-latest-group-of-size-m | You are given a string `allowed` consisting of **distinct** characters and an array of strings `words`. A string is **consistent** if all characters in the string appear in the string `allowed`.
Return _the number of **consistent** strings in the array_ `words`.
**Example 1:**
**Input:** allowed = "ab ", words = \[... | Since the problem asks for the latest step, can you start the searching from the end of arr? Use a map to store the current “1” groups. At each step (going backwards) you need to split one group and update the map. | Array,Binary Search,Simulation | Medium | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.