- 198
- 141 416
Code with Carter
เข้าร่วมเมื่อ 30 มี.ค. 2022
Tutorials on Python, SQL, and System Design.
#python #mysql # systemdesign #leetcode #leetcodesql #leetcodequestionandanswers #coding #programming
#python #mysql # systemdesign #leetcode #leetcodesql #leetcodequestionandanswers #coding #programming
2909. Minimum Sum of Mountain Triplets II - LeetCode Python tutorial
Today I solve and explain very quickly a medium level difficulty leetcode algorithm using Python3 called "2909. Minimum Sum of Mountain Triplets II".
Question: leetcode.com/problems/minimum-sum-of-mountain-triplets-ii
If you found this helpful Like and Subscribe! I solve LeetCode Algorithms (Python/ Java) and SQL Problems daily!
#leetcode #python #python3 #tutorial #coding #programming #leetcodedailychallenge #dailychallenge
Question: leetcode.com/problems/minimum-sum-of-mountain-triplets-ii
If you found this helpful Like and Subscribe! I solve LeetCode Algorithms (Python/ Java) and SQL Problems daily!
#leetcode #python #python3 #tutorial #coding #programming #leetcodedailychallenge #dailychallenge
มุมมอง: 334
วีดีโอ
2908. Minimum Sum of Mountain Triplets I - LeetCode Python tutorial
มุมมอง 369ปีที่แล้ว
Today I solve and explain very quickly an easy level difficulty leetcode algorithm using Python3 called "2908. Minimum Sum of Mountain Triplets i". Question: leetcode.com/problems/minimum-sum-of-mountain-triplets-i If you found this helpful Like and Subscribe! I solve LeetCode Algorithms (Python/ Java) and SQL Problems daily! #leetcode #python #python3 #tutorial #coding #programming #leetcodeda...
119. Pascal's Triangle II - LeetCode Python tutorial
มุมมอง 250ปีที่แล้ว
Today I solve and explain very quickly an easy level difficulty leetcode algorithm using Python3 called "119. Pascal's Triangle II". I go over two different mathematical formulas to solve this using either a recursive or iterative approach. Question: leetcode.com/problems/pascals-triangle-ii If you found this helpful Like and Subscribe! I solve LeetCode Algorithms (Python/ Java) and SQL Problem...
2875. Minimum Size Subarray in Infinite Array - LeetCode Python tutorial
มุมมอง 390ปีที่แล้ว
Today I solve and explain very quickly a medium level difficulty leetcode algorithm using Python3 called "2875. Minimum Size Subarray in Infinite Array". Question: leetcode.com/problems/minimum-size-subarray-in-infinite-array If you found this helpful Like and Subscribe! I solve LeetCode Algorithms (Python/ Java) and SQL Problems daily! #leetcode #python #python3 #tutorial #coding #programming ...
LeetCode 2038. Remove Colored Pieces if Both Neighbors are the Same Color - Python Solution
มุมมอง 163ปีที่แล้ว
Today I solve and explain very quickly a medium level difficulty leetcode algorithm using Python3 called "2038. Remove Colored Pieces if Both Neighbors are the Same Color". I go over how to solve this question in O(N) time & O(1) space by using a "Greedy" approach without having to actually play the entire game. Question: leetcode.com/problems/remove-colored-pieces-if-both-neighbors-are-the-sam...
456. 132 Pattern - LeetCode Python tutorial
มุมมอง 647ปีที่แล้ว
Today I solve and explain very quickly a medium level difficulty leetcode algorithm using Python3 called "456. 132 Pattern". I go over how to solve this question in O(N) time & O(N) space while iterating through the array backwards using a monotonic decreasing stack! Question: leetcode.com/problems/monotonic-array If you found this helpful Like and Subscribe! I solve LeetCode Algorithms (Python...
Leetcode 896. Monotonic Array - Python tutorial
มุมมอง 148ปีที่แล้ว
Today I solve and explain very quickly an easy level difficulty leetcode algorithm using Python3 called "896. Monotonic Array". I go over how to solve this question in O(N) time & constant space while iterating through the array just once! Question: leetcode.com/problems/monotonic-array If you found this helpful Like and Subscribe! I solve LeetCode Algorithms (Python/ Java) and SQL Problems dai...
Leetcode 2393. Count Strictly Increasing Subarrays - Python tutorial
มุมมอง 211ปีที่แล้ว
Today I solve and explain very quickly a medium level difficulty leetcode algorithm using Python3 called "2393. Count Strictly Increasing Subarrays". I go over two possible approaches. One using a monotonic stack the other using the "kadane-ish" pattern. Essentially allowing us to go from O(N) space complexity to O(1)! Question: leetcode.com/problems/count-strictly-increasing-subarrays If you f...
550. Game Play Analysis IV - LeetCode SQL Question
มุมมอง 507ปีที่แล้ว
Today I solve and explain very quickly a medium level difficulty leetcode database query problem using MySQL called "550. Game Play Analysis IV". This is a popular data engineering interview question that makes use of three different queries. Question: leetcode.com/problems/game-play-analysis-iv If you found this helpful Like and Subscribe! I solve LeetCode Algorithms (Python/ Java) and SQL Pro...
316. Remove Duplicate Letters - Google Interview Question
มุมมอง 240ปีที่แล้ว
Today I solve and explain very quickly a medium level difficulty leetcode algorithm using Python3 called "316. Remove Duplicate Letters". This is a popular interview question from Google using the Stack Data Structure. Question: leetcode.com/problems/remove-duplicate-letters If you found this helpful Like and Subscribe! I solve LeetCode Algorithms (Python/ Java) and SQL Problems daily! #leetcod...
877. Stone Game - Cisco Interview Question
มุมมอง 130ปีที่แล้ว
Today I solve and explain very quickly a medium level difficulty leetcode algorithm using Python3 called "877. Stone Game". This is a popular interview question from Cisco using the minimax algorithm. Question: leetcode.com/problems/stone-game If you found this helpful Like and Subscribe! I solve LeetCode Algorithms (Python/ Java) and SQL Problems daily! #leetcode #python #python3 #tutorial #co...
1658. Minimum Operations to Reduce X to Zero - Apple Interview Question
มุมมอง 189ปีที่แล้ว
Today I solve and explain very quickly a medium level difficulty leetcode algorithm using Python3 called "1658. Minimum Operations to Reduce X to Zero". This is a popular interview question using the Sliding Window Pattern. Question: leetcode.com/problems/minimum-operations-to-reduce-x-to-zero If you found this helpful Like and Subscribe! I solve LeetCode Algorithms (Python/ Java) and SQL Probl...
Leetcode 287. Find the Duplicate Number - Microsoft Interview Question
มุมมอง 1.3Kปีที่แล้ว
Today I solve and explain very quickly a medium level difficulty leetcode algorithm using Python3 called "287. Find the Duplicate Number". This is a popular Microsoft Interview problem using Floyd's Cycle Detection Algorithm. Question: leetcode.com/problems/find-the-duplicate-number If you found this helpful Like and Subscribe! I solve LeetCode Algorithms (Python/ Java) and SQL Problems daily! ...
1570. Dot Product of Two Sparse Vectors - Facebook Interview Question
มุมมอง 2.8Kปีที่แล้ว
Today I solve and explain very quickly a medium level difficulty leetcode algorithm using Python3 called "1570. Dot Product of Two Sparse Vectors". This is a popular Facebook Interview problem using a hashmap. Question: leetcode.com/problems/dot-product-of-two-sparse-vectors/ If you found this helpful Like and Subscribe! I solve LeetCode Algorithms (Python/ Java) and SQL Problems daily! #leetco...
[Tesla Interview] Leetcode 1239. Maximum Length of a Concatenated String with Unique Characters
มุมมอง 548ปีที่แล้ว
Today I solve and explain very quickly a medium level difficulty leetcode algorithm using Python3 called "1239. Maximum Length of a Concatenated String with Unique Characters". This is a popular Tesla Interview problem using the backtracking pattern. Question: leetcode.com/problems/maximum-length-of-a-concatenated-string-with-unique-characters If you found this helpful Like and Subscribe! I sol...
LeetCode 1282. Group the People Given the Group Size They Belong To - Apple Interview Question
มุมมอง 547ปีที่แล้ว
LeetCode 1282. Group the People Given the Group Size They Belong To - Apple Interview Question
LeetCode 2519. Count the Number of K-Big Indices - Amazon Interview Question
มุมมอง 1.3Kปีที่แล้ว
LeetCode 2519. Count the Number of K-Big Indices - Amazon Interview Question
LeetCode 358. Rearrange String k Distance Apart - Google Interview Question
มุมมอง 576ปีที่แล้ว
LeetCode 358. Rearrange String k Distance Apart - Google Interview Question
LeetCode 725. Split Linked List in Parts - Amazon Interview Question
มุมมอง 158ปีที่แล้ว
LeetCode 725. Split Linked List in Parts - Amazon Interview Question
LeetCode 138. Copy List with Random Pointer [IN 3 MINUTES]
มุมมอง 170ปีที่แล้ว
LeetCode 138. Copy List with Random Pointer [IN 3 MINUTES]
6 GRAPH PROBLEMS SOLVED | LeetCode Grind 2023 | Blind 75 List
มุมมอง 1.2Kปีที่แล้ว
6 GRAPH PROBLEMS SOLVED | LeetCode Grind 2023 | Blind 75 List
11 TREE PROBLEMS SOLVED | LeetCode Grind 2023 | Blind 75 List
มุมมอง 832ปีที่แล้ว
11 TREE PROBLEMS SOLVED | LeetCode Grind 2023 | Blind 75 List
SOLVING ALL Linked List | Blind75 LeetCode Problems
มุมมอง 892ปีที่แล้ว
SOLVING ALL Linked List | Blind75 LeetCode Problems
Solving All Blind75 Binary Search Pattern LeetCode Problems
มุมมอง 459ปีที่แล้ว
Solving All Blind75 Binary Search Pattern LeetCode Problems
SOLVING ALL Sliding Window [Blind75 List] | LeetCode Problems
มุมมอง 410ปีที่แล้ว
SOLVING ALL Sliding Window [Blind75 List] | LeetCode Problems
20. Valid Parentheses - Stack Pattern [Blind75 List]
มุมมอง 247ปีที่แล้ว
20. Valid Parentheses - Stack Pattern [Blind75 List]
Solving All Two Pointer Pattern | Blind75 LeetCode Problems
มุมมอง 2.1Kปีที่แล้ว
Solving All Two Pointer Pattern | Blind75 LeetCode Problems
SOLVING ALL Arrays & Hashmap | Blind75 LeetCode Problems
มุมมอง 7Kปีที่แล้ว
SOLVING ALL Arrays & Hashmap | Blind75 LeetCode Problems
Consistent Hashing Explained - System Design Fundamentals
มุมมอง 754ปีที่แล้ว
Consistent Hashing Explained - System Design Fundamentals
2369. Check if There is a Valid Partition For The Array - Leetcode Python Solution
มุมมอง 58ปีที่แล้ว
2369. Check if There is a Valid Partition For The Array - Leetcode Python Solution
Thank you for the explanation.
Very simple solution. Thank you.
Thank you Carter. I forget that the .add method of ArrayList has another paremeter index to insert into specific location, that is my pain point. Again, thank you Carter !
Nice solution! All the other solutions were too complicated, but this was easy to understand. I optimized it to run at 0ms and consume less memory. class Solution(object): def reorderLogFiles(self, logs): letter_log, digit_log = [], [] for i, log in enumerate(logs): if log.split()[1].isdigit(): digit_log.append(log) else: values = log.split(" ") letter_log.append([' '.join(values[1:]), values[0], i]) result = [] for log in sorted(letter_log): result.append(logs[log[2]]) return result + digit_log
this solution helps to understand backtracking, but doesn't use the 0/1 knapsack methodology fyi
Thanks a lot bro!
class Solution { public int romanToInt(String s) { int num = 0; String[] roman = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"}; int[] number = {1000,900,500,400,100,90,50,40,10,9,5,4,1}; for(int i=0; i<roman.length;i++) { int cur = number[s.charAt(i)]; int next = number[s.charAt(i+1)]; if(cur < next) { num = num+(next - cur); } else{ num = num + cur; } } return num; } } what is wrong with this code
Ask chatGPT
In the book 10 is on the 4th position, that's why was looking whether this is correct or not
Thank you for explanation! You are great teacher
Great solution, exactly what I came up with. Better than some of the more popular videos out there.
Best solution
hey, this is insanely well made, thank you so much ❤
thanks!! helped me understand the daily problem for today :)
The time complexity is 2^n is it not?
Nice solution in problem 76, mate))
Great explanation. Keep doing this work
Thanks a lot. :)
I understand the logic of storing efficiently in the init function. What I struggle with is understanding at what point will v1 and v2 be used. Is self.hm containing the values for v1 and vec.hm containing the values for v2?
heavily underrated video
didn't understand the explanation
clear and creative, respect +
why is the bottom-up approach called a "true DP"? Is it because you are starting from smaller problem and building it up to the end result? If so, doesn't top-down, in principal, do the same thing by reaching the base case then unwinding the recursive stack from there?
@@3227998 IMO I think it’s because when you do bottom up you have a chance (not guaranteed) that you can get space optimization of O(1) or say O(LOG(N)). However, when you’re doing too down you always have the recursive stack or some kind of memorization which attributes to added space. So in other words often the bottom up approach is preferable as it can lead to space optimization.
Crazy clean solution - would love to see the recursive proof behind this
I mean, wont it grab the 8 since you are using num % 10, and not 3? And when you divide with 10, it wont take away 3, it will take away 8:)
This one was a fun problem!
The problem becomes clear once you realize computing the actual product is irrelevant.
This is the 3rd video I watched. Simplest explanation, I think.
Hmm, I kinda miss the point where you explain why the reset actually works.. Does it require to have a certain amount of items or does the cycle needs to have a certain length? Cause I read that it doesnt matter where the pointers meet initially, resetting will always make sure you get the start. But thats complete nonsense right? Cause if i have a list 1-2-3-4-5-6 and a cycle 456 with 6 pointing to 4, thats mathematically not possible, right?
I came here from Cracking the Interview because I was stumped by problem 4.3 which is this same problem, nice explanation!
Please provide the create & insert statement for every question you practice on leetcode. Provide questions in your github account.
Thanks, you really simplified the problem
Can't we deduce the whitespace_count by subtracting charr_array.length - actual_length?
Sorry But what is the point of leetcode or exercising if you still use some library which abstract the solution?
@@vileni1 collections is a pretty famous library so using Counter is fairly well documented. Nonetheless, using a hash map works fine is just an extra line of code or two.
it seemed like a monotonic stack worked from right to left -- was really hoping it would also work from left to right
I cant thank you enough I was literally looking for someone to explain why we are using inclusion and exclusion!!!!!!! damn. I was using the initial intuition approach that you should was wrong and it was counting multiple times. And i was tryna use sets but that would be real inefficient. I still might have to understand it more, to really hit the spot but It was a really nice ice breaker. Basically I was thinking to prove how the code prevents {1,2,3} and {3,2,1} !
Hi, I am a beginner in sql, just started learning and side by side solving problems, I understood till half I kept myself stick to the concepts you were delivering, then at some point I lost, is it normal or it means I still need to study sql a lot?
Hello....can you please provide us the all pattern playlist....like two pointers, backtracking, dp , graphs , trees , sliding window and so on ...
Very good solution.
Please finish all blind 75 plsssss! Your video is so well explained! It's the best resource to learn using python to leetcode
My solution goes like that: for key in hash_map: key_end = key start = 0 While key_end <= len(hash_map[key]): res2 = [] for i in range(start_end, key_end): res_2.append(hash_map[key][i]) start = key_end key_end += key res.append(res2)
Hey Carter, Thanks
Love the blind 75 collection videos, I do leetcode a lot faster when I do it with you!
Thanks Man . Best solution video on yt by far for this question. 😄
FYI - the code used is not directed towards the most efficient time and space complexity, it's more so to understand the data structures in Python and the methods/functions applied on top of it. If you really want the time space complexity, refer to the original NeetCode videos. Thank you Carter, the videos are a good way of refresher for DE interviews
you made this problem look so easy 😲
thank you kind sir
thank you from Egypt you are great
wow!!!!!!!!!!! thankyouu!!!
Good
what tool do you use to write on the screen? I could really use that tool to help me organize my thoughts