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 |
|---|---|---|---|---|---|---|---|---|
1,726 | Hello Everyone Today Will Not Fall Bilk Dilli Challenge But They Will Win The Contest Question Dob Last Week Ended Subscribe Now To Receive New Updates Account Of Subscribe To Subscribe Our Kunwar 6 Babli Accounted For Mediation Se Independently And Not Interested In The Combination Having Information Spot Flats Loot L... | Tuple with Same Product | coordinate-with-maximum-network-quality | Given an array `nums` of **distinct** positive integers, return _the number of tuples_ `(a, b, c, d)` _such that_ `a * b = c * d` _where_ `a`_,_ `b`_,_ `c`_, and_ `d` _are elements of_ `nums`_, and_ `a != b != c != d`_._
**Example 1:**
**Input:** nums = \[2,3,4,6\]
**Output:** 8
**Explanation:** There are 8 valid tup... | The constraints are small enough to consider every possible coordinate and calculate its quality. | Array,Enumeration | Medium | null |
473 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem match sticks to square we're basically given an integer array of matchsticks where each value in the matchsticks array represents the length of the ith matchstick and we are required to use every single matchstick we ha... | Matchsticks to Square | matchsticks-to-square | You are given an integer array `matchsticks` where `matchsticks[i]` is the length of the `ith` matchstick. You want to use **all the matchsticks** to make one square. You **should not break** any stick, but you can link them up, and each matchstick must be used **exactly one time**.
Return `true` if you can make this ... | Treat the matchsticks as an array. Can we split the array into 4 equal halves? Every matchstick can belong to either of the 4 sides. We don't know which one. Maybe try out all options! For every matchstick, we have to try out each of the 4 options i.e. which side it can belong to. We can make use of recursion for this.... | Array,Dynamic Programming,Backtracking,Bit Manipulation,Bitmask | Medium | null |
309 | hey guys welcome back to another video and today we're going to be solving the lead code question best time to buy and sell stock with cooldown all right so before i get started with the question i just want to mention that if there are any questions that you want me to solve just let me know down in the comments and i... | Best Time to Buy and Sell Stock with Cooldown | best-time-to-buy-and-sell-stock-with-cooldown | You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the following restrictions:
* After you sell your stock, yo... | null | Array,Dynamic Programming | Medium | 121,122 |
797 | hello hi everyone this is Raman deep and I'm back with yet another video that is all paths from source to Target this is a lead C problem and in this problem basically we given a directed a cyclic graph that is a dag which has n nodes and they are labeled from 0 to n minus one and what we have to do in this problem is ... | All Paths From Source to Target | rabbits-in-forest | Given a directed acyclic graph (**DAG**) of `n` nodes labeled from `0` to `n - 1`, find all possible paths from node `0` to node `n - 1` and return them in **any order**.
The graph is given as follows: `graph[i]` is a list of all nodes you can visit from node `i` (i.e., there is a directed edge from node `i` to node `... | null | Array,Hash Table,Math,Greedy | Medium | null |
1,913 | hi everyone welcome back to the channel and to solve code daily challenge problem number 1913 maximum product difference between two pairs so it's a really simple problem to solve and we're going to look into the easiest uh possible solution and the solution will be of two lines only okay two lines of code I mean to sa... | Maximum Product Difference Between Two Pairs | make-the-xor-of-all-segments-equal-to-zero | The **product difference** between two pairs `(a, b)` and `(c, d)` is defined as `(a * b) - (c * d)`.
* For example, the product difference between `(5, 6)` and `(2, 7)` is `(5 * 6) - (2 * 7) = 16`.
Given an integer array `nums`, choose four **distinct** indices `w`, `x`, `y`, and `z` such that the **product differ... | Let's note that for the XOR of all segments with size K to be equal to zeros, nums[i] has to be equal to nums[i+k] Basically, we need to make the first K elements have XOR = 0 and then modify them. | Array,Dynamic Programming,Bit Manipulation | Hard | null |
1,654 | hey what's up guys this is john here again so today let's take a look at the latest bi-weekly contest problem the latest bi-weekly contest problem the latest bi-weekly contest problem number 1654 minimum jumps to reach home right a certain box home is on the axis at a position x okay so your purpose your goal is to hel... | Minimum Jumps to Reach Home | customer-order-frequency | A certain bug's home is on the x-axis at position `x`. Help them get there from position `0`.
The bug jumps according to the following rules:
* It can jump exactly `a` positions **forward** (to the right).
* It can jump exactly `b` positions **backward** (to the left).
* It cannot jump backward twice in a row.
... | null | Database | Easy | null |
147 | today i'm gonna show you how to solve legal question insertion sort list it's a median question giving the head of a singly linked list sort the list use the algorithm called insertion sort so the insertion sword algorithm is you basically insert sort iterates and consuming one input element each repetition and a growi... | Insertion Sort List | insertion-sort-list | Given the `head` of a singly linked list, sort the list using **insertion sort**, and return _the sorted list's head_.
The steps of the **insertion sort** algorithm:
1. Insertion sort iterates, consuming one input element each repetition and growing a sorted output list.
2. At each iteration, insertion sort removes... | null | Linked List,Sorting | Medium | 148,850 |
1,650 | hey yo what's up guys babybear4812 coming at you one more time and today you guys are getting two problems for the price of one uh you're getting problems 1123 which is the lowest common ancestor of deepest leaves problem and it's actually identical to problem 865 i'm not sure why they do this which is called smallest ... | Lowest Common Ancestor of a Binary Tree III | find-root-of-n-ary-tree | Given two nodes of a binary tree `p` and `q`, return _their lowest common ancestor (LCA)_.
Each node will have a reference to its parent node. The definition for `Node` is below:
class Node {
public int val;
public Node left;
public Node right;
public Node parent;
}
According to the **[definition of ... | Node with indegree 0 is the root | Hash Table,Bit Manipulation,Tree,Depth-First Search | Medium | 1655 |
47 | going to show you how to solve legal question 47 permutations to given a collection of numbers that might contain duplicates return all possible unique permutations in any order so we have already sold a permutation one question and uh um from my channel and this is a question that is super similar to uh permutation on... | Permutations II | permutations-ii | Given a collection of numbers, `nums`, that might contain duplicates, return _all possible unique permutations **in any order**._
**Example 1:**
**Input:** nums = \[1,1,2\]
**Output:**
\[\[1,1,2\],
\[1,2,1\],
\[2,1,1\]\]
**Example 2:**
**Input:** nums = \[1,2,3\]
**Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,... | null | Array,Backtracking | Medium | 31,46,267,1038 |
72 | Listened to Desmond of chain pattern this morning and evening, whole talking edit distance, there is a very amazing DP problem in which it is said that you have to convert one train into another by using minimum number of operations. What are your operations? Insult delete and replace travel operation done and you have... | 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 |
941 | hello everyone welcome or welcome back to my channel so today we are going to discuss another problem but before going forward if you have not liked the video please like it subscribe to my channel so that you get notified whenever i post a new video so without any further ado let's get started problem is valid mountai... | Valid Mountain Array | sort-array-by-parity | Given an array of integers `arr`, return _`true` if and only if it is a valid mountain array_.
Recall that arr is a mountain array if and only if:
* `arr.length >= 3`
* There exists some `i` with `0 < i < arr.length - 1` such that:
* `arr[0] < arr[1] < ... < arr[i - 1] < arr[i]`
* `arr[i] > arr[i + 1]... | null | Array,Two Pointers,Sorting | Easy | 2283,2327 |
290 | That's a hello hi everyone today late september challenge that 30 will address which if board pattern is warden giver pattern and spring str find a first year followers in pattern now hair fall hope successful message smear a victim between letters in pattern in the board I am senior, so I dedicate myself to the same w... | Word Pattern | word-pattern | Given a `pattern` and a string `s`, find if `s` follows the same pattern.
Here **follow** means a full match, such that there is a bijection between a letter in `pattern` and a **non-empty** word in `s`.
**Example 1:**
**Input:** pattern = "abba ", s = "dog cat cat dog "
**Output:** true
**Example 2:**
**Input:*... | null | Hash Table,String | Easy | 205,291 |
2,000 | hey what is up it is saturday july 2nd uh welcome to chef the algo guy and yeah um we are gonna get another coding problem going it's yes saturday and july is hot and i am ready to go um get to the beach we do all sorts of i don't know cool summer things but first we gotta figure out uh these algorithms so uh yeah toda... | Reverse Prefix of Word | minimum-speed-to-arrive-on-time | Given a **0-indexed** string `word` and a character `ch`, **reverse** the segment of `word` that starts at index `0` and ends at the index of the **first occurrence** of `ch` (**inclusive**). If the character `ch` does not exist in `word`, do nothing.
* For example, if `word = "abcdefd "` and `ch = "d "`, then you s... | Given the speed the trains are traveling at, can you find the total time it takes for you to arrive? Is there a cutoff where any speeds larger will always allow you to arrive on time? | Array,Binary Search | Medium | 1335,2013,2294 |
746 | hello welcome to my channel i'm here to do my hunter lego challenge and today we have leeco 746 min cars climbing stairs for this question as you know is climbing stairs right and then you can jump one step or two step on the stairs and every time you step on the stair there's a cost so in this array is each stairs hav... | Min Cost Climbing Stairs | prefix-and-suffix-search | You are given an integer array `cost` where `cost[i]` is the cost of `ith` step on a staircase. Once you pay the cost, you can either climb one or two steps.
You can either start from the step with index `0`, or the step with index `1`.
Return _the minimum cost to reach the top of the floor_.
**Example 1:**
**Input... | For a word like "test", consider "#test", "t#test", "st#test", "est#test", "test#test". Then if we have a query like prefix = "te", suffix = "t", we can find it by searching for something we've inserted starting with "t#te". | String,Design,Trie | Hard | 211 |
1,791 | hello everyone and welcome my name is rodrigo and today we will be solving another lead code problem in apl today we will tackle problem 1791 find center of star graph now before we jump right into it i've been getting some comments telling me that i sound like the volume is too low so i try to increase it a little bit... | 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 |
16 | hello everyone I welcome you all in our another DS where we will be solving a new DSA problem in C++ if you haven't new DSA problem in C++ if you haven't new DSA problem in C++ if you haven't checked our playlist the playlist is ready I will be uploading all the DSC questions here so you can check out so let's start ou... | 3Sum Closest | 3sum-closest | Given an integer array `nums` of length `n` and an integer `target`, find three integers in `nums` such that the sum is closest to `target`.
Return _the sum of the three integers_.
You may assume that each input would have exactly one solution.
**Example 1:**
**Input:** nums = \[-1,2,1,-4\], target = 1
**Output:** ... | null | Array,Two Pointers,Sorting | Medium | 15,259 |
134 | hello guys welcome to algorithms made easy my name is rajat and today we will be discussing the question gas station in this question we are given n gas stations along a circular route where the amount of gas at the iath station is gas of i now we have a car with unlimited gas tank and it cost of eye or guests to trave... | 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 |
1,344 | hello friends in this problem we have to find angle between hour and minute uh needles in this clock so you can see some time here so you have to measure this angle so you can find two angles between them one is this bigger angle one is smaller angle this is alpha this is 360 minus alpha so whichever is smaller you hav... | Angle Between Hands of a Clock | maximum-equal-frequency | Given two numbers, `hour` and `minutes`, return _the smaller angle (in degrees) formed between the_ `hour` _and the_ `minute` _hand_.
Answers within `10-5` of the actual value will be accepted as correct.
**Example 1:**
**Input:** hour = 12, minutes = 30
**Output:** 165
**Example 2:**
**Input:** hour = 3, minutes ... | Keep track of the min and max frequencies. The number to be eliminated must have a frequency of 1, same as the others or the same +1. | Array,Hash Table | Hard | null |
93 | okay let's take a look at 93 restore IP addresses so for this problem actually I have Raleigh I have already recorded a 1 video before however for that great video I did not use stream beauty so the runtime is a little bit of high so for this video I put a challenge myself to use stream builders instead of substrings s... | Restore IP Addresses | restore-ip-addresses | A **valid IP address** consists of exactly four integers separated by single dots. Each integer is between `0` and `255` (**inclusive**) and cannot have leading zeros.
* For example, `"0.1.2.201 "` and `"192.168.1.1 "` are **valid** IP addresses, but `"0.011.255.245 "`, `"192.168.1.312 "` and `"192.168@1.1 "` are **... | null | String,Backtracking | Medium | 752 |
387 | hello everyone in this video we're going to be going through lead code problem 387 which is first unique character in a string so this problem states that given a string s find the first non-repeating a string s find the first non-repeating a string s find the first non-repeating character in it and return its index if... | First Unique Character in a String | first-unique-character-in-a-string | Given a string `s`, _find the first non-repeating character in it and return its index_. If it does not exist, return `-1`.
**Example 1:**
**Input:** s = "leetcode"
**Output:** 0
**Example 2:**
**Input:** s = "loveleetcode"
**Output:** 2
**Example 3:**
**Input:** s = "aabb"
**Output:** -1
**Constraints:**
* `... | null | Hash Table,String,Queue,Counting | Easy | 451 |
96 | A Husband Is The Best Way For Dalit To Zoom Challenge And His Problems Unique Binary Search Tree All Types Of Witnesses YouTube Channel Please Do Subscribe Vishal Shila To Complete Your Problems And Right Knowledge Within With Problems Is Given And How Many Structural Evening By Best 30 Duets One Two and Saw That They ... | Unique Binary Search Trees | unique-binary-search-trees | Given an integer `n`, return _the number of structurally unique **BST'**s (binary search trees) which has exactly_ `n` _nodes of unique values from_ `1` _to_ `n`.
**Example 1:**
**Input:** n = 3
**Output:** 5
**Example 2:**
**Input:** n = 1
**Output:** 1
**Constraints:**
* `1 <= n <= 19` | null | Math,Dynamic Programming,Tree,Binary Search Tree,Binary Tree | Medium | 95 |
763 | Jhal Hua Tha Hello Hi Guys Welcome To Cold Weather Today Is Question And Partition Labels In This Question Vijay Given String Of Lower Case In Which State Has Given To Partition A String Into A Very Fast S Possible So That Each Letter Appears In A Most One Part In the list of interior representing a size updates it mea... | Partition Labels | special-binary-string | You are given a string `s`. We want to partition the string into as many parts as possible so that each letter appears in at most one part.
Note that the partition is done so that after concatenating all the parts in order, the resultant string should be `s`.
Return _a list of integers representing the size of these ... | Draw a line from (x, y) to (x+1, y+1) if we see a "1", else to (x+1, y-1).
A special substring is just a line that starts and ends at the same y-coordinate, and that is the lowest y-coordinate reached.
Call a mountain a special substring with no special prefixes - ie. only at the beginning and end is the lowest y-coo... | String,Recursion | Hard | 678 |
39 | welcome to the coding interview question combination sum you're given an array of distinct integers candidates and a target integer target return a list of all unique combinations of candidates where the chosen numbers sum to target you may return the combinations in any order note that the same number may be chosen fr... | Combination Sum | combination-sum | Given an array of **distinct** integers `candidates` and a target integer `target`, return _a list of all **unique combinations** of_ `candidates` _where the chosen numbers sum to_ `target`_._ You may return the combinations in **any order**.
The **same** number may be chosen from `candidates` an **unlimited number of... | null | Array,Backtracking | Medium | 17,40,77,216,254,377 |
165 | how's it going everyone michael here so today we're gonna go over the algorithm problem compare version numbers this problem involves the use of a two-pointer algorithm and it's asked by two-pointer algorithm and it's asked by two-pointer algorithm and it's asked by amazon microsoft and salesforce so let's dive into it... | Compare Version Numbers | compare-version-numbers | Given two version numbers, `version1` and `version2`, compare them.
Version numbers consist of **one or more revisions** joined by a dot `'.'`. Each revision consists of **digits** and may contain leading **zeros**. Every revision contains **at least one character**. Revisions are **0-indexed from left to right**, wit... | null | Two Pointers,String | Medium | null |
1,976 | hi everyone this is anfiosando today i'm going to talk about leeco 1976 number of ways to arrive at destination if you like videos you can support me by subscribe my channel or click liking of these videos to find complete code and all the video list in video description below at first let's look at the problem this vi... | Number of Ways to Arrive at Destination | splitting-a-string-into-descending-consecutive-values | You are in a city that consists of `n` intersections numbered from `0` to `n - 1` with **bi-directional** roads between some intersections. The inputs are generated such that you can reach any intersection from any other intersection and that there is at most one road between any two intersections.
You are given an in... | One solution is to try all possible splits using backtrack Look out for trailing zeros in string | String,Backtracking | Medium | null |
79 | Everyone welcome to my channel again we will discuss some problem from list code word search inside problem number 10 pure problem statement saying you will give one board foot contents vansh character in the cell baby cscs chief will give person search the voice president in this point note How You Can Search Supposed... | Word Search | word-search | Given an `m x n` grid of characters `board` and a string `word`, return `true` _if_ `word` _exists in the grid_.
The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.
**Example 1:**... | null | Array,Backtracking,Matrix | Medium | 212 |
92 | hello everybody so in this video we will be looking at the lead code problem 92 that is reverse linked list 2. so it is a medium level problem so the problem statement says that we are given with the head of a single linked list and we are also given two integers that is left and we are also given right so and left is ... | Reverse Linked List II | reverse-linked-list-ii | Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_.
**Example 1:**
**Input:** head = \[1,2,3,4,5\], left = 2, right = 4
**Output:** \[1,4,3,2,5\]
**Example 2:**
**I... | null | Linked List | Medium | 206 |
746 | everyone welcome back and let's write some more neat code today let's solve minimum cost climbing stairs and this problem is very similar to another problem that we've solved that's called climbing stairs and honestly i think this is probably one of my best videos explaining dynamic programming i really walk through al... | Min Cost Climbing Stairs | prefix-and-suffix-search | You are given an integer array `cost` where `cost[i]` is the cost of `ith` step on a staircase. Once you pay the cost, you can either climb one or two steps.
You can either start from the step with index `0`, or the step with index `1`.
Return _the minimum cost to reach the top of the floor_.
**Example 1:**
**Input... | For a word like "test", consider "#test", "t#test", "st#test", "est#test", "test#test". Then if we have a query like prefix = "te", suffix = "t", we can find it by searching for something we've inserted starting with "t#te". | String,Design,Trie | Hard | 211 |
831 | hey what's going on guys it's ilabel here i recording stuff on youtube chat description for all my information i do all lit good problems uh make sure you subscribe to this channel give me a big thumbs up to support it and this is called masking personal information we are given a personal information screen as which m... | Masking Personal Information | largest-sum-of-averages | You are given a personal information string `s`, representing either an **email address** or a **phone number**. Return _the **masked** personal information using the below rules_.
**Email address:**
An email address is:
* A **name** consisting of uppercase and lowercase English letters, followed by
* The `'@'` ... | null | Array,Dynamic Programming | Medium | null |
1,794 | hello everyone let's take a look at this little problem so it's a log question so let's take a look at the description first so we are given two strings first string and second string and they are zero index and consists only lowercase english letters when you to count the number of index card plates i j a b satisfy th... | Count Pairs of Equal Substrings With Minimum Difference | minimize-deviation-in-array | You are given two strings `firstString` and `secondString` that are **0-indexed** and consist only of lowercase English letters. Count the number of index quadruples `(i,j,a,b)` that satisfy the following conditions:
* `0 <= i <= j < firstString.length`
* `0 <= a <= b < secondString.length`
* The substring of `f... | Assume you start with the minimum possible value for each number so you can only multiply a number by 2 till it reaches its maximum possible value. If there is a better solution than the current one, then it must have either its maximum value less than the current maximum value, or the minimum value larger than the cur... | Array,Greedy,Heap (Priority Queue),Ordered Set | Hard | null |
146 | what's up guys today we're gonna go over lru cache first we'll look at the input and the output so if you already know what lru cache is you can just skip ahead then we'll look at the diagram so i'm gonna try explaining in a way that you remember it even months from now and for the code i'll be linking it down below an... | LRU Cache | lru-cache | Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**.
Implement the `LRUCache` class:
* `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`.
* `int get(int key)` Return the valu... | null | Hash Table,Linked List,Design,Doubly-Linked List | Medium | 460,588,604,1903 |
859 | what's up everyone today we're going to go release code 859 buddy strings first we'll go over the input and the output then we'll look at the approach and finally we'll look at the code and complexity the input is going to be two strings and the output is going to be a boolean true or false this problem is more of just... | 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 |
675 | hello everyone so in this video let us talk about a hardware problem from lead code the problem name is cut off trees for gold event so let's go the problem statement first you're given or you're actually asked to cut all the trees in a forest for a golf event the forest is represented by a m cross n Matrix in The Matr... | Cut Off Trees for Golf Event | cut-off-trees-for-golf-event | You are asked to cut off all the trees in a forest for a golf event. The forest is represented as an `m x n` matrix. In this matrix:
* `0` means the cell cannot be walked through.
* `1` represents an empty cell that can be walked through.
* A number greater than `1` represents a tree in a cell that can be walked... | null | Array,Breadth-First Search,Heap (Priority Queue),Matrix | Hard | null |
350 | Cube welcome back to you have this problem called intersection of two arrays given two integral arrays numbers one nums 2 return an array of their intersection each element in the result must appear as many as um as many times as it shines in both arrays and you may return the results in any order no problem with the w... | 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 |
804 | hey everybody this is larry this is day 17 of the august nicole daddy challenge hit the like button hit the subscribe button join me on discord let me know what you think about today's farm unique morse code words okay so you have some morse code mapping thing uh let's see oh this is in the best okay cool that's cool t... | Unique Morse Code Words | rotated-digits | International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows:
* `'a'` maps to `".- "`,
* `'b'` maps to `"-... "`,
* `'c'` maps to `"-.-. "`, and so on.
For convenience, the full table for the `26` letters of the English alphabet is given below:
\[ ... | null | Math,Dynamic Programming | Medium | null |
344 | and if you don't what you doing anyways this is a character array right um i don't know this is kind of weird but they represent a string with a array of characters which is very convenient for us to reverse so you might be thinking yo why not just start from the end and just you know use a temporary array and just cop... | Reverse String | reverse-string | Write a function that reverses a string. The input string is given as an array of characters `s`.
You must do this by modifying the input array [in-place](https://en.wikipedia.org/wiki/In-place_algorithm) with `O(1)` extra memory.
**Example 1:**
**Input:** s = \["h","e","l","l","o"\]
**Output:** \["o","l","l","e","h... | The entire logic for reversing a string is based on using the opposite directional two-pointer approach! | Two Pointers,String,Recursion | Easy | 345,541 |
838 | hey guys what's up this is steve today let's go through legal problem 838 push dominoes let's take a look at the problem first there are n dominoes in a line and we place each domino vertically upright it's looking like this it's vertically upright every single domino in the beginning we simultaneously push some of the... | Push Dominoes | design-linked-list | There are `n` dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to the left or to the right.
After each second, each domino that is falling to the left pushes the adjacent domino on the left. Similarly, the dominoes falling to the righ... | null | Linked List,Design | Medium | 1337 |
1,441 | Hello everyone welcome to my channel Kodasari with me so today we are going to do video number 14 of our stack playlist ok lead code number leetcode number 1441 is medium but it is not at all medium this is a very easy question actually I do n't know Why is it marked medium? Okay, just pay a little attention to the que... | Build an Array With Stack Operations | minimum-flips-to-make-a-or-b-equal-to-c | You are given an integer array `target` and an integer `n`.
You have an empty stack with the two following operations:
* **`"Push "`**: pushes an integer to the top of the stack.
* **`"Pop "`**: removes the integer on the top of the stack.
You also have a stream of the integers in the range `[1, n]`.
Use the tw... | Check the bits one by one whether they need to be flipped. | Bit Manipulation | Medium | 2323 |
557 | this is the third version of reversing of a strings problem in first version we reverse the entire string in the second version we reverse the string in sizes of k characters and in this version we are reversing the words of the string and in this string the words are separated by single space so this is one word w1 th... | Reverse Words in a String III | reverse-words-in-a-string-iii | Given a string `s`, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.
**Example 1:**
**Input:** s = "Let's take LeetCode contest"
**Output:** "s'teL ekat edoCteeL tsetnoc"
**Example 2:**
**Input:** s = "God Ding"
**Output:** "doG gniD"
**Constr... | null | Two Pointers,String | Easy | 541 |
920 | hi everyone in today challenge we are going to solve this problem the problem I mean number of music please and the problem number is 920 only guess so first of all what we are going to do we are going to clearly understand the problem statement after understanding the problem statement then we will move to the logic p... | Number of Music Playlists | uncommon-words-from-two-sentences | Your music player contains `n` different songs. You want to listen to `goal` songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that:
* Every song is played **at least once**.
* A song can only be played again only if `k` other songs have been played.
Given `n`, `g... | null | Hash Table,String | Easy | 2190 |
1,735 | hey everybody this is larry this is me going with q4 of the reason by weekly contest 44 uh 17 uh count ways to make away with uh product um so actually uh oh yeah hit the like button to subscribe and join me on discord um so i didn't stop just doing the contest i'll have a link below so that you can watch myself during... | Count Ways to Make Array With Product | the-most-frequently-ordered-products-for-each-customer | You are given a 2D integer array, `queries`. For each `queries[i]`, where `queries[i] = [ni, ki]`, find the number of different ways you can place positive integers into an array of size `ni` such that the product of the integers is `ki`. As the number of ways may be too large, the answer to the `ith` query is the numb... | null | Database | Medium | 1688 |
202 | welcome back to python interview coding Series today I will discuss mostly ask coding question and their solution before going to start I apply you to watch this series from the first video so that you can get a clear understanding of what type of question are asked in the coding interview round so let us start the dis... | Happy Number | happy-number | Write an algorithm to determine if a number `n` is happy.
A **happy number** is a number defined by the following process:
* Starting with any positive integer, replace the number by the sum of the squares of its digits.
* Repeat the process until the number equals 1 (where it will stay), or it **loops endlessly ... | null | Hash Table,Math,Two Pointers | Easy | 141,258,263,2076 |
86 | welcome to this daily leak code challenge in this question we'll be optimizing a linked list challenge problem this is an old problem on leak code and it's tough to break into the top ranks but today we'll take that journey to beat over 98 percent given the head of a linked list and a value X we want to partition it su... | Partition List | partition-list | Given the `head` of a linked list and a value `x`, partition it such that all nodes **less than** `x` come before nodes **greater than or equal** to `x`.
You should **preserve** the original relative order of the nodes in each of the two partitions.
**Example 1:**
**Input:** head = \[1,4,3,2,5,2\], x = 3
**Output:**... | null | Linked List,Two Pointers | Medium | 2265 |
796 | hello welcome to my channel i'm here to do my 100 legal challenge today we have lead code 796 rotate string so this question basically input two string a and b and output if we can rotate uh string a by certain amount of number and we can get it to string b so in this case if we rotate left um for do two character for ... | Rotate String | reaching-points | Given two strings `s` and `goal`, return `true` _if and only if_ `s` _can become_ `goal` _after some number of **shifts** on_ `s`.
A **shift** on `s` consists of moving the leftmost character of `s` to the rightmost position.
* For example, if `s = "abcde "`, then it will be `"bcdea "` after one shift.
**Example 1... | null | Math | Hard | null |
74 | Will do video number 3 of the play list. Okay, this is a medium level question. Okay, you have to search the target. They have given some specialty in the studio matrix. What is the specialty of the first Jewish matrix that they have given that there is a man in every row is taken. The interiors in are sorted 1357 and ... | Search a 2D Matrix | search-a-2d-matrix | You are given an `m x n` integer matrix `matrix` with the following two properties:
* Each row is sorted in non-decreasing order.
* The first integer of each row is greater than the last integer of the previous row.
Given an integer `target`, return `true` _if_ `target` _is in_ `matrix` _or_ `false` _otherwise_.
... | null | Array,Binary Search,Matrix | Medium | 240 |
134 | hello everyone welcome to day 21st of january elite code challenge and i hope all of you are having a great time the question that we have in today is gas stations here in this question we are given n gas stations that are placed along a circular route we are also given a car and a cost array the cost signifies the tot... | 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 |
81 | hello guys welcome to algorithms made easy today we will be discussing the question search in rotated sorted array 2. this is a follow-up problem to search in this is a follow-up problem to search in this is a follow-up problem to search in rotated sorted array and i highly suggest you to do that first before moving on... | Search in Rotated Sorted Array II | search-in-rotated-sorted-array-ii | There is an integer array `nums` sorted in non-decreasing order (not necessarily with **distinct** values).
Before being passed to your function, `nums` is **rotated** at an unknown pivot index `k` (`0 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nu... | null | Array,Binary Search | Medium | 33 |
460 | hey everybody this is Larry this is day 29th of delete code day challenge and apparently there's a weekly challenge next so stay tuned for that one as well um hit the like button hit the Subscribe button join me on Discord let me know what you think about this problem and you know and good luck on the contest later if ... | 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 |
923 | hello everyone welcome to coderscam hope you are all doing great and today we are going to see another interesting problem threesome with multiplicity so the input given here is an integer array and a target integer and we have to return the number of tuples i j k such that i less than j less than k and array of i plus... | 3Sum With Multiplicity | super-egg-drop | Given an integer array `arr`, and an integer `target`, return the number of tuples `i, j, k` such that `i < j < k` and `arr[i] + arr[j] + arr[k] == target`.
As the answer can be very large, return it **modulo** `109 + 7`.
**Example 1:**
**Input:** arr = \[1,1,2,2,3,3,4,4,5,5\], target = 8
**Output:** 20
**Explanatio... | null | Math,Binary Search,Dynamic Programming | Hard | 2031 |
540 | hey guys welcome to a new video in today's video we're going to look at the lead code problem and the problem's name is single element in a sorted array so in the input we are given an array consisting of integer elements and the array sorted in ascending order out of which there is one such element which appears only ... | Single Element in a Sorted Array | single-element-in-a-sorted-array | You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once.
Return _the single element that appears only once_.
Your solution must run in `O(log n)` time and `O(1)` space.
**Example 1:**
**Input:** nums = \[1,1,2,3,3,4,4,8,8\... | null | Array,Binary Search | Medium | null |
524 | welcome to february's lego challenge today's problem is longest word and dictionary through deleting given a string and a string dictionary find the longest string in the dictionary that can be formed by deleting some characters of the given string if there are more than one possible results return the longest word wit... | Longest Word in Dictionary through Deleting | longest-word-in-dictionary-through-deleting | Given a string `s` and a string array `dictionary`, return _the longest string in the dictionary that can be formed by deleting some of the given string characters_. If there is more than one possible result, return the longest word with the smallest lexicographical order. If there is no possible result, return the emp... | null | Array,Two Pointers,String,Sorting | Medium | 720 |
71 | Today Vaikuntha Question Seven Shift Medium Level Question Stock Problem Hai Net E Want Help With A Question Is Very Good Example President For Example Easy To Control Solution For Class 8 Ko 102 Pen Refill November Ki Agar Plotting To Remember With High Profile Password Left To Right All Should replace all multiple ch... | 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 |
1,884 | hello guys welcome back today we are going to see uh next question that has been requested in the comment box of other question okay so this question has been asked with the uh the user has asked this question uh in the comment box right and uh so I'll recommend you to watch full videos and I have tried to cover all th... | Egg Drop With 2 Eggs and N Floors | minimum-changes-to-make-alternating-binary-string | You are given **two identical** eggs and you have access to a building with `n` floors labeled from `1` to `n`.
You know that there exists a floor `f` where `0 <= f <= n` such that any egg dropped at a floor **higher** than `f` will **break**, and any egg dropped **at or below** floor `f` will **not break**.
In each ... | Think about how the final string will look like. It will either start with a '0' and be like '010101010..' or with a '1' and be like '10101010..' Try both ways, and check for each way, the number of changes needed to reach it from the given string. The answer is the minimum of both ways. | String | Easy | null |
1,411 | Ajay Ko 200 Hi Guys Welcome To My Channel In This Dynamic Programming Body Suggestion Or Into Consideration Important Question Which Cold Tailors Importance Of Dynamic Programming As Well As Convenience And Ex In Programming Languages Pure In Programming Languages Pure In Programming Languages Pure Problem Networ... | Number of Ways to Paint N × 3 Grid | convert-binary-number-in-a-linked-list-to-integer | You have a `grid` of size `n x 3` and you want to paint each cell of the grid with exactly one of the three colors: **Red**, **Yellow,** or **Green** while making sure that no two adjacent cells have the same color (i.e., no two cells that share vertical or horizontal sides have the same color).
Given `n` the number o... | Traverse the linked list and store all values in a string or array. convert the values obtained to decimal value. You can solve the problem in O(1) memory using bits operation. use shift left operation ( << ) and or operation ( | ) to get the decimal value in one operation. | Linked List,Math | Easy | null |
1,026 | problem is difference between and be given a ro of B and we need to find not a and such that the maximum difference between them will be the maximum one and a should also be the max ancestor of B and it is clearly mentioned that we must take absolute difference okay so let us see what is the what is an okay ancestor is... | 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 |
79 | hi everyone today we are going to solve the readable question was such so you are given M by n grid of characters Bold and the student World return true if World exists in the grid the wall can be constructed from letters of sequentially adjacent cell where adjacent cells are horizontally or vertically neighboring the ... | Word Search | word-search | Given an `m x n` grid of characters `board` and a string `word`, return `true` _if_ `word` _exists in the grid_.
The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.
**Example 1:**... | null | Array,Backtracking,Matrix | Medium | 212 |
138 | foreign copy of a linked list where each node has a random pointer in addition to the next pointer we will be discussing a solution for this problem that takes linear time and utilizes constant space a linked list is a data structure where each element called a node points to the next one this makes linked lists very v... | 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 |
88 | hey what's going on everybody so today we are going to solve uh the one of the coolest problems sorted area so this program is quite good it's literally good so how we're going to perform this problem uh so it's nothing like that is nothing too complicated so there are two ways which we can do i will solve in one way a... | Merge Sorted Array | merge-sorted-array | You are given two integer arrays `nums1` and `nums2`, sorted in **non-decreasing order**, and two integers `m` and `n`, representing the number of elements in `nums1` and `nums2` respectively.
**Merge** `nums1` and `nums2` into a single array sorted in **non-decreasing order**.
The final sorted array should not be re... | You can easily solve this problem if you simply think about two elements at a time rather than two arrays. We know that each of the individual arrays is sorted. What we don't know is how they will intertwine. Can we take a local decision and arrive at an optimal solution? If you simply consider one element each at a ti... | Array,Two Pointers,Sorting | Easy | 21,1019,1028 |
1,095 | hello welcome to today's daily lead code challenge we'll be solving question 195 find in Mountain array uh let's begin found in mountain array so this problem is an interactive problem uh I do not know what that means you may recall that an R is Mountain array if and only if its length is at least three and there exist... | Find in Mountain Array | two-city-scheduling | _(This problem is an **interactive problem**.)_
You may recall that an array `arr` is a **mountain array** if and only if:
* `arr.length >= 3`
* There exists some `i` with `0 < i < arr.length - 1` such that:
* `arr[0] < arr[1] < ... < arr[i - 1] < arr[i]`
* `arr[i] > arr[i + 1] > ... > arr[arr.length ... | null | Array,Greedy,Sorting | Medium | null |
1,557 | hey everyone welcome back and let's write some more neat code today so today I'll solve the problem minimum number of vertices to reach all nodes we're given a directed acyclical graph with n vertices numbered from 0 to n minus one and we want to find the smallest set of vertices from which all other nodes in the graph... | Minimum Number of Vertices to Reach All Nodes | check-if-a-string-contains-all-binary-codes-of-size-k | Given a **directed acyclic graph**, with `n` vertices numbered from `0` to `n-1`, and an array `edges` where `edges[i] = [fromi, toi]` represents a directed edge from node `fromi` to node `toi`.
Find _the smallest set of vertices from which all nodes in the graph are reachable_. It's guaranteed that a unique solution ... | We need only to check all sub-strings of length k. The number of distinct sub-strings should be exactly 2^k. | Hash Table,String,Bit Manipulation,Rolling Hash,Hash Function | Medium | null |
1,679 | Jhal Hello Hi Guys Welcome To And Virus In This Video Get Serial List Question Practice Makes Number Of A Sumtuous So In This Question You Were Given Interior And Comes And When According To Operation Pintu Number From Different Forms Equal To And Removed From Also Are Okay Ninth Maths Number Operation You Can Perform ... | Max Number of K-Sum Pairs | shortest-subarray-to-be-removed-to-make-array-sorted | You are given an integer array `nums` and an integer `k`.
In one operation, you can pick two numbers from the array whose sum equals `k` and remove them from the array.
Return _the maximum number of operations you can perform on the array_.
**Example 1:**
**Input:** nums = \[1,2,3,4\], k = 5
**Output:** 2
**Explana... | The key is to find the longest non-decreasing subarray starting with the first element or ending with the last element, respectively. After removing some subarray, the result is the concatenation of a sorted prefix and a sorted suffix, where the last element of the prefix is smaller than the first element of the suffix... | Array,Two Pointers,Binary Search,Stack,Monotonic Stack | Medium | null |
162 | welcome guys so let's start in the code 162 fight fine pick anime uh yeah this problem is basically uh famous results that uh i mean the old school problem okay so basically the pig elements basically uh the pig element is strictly greater than its neighbor okay uh so which means that uh okay so let me just write it so... | 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 |
216 | cool find all possible combinations of K numbers that add up to a number and given that the numbers 1 to 9 can be used any combination should be a unique set of numbers or numbers should be all numbers will be positive integer the solution set must not contain two brigid combinations okay so this is how they won or pos... | Combination Sum III | combination-sum-iii | Find all valid combinations of `k` numbers that sum up to `n` such that the following conditions are true:
* Only numbers `1` through `9` are used.
* Each number is used **at most once**.
Return _a list of all possible valid combinations_. The list must not contain the same combination twice, and the combinations... | null | Array,Backtracking | Medium | 39 |
110 | going to show you how to solve lethal question balance the binary tree it's an easy legal question so give a binary tree determine if it's height based if it is height based for this problem a height high balanced high balance the binary tree is defined as a binary tree in which the left and right subtree of every node... | Balanced Binary Tree | balanced-binary-tree | Given a binary tree, determine if it is **height-balanced**.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** true
**Example 2:**
**Input:** root = \[1,2,2,3,3,null,null,4,4\]
**Output:** false
**Example 3:**
**Input:** root = \[\]
**Output:** true
**Constraints:**
* The number of nodes ... | null | Tree,Depth-First Search,Binary Tree | Easy | 104 |
208 | hello everybody and welcome back in this video solution let's talk about how to implement prefix trees first things first why even think about a different data structure let's take the case of autocompletion and this is what i've implemented over here this is what we see l-e-e are the three characters that i l-e-e are ... | 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 |
669 | Hello Viewers Welcome To Lord Interested In The Cities For Watching This Time Problems Call Trim Binary Search Tree Surya Yantra Rot By Russian Revolution Is Very Slow And I Agree Military Sudhar Toilets Element Lies Between Lion Harris Guarantee Develop Unique Answer And Where To File Return Must Trim Binary Tree Slap... | Trim a Binary Search Tree | trim-a-binary-search-tree | Given the `root` of a binary search tree and the lowest and highest boundaries as `low` and `high`, trim the tree so that all its elements lies in `[low, high]`. Trimming the tree should **not** change the relative structure of the elements that will remain in the tree (i.e., any node's descendant should remain a desce... | null | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | null |
404 | hey guys welcome back to another video and today we're going to be solving the leakout question sum of left leaves all right so in this question we need to find the sum of all the left leaves in a given binary tree so we're given this example the left leaves are about 9 and 15 so we return 9 plus 15 which is 24. all ri... | Sum of Left Leaves | sum-of-left-leaves | Given the `root` of a binary tree, return _the sum of all left leaves._
A **leaf** is a node with no children. A **left leaf** is a leaf that is the left child of another node.
**Example 1:**
**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** 24
**Explanation:** There are two left leaves in the binary tree, wit... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Easy | null |
1,679 | so today's question as you can see on the screen is that we have to find the max number of pairs that can have the sum equals sub k okay so uh we will be given a array and the target value k that is equal to 5 here so here are like two uh that such pairs that they are sum equals to uh five as you can see three plus two... | Max Number of K-Sum Pairs | shortest-subarray-to-be-removed-to-make-array-sorted | You are given an integer array `nums` and an integer `k`.
In one operation, you can pick two numbers from the array whose sum equals `k` and remove them from the array.
Return _the maximum number of operations you can perform on the array_.
**Example 1:**
**Input:** nums = \[1,2,3,4\], k = 5
**Output:** 2
**Explana... | The key is to find the longest non-decreasing subarray starting with the first element or ending with the last element, respectively. After removing some subarray, the result is the concatenation of a sorted prefix and a sorted suffix, where the last element of the prefix is smaller than the first element of the suffix... | Array,Two Pointers,Binary Search,Stack,Monotonic Stack | Medium | null |
222 | in this problem we have to count the number of nodes in a complete binary tree so first understand what is a complete binary tree a binary tree as the name says it will have at max 2 child but a complete binary tree means that all the nodes have two child except the nodes at second last level they can have one child so... | 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 |
51 | Hello hello guys welcome to khana interesting video the telegraph virud problem is point ko is affairs quiz science quiz page and coins and notes and sports doing hata ki place par example dhak daily change dead play school this is not doing wrong to attack the possible for Example subscribe The Video then subscribe to... | 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 |
230 | hi today i'm talking about leak code problem 230 case smallest element in a binary search tree what this question asks you to do is find the kth smallest element in a binary search tree now a binary search tree is a data structure such that any node excuse me something happened to my screen such that any node has the p... | Kth Smallest Element in a BST | kth-smallest-element-in-a-bst | Given the `root` of a binary search tree, and an integer `k`, return _the_ `kth` _smallest value (**1-indexed**) of all the values of the nodes in the tree_.
**Example 1:**
**Input:** root = \[3,1,4,null,2\], k = 1
**Output:** 1
**Example 2:**
**Input:** root = \[5,3,6,2,4,null,null,1\], k = 3
**Output:** 3
**Cons... | Try to utilize the property of a BST. Try in-order traversal. (Credits to @chan13) What if you could modify the BST node's structure? The optimal runtime complexity is O(height of BST). | Tree,Depth-First Search,Binary Search Tree,Binary Tree | Medium | 94,671 |
49 | Hello Bhavna Kharma Naap Hindi Video Vande In Aur Important Network Problem Andhaan Interview Sake Tak Na To Koi Problem Amazon Jo A Marinara Companies In The Recent Idea Karana Problem Anil Pathak's Group And Gram Siddha Mandir Medium Problem Description Hai Ab In Conversation Na Amalta That Rinku is coming to Indore,... | Group Anagrams | group-anagrams | Given an array of strings `strs`, group **the anagrams** together. You can return the answer in **any order**.
An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
**Example 1:**
**Input:** strs = \["eat","tea","tan... | null | Hash Table,String,Sorting | Medium | 242,249 |
54 | hey everyone welcome back and let's write some more neat code today so today let's look at spiral matrix we are given an m by n matrix and all we need to do is return all of the elements in spiral order so the order that we're given the elements in is one two three four five six seven eight nine right if you go from le... | Spiral Matrix | spiral-matrix | Given an `m x n` `matrix`, return _all elements of the_ `matrix` _in spiral order_.
**Example 1:**
**Input:** matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[1,2,3,6,9,8,7,4,5\]
**Example 2:**
**Input:** matrix = \[\[1,2,3,4\],\[5,6,7,8\],\[9,10,11,12\]\]
**Output:** \[1,2,3,4,8,12,11,10,9,5,6,7\]
**Const... | Well for some problems, the best way really is to come up with some algorithms for simulation. Basically, you need to simulate what the problem asks us to do. We go boundary by boundary and move inwards. That is the essential operation. First row, last column, last row, first column and then we move inwards by 1 and th... | Array,Matrix,Simulation | Medium | 59,921 |
201 | hey guys welcome to Day N of solving lead Cod daily challenges so today's problem is bitwise and of numbers range so the statement is given as given two integers left and right that represent range left and right return the bitwise and of all numbers in this range inclusively that means we need to find the and of the n... | Bitwise AND of Numbers Range | bitwise-and-of-numbers-range | Given two integers `left` and `right` that represent the range `[left, right]`, return _the bitwise AND of all numbers in this range, inclusive_.
**Example 1:**
**Input:** left = 5, right = 7
**Output:** 4
**Example 2:**
**Input:** left = 0, right = 0
**Output:** 0
**Example 3:**
**Input:** left = 1, right = 2147... | null | Bit Manipulation | Medium | null |
897 | hi guys how are you i hope all you are doing good welcome to the learn code easily in this playlist we are moving further and today we will do increasing order search three and yesterday we have done i think we have done one question i think yeah by parity something we have done okay so today we will do this question s... | Increasing Order Search Tree | prime-palindrome | Given the `root` of a binary search tree, rearrange the tree in **in-order** so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only one right child.
**Example 1:**
**Input:** root = \[5,3,6,2,4,null,8,1,null,null,null,7,9\]
**Output:** \[1,null,2,null,3,null,4,nul... | null | Math | Medium | 2202 |
213 | hey what's up guys this is john here so today uh let's take a look at today's daily challenge problem uh number 213 house robber number two um it's very i think it's a classic uh problem you know uh if you guys have done uh the house rubber number one so this one is a little bit extension for the other one so the basic... | House Robber II | house-robber-ii | You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are **arranged in a circle.** That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have a security system connected, and **it will automatical... | Since House[1] and House[n] are adjacent, they cannot be robbed together. Therefore, the problem becomes to rob either House[1]-House[n-1] or House[2]-House[n], depending on which choice offers more money. Now the problem has degenerated to the House Robber, which is already been solved. | Array,Dynamic Programming | Medium | 198,256,276,337,600,656 |
439 | hey everybody this is Larry this is me trying to do week oh yeah week four of the liquor premium daily what July challenge hit the like button hit the Subscribe button join me on Discord let me know what you think about you know just July challenge in general uh yeah I haven't done this one before so let's go right to ... | Ternary Expression Parser | ternary-expression-parser | Given a string `expression` representing arbitrarily nested ternary expressions, evaluate the expression, and return _the result of it_.
You can always assume that the given expression is valid and only contains digits, `'?'`, `':'`, `'T'`, and `'F'` where `'T'` is true and `'F'` is false. All the numbers in the expre... | null | String,Stack,Recursion | Medium | 385,722,736 |
199 | hey everyone welcome back to this channel so friends in this particular video the problem that we are going to solve is binary right side view so we are given the root of a binary and we have to imagine ourselves that we are standing on the right side of the binary and we have to return the values of the nodes that are... | Binary Tree Right Side View | binary-tree-right-side-view | Given the `root` of a binary tree, imagine yourself standing on the **right side** of it, return _the values of the nodes you can see ordered from top to bottom_.
**Example 1:**
**Input:** root = \[1,2,3,null,5,null,4\]
**Output:** \[1,3,4\]
**Example 2:**
**Input:** root = \[1,null,3\]
**Output:** \[1,3\]
**Examp... | null | Tree,Depth-First Search,Breadth-First Search,Binary Tree | Medium | 116,545 |
42 | trapping rain water is one of the important question which is being asked in multiple interviews here a non-negative integers are being given non-negative integers are being given non-negative integers are being given and we have to represent it with the elevator and we have to find out uh for each of the elevator it i... | Trapping Rain Water | trapping-rain-water | Given `n` non-negative integers representing an elevation map where the width of each bar is `1`, compute how much water it can trap after raining.
**Example 1:**
**Input:** height = \[0,1,0,2,1,0,1,3,2,1,2,1\]
**Output:** 6
**Explanation:** The above elevation map (black section) is represented by array \[0,1,0,2,1,... | null | Array,Two Pointers,Dynamic Programming,Stack,Monotonic Stack | Hard | 11,238,407,756 |
509 | hello everyone so in this video let us talk about two important problems the problem name is Fibonacci number and Fibonacci number now I think that most of you might know both of these jumps but it's still important to know these terms and revise it regularly so let us talk about both of these problems in a very fast m... | Fibonacci Number | inorder-successor-in-bst-ii | The **Fibonacci numbers**, commonly denoted `F(n)` form a sequence, called the **Fibonacci sequence**, such that each number is the sum of the two preceding ones, starting from `0` and `1`. That is,
F(0) = 0, F(1) = 1
F(n) = F(n - 1) + F(n - 2), for n > 1.
Given `n`, calculate `F(n)`.
**Example 1:**
**Input:** n = ... | null | Tree,Binary Search Tree,Binary Tree | Medium | 285 |
1,004 | See in this video we are going to question the maximum consecutive descendant of let code is three. Now see what is happening here it is saying given is a binary and one is given i.e. given is a binary and one is given i.e. given is a binary and one is given i.e. one and zero and one is given we have to return maximum.... | Max Consecutive Ones III | least-operators-to-express-number | Given a binary array `nums` and an integer `k`, return _the maximum number of consecutive_ `1`_'s in the array if you can flip at most_ `k` `0`'s.
**Example 1:**
**Input:** nums = \[1,1,1,0,0,0,1,1,1,1,0\], k = 2
**Output:** 6
**Explanation:** \[1,1,1,0,0,**1**,1,1,1,1,**1**\]
Bolded numbers were flipped from 0 to 1.... | null | Math,Dynamic Programming | Hard | null |
1,065 | hey everybody this is Larry this is May 1st uh in theory anyway always I'm doing the fun for May 1st which is the first weekly Premium plan so we're doing week one of the weekly premium farm and it's an easy so let's hopefully do this quickly 1065 index periods of string of Earth string given the strength tax and an ar... | Index Pairs of a String | binary-string-with-substrings-representing-1-to-n | Given a string `text` and an array of strings `words`, return _an array of all index pairs_ `[i, j]` _so that the substring_ `text[i...j]` _is in `words`_.
Return the pairs `[i, j]` in sorted order (i.e., sort them by their first coordinate, and in case of ties sort them by their second coordinate).
**Example 1:**
*... | We only need to check substrings of length at most 30, because 10^9 has 30 bits. | String | Medium | null |
72 | hey how's it going today i'll quickly go over my solution to the liquid 72 added distance problem so given two strings were one two word two return the minimum number of operations required to convert word one to word two you have the following three operations permitted on a word you can insert you can delete or you c... | 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 |
646 | hey everybody this is Larry this is September 29th or 30th depending on where you are hit the like button and subscribe button join me in Discord let me know what you think about today's uh extra bonus question that Larry's doing so yeah so because I've done a lot of these problems I forgot how to do it okay to do yeah... | Maximum Length of Pair Chain | maximum-length-of-pair-chain | You are given an array of `n` pairs `pairs` where `pairs[i] = [lefti, righti]` and `lefti < righti`.
A pair `p2 = [c, d]` **follows** a pair `p1 = [a, b]` if `b < c`. A **chain** of pairs can be formed in this fashion.
Return _the length longest chain which can be formed_.
You do not need to use up all the given int... | null | Array,Dynamic Programming,Greedy,Sorting | Medium | 300,491 |
57 | hey everyone welcome back and let's write some more neat code today so today let's solve the problem insert interval and this is actually another problem from the blind 75 list a list of 75 common leak good questions that we've been tracking on this spreadsheet we're almost done with all of them today we'll be solving ... | Insert Interval | insert-interval | You are given an array of non-overlapping intervals `intervals` where `intervals[i] = [starti, endi]` represent the start and the end of the `ith` interval and `intervals` is sorted in ascending order by `starti`. You are also given an interval `newInterval = [start, end]` that represents the start and end of another i... | null | Array | Medium | 56,715 |
1,414 | Do it Hello everyone in this video Hey Arvind Joe Shoulder problem Phantom number of black numbers Committee's toe keep heavenly number That they are the first number of That numbers were requested at that time by ABP News Now their number Sequences of multiple times award winner Subscription people just made that sequ... | Find the Minimum Number of Fibonacci Numbers Whose Sum Is K | shortest-path-in-a-grid-with-obstacles-elimination | Given an integer `k`, _return the minimum number of Fibonacci numbers whose sum is equal to_ `k`. The same Fibonacci number can be used multiple times.
The Fibonacci numbers are defined as:
* `F1 = 1`
* `F2 = 1`
* `Fn = Fn-1 + Fn-2` for `n > 2.`
It is guaranteed that for the given constraints we can always fin... | Use BFS. BFS on (x,y,r) x,y is coordinate, r is remain number of obstacles you can remove. | Array,Breadth-First Search,Matrix | Hard | 550 |
202 | Hello, I am Gary, a developer child. The problem we are going to solve today is happy number 202. It is a problem of writing a function to check whether the number is a happy number 2. We will receive a number called Happy Number and add that number to each digit. Multiply by the square and all are given to me. Then, w... | Happy Number | happy-number | Write an algorithm to determine if a number `n` is happy.
A **happy number** is a number defined by the following process:
* Starting with any positive integer, replace the number by the sum of the squares of its digits.
* Repeat the process until the number equals 1 (where it will stay), or it **loops endlessly ... | null | Hash Table,Math,Two Pointers | Easy | 141,258,263,2076 |
1,567 | hello and welcome back to the cracking thing youtube channel today we're going to be solving lead code problem 1567 maximum length of subarray with positive product given an array of integers nums find the maximum length of a subarray where the product of all of its elements is positive a sub array of an array is a con... | Maximum Length of Subarray With Positive Product | maximum-number-of-vowels-in-a-substring-of-given-length | Given an array of integers `nums`, find the maximum length of a subarray where the product of all its elements is positive.
A subarray of an array is a consecutive sequence of zero or more values taken out of that array.
Return _the maximum length of a subarray with positive product_.
**Example 1:**
**Input:** nums... | Keep a window of size k and maintain the number of vowels in it. Keep moving the window and update the number of vowels while moving. Answer is max number of vowels of any window. | String,Sliding Window | Medium | null |
3 | welcome to the lid code coding problem longest substring without repeating characters here's the problem statement you're given a string find the length of the longest substring without repeating characters and we have to solve this problem in bigger of in time complexity let's see some examples if we're given this inp... | 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 |
446 | Hello friends today I'm going to solve liquid problem 446 arithmetic slices to subsequence in this problem we are given an integer array nums and we need to return the number of the arithmetic sequences that can be formed from this array so what is a sequence basically sequence is an arithmetics equivalence if the sequ... | Arithmetic Slices II - Subsequence | arithmetic-slices-ii-subsequence | Given an integer array `nums`, return _the number of all the **arithmetic subsequences** of_ `nums`.
A sequence of numbers is called arithmetic if it consists of **at least three elements** and if the difference between any two consecutive elements is the same.
* For example, `[1, 3, 5, 7, 9]`, `[7, 7, 7, 7]`, and ... | null | Array,Dynamic Programming | Hard | 413 |
18 | hey everyone welcome back and let's write some more neat code today so today let's finally solve the problem for some it's been a long time coming we solved the original two sum problem we also solved two sum two and then we solved three sum i definitely recommend solving these two problems before you solve this one be... | 4Sum | 4sum | Given an array `nums` of `n` integers, return _an array of all the **unique** quadruplets_ `[nums[a], nums[b], nums[c], nums[d]]` such that:
* `0 <= a, b, c, d < n`
* `a`, `b`, `c`, and `d` are **distinct**.
* `nums[a] + nums[b] + nums[c] + nums[d] == target`
You may return the answer in **any order**.
**Examp... | null | Array,Two Pointers,Sorting | Medium | 1,15,454,2122 |
279 | hey everybody this is Larry this is Day 22 of delete code daily challenge hit the like button hit the Subscribe button join me on Discord no extra points uh there's a deal apparently uh yeah hit the like button hit the Subscribe button I thought I clicked on it uh join me on Discord let me know what you think about tod... | 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,964 | hey everybody this is larry this is me going with q4 of the weekly contest 253 find the longest valid obstacle course at each position so you know the biggest obstacle for this problem is haha hit the like button hit the subscribe button join me on discord let me know what you think about this problem um and yeah if yo... | Find the Longest Valid Obstacle Course at Each Position | find-interview-candidates | You want to build some obstacle courses. You are given a **0-indexed** integer array `obstacles` of length `n`, where `obstacles[i]` describes the height of the `ith` obstacle.
For every index `i` between `0` and `n - 1` (**inclusive**), find the length of the **longest obstacle course** in `obstacles` such that:
* ... | null | Database | Medium | null |
1,629 | hello everyone welcome to coding culture this channel will contain those programs whose explanation is either not present on youtube or the explanation is present but not up to the mark so without wasting time let's get started so today is the sixth day of the september late coding challenge and the today's question is... | Slowest Key | minimum-possible-integer-after-at-most-k-adjacent-swaps-on-digits | A newly designed keypad was tested, where a tester pressed a sequence of `n` keys, one at a time.
You are given a string `keysPressed` of length `n`, where `keysPressed[i]` was the `ith` key pressed in the testing sequence, and a sorted list `releaseTimes`, where `releaseTimes[i]` was the time the `ith` key was releas... | We want to make the smaller digits the most significant digits in the number. For each index i, check the smallest digit in a window of size k and append it to the answer. Update the indices of all digits in this range accordingly. | String,Greedy,Binary Indexed Tree,Segment Tree | Hard | null |
17 | hey everyone in this video we are going to solve the question of Latter combinations of a phone number on lead code so we are given digits 2 and 3 and we have to return all the possible mappings and combinations we can get by pressing these Keys it's similar to what we used to have in old phones so if we press key we c... | Letter Combinations of a Phone Number | letter-combinations-of-a-phone-number | Given a string containing digits from `2-9` inclusive, return all possible letter combinations that the number could represent. Return the answer in **any order**.
A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.
**Example 1:**
**Input:** di... | null | Hash Table,String,Backtracking | Medium | 22,39,401 |
1,991 | welcome back guys so now let's discuss lead code by weekly contact 60. uh and the question is find the middle index in array so now i will explain the question is like we are given an array which is zero indexed and what we have to find is we have to find an index such that uh the sum of the all the elements on the lef... | Find the Middle Index in Array | league-statistics | Given a **0-indexed** integer array `nums`, find the **leftmost** `middleIndex` (i.e., the smallest amongst all the possible ones).
A `middleIndex` is an index where `nums[0] + nums[1] + ... + nums[middleIndex-1] == nums[middleIndex+1] + nums[middleIndex+2] + ... + nums[nums.length-1]`.
If `middleIndex == 0`, the lef... | null | Database | Medium | null |
1,345 | Railway Admit Card 2017 Acquisition and Subscribe Video Id Subscribe Button Under Everything From Person subscribe to subscribe and subscribe the Video then subscribe to the Page Intermediate Faux Tourist Se Zameer Vway 10 - 1404 subscribe Video Subscribe Vway 10 - 1404 subscribe Video Subscribe Vway 10 - 1404 subscrib... | Jump Game IV | perform-string-shifts | Given an array of integers `arr`, you are initially positioned at the first index of the array.
In one step you can jump from index `i` to index:
* `i + 1` where: `i + 1 < arr.length`.
* `i - 1` where: `i - 1 >= 0`.
* `j` where: `arr[i] == arr[j]` and `i != j`.
Return _the minimum number of steps_ to reach the... | Intuitively performing all shift operations is acceptable due to the constraints. You may notice that left shift cancels the right shift, so count the total left shift times (may be negative if the final result is right shift), and perform it once. | Array,Math,String | Easy | null |
401 | hey everyone welcome back and today we'll be doing another lead code 401 binary watch this is an easy one a Bundy watch has four LEDs on the top represent to represent ours zero to eleven so these four are eight these four LEDs are eight four two and one these are for hours and six LEDs on the bottom which are represen... | Binary Watch | binary-watch | A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent the minutes (0-59). Each LED represents a zero or one, with the least significant bit on the right.
* For example, the below binary watch reads `"4:51 "`.
Given an integer `turnedOn` which represents the number... | Simplify by seeking for solutions that involve comparing bit counts. Consider calculating all possible times for comparison purposes. | Backtracking,Bit Manipulation | Easy | 17,191 |
1,238 | hi everyone with Calvin here so let's discuss about the contest 1 or 60 second question circular permutation in binary representation so given two integer and start our task is to return any permutation of P so from 0 until to power n minus 1 so for example 2 power 3 minus 1 is 7 so from 0 to 7 such the condition here ... | Circular Permutation in Binary Representation | alphabet-board-path | Given 2 integers `n` and `start`. Your task is return **any** permutation `p` of `(0,1,2.....,2^n -1)` such that :
* `p[0] = start`
* `p[i]` and `p[i+1]` differ by only one bit in their binary representation.
* `p[0]` and `p[2^n -1]` must also differ by only one bit in their binary representation.
**Example 1:*... | Create a hashmap from letter to position on the board. Now for each letter, try moving there in steps, where at each step you check if it is inside the boundaries of the board. | Hash Table,String | Medium | null |
891 | so hello everyone so this is sonu and today we are going to discuss the problem from the lead code and the statement is given as we have to calculate the sum of the subsequences with so let us see the statement of the problem so yeah i hope the screen is visible so the problem statement is given as this is the heart le... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.