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 |
|---|---|---|---|---|---|---|---|---|
460 | hello friends in this session we are going to discuss another lead code problem lfu cache least frequently used cache which is different from lru cache least recently used cache it is good to understand lru cache implementation before understanding lfu cache i have given lru cache video link in the description please w... | LFU Cache | lfu-cache | Design and implement a data structure for a [Least Frequently Used (LFU)](https://en.wikipedia.org/wiki/Least_frequently_used) cache.
Implement the `LFUCache` class:
* `LFUCache(int capacity)` Initializes the object with the `capacity` of the data structure.
* `int get(int key)` Gets the value of the `key` if the... | null | Hash Table,Linked List,Design,Doubly-Linked List | Hard | 146,588 |
1,287 | hey everybody this is Larry this is day 11 of the good day challenge hit the like button hit the Subscribe button Jo the Discord let me know what you think about today's bar I'm in uh Ali Shan here um watching the sun rise the sun has already risen but hopefully so will your the code skills let's do this one yeah I hop... | Element Appearing More Than 25% In Sorted Array | distance-between-bus-stops | Given an integer array **sorted** in non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time, return that integer.
**Example 1:**
**Input:** arr = \[1,2,2,6,6,6,6,7,10\]
**Output:** 6
**Example 2:**
**Input:** arr = \[1,1\]
**Output:** 1
**Constraints:**
* `1 <= arr... | Find the distance between the two stops if the bus moved in clockwise or counterclockwise directions. | Array | Easy | null |
501 | hello and welcome to another video in this video we're going to be working on find mode in a binary search tree and so in this problem you have the root of a binary search tree without duplicates and you want to return the mode I.E the and you want to return the mode I.E the and you want to return the mode I.E the most... | Find Mode in Binary Search Tree | find-mode-in-binary-search-tree | Given the `root` of a binary search tree (BST) with duplicates, return _all the [mode(s)](https://en.wikipedia.org/wiki/Mode_(statistics)) (i.e., the most frequently occurred element) in it_.
If the tree has more than one mode, return them in **any order**.
Assume a BST is defined as follows:
* The left subtree of... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Easy | 98 |
10 | hey everyone welcome back now let's write some more neat code today so today let's solve a pretty hard problem regular expression matching so we are given an input string s and a pattern or a regular expression p and we want to implement regular expression matching and these are the two special characters that we're go... | Regular Expression Matching | regular-expression-matching | Given an input string `s` and a pattern `p`, implement regular expression matching with support for `'.'` and `'*'` where:
* `'.'` Matches any single character.
* `'*'` Matches zero or more of the preceding element.
The matching should cover the **entire** input string (not partial).
**Example 1:**
**Input:... | null | String,Dynamic Programming,Recursion | Hard | 44 |
204 | hey everybody this is larry this is day 10 of the may legal daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's problem uh let's actually scroll down you should say that but one thing i wanted to point out was that you may notice my on the bottom uh t... | 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 |
331 | hey everybody this is larry this is day 26 of the august lego daily challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's farm my internet's been kind of bad so this video may be a little bit weird because i am recording it live so if it does get bad just fas... | Verify Preorder Serialization of a Binary Tree | verify-preorder-serialization-of-a-binary-tree | One way to serialize a binary tree is to use **preorder traversal**. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as `'#'`.
For example, the above binary tree can be serialized to the string `"9,3,4,#,#,1,#,#,2,#,6,#,# "`, where `'#'` repres... | null | String,Stack,Tree,Binary Tree | Medium | null |
154 | hi hello today we will talk another binary search question find minimum in rotated sorted array 2. let's see what this question is all about all right so this question provide us a rotated sorted array and we had to find a min element from it with an extra condition that it hasn't it can have duplicates i have write fe... | Find Minimum in Rotated Sorted Array II | find-minimum-in-rotated-sorted-array-ii | Suppose an array of length `n` sorted in ascending order is **rotated** between `1` and `n` times. For example, the array `nums = [0,1,4,4,5,6,7]` might become:
* `[4,5,6,7,0,1,4]` if it was rotated `4` times.
* `[0,1,4,4,5,6,7]` if it was rotated `7` times.
Notice that **rotating** an array `[a[0], a[1], a[2], .... | null | Array,Binary Search | Hard | 153 |
495 | Jhaal Hello Hi Guys Welcome To Questions Today's Question Attacking In Speed This Question Attacking In Speed This Question Attacking In Speed This Question That Bihar Invoice Jaaye Zero Point Teams Undertaking Can Make This MSG Been Present Condition Not Given Date Attacking In This Question Teams On Standing Ti... | Teemo Attacking | teemo-attacking | Our hero Teemo is attacking an enemy Ashe with poison attacks! When Teemo attacks Ashe, Ashe gets poisoned for a exactly `duration` seconds. More formally, an attack at second `t` will mean Ashe is poisoned during the **inclusive** time interval `[t, t + duration - 1]`. If Teemo attacks again **before** the poison effe... | null | Array,Simulation | Easy | 56,605,649 |
1,523 | uh hey everybody this is larry this is q1 of the recent only contest you'll see me try to do it live and i gotta mess it up a little bit but that but for this problem you're trying to figure out the count of odd numbers between low and high inclusive uh and the user's way to do that is just by um case enumeration i thi... | Count Odd Numbers in an Interval Range | capital-gainloss | Given two non-negative integers `low` and `high`. Return the _count of odd numbers between_ `low` _and_ `high` _(inclusive)_.
**Example 1:**
**Input:** low = 3, high = 7
**Output:** 3
**Explanation:** The odd numbers between 3 and 7 are \[3,5,7\].
**Example 2:**
**Input:** low = 8, high = 10
**Output:** 1
**Explana... | null | Database | Medium | null |
1,013 | hey guys I'm in this video we show see another problem partition array into three parts with equal sum so given array of integers return to if you can partition AR into three non empty Parts with equal sums so question say says the given an array of integers and we should check that if we are able to partition the arra... | Partition Array Into Three Parts With Equal Sum | fibonacci-number | Given an array of integers `arr`, return `true` if we can partition the array into three **non-empty** parts with equal sums.
Formally, we can partition the array if we can find indexes `i + 1 < j` with `(arr[0] + arr[1] + ... + arr[i] == arr[i + 1] + arr[i + 2] + ... + arr[j - 1] == arr[j] + arr[j + 1] + ... + arr[ar... | null | Math,Dynamic Programming,Recursion,Memoization | Easy | 70,872,905,1236 |
1,438 | all right long as continuous are both absolute difference let's make a limit so let's say i have this array of numbers here and i have a limit of 50. and let's just look at this sub array here so this is actually the longest sub array where the difference between any two of the elements so if i like look at any two ele... | Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | find-the-team-size | Given an array of integers `nums` and an integer `limit`, return the size of the longest **non-empty** subarray such that the absolute difference between any two elements of this subarray is less than or equal to `limit`_._
**Example 1:**
**Input:** nums = \[8,2,4,7\], limit = 4
**Output:** 2
**Explanation:** All su... | null | Database | Easy | null |
1,032 | Hello hello everybody welcome to my channel it's all the problem in freedom of characters to implement his team chapter class carlos slim check kar witch gets relief but switzerland constructor in data structure will give words and various methoded witch will get neither patient nor notification glass virgin oldest In ... | Stream of Characters | satisfiability-of-equality-equations | Design an algorithm that accepts a stream of characters and checks if a suffix of these characters is a string of a given array of strings `words`.
For example, if `words = [ "abc ", "xyz "]` and the stream added the four characters (one by one) `'a'`, `'x'`, `'y'`, and `'z'`, your algorithm should detect that the suf... | null | Array,String,Union Find,Graph | Medium | null |
350 | written an array of the intersection so what the question says is that given two arrays and we just need to return the intersection of elements of both the eyes and the condition given is each element in the result must appear as many as times if chosen both the arrays and you may return the result in any order that me... | 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 |
334 | all right so let's talk about the increasing triple sub sequence so you are giving integer real numbers you have to return true if you can fulfill the constraint and this question is pretty straightforward you can use in a brutal force but i don't recommend that brutal force is pretty straightforward ijk right and then... | 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 |
198 | That show, Hello friends, Tech's new video and 175, today is a very special day because we have to steal, not actually, etc., through this question, this is the not actually, etc., through this question, this is the not actually, etc., through this question, this is the house road and this is Google's question and Goog... | 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 |
917 | welcome to september's leeco challenge today's problem is reverse only letters given a string s reverse the string according to the following rules all the characters that are not english letters remain in the same position all the english letters lowercase or uppercase should be reversed normally when we reverse a str... | Reverse Only Letters | boats-to-save-people | Given a string `s`, reverse the string according to the following rules:
* All the characters that are not English letters remain in the same position.
* All the English letters (lowercase or uppercase) should be reversed.
Return `s` _after reversing it_.
**Example 1:**
**Input:** s = "ab-cd"
**Output:** "dc-ba... | null | Array,Two Pointers,Greedy,Sorting | Medium | null |
84 | Hello friends, welcome to the new video, question number 84 is the list of DS rectangle in histogram, Arya's question is tax question, other category is your DP energy question, you guys will get the interview with us on Google Facebook Amazon, let's start. The question is that you have been given an interior, basicall... | Largest Rectangle in Histogram | largest-rectangle-in-histogram | Given an array of integers `heights` representing the histogram's bar height where the width of each bar is `1`, return _the area of the largest rectangle in the histogram_.
**Example 1:**
**Input:** heights = \[2,1,5,6,2,3\]
**Output:** 10
**Explanation:** The above is a histogram where width of each bar is 1.
The l... | null | Array,Stack,Monotonic Stack | Hard | 85,1918 |
303 | guys hope you're doing 3r today's question is range some query immutable it's an easy question on gate code and involves an emic programming as one of the possible solutions and I thought it would be a good one to have on the list so the question says given an integer array nums find the sum of the elements between ind... | 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 |
1,461 | Hello Hi Friends Welcome Back Today We Are Going To Solve Tourist Co Problems A So Lets Start With The First Co Problem 1446 Which Coating Actor Now We Start Looking Into The Details Of The Problems And Their Solutions Is Meant To Mention Data My Channel Dedicated To Help People Work Preparing for Coding Interviews and... | Check If a String Contains All Binary Codes of Size K | count-all-valid-pickup-and-delivery-options | Given a binary string `s` and an integer `k`, return `true` _if every binary code of length_ `k` _is a substring of_ `s`. Otherwise, return `false`.
**Example 1:**
**Input:** s = "00110110 ", k = 2
**Output:** true
**Explanation:** The binary codes of length 2 are "00 ", "01 ", "10 " and "11 ". They can be all f... | Use the permutation and combination theory to add one (P, D) pair each time until n pairs. | Math,Dynamic Programming,Combinatorics | Hard | null |
208 | hey everyone in this video let's take a look at question 208 Implement try only code this is part of our blind 75 list of questions so let's begin in this question a try or a prefix tree is a tree data structure used to efficiently store and retrieve keys in a data set of strings there are various applications of this ... | Implement Trie (Prefix Tree) | implement-trie-prefix-tree | A [**trie**](https://en.wikipedia.org/wiki/Trie) (pronounced as "try ") or **prefix tree** is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker.
Implement the Trie class:
* `Trie()` ... | null | Hash Table,String,Design,Trie | Medium | 211,642,648,676,1433,1949 |
397 | hello YouTube this is another Nikko problem for integer placement giving a positive integer starting from 1 to integer no max value you can the operation that follows if n is even replaced me in divided by 2 it is odd you can't replace n with either n plus 1 or M minus 1 so the max value of integer is odd if we add 1 t... | Integer Replacement | integer-replacement | Given a positive integer `n`, you can apply one of the following operations:
1. If `n` is even, replace `n` with `n / 2`.
2. If `n` is odd, replace `n` with either `n + 1` or `n - 1`.
Return _the minimum number of operations needed for_ `n` _to become_ `1`.
**Example 1:**
**Input:** n = 8
**Output:** 3
**Explanat... | null | Dynamic Programming,Greedy,Bit Manipulation,Memoization | Medium | null |
102 | okay hi guys today we are going to solve a very interesting problem from lead code it's a medium problem and the problem statement is binary tree level order traversal so let me go through the statement and then let's try to explain the problem to all of you so the problem statement is given the root of a binary tree w... | Binary Tree Level Order Traversal | binary-tree-level-order-traversal | Given the `root` of a binary tree, return _the level order traversal of its nodes' values_. (i.e., from left to right, level by level).
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[\[3\],\[9,20\],\[15,7\]\]
**Example 2:**
**Input:** root = \[1\]
**Output:** \[\[1\]\]
**Example 3:**
**I... | null | Tree,Breadth-First Search,Binary Tree | Medium | 103,107,111,314,637,764,1035 |
1,235 | hello guys welcome to algorithms made easy my name is richard and today we will be discussing the question maximum profit in job scheduling in this question we have n jobs where every job is scheduled to be done from start time to end time obtaining a profit now we are given the start and the end time and the profit in... | 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 |
171 | hey guys welcome back to another video and today we're going to be solving the leakout question excel sheet column numbers so in this question we're given a column title as appeared in an excel sheet we respond its corresponding column number so what does this mean so let's say we're given the letter a and a correspond... | 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 |
171 | hello guys my name is Ursula and welcome back to my channel and today we are going to solve a new lead code portion that is Excel sheet column number so question C is given a string column title that represent the column title sap as it appears in an Excel sheet written its corresponding volume number so we have to wri... | 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 |
3 | in this video I want to really explain the sliding window algorithm so let's take a look we're given a string s and we want to find the length of the longest substring without any repeating characters so let's set both L and R to be the beginning marking that our window is just the a to easily keep track of the charact... | Longest Substring Without Repeating Characters | longest-substring-without-repeating-characters | Given a string `s`, find the length of the **longest** **substring** without repeating characters.
**Example 1:**
**Input:** s = "abcabcbb "
**Output:** 3
**Explanation:** The answer is "abc ", with the length of 3.
**Example 2:**
**Input:** s = "bbbbb "
**Output:** 1
**Explanation:** The answer is "b ", with t... | null | Hash Table,String,Sliding Window | Medium | 159,340,1034,1813,2209 |
1,003 | hey everybody this is Larry I hit the like button hit the subscribe button let me know how you're doing this problem I'm gonna stop alive right about now alright when does it end we check if word is valid after substitutions but giving the string ABC is valid for any valid string read we may split we in the two pieces ... | Check If Word Is Valid After Substitutions | minimum-area-rectangle-ii | Given a string `s`, determine if it is **valid**.
A string `s` is **valid** if, starting with an empty string `t = " "`, you can **transform** `t` **into** `s` after performing the following operation **any number of times**:
* Insert string `"abc "` into any position in `t`. More formally, `t` becomes `tleft + "ab... | null | Array,Math,Geometry | Medium | null |
117 | hello everyone so today we are going to do lead good daily challenge populating next right pointers in each node so here we are given with a tree and we are required to do something like this which if we get to our first level node means a node which is at the first level then we are simply we need to do is we need to ... | Populating Next Right Pointers in Each Node II | populating-next-right-pointers-in-each-node-ii | Given a binary tree
struct Node {
int val;
Node \*left;
Node \*right;
Node \*next;
}
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to `NULL`.
Initially, all next pointers are set to `NULL`.
**Example 1:**
**Input:** root = \[1,2,3... | null | Linked List,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 116 |
1,780 | hello guys welcome to another video in the series of coding or today we have with us a problem that is called check if number is a sum of powers of three so we are given an integer n and we have to return truth it is possible to represent n as the sum of distinct powers of three otherwise you have to return false so wh... | Check if Number is a Sum of Powers of Three | lowest-common-ancestor-of-a-binary-tree-ii | Given an integer `n`, return `true` _if it is possible to represent_ `n` _as the sum of distinct powers of three._ Otherwise, return `false`.
An integer `y` is a power of three if there exists an integer `x` such that `y == 3x`.
**Example 1:**
**Input:** n = 12
**Output:** true
**Explanation:** 12 = 31 + 32
**Examp... | Traverse the graph visiting root, left, root, right, root to make an Euler Path Return the node (LCA) that is at the lowest depth between p and q in the Euler Path | Tree,Depth-First Search,Binary Tree | Medium | 235,236,1790,1816 |
70 | hello everyone I'm going to be showing you guys how to do 70 climbing stairs and it's ranked easy for elite code so it says you're climbing a staircase it takes n-steps to reach the top each it takes n-steps to reach the top each it takes n-steps to reach the top each time you can either climb one or two steps and how ... | Climbing Stairs | climbing-stairs | You are climbing a staircase. It takes `n` steps to reach the top.
Each time you can either climb `1` or `2` steps. In how many distinct ways can you climb to the top?
**Example 1:**
**Input:** n = 2
**Output:** 2
**Explanation:** There are two ways to climb to the top.
1. 1 step + 1 step
2. 2 steps
**Example 2:**
... | To reach nth step, what could have been your previous steps? (Think about the step sizes) | Math,Dynamic Programming,Memoization | Easy | 747,1013,1236 |
735 | We have to do that so we will see later how it comes in this type of picture first let's understand so what is given here is where life is asteroids of wait representing asteroid in ours okay so we have the ering of an asteroid asteroids Richter absolute value represented size on Ka, so whatever the error image is, it ... | Asteroid Collision | asteroid-collision | We are given an array `asteroids` of integers representing asteroids in a row.
For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed.
Find out the state of the asteroids after all collisio... | Say a row of asteroids is stable. What happens when a new asteroid is added on the right? | Array,Stack | Medium | 605,2245,2317 |
1,550 | uh hey everybody this is larry this is a cube one of the recent contests uh three consecutive odds um so this is easy and it's easy i think you should just do the first thing that comes into your mind and in this case given that n is less than a thousand just do the stupid thing uh and that's basically what i did um i ... | Three Consecutive Odds | find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows | Given an integer array `arr`, return `true` if there are three consecutive odd numbers in the array. Otherwise, return `false`.
**Example 1:**
**Input:** arr = \[2,6,4,1\]
**Output:** false
**Explanation:** There are no three consecutive odds.
**Example 2:**
**Input:** arr = \[1,2,34,3,4,5,7,23,12\]
**Output:** tru... | Save all visited sums and corresponding indexes in a priority queue. Then, once you pop the smallest sum so far, you can quickly identify the next m candidates for smallest sum by incrementing each row index by 1. | Array,Binary Search,Heap (Priority Queue),Matrix | Hard | null |
266 | guys this is you sir hi Serena going in this video I'm going to take a look at 266 button pattern from permutation clean a string to me for the permutation of the string could form a palindrome told not okay may be true your rear rack true so what is palatal it means like a be a and AP day right so you read it from lef... | Palindrome Permutation | palindrome-permutation | Given a string `s`, return `true` _if a permutation of the string could form a_ _**palindrome**_ _and_ `false` _otherwise_.
**Example 1:**
**Input:** s = "code "
**Output:** false
**Example 2:**
**Input:** s = "aab "
**Output:** true
**Example 3:**
**Input:** s = "carerac "
**Output:** true
**Constraints:**
... | Consider the palindromes of odd vs even length. What difference do you notice? Count the frequency of each character. If each character occurs even number of times, then it must be a palindrome. How about character which occurs odd number of times? | Hash Table,String,Bit Manipulation | Easy | 5,242,267,409 |
470 | hey everybody this is larry this is day 28 of the august decode daily challenge i hit the like button hit the subscribe button and let's get started uh join me on discord and implement rent 10 using van 7 using a given when seven one two seven uh okay yeah i mean okay what are these oh they're just number numbers um so... | 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 |
62 | ne them big this time and welcome back to new video in this video before going to solve six second problem only code and visiting squad unique parts software will give and grade of clan hair in this case which has great of three 2279 teen rose seven columns no This point to be our starting co in which 1000 that is lapt... | 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 |
37 | uh today we're gonna be working on lead code question number 37 suru suroku solver so last time we did just uh we checked for the validity of the circle and the last question this question we're gonna be solving the sudoku so it's going it's gonna be done using a back tracking uh here are the rules it's gonna go from o... | Sudoku Solver | sudoku-solver | Write a program to solve a Sudoku puzzle by filling the empty cells.
A sudoku solution must satisfy **all of the following rules**:
1. Each of the digits `1-9` must occur exactly once in each row.
2. Each of the digits `1-9` must occur exactly once in each column.
3. Each of the digits `1-9` must occur exactly onc... | null | Array,Backtracking,Matrix | Hard | 36,1022 |
665 | um hello so today we are going to do um this problem non-decreasing array non-decreasing array non-decreasing array uh basically what the problem says is we get an array of numbers with n integers and what we want is to check if this array can become non-decreasing this array can become non-decreasing this array can be... | Non-decreasing Array | non-decreasing-array | Given an array `nums` with `n` integers, your task is to check if it could become non-decreasing by modifying **at most one element**.
We define an array is non-decreasing if `nums[i] <= nums[i + 1]` holds for every `i` (**0-based**) such that (`0 <= i <= n - 2`).
**Example 1:**
**Input:** nums = \[4,2,3\]
**Output:... | null | Array | Medium | 2205 |
212 | So hello friends today I have given 48 and my name is Keshav you are watching take it world search second actually this is a hard problem why is it hard actually no problem is hard it just has more parts so if we divide it part by part If you understand the parts then it becomes easy then why is there a reason for it b... | Word Search II | word-search-ii | Given an `m x n` `board` of characters and a list of strings `words`, return _all words on the board_.
Each word must be constructed from letters of sequentially adjacent cells, where **adjacent cells** are horizontally or vertically neighboring. The same letter cell may not be used more than once in a word.
**Exampl... | You would need to optimize your backtracking to pass the larger test. Could you stop backtracking earlier? If the current candidate does not exist in all words' prefix, you could stop backtracking immediately. What kind of data structure could answer such query efficiently? Does a hash table work? Why or why not? How a... | Array,String,Backtracking,Trie,Matrix | Hard | 79,1022,1433 |
46 | hi everyone once again welcome to my channel today in this video we are solving another problem from lit code top and derby question list and the problem is permutations so if you see this problem like and dislike ratio you can get automatically how much important is this problem so and this problem is get asked in all... | Permutations | permutations | Given an array `nums` of distinct integers, return _all the possible permutations_. You can return the answer in **any order**.
**Example 1:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,1\],\[3,1,2\],\[3,2,1\]\]
**Example 2:**
**Input:** nums = \[0,1\]
**Output:** \[\[0,1\],\[1,0\... | null | Array,Backtracking | Medium | 31,47,60,77 |
847 | hey everybody this is Larry this is me doing attempting day 17 of the legal daily challenge hit the like button hit the Subscribe button drop me on Discord let me know what you think about today's problem is going to be 8 47. uh shortest path visiting or notes this seems like a short platform is the name let's take a l... | Shortest Path Visiting All Nodes | shortest-path-visiting-all-nodes | You have an undirected, connected graph of `n` nodes labeled from `0` to `n - 1`. You are given an array `graph` where `graph[i]` is a list of all the nodes connected with node `i` by an edge.
Return _the length of the shortest path that visits every node_. You may start and stop at any node, you may revisit nodes mul... | null | null | Hard | null |
273 | today we're gonna be working on read quote question number 273 uh anterior to english words convert a non-negative integer num to convert a non-negative integer num to convert a non-negative integer num to its english words representation so the num is equal to 1 2 3 which is going to be 123. this number is going to be... | Integer to English Words | integer-to-english-words | Convert a non-negative integer `num` to its English words representation.
**Example 1:**
**Input:** num = 123
**Output:** "One Hundred Twenty Three "
**Example 2:**
**Input:** num = 12345
**Output:** "Twelve Thousand Three Hundred Forty Five "
**Example 3:**
**Input:** num = 1234567
**Output:** "One Million Tw... | Did you see a pattern in dividing the number into chunk of words? For example, 123 and 123000. Group the number by thousands (3 digits). You can write a helper function that takes a number less than 1000 and convert just that chunk to words. There are many edge cases. What are some good test cases? Does your code work ... | Math,String,Recursion | Hard | 12 |
63 | question 63 the code unique path two so you're given an m by n integer array grid there is a robot initially located at the top left corner the robot tries to move to the bottom right corner the robot can only move either down or right at any point in time an obstacle in space are marked as one or zero respectively in ... | Unique Paths II | unique-paths-ii | You are given an `m x n` integer array `grid`. There is a robot initially located at the **top-left corner** (i.e., `grid[0][0]`). The robot tries to move to the **bottom-right corner** (i.e., `grid[m - 1][n - 1]`). The robot can only move either down or right at any point in time.
An obstacle and space are marked as ... | The robot can only move either down or right. Hence any cell in the first row can only be reached from the cell left to it. However, if any cell has an obstacle, you don't let that cell contribute to any path. So, for the first row, the number of ways will simply be
if obstacleGrid[i][j] is not an obstacle
... | Array,Dynamic Programming,Matrix | Medium | 62,1022 |
460 | Peace be upon you, my dear friend. What are you doing? I hope you will be fine and in the best condition. God willing, we will solve the problem together today. Today, if you have not tried the problem, as usual, you must switch to it first before you watch the video. Give yourself some rest at this time, tomorrow, the... | LFU Cache | lfu-cache | Design and implement a data structure for a [Least Frequently Used (LFU)](https://en.wikipedia.org/wiki/Least_frequently_used) cache.
Implement the `LFUCache` class:
* `LFUCache(int capacity)` Initializes the object with the `capacity` of the data structure.
* `int get(int key)` Gets the value of the `key` if the... | null | Hash Table,Linked List,Design,Doubly-Linked List | Hard | 146,588 |
1,675 | Hello everyone, so today we will do division, the problem is that we have given the end of positive integers and we can perform two operations on it. What are the two types of operations we can perform that if the element is and then we can perform it. We can divide by tu means like this is 4 emails then we divided it ... | 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 |
396 | hi so this question is rotate function so you are giving the integer numbers array and then you want to rotate the nodes by K position clockwise so you define the rotate function so this is the formula and then you want to return the maximum of value F of 0 f of one all the way until F of n minus 1. so uh let's look at... | Rotate Function | rotate-function | You are given an integer array `nums` of length `n`.
Assume `arrk` to be an array obtained by rotating `nums` by `k` positions clock-wise. We define the **rotation function** `F` on `nums` as follow:
* `F(k) = 0 * arrk[0] + 1 * arrk[1] + ... + (n - 1) * arrk[n - 1].`
Return _the maximum value of_ `F(0), F(1), ...,... | null | Array,Math,Dynamic Programming | Medium | null |
437 | in this video we're going to take a look at a lethal problem called paths on number three so in this video i'm just going to show you how we can do this in a n squared time complexity as well as a linear time complexity and basically the question is that we're given a binary tree and we want to find uh we want to find ... | Path Sum III | path-sum-iii | Given the `root` of a binary tree and an integer `targetSum`, return _the number of paths where the sum of the values along the path equals_ `targetSum`.
The path does not need to start or end at the root or a leaf, but it must go downwards (i.e., traveling only from parent nodes to child nodes).
**Example 1:**
**In... | null | Tree,Depth-First Search,Binary Tree | Medium | 112,113,666,687 |
476 | Ki Welcome Everyone Today In This Video Bihar Ko * Solid Code Is Question And The Question Is Ko * Solid Code Is Question And The Question Is Ko * Solid Code Is Question And The Question Is Number Complaint In This Question Will Be Given And Enters In Important Where To Written And Judgment Is So Ki Sapoch Bhi Hai And ... | Number Complement | number-complement | 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 `num`, return _its complement_.
**... | null | Bit Manipulation | Easy | null |
144 | hi today we're solving this code number 144 binary tree periodic traversal and basically we are given a root node of a binary tree and we're supposed to travel seeds uh using the pre-order method and seeds uh using the pre-order method and seeds uh using the pre-order method and this is an easiest problem and the only ... | 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,248 | See, in this video we will see lead code 1 2 4 8 In the previous video, we had asked a question, the question was sub ars sum = I told you that when the restrictions which are there become = I told you that when the restrictions which are there become = I told you that when the restrictions which are there become stric... | Count Number of Nice Subarrays | binary-tree-coloring-game | Given an array of integers `nums` and an integer `k`. A continuous subarray is called **nice** if there are `k` odd numbers on it.
Return _the number of **nice** sub-arrays_.
**Example 1:**
**Input:** nums = \[1,1,2,1,1\], k = 3
**Output:** 2
**Explanation:** The only sub-arrays with 3 odd numbers are \[1,1,2,1\] an... | The best move y must be immediately adjacent to x, since it locks out that subtree. Can you count each of (up to) 3 different subtrees neighboring x? | Tree,Depth-First Search,Binary Tree | Medium | null |
215 | So in this video the problem of soil is the test element against quality of Africa and so in this brings your energy in the tenets and number of dry is basically a number which we want to return from direct which is the largest number presented here so let's Ban Sri Lanka Only Nikalna Bulk Rajesh Number Three Se Limit ... | 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 |
91 | Hello Hi Everyone Welcome To My Channel It's All The Problem Record Beans Message Containing Letter From The 2G Is VPN To Dr To Numbers Using Following Mapping 102 And Monitor 2016 Dholi Digits Determine Total Number Of Best Dancers Guarantee 232 Sorry For Example A Number Of Different Video subscribe and subscribe the... | Decode Ways | decode-ways | A message containing letters from `A-Z` can be **encoded** into numbers using the following mapping:
'A' -> "1 "
'B' -> "2 "
...
'Z' -> "26 "
To **decode** an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For examp... | null | String,Dynamic Programming | Medium | 639,2091 |
433 | hello everyone so now we are solving 433 which is minimum genetic mutation it says that you are given a string given two Gene strings start Gene and engine and the gene bank which is basically an area of this written the minimum number of mutations needed to mutate star okay so um I just solve this sum which was I thin... | 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,588 | hello thanks for checking out this video in today's video we'll be looking at lead code problem number one five eight the sum of all odd length sub arrays the problem description says given an array of positive integers we want to calculate the sum of all possible odd length subarrays we're told that a subarray is a co... | Sum of All Odd Length Subarrays | sum-of-all-odd-length-subarrays | Given an array of positive integers `arr`, return _the sum of all possible **odd-length subarrays** of_ `arr`.
A **subarray** is a contiguous subsequence of the array.
**Example 1:**
**Input:** arr = \[1,4,2,5,3\]
**Output:** 58
**Explanation:** The odd-length subarrays of arr and their sums are:
\[1\] = 1
\[4\] = 4... | null | null | Easy | null |
791 | Hello everyone welcome back today we will solve another new problem which is the daily problem of lead code the problem is very interesting you will get to learn a lot here so let's start let's understand what the problem statement is saying to us ok and its So we go to the white board, so what the problem statement is... | Custom Sort String | split-bst | You are given two strings order and s. All the characters of `order` are **unique** and were sorted in some custom order previously.
Permute the characters of `s` so that they match the order that `order` was sorted. More specifically, if a character `x` occurs before a character `y` in `order`, then `x` should occur ... | Use recursion. If root.val <= V, you split root.right into two halves, then join it's left half back on root.right. | Tree,Binary Search Tree,Recursion,Binary Tree | Medium | 450 |
207 | what is going on everyone so today we are going to be looking at lead code number 207 it is called course schedule and i have to say this one is a pretty tricky one it's working off of some patterns and i think the key to this question is really recognizing the patterns that are that this question is asking and once yo... | Course Schedule | course-schedule | There are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses - 1`. You are given an array `prerequisites` where `prerequisites[i] = [ai, bi]` indicates that you **must** take course `bi` first if you want to take course `ai`.
* For example, the pair `[0, 1]`, indicates that to take cou... | This problem is equivalent to finding if a cycle exists in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses. Topological Sort via DFS - A great video tutorial (21 minutes) on Coursera explaining the basic concepts of Topological Sort. Topologica... | Depth-First Search,Breadth-First Search,Graph,Topological Sort | Medium | 210,261,310,630 |
1,572 | That aapke ajay ko hua hai Hello hello everyone welcome to new video in this video marriage ko * Discuss another video marriage ko * Discuss another video marriage ko * Discuss another problem from code problem life more return primary element not primary ok problem said that we are a matriculation -Matriculation will ... | Matrix Diagonal Sum | subrectangle-queries | Given a square matrix `mat`, return the sum of the matrix diagonals.
Only include the sum of all the elements on the primary diagonal and all the elements on the secondary diagonal that are not part of the primary diagonal.
**Example 1:**
**Input:** mat = \[\[**1**,2,**3**\],
\[4,**5**,6\],
... | Use brute force to update a rectangle and, response to the queries in O(1). | Array,Design,Matrix | Medium | null |
203 | hey Haleh let's talk about the Leslie coding challenge question removed linked list elements given a linked list we want to remove the nodes of a given value looking at the first example we have a linked list of seven notes and we want to remove those nodes with value 6 that is to say if we exam this input linked list ... | Remove Linked List Elements | remove-linked-list-elements | Given the `head` of a linked list and an integer `val`, remove all the nodes of the linked list that has `Node.val == val`, and return _the new head_.
**Example 1:**
**Input:** head = \[1,2,6,3,4,5,6\], val = 6
**Output:** \[1,2,3,4,5\]
**Example 2:**
**Input:** head = \[\], val = 1
**Output:** \[\]
**Example 3:**... | null | Linked List,Recursion | Easy | 27,237,2216 |
433 | hello everyone so in this video let us talk about a medium level problem from lead code the problem name is minimum genetic mutation so problem statement goes like this that a gene string can be represented by a eight character long string which has a choice of characters of atgc so these are the nucleotides if you kno... | 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 |
138 | hey guys guess you wonder a problem at Lee code copy this will send a boy on a linked list is given such that each node contains additional random pointer which could point to any node in the list almost returned a deep copy of the list so basically we have to copy Alice rehab who each node has a random pointer so we a... | Copy List with Random Pointer | copy-list-with-random-pointer | A linked list of length `n` is given such that each node contains an additional random pointer, which could point to any node in the list, or `null`.
Construct a [**deep copy**](https://en.wikipedia.org/wiki/Object_copying#Deep_copy) of the list. The deep copy should consist of exactly `n` **brand new** nodes, where e... | Just iterate the linked list and create copies of the nodes on the go. Since a node can be referenced from multiple nodes due to the random pointers, make sure you are not making multiple copies of the same node. You may want to use extra space to keep old node ---> new node mapping to prevent creating multiples copies... | Hash Table,Linked List | Medium | 133,1624,1634 |
1,187 | hello guys welcome to deep codes and in today's video we will discuss liquid question 1187 that says make error strictly increasing so guys although this question is very easy to understand and the question description is very clear but the question is slightly a tougher level where we have to use our mind and try to d... | Make Array Strictly Increasing | print-foobar-alternately | Given two integer arrays `arr1` and `arr2`, return the minimum number of operations (possibly zero) needed to make `arr1` strictly increasing.
In one operation, you can choose two indices `0 <= i < arr1.length` and `0 <= j < arr2.length` and do the assignment `arr1[i] = arr2[j]`.
If there is no way to make `arr1` str... | null | Concurrency | Medium | 1203,1216 |
1,260 | Hello hello everyone welcome back to my channel listen to today's events two problems shipped to degrade show in this problem yagya na today grade of size ambros and when unit to shift grade of time in the operation element subscription will go to columns and elements vich Will give an example of a day after operation ... | Shift 2D Grid | day-of-the-year | Given a 2D `grid` of size `m x n` and an integer `k`. You need to shift the `grid` `k` times.
In one shift operation:
* Element at `grid[i][j]` moves to `grid[i][j + 1]`.
* Element at `grid[i][n - 1]` moves to `grid[i + 1][0]`.
* Element at `grid[m - 1][n - 1]` moves to `grid[0][0]`.
Return the _2D grid_ after... | Have a integer array of how many days there are per month. February gets one extra day if its a leap year. Then, we can manually count the ordinal as day + (number of days in months before this one). | Math,String | Easy | null |
445 | hey guys welcome back to another video and today we're going to be solving the lee code question add two numbers of part two all right so in this question we're given two non-empty linked lists representing two non-empty linked lists representing two non-empty linked lists representing two non-negative integers so non-... | Add Two Numbers II | add-two-numbers-ii | You are given two **non-empty** linked lists representing two non-negative integers. The most significant digit comes first 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 itsel... | null | Linked List,Math,Stack | Medium | 2,1774 |
1,779 | hey everybody this is larry this is me going with q1 of the buy weekly contest 47. find nearest point that's the same x y coordinates um to be honest hit the like button to subscribe on drumming discord if you're here thanks for your support because i don't really think this is a hard problem you can look at my code bu... | Find Nearest Point That Has the Same X or Y Coordinate | hopper-company-queries-i | You are given two integers, `x` and `y`, which represent your current location on a Cartesian grid: `(x, y)`. You are also given an array `points` where each `points[i] = [ai, bi]` represents that a point exists at `(ai, bi)`. A point is **valid** if it shares the same x-coordinate or the same y-coordinate as your loca... | null | Database | Hard | 262,1785,1795,2376 |
59 | what's up guys today we're gonna talking about electrical problem named spiral matrix 2. this is a medium category problem the problem is asked by several giant companies like facebook microsoft linkedin oracle etc uh the problem is pretty straightforward and here is the estimate is given a positive integer n generate ... | Spiral Matrix II | spiral-matrix-ii | Given a positive integer `n`, generate an `n x n` `matrix` filled with elements from `1` to `n2` in spiral order.
**Example 1:**
**Input:** n = 3
**Output:** \[\[1,2,3\],\[8,9,4\],\[7,6,5\]\]
**Example 2:**
**Input:** n = 1
**Output:** \[\[1\]\]
**Constraints:**
* `1 <= n <= 20` | null | Array,Matrix,Simulation | Medium | 54,921 |
871 | hey everybody this is larry this is june 12th the 12th day of the june nico daddy challenge i feel like i've said this before but anyway uh yeah today's problem is minimum number of refueling stops i usually solve this live so this is my disclaimer so if it's a little bit slow just fast forward and all that stuff um ye... | Minimum Number of Refueling Stops | keys-and-rooms | A car travels from a starting position to a destination which is `target` miles east of the starting position.
There are gas stations along the way. The gas stations are represented as an array `stations` where `stations[i] = [positioni, fueli]` indicates that the `ith` gas station is `positioni` miles east of the sta... | null | Depth-First Search,Breadth-First Search,Graph | Medium | 261 |
399 | Hello Everyone Welcome Tension Quiet Days Ago In Dishaon Birthday 27th September List Ko Challenge Today's Problem Missile Edison Electronic Provident Fund Should Be Placid List In The Amazing And Give The Number To Computer Classes The Video then subscribe to the Page So Let's try to understand which gives an example ... | 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 |
704 | hey what's up guys it's Nick white - hey what's up guys it's Nick white - hey what's up guys it's Nick white - tech encoding stuff on twitch and YouTube do all the leak out stuff so if you would do leak code check out my other videos this is just the explore page which helps you learn like everything you need to know p... | Binary Search | binary-search | Given an array of integers `nums` which is sorted in ascending order, and an integer `target`, write a function to search `target` in `nums`. If `target` exists, then return its index. Otherwise, return `-1`.
You must write an algorithm with `O(log n)` runtime complexity.
**Example 1:**
**Input:** nums = \[-1,0,3,5,... | null | null | Easy | null |
928 | hi friends welcome back today we are going to solve one very interesting and hard coding question it's on lead code 928 minimize malware spread 2. so as you can see this is quite likeable problem from life dislike ratio so we will understand this problem uh we will uh with couple of examples in today's session um and i... | Minimize Malware Spread II | surface-area-of-3d-shapes | You are given a network of `n` nodes represented as an `n x n` adjacency matrix `graph`, where the `ith` node is directly connected to the `jth` node if `graph[i][j] == 1`.
Some nodes `initial` are initially infected by malware. Whenever two nodes are directly connected, and at least one of those two nodes is infected... | null | Array,Math,Geometry,Matrix | Easy | null |
974 | hey what's up guys this is chung here so today uh let's take a look at this number 974 subarray sums divisible by k so basically you're given like array a of integers and you need to return like the sub array right which means the contiguous uh non empty list arrays that have a sum which uh divisible by k right so for ... | 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 |
10 | okay hi guys welcome to the channel this is vaca we are going to do another leech good question and the question in question is number 10 regular expression marching right uh pretty straightforward okay it's not pretty straightforward the number of edge cases you have to look at in this question are absolutely uh it's ... | Regular Expression Matching | regular-expression-matching | Given an input string `s` and a pattern `p`, implement regular expression matching with support for `'.'` and `'*'` where:
* `'.'` Matches any single character.
* `'*'` Matches zero or more of the preceding element.
The matching should cover the **entire** input string (not partial).
**Example 1:**
**Input:... | null | String,Dynamic Programming,Recursion | Hard | 44 |
1,727 | let's do lead code cool largest sub matrix with three arrangements you're given a binary matrix of size n times n and you're allowed to rearrange columns of matrix in any order turn the area of the largest sub matrix with the matrix every element of the sub matrix is one after reordering the columns optimally up to ten... | 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 |
73 | Hello friends welcome to coding First Youtube channel in this video I will explain you Elite code problem set Matrix zeros so in this question we will have a m into an integer Matrix and if an element is 0 then we have to set its entire row and column to zeros so you can see here in this example one this is our Matrix ... | Set Matrix Zeroes | set-matrix-zeroes | Given an `m x n` integer matrix `matrix`, if an element is `0`, set its entire row and column to `0`'s.
You must do it [in place](https://en.wikipedia.org/wiki/In-place_algorithm).
**Example 1:**
**Input:** matrix = \[\[1,1,1\],\[1,0,1\],\[1,1,1\]\]
**Output:** \[\[1,0,1\],\[0,0,0\],\[1,0,1\]\]
**Example 2:**
**In... | If any cell of the matrix has a zero we can record its row and column number using additional memory.
But if you don't want to use extra memory then you can manipulate the array instead. i.e. simulating exactly what the question says. Setting cell values to zero on the fly while iterating might lead to discrepancies. ... | Array,Hash Table,Matrix | Medium | 289,2244,2259,2314 |
1,029 | hey what's up guys babybear4812 coming at you one more time uh trying to get one more video in before the sun goes down so it's a bit dark uh today we got 10 29 two city scheduling and i think this will be relatively quick i'm going to keep peaking over there at the uh so i see the cn tower from here and i think the li... | Two City Scheduling | vertical-order-traversal-of-a-binary-tree | A company is planning to interview `2n` people. Given the array `costs` where `costs[i] = [aCosti, bCosti]`, the cost of flying the `ith` person to city `a` is `aCosti`, and the cost of flying the `ith` person to city `b` is `bCosti`.
Return _the minimum cost to fly every person to a city_ such that exactly `n` people... | null | Hash Table,Tree,Depth-First Search,Breadth-First Search,Binary Tree | Hard | null |
115 | lead code problem number 115 distinct subsequences so this problem gives us two string s and string T and the goal is to return the number of distinct subsequences of s which equals to T here's some information about the test cases and here's an example right so we have rabbit here with three Bs and for string T it'll ... | Distinct Subsequences | distinct-subsequences | Given two strings `s` and `t`, return _the number of distinct_ **_subsequences_** _of_ `s` _which equals_ `t`.
The test cases are generated so that the answer fits on a 32-bit signed integer.
**Example 1:**
**Input:** s = "rabbbit ", t = "rabbit "
**Output:** 3
**Explanation:**
As shown below, there are 3 ways you... | null | String,Dynamic Programming | Hard | 2115 |
139 | hello and welcome in today's video we are going to solve the word break which is a quite popular problem it was asked frequently by meda amazon microsoft and google let's look at the first example we are giving an input string s containing lead code and the list of the strings in the word dictionary the required functi... | Word Break | word-break | Given a string `s` and a dictionary of strings `wordDict`, return `true` if `s` can be segmented into a space-separated sequence of one or more dictionary words.
**Note** that the same word in the dictionary may be reused multiple times in the segmentation.
**Example 1:**
**Input:** s = "leetcode ", wordDict = \[ "... | null | Hash Table,String,Dynamic Programming,Trie,Memoization | Medium | 140 |
1,026 | Hello everyone Welcome to my channel here they solve problems Lead code today task number 1026 maximum difference between node and parent level medium Yes the root of a binary tree we need to find the maximum value V so which is the difference between nodes so the difference between nodes A and B such that the differen... | Maximum Difference Between Node and Ancestor | string-without-aaa-or-bbb | Given the `root` of a binary tree, find the maximum value `v` for which there exist **different** nodes `a` and `b` where `v = |a.val - b.val|` and `a` is an ancestor of `b`.
A node `a` is an ancestor of `b` if either: any child of `a` is equal to `b` or any child of `a` is an ancestor of `b`.
**Example 1:**
**Input... | null | String,Greedy | Medium | null |
957 | all right let's talk about the prison cells after 10 days so you have a person's cells a rate and an integer n and for every single day you need to just follow the constraint so if a cell has to adjust neighbors they are both occupied or both vegan right it becomes occupied so uh what it means is like if there is a uh ... | Prison Cells After N Days | minimum-add-to-make-parentheses-valid | There are `8` prison cells in a row and each cell is either occupied or vacant.
Each day, whether the cell is occupied or vacant changes according to the following rules:
* If a cell has two adjacent neighbors that are both occupied or both vacant, then the cell becomes occupied.
* Otherwise, it becomes vacant.
... | null | String,Stack,Greedy | Medium | 2095 |
1,696 | That will be the morning to day to ask question is jump we six Soviet Union to Soham told by name came out if your initial futile effort heroine we here to Vijendra young adult most cases forward so and placid inside Sadher Lau example can go Vaastu study If for this we have to click the like share and subscribe button... | Jump Game VI | strange-printer-ii | You are given a **0-indexed** integer array `nums` and an integer `k`.
You are initially standing at index `0`. In one move, you can jump at most `k` steps forward without going outside the boundaries of the array. That is, you can jump from index `i` to any index in the range `[i + 1, min(n - 1, i + k)]` **inclusive*... | Try thinking in reverse. Given the grid, how can you tell if a colour was painted last? | Array,Graph,Topological Sort,Matrix | Hard | 664 |
409 | hey guys welcome back to another video and today we're going to be solving the lead code question longest palindrome so in this question we're given a string which consists of lowercase or uppercase letters and we need to find the length of the longest palindrome that we can build using those letters and note that this... | Longest Palindrome | longest-palindrome | Given a string `s` which consists of lowercase or uppercase letters, return _the length of the **longest palindrome**_ that can be built with those letters.
Letters are **case sensitive**, for example, `"Aa "` is not considered a palindrome here.
**Example 1:**
**Input:** s = "abccccdd "
**Output:** 7
**Explanation... | null | Hash Table,String,Greedy | Easy | 266,2237 |
1,920 | today we will try to solve lead code easy problem 1920 so we'll try to build array from permutation so let's see how is this problem okay so i'll try to do i will try to challenge this problem in javascript because that's my programming language which i like to code in so what we have to do so we have got here basicall... | Build Array from Permutation | determine-color-of-a-chessboard-square | Given a **zero-based permutation** `nums` (**0-indexed**), build an array `ans` of the **same length** where `ans[i] = nums[nums[i]]` for each `0 <= i < nums.length` and return it.
A **zero-based permutation** `nums` is an array of **distinct** integers from `0` to `nums.length - 1` (**inclusive**).
**Example 1:**
*... | Convert the coordinates to (x, y) - that is, "a1" is (1, 1), "d7" is (4, 7). Try add the numbers together and look for a pattern. | Math,String | Easy | null |
208 | hello there so today's li coding challenge question is implementation of tri prefix tree yeah that's finish the question we have to support three operations insert which is memorize a word search is to find we do we have the word thirdly is the star Swit it's a do we have a partial March for the searched word so that's... | Implement Trie (Prefix Tree) | implement-trie-prefix-tree | A [**trie**](https://en.wikipedia.org/wiki/Trie) (pronounced as "try ") or **prefix tree** is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker.
Implement the Trie class:
* `Trie()` ... | null | Hash Table,String,Design,Trie | Medium | 211,642,648,676,1433,1949 |
274 | hi everyone welcome back for another video we are going to do another decode question the question is h index given a array of integers citations where citations i is the number of citations a researcher received for their i've paper return compute the researchers age index according to the definition of age index on w... | H-Index | h-index | Given an array of integers `citations` where `citations[i]` is the number of citations a researcher received for their `ith` paper, return _the researcher's h-index_.
According to the [definition of h-index on Wikipedia](https://en.wikipedia.org/wiki/H-index): The h-index is defined as the maximum value of `h` such th... | An easy approach is to sort the array first. What are the possible values of h-index? A faster approach is to use extra space. | Array,Sorting,Counting Sort | Medium | 275 |
1,288 | hi all welcome to learn code repeat so today we will be looking at day 4 of the october lead code challenge the name of the problem is remove covered intervals let's look into the problem so the problem says given a list of intervals remove all intervals that are covered by another interval in the list interval a comma... | Remove Covered Intervals | maximum-subarray-sum-with-one-deletion | Given an array `intervals` where `intervals[i] = [li, ri]` represent the interval `[li, ri)`, remove all intervals that are covered by another interval in the list.
The interval `[a, b)` is covered by the interval `[c, d)` if and only if `c <= a` and `b <= d`.
Return _the number of remaining intervals_.
**Example 1:... | How to solve this problem if no deletions are allowed ? Try deleting each element and find the maximum subarray sum to both sides of that element. To do that efficiently, use the idea of Kadane's algorithm. | Array,Dynamic Programming | Medium | null |
48 | said today let's see this rotate an image romantics problem so it's a medium problem let's quickly jump into the description so you're given an n into n 2d matrix representing an image and we are asked to rotate the image by 90 degrees clockwise okay and they're saying that you should have take the image in place which... | 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 |
72 | hello everyone this is mustafa from the code show again with another lead code problem this one is a very popular dynamic programming problem this name is it is a distance the problem statement is that we have like two strings world one and world two and we need to find the minimum number of operation to convert world ... | 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,800 | Hello friends, welcome, this is youtube1 linker challenge, the challenge is going very well, let's go straight to our screen and start, so here I am on the screen, the number of our question today is 1800. And the name of the question is 'Maximum Ascending Sub Array'. name of the question is 'Maximum Ascending Sub Arra... | Maximum Ascending Subarray Sum | concatenation-of-consecutive-binary-numbers | Given an array of positive integers `nums`, return the _maximum possible sum of an **ascending** subarray in_ `nums`.
A subarray is defined as a contiguous sequence of numbers in an array.
A subarray `[numsl, numsl+1, ..., numsr-1, numsr]` is **ascending** if for all `i` where `l <= i < r`, `numsi < numsi+1`. Note th... | Express the nth number value in a recursion formula and think about how we can do a fast evaluation. | Math,Bit Manipulation,Simulation | Medium | null |
802 | hey everyone today we are going to solve the little question find the eventual safe States so there is a directed graph of nodes with each node leveraged from 0 to n minus 1. the graph is represented by a zero index to the integer array graph where graph I is integer array of nodes are adjacent to node I meaning these ... | Find Eventual Safe States | k-th-smallest-prime-fraction | There is a directed graph of `n` nodes with each node labeled from `0` to `n - 1`. The graph is represented by a **0-indexed** 2D integer array `graph` where `graph[i]` is an integer array of nodes adjacent to node `i`, meaning there is an edge from node `i` to each node in `graph[i]`.
A node is a **terminal node** if... | null | Array,Binary Search,Heap (Priority Queue) | Hard | 378,668,719 |
863 | okay so uh need code practice time so in this video there are two goals the first goal is to see how to solve this problem and then we are going to do some coding work and the second goal is to see how we should behave in a real interview so let's get started so remember the first step in the real interview is to alway... | All Nodes Distance K in Binary Tree | sum-of-distances-in-tree | Given the `root` of a binary tree, the value of a target node `target`, and an integer `k`, return _an array of the values of all nodes that have a distance_ `k` _from the target node._
You can return the answer in **any order**.
**Example 1:**
**Input:** root = \[3,5,1,6,2,0,8,null,null,7,4\], target = 5, k = 2
**O... | null | Dynamic Programming,Tree,Depth-First Search,Graph | Hard | 1021,2175 |
1,774 | hello everyone let's take a look at this new core problem it's a um the second problem in the weekly context although it's the second problem but i think it's a little bit hard since it's kind of like a knapsack problem so it's a dp problem also you can solve it unlike by dfs and since the constraint is not set strict ... | Closest Dessert Cost | add-two-polynomials-represented-as-linked-lists | You would like to make dessert and are preparing to buy the ingredients. You have `n` ice cream base flavors and `m` types of toppings to choose from. You must follow these rules when making your dessert:
* There must be **exactly one** ice cream base.
* You can add **one or more** types of topping or have no topp... | Process both linked lists at the same time If the current power of the two heads is equal, add this power with the sum of the coefficients to the answer list. If one head has a larger power, add this power to the answer list and move only this head. | Linked List,Math,Two Pointers | Medium | 2,21,445 |
19 | this is one of the frequently Asked question in interviews like Google mang Facebook companies and the question is like remove and node from each of the list means you have to remove the specific node you will be giving a head of that linked list and removing which node you have to remove so here I have given a link li... | 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 |
523 | hello friends today nests of continuous sub Arisa will give a list of non-negative numbers and their target non-negative numbers and their target non-negative numbers and their target integer K we need to write a function to check if the array has a continuous sub array of size illicit you there are some sub your multi... | 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,609 | hey everybody this is larry this is me going with q2 of the recent contest juvenile trees uh hit the like button to subscribe and join me in discord and let me know what you think so this one is a relatively straight application of either pre-order or in application of either pre-order or in application of either pre-o... | Even Odd Tree | find-all-the-lonely-nodes | A binary tree is named **Even-Odd** if it meets the following conditions:
* The root of the binary tree is at level index `0`, its children are at level index `1`, their children are at level index `2`, etc.
* For every **even-indexed** level, all nodes at the level have **odd** integer values in **strictly increa... | Do a simple tree traversal, try to check if the current node is lonely or not. Node is lonely if at least one of the left/right pointers is null. | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | 563,1005 |
6 | everyone i'm back again with an interesting video this is an interesting problem that we will look at and i would share the solution that i developed to solve this problem uh says the string paypal is hiring is written in a zigzag pattern on a given number of rows like this uh paypal is hiring so zigzag pattern p a y t... | 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 |
1,091 | welcome back to other Jess today's question is leak code1091 shortest path and binary Matrix so given an M by m binary Matrix grid return the length of the shortest clear path in The Matrix if there is no clear path return -1 so a there is no clear path return -1 so a there is no clear path return -1 so a clear path an... | 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 |
1,026 | hello hi guys good morning welcome back to the new video in this we going to see a problem maximum difference between node and ancestors and uh this problem is asked by Amazon Google and Facebook in last one year so in the last 6 months it has not been that frequent but in the last one year it has been let's see what t... | Maximum Difference Between Node and Ancestor | string-without-aaa-or-bbb | Given the `root` of a binary tree, find the maximum value `v` for which there exist **different** nodes `a` and `b` where `v = |a.val - b.val|` and `a` is an ancestor of `b`.
A node `a` is an ancestor of `b` if either: any child of `a` is equal to `b` or any child of `a` is an ancestor of `b`.
**Example 1:**
**Input... | null | String,Greedy | Medium | null |
134 | hey everybody this is Larry this is the seventh day of the legal daily challenge of the year or the sixth day out no let me now look at this uh hit the like button hit the Subscribe button join me on Discord let me know what you think about today's problem I'm gonna just see if there any bonus coins nope uh yeah um tod... | Gas Station | gas-station | There are `n` gas stations along a circular route, where the amount of gas at the `ith` station is `gas[i]`.
You have a car with an unlimited gas tank and it costs `cost[i]` of gas to travel from the `ith` station to its next `(i + 1)th` station. You begin the journey with an empty tank at one of the gas stations.
Gi... | null | Array,Greedy | Medium | 1346 |
71 | guys anyone ask you what is your path in life what is your aim in life do you have to clear your path right so that's a question this is in this question you will just play with the dot double dot and double slash if there is single dot in the string you will go to the current directory if there is double you have to m... | 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 |
316 | hi all welcome to learn code repeat so today we will be looking at day 11 of the october lead code challenge the name of the problem is remove duplicate letters there are two problems in lead code one is three one six and the other is one zero eight one both are of similar type so let us look into the problem so proble... | Remove Duplicate Letters | remove-duplicate-letters | Given a string `s`, remove duplicate letters so that every letter appears once and only once. You must make sure your result is **the smallest in lexicographical order** among all possible results.
**Example 1:**
**Input:** s = "bcabc "
**Output:** "abc "
**Example 2:**
**Input:** s = "cbacdcbc "
**Output:** "a... | Greedily try to add one missing character. How to check if adding some character will not cause problems ? Use bit-masks to check whether you will be able to complete the sub-sequence if you add the character at some index i. | String,Stack,Greedy,Monotonic Stack | Medium | 2157 |
98 | foreign code called validate binary search tree it is a medium let's get right into it given the root of a binary tree determine if it is a valid binary search tree a valid BST is defined as follows the left subtree of a node contains only nodes with keys less than the node's key the right subtree of a node contains on... | Validate Binary Search Tree | validate-binary-search-tree | Given the `root` of a binary tree, _determine if it is a valid binary search tree (BST)_.
A **valid BST** is defined as follows:
* The left subtree of a node contains only nodes with keys **less than** the node's key.
* The right subtree of a node contains only nodes with keys **greater than** the node's key.
* ... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | 94,501 |
1,542 | This point lungs and sunscreen in this question I have given you a string which will only visit someone will keep mother will edit content from zero to nine this is ok now what is the use of it see you tell on this any servicing You can catch the letter post, I caught your reception, now whatever numbers are there in i... | Find Longest Awesome Substring | consecutive-characters | You are given a string `s`. An **awesome** substring is a non-empty substring of `s` such that we can make any number of swaps in order to make it a palindrome.
Return _the length of the maximum length **awesome substring** of_ `s`.
**Example 1:**
**Input:** s = "3242415 "
**Output:** 5
**Explanation:** "24241 " i... | Keep an array power where power[i] is the maximum power of the i-th character. The answer is max(power[i]). | String | Easy | 485,1416,1885,2319 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.