Code with Carter
Code with Carter
  • 198
  • 141 416
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
มุมมอง: 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

ความคิดเห็น

  • @nehascorpion
    @nehascorpion 3 วันที่ผ่านมา

    Thank you for the explanation.

  • @vibhormehta4549
    @vibhormehta4549 4 วันที่ผ่านมา

    Very simple solution. Thank you.

  • @dat4031
    @dat4031 5 วันที่ผ่านมา

    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 !

  • @supergato4488
    @supergato4488 9 วันที่ผ่านมา

    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

  • @nikhilkulkarni1755
    @nikhilkulkarni1755 10 วันที่ผ่านมา

    this solution helps to understand backtracking, but doesn't use the 0/1 knapsack methodology fyi

  • @JOONWOOKIYOTAKA
    @JOONWOOKIYOTAKA 11 วันที่ผ่านมา

    Thanks a lot bro!

  • @HarrshMehta
    @HarrshMehta 13 วันที่ผ่านมา

    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

  • @A-myth
    @A-myth 17 วันที่ผ่านมา

    In the book 10 is on the 4th position, that's why was looking whether this is correct or not

  • @ВостряковАлександр-п9ы
    @ВостряковАлександр-п9ы 27 วันที่ผ่านมา

    Thank you for explanation! You are great teacher

  • @TheMadisonBluesBand
    @TheMadisonBluesBand 27 วันที่ผ่านมา

    Great solution, exactly what I came up with. Better than some of the more popular videos out there.

  • @jakemoss8700
    @jakemoss8700 หลายเดือนก่อน

    Best solution

  • @l1f3study74
    @l1f3study74 หลายเดือนก่อน

    hey, this is insanely well made, thank you so much ❤

  • @daleyfraser6993
    @daleyfraser6993 หลายเดือนก่อน

    thanks!! helped me understand the daily problem for today :)

  • @hotlife1000
    @hotlife1000 หลายเดือนก่อน

    The time complexity is 2^n is it not?

  • @RomanTokarenko
    @RomanTokarenko หลายเดือนก่อน

    Nice solution in problem 76, mate))

  • @shashwatbhatnagar659
    @shashwatbhatnagar659 หลายเดือนก่อน

    Great explanation. Keep doing this work

  • @SergioTomásVargasVillarreal
    @SergioTomásVargasVillarreal หลายเดือนก่อน

    Thanks a lot. :)

  • @breonthibodeaux9916
    @breonthibodeaux9916 หลายเดือนก่อน

    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?

  • @KaledDahleh
    @KaledDahleh หลายเดือนก่อน

    heavily underrated video

  • @igorromanenko336
    @igorromanenko336 หลายเดือนก่อน

    didn't understand the explanation

  • @santiagogomezramirez1627
    @santiagogomezramirez1627 หลายเดือนก่อน

    clear and creative, respect +

  • @3227998
    @3227998 หลายเดือนก่อน

    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?

    • @codewithcarter
      @codewithcarter หลายเดือนก่อน

      @@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.

  • @ahjiba
    @ahjiba หลายเดือนก่อน

    Crazy clean solution - would love to see the recursive proof behind this

  • @thomshetland
    @thomshetland หลายเดือนก่อน

    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:)

  • @nafis_rk
    @nafis_rk 2 หลายเดือนก่อน

    This one was a fun problem!

  • @nbktechworld
    @nbktechworld 2 หลายเดือนก่อน

    The problem becomes clear once you realize computing the actual product is irrelevant.

  • @mixone6168
    @mixone6168 2 หลายเดือนก่อน

    This is the 3rd video I watched. Simplest explanation, I think.

  • @adennis200
    @adennis200 2 หลายเดือนก่อน

    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?

  • @artimes5542
    @artimes5542 2 หลายเดือนก่อน

    I came here from Cracking the Interview because I was stumped by problem 4.3 which is this same problem, nice explanation!

  • @chandanpatra1053
    @chandanpatra1053 2 หลายเดือนก่อน

    Please provide the create & insert statement for every question you practice on leetcode. Provide questions in your github account.

  • @SamuelEvans1991
    @SamuelEvans1991 2 หลายเดือนก่อน

    Thanks, you really simplified the problem

  • @lukaszm9234
    @lukaszm9234 2 หลายเดือนก่อน

    Can't we deduce the whitespace_count by subtracting charr_array.length - actual_length?

  • @vileni1
    @vileni1 2 หลายเดือนก่อน

    Sorry But what is the point of leetcode or exercising if you still use some library which abstract the solution?

    • @codewithcarter
      @codewithcarter 2 หลายเดือนก่อน

      @@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.

  • @firezdog
    @firezdog 2 หลายเดือนก่อน

    it seemed like a monotonic stack worked from right to left -- was really hoping it would also work from left to right

  • @SHUBHAMJHA-o3g
    @SHUBHAMJHA-o3g 2 หลายเดือนก่อน

    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} !

  • @bidhanry9740
    @bidhanry9740 3 หลายเดือนก่อน

    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?

  • @CPCODE14
    @CPCODE14 3 หลายเดือนก่อน

    Hello....can you please provide us the all pattern playlist....like two pointers, backtracking, dp , graphs , trees , sliding window and so on ...

  • @ronihossain7428
    @ronihossain7428 3 หลายเดือนก่อน

    Very good solution.

  • @itsnotxueying
    @itsnotxueying 3 หลายเดือนก่อน

    Please finish all blind 75 plsssss! Your video is so well explained! It's the best resource to learn using python to leetcode

  • @Argathattica
    @Argathattica 3 หลายเดือนก่อน

    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)

  • @nrk07
    @nrk07 3 หลายเดือนก่อน

    Hey Carter, Thanks

  • @itsnotxueying
    @itsnotxueying 3 หลายเดือนก่อน

    Love the blind 75 collection videos, I do leetcode a lot faster when I do it with you!

  • @DharshanNadar0
    @DharshanNadar0 3 หลายเดือนก่อน

    Thanks Man . Best solution video on yt by far for this question. 😄

  • @SAURABHKUMAR-uk5gg
    @SAURABHKUMAR-uk5gg 3 หลายเดือนก่อน

    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

  • @Martinnnnnn-e5s
    @Martinnnnnn-e5s 3 หลายเดือนก่อน

    you made this problem look so easy 😲

  • @BaoNguyen-d8u
    @BaoNguyen-d8u 3 หลายเดือนก่อน

    thank you kind sir

  • @osamakhidr7559
    @osamakhidr7559 3 หลายเดือนก่อน

    thank you from Egypt you are great

  • @AishwaryaAishwarya-e4l
    @AishwaryaAishwarya-e4l 3 หลายเดือนก่อน

    wow!!!!!!!!!!! thankyouu!!!

  • @SMMahediHasan-BANGLADESH
    @SMMahediHasan-BANGLADESH 3 หลายเดือนก่อน

    Good

  • @viper440
    @viper440 3 หลายเดือนก่อน

    what tool do you use to write on the screen? I could really use that tool to help me organize my thoughts