Greg Hogg
Greg Hogg
  • 855
  • 23 834 024
Time & Space Complexity - Big O Notation Explained
Please check my playlists for free DSA problem solutions:
ua-cam.com/play/PLKYEe2WisBTFlP0RlwfwPrdkvHrcTBUg-.html
ua-cam.com/play/PLKYEe2WisBTEK8_GVXySX9aDWBHk5fGwQ.html
ua-cam.com/play/PLKYEe2WisBTFZH-p9jgAOwtHy9_LGI28W.html
ua-cam.com/play/PLKYEe2WisBTH7I9sCPjSZCs-iBAH4ybmS.html
ua-cam.com/play/PLKYEe2WisBTH601scI_A008gm34oARlIp.html&si=DnCpq_RiFkObYn7p
ua-cam.com/play/PLKYEe2WisBTF21RGRtZfGGolpHmca_d3N.html
ua-cam.com/play/PLKYEe2WisBTH48RzVCL_LQrGW-ahPY44S.html
ua-cam.com/play/PLKYEe2WisBTHcWHAGWvKJuVMu5ElMA18M.html
ua-cam.com/play/PLKYEe2WisBTEY7eJBW7W-jbxlXCGb928P.html
ua-cam.com/play/PLKYEe2WisBTHCmJ6IfEMjg8o--Bvfc5gt.html
ua-cam.com/play/PLKYEe2WisBTFw-XWc-kwS3dkQeeSmvpg5.html
Learn Python and Data Science at mlnow.ai :)
Best Courses for Analytics:
---------------------------------------------------------------------------------------------------------
+ IBM Data Science (Python): bit.ly/3Rn00ZA
+ Google Analytics (R): bit.ly/3cPikLQ
+ SQL Basics: bit.ly/3Bd9nFu
Best Courses for Programming:
---------------------------------------------------------------------------------------------------------
+ Data Science in R: bit.ly/3RhvfFp
+ Python for Everybody: bit.ly/3ARQ1Ei
+ Data Structures & Algorithms: bit.ly/3CYR6wR
Best Courses for Machine Learning:
---------------------------------------------------------------------------------------------------------
+ Math Prerequisites: bit.ly/3ASUtTi
+ Machine Learning: bit.ly/3d1QATT
+ Deep Learning: bit.ly/3KPfint
+ ML Ops: bit.ly/3AWRrxE
Best Courses for Statistics:
---------------------------------------------------------------------------------------------------------
+ Introduction to Statistics: bit.ly/3QkEgvM
+ Statistics with Python: bit.ly/3BfwejF
+ Statistics with R: bit.ly/3QkicBJ
Best Courses for Big Data:
---------------------------------------------------------------------------------------------------------
+ Google Cloud Data Engineering: bit.ly/3RjHJw6
+ AWS Data Science: bit.ly/3TKnoBS
+ Big Data Specialization: bit.ly/3ANqSut
More Courses:
---------------------------------------------------------------------------------------------------------
+ Tableau: bit.ly/3q966AN
+ Excel: bit.ly/3RBxind
+ Computer Vision: bit.ly/3esxVS5
+ Natural Language Processing: bit.ly/3edXAgW
+ IBM Dev Ops: bit.ly/3RlVKt2
+ IBM Full Stack Cloud: bit.ly/3x0pOm6
+ Object Oriented Programming (Java): bit.ly/3Bfjn0K
+ TensorFlow Advanced Techniques: bit.ly/3BePQV2
+ TensorFlow Data and Deployment: bit.ly/3BbC5Xb
+ Generative Adversarial Networks / GANs (PyTorch): bit.ly/3RHQiRj
Become a Member of the Channel! bit.ly/3oOMrVH
Follow me on LinkedIn! www.linkedin.com/in/greghogg/
Full Disclosure:
Please note that I may earn a commission for purchases made at the above sites! I strongly believe in the material provided; I only recommend what I truly think is great. If you do choose to make purchases through these links; thank you for supporting the channel, it helps me make more free content like this!
Переглядів: 190

Відео

Implement Trie (Prefix Tree) - Leetcode 208 - Trees (Python)
Переглядів 78010 годин тому
The Python code for this problem can be found at my GitHub repo here: github.com/gahogg/Leetcode-Solutions/blob/main/Fibonacci Number - Leetcode 509.py Please check my playlists for free DSA problem solutions: ua-cam.com/play/PLKYEe2WisBTFlP0RlwfwPrdkvHrcTBUg-.html ua-cam.com/play/PLKYEe2WisBTEK8_GVXySX9aDWBHk5fGwQ.html ua-cam.com/play/PLKYEe2WisBTFZH-p9jgAOwtHy9_LGI28W.html ua-cam.com/play/PLK...
Minimum Absolute Difference in BST - Leetcode 530 - Trees (Python)
Переглядів 51412 годин тому
The Python code for this problem can be found at my GitHub repo here: github.com/gahogg/Leetcode-Solutions/blob/main/Fibonacci Number - Leetcode 509.py Please check my playlists for free DSA problem solutions: ua-cam.com/play/PLKYEe2WisBTFlP0RlwfwPrdkvHrcTBUg-.html ua-cam.com/play/PLKYEe2WisBTEK8_GVXySX9aDWBHk5fGwQ.html ua-cam.com/play/PLKYEe2WisBTFZH-p9jgAOwtHy9_LGI28W.html ua-cam.com/play/PLK...
Summary Ranges - Leetcode 228 - Top Questions (Python)
Переглядів 49612 годин тому
The Python code for this problem can be found at my GitHub repo here: github.com/gahogg/Leetcode-Solutions/blob/main/Fibonacci Number - Leetcode 509.py Please check my playlists for free DSA problem solutions: ua-cam.com/play/PLKYEe2WisBTFlP0RlwfwPrdkvHrcTBUg-.html ua-cam.com/play/PLKYEe2WisBTEK8_GVXySX9aDWBHk5fGwQ.html ua-cam.com/play/PLKYEe2WisBTFZH-p9jgAOwtHy9_LGI28W.html ua-cam.com/play/PLK...
Is Subsequence - Leetcode 392 - Top Questions (Python)
Переглядів 31912 годин тому
The Python code for this problem can be found at my GitHub repo here: github.com/gahogg/Leetcode-Solutions/blob/main/Fibonacci Number - Leetcode 509.py Please check my playlists for free DSA problem solutions: ua-cam.com/play/PLKYEe2WisBTFlP0RlwfwPrdkvHrcTBUg-.html ua-cam.com/play/PLKYEe2WisBTEK8_GVXySX9aDWBHk5fGwQ.html ua-cam.com/play/PLKYEe2WisBTFZH-p9jgAOwtHy9_LGI28W.html ua-cam.com/play/PLK...
Roman to Integer - Leetcode 13 - Top Questions (Python)
Переглядів 1 тис.12 годин тому
The Python code for this problem can be found at my GitHub repo here: github.com/gahogg/Leetcode-Solutions/blob/main/Fibonacci Number - Leetcode 509.py Please check my playlists for free DSA problem solutions: ua-cam.com/play/PLKYEe2WisBTFlP0RlwfwPrdkvHrcTBUg-.html ua-cam.com/play/PLKYEe2WisBTEK8_GVXySX9aDWBHk5fGwQ.html ua-cam.com/play/PLKYEe2WisBTFZH-p9jgAOwtHy9_LGI28W.html ua-cam.com/play/PLK...
Kth Smallest Element in a BST - Leetcode 230 - Trees (Python)
Переглядів 96014 годин тому
The Python code for this problem can be found at my GitHub repo here: github.com/gahogg/Leetcode-Solutions/blob/main/ Please check my playlists for free DSA problem solutions: ua-cam.com/play/PLKYEe2WisBTFlP0RlwfwPrdkvHrcTBUg-.html ua-cam.com/play/PLKYEe2WisBTEK8_GVXySX9aDWBHk5fGwQ.html ua-cam.com/play/PLKYEe2WisBTFZH-p9jgAOwtHy9_LGI28W.html ua-cam.com/play/PLKYEe2WisBTH7I9sCPjSZCs-iBAH4ybmS.ht...
Majority Element - Leetcode 169 - Top Questions (Python)
Переглядів 81914 годин тому
The Python code for this problem can be found at my GitHub repo here: github.com/gahogg/Leetcode-Solutions/blob/main/Fibonacci Number - Leetcode 509.py Please check my playlists for free DSA problem solutions: ua-cam.com/play/PLKYEe2WisBTFlP0RlwfwPrdkvHrcTBUg-.html ua-cam.com/play/PLKYEe2WisBTEK8_GVXySX9aDWBHk5fGwQ.html ua-cam.com/play/PLKYEe2WisBTFZH-p9jgAOwtHy9_LGI28W.html ua-cam.com/play/PLK...
Merge K Sorted Linked Lists - Leetcode 23 - Heaps (Python)
Переглядів 87817 годин тому
The Python code for this problem can be found at my GitHub repo here: github.com/gahogg/Leetcode-Solutions/blob/main/Fibonacci Number - Leetcode 509.py Please check my playlists for free DSA problem solutions: ua-cam.com/play/PLKYEe2WisBTFlP0RlwfwPrdkvHrcTBUg-.html ua-cam.com/play/PLKYEe2WisBTEK8_GVXySX9aDWBHk5fGwQ.html ua-cam.com/play/PLKYEe2WisBTFZH-p9jgAOwtHy9_LGI28W.html ua-cam.com/play/PLK...
Longest Common Prefix - Leetcode 14 - Top Questions (Python)
Переглядів 1,3 тис.17 годин тому
The Python code for this problem can be found at my GitHub repo here: github.com/gahogg/Leetcode-Solutions/blob/main/Fibonacci Number - Leetcode 509.py Please check my playlists for free DSA problem solutions: ua-cam.com/play/PLKYEe2WisBTFlP0RlwfwPrdkvHrcTBUg-.html ua-cam.com/play/PLKYEe2WisBTEK8_GVXySX9aDWBHk5fGwQ.html ua-cam.com/play/PLKYEe2WisBTFZH-p9jgAOwtHy9_LGI28W.html ua-cam.com/play/PLK...
Average of Levels in Binary Tree - Leetcode 637 - Trees (Python)
Переглядів 40517 годин тому
Related video - Binary Tree Level-Order Traversal - ua-cam.com/video/2_tm34ZtYT4/v-deo.html The Python code for this problem can be found at my GitHub repo here: github.com/gahogg/Leetcode-Solutions/blob/main/ Please check my playlists for free DSA problem solutions: ua-cam.com/play/PLKYEe2WisBTFlP0RlwfwPrdkvHrcTBUg-.html ua-cam.com/play/PLKYEe2WisBTEK8_GVXySX9aDWBHk5fGwQ.html ua-cam.com/play/P...
Path Sum - Leetcode 112 - Trees (Python)
Переглядів 88719 годин тому
Path Sum - Leetcode 112 - Trees (Python)
Minimum Size Subarray Sum - Leetcode 209 - Sliding Window (Python)
Переглядів 91719 годин тому
Minimum Size Subarray Sum - Leetcode 209 - Sliding Window (Python)
Symmetric Tree - Leetcode 101 - Trees (Python)
Переглядів 50219 годин тому
Symmetric Tree - Leetcode 101 - Trees (Python)
Best Time to Buy and Sell Stock - Leetcode 121 - Arrays, Strings and Hashing (Python)
Переглядів 1,2 тис.День тому
Best Time to Buy and Sell Stock - Leetcode 121 - Arrays, Strings and Hashing (Python)
Spiral Matrix - Leetcode 54 - Top Questions (Python)
Переглядів 1,4 тис.День тому
Spiral Matrix - Leetcode 54 - Top Questions (Python)
Rotate Image - Leetcode 48 - Top Questions (Python)
Переглядів 2,6 тис.День тому
Rotate Image - Leetcode 48 - Top Questions (Python)
Merge Intervals - Leetcode 56 - Top Questions (Python)
Переглядів 1,1 тис.День тому
Merge Intervals - Leetcode 56 - Top Questions (Python)
Kth Largest Element in an Array - Leetcode 215 - Heaps (Python)
Переглядів 2,4 тис.День тому
Kth Largest Element in an Array - Leetcode 215 - Heaps (Python)
Last Stone Weight - Leetcode 1046 - Heaps (Python)
Переглядів 1,2 тис.14 днів тому
Last Stone Weight - Leetcode 1046 - Heaps (Python)
Longest Common Subsequence - Leetcode 1143 - Dynamic Programming (Python)
Переглядів 1,1 тис.14 днів тому
Longest Common Subsequence - Leetcode 1143 - Dynamic Programming (Python)
Longest Increasing Subsequence - Leetcode 300 - Dynamic Programming (Python)
Переглядів 1,2 тис.14 днів тому
Longest Increasing Subsequence - Leetcode 300 - Dynamic Programming (Python)
Jump Game - Leetcode 55 - Dynamic Programming (Python)
Переглядів 84414 днів тому
Jump Game - Leetcode 55 - Dynamic Programming (Python)
Maximum Subarray (Kadane's Algorithm) - Leetcode 53 - Dynamic Programming (Python)
Переглядів 1,9 тис.14 днів тому
Maximum Subarray (Kadane's Algorithm) - Leetcode 53 - Dynamic Programming (Python)
Coin Change - Leetcode 322 - Dynamic Programming (Python)
Переглядів 2,1 тис.14 днів тому
Coin Change - Leetcode 322 - Dynamic Programming (Python)
Unique Paths - Leetcode 62 - Dynamic Programming (Python)
Переглядів 1 тис.14 днів тому
Unique Paths - Leetcode 62 - Dynamic Programming (Python)
Strong Noob Programmer vs O(n) Remote Engineer on Best Time to Buy and Sell Stock, Leetcode 121
Переглядів 9 тис.14 днів тому
Strong Noob Programmer vs O(n) Remote Engineer on Best Time to Buy and Sell Stock, Leetcode 121
Reversed O(n^2) Developer vs Skilled Heap O(n log n) Engineer on Last Stone Weight, Leetcode 1046
Переглядів 7 тис.14 днів тому
Reversed O(n^2) Developer vs Skilled Heap O(n log n) Engineer on Last Stone Weight, Leetcode 1046
Noob Developer vs Sports Fanatic Engineer on Search a 2D Matrix, Leetcode 74 (Full Video)
Переглядів 7 тис.21 день тому
Noob Developer vs Sports Fanatic Engineer on Search a 2D Matrix, Leetcode 74 (Full Video)
CHEATING Noob Coder vs Classy Senior Engineer on Permutations, Leetcode 46
Переглядів 6 тис.21 день тому
CHEATING Noob Coder vs Classy Senior Engineer on Permutations, Leetcode 46

КОМЕНТАРІ

  • @Moses-ff1pr
    @Moses-ff1pr 8 годин тому

    Kindly zoom in while you are writing the code

  • @Moses-ff1pr
    @Moses-ff1pr 8 годин тому

    Man. This is brilliant. I found it better than neetcode 🎉

  • @trinityblood5622
    @trinityblood5622 8 годин тому

    This is very inefficient. There are cases where it will fail.

  • @tongpoo8985
    @tongpoo8985 8 годин тому

    Did I just get pranked? There was literally nothing difficult about that. Was expecting some weird twist. Was it hard because you had to write all the uppercase and lowercase letters? 😂

  • @greycell2442
    @greycell2442 9 годин тому

    ya, when you smoke regex in your crack pipe, and ask prospects this question, quit. It makes sense from an AI language analysis angle, but "is", "to", "it", "we", "he". The very premise behind the question is a koan, asking you for your method for no reason other than exhibition. Gotta ask my future employer to get real.

  • @User-w9x
    @User-w9x 9 годин тому

    Hii Greg thanks a lot for this awesome video could you please make same content for HDBSCAN please

  • @ss10million
    @ss10million 9 годин тому

    Forgive me if it’s flown over my head but isn’t there a fallacy in this algorithm? If you have [2,2,1,1,1,2,2,3,3,3] would the candidate not return as 3 even though 2 is the clear majority? So 1,2,1,0,1,0,1,0,1,2 where the final 2 is from the 3s. Maybe I’m just confused.

    • @ss10million
      @ss10million 9 годин тому

      Okay nevermind after doing some due diligence I failed to realize that the algorithm assumes the list will always have a majority element where the element appearance is greater than the length / 2

  • @hawkeye312
    @hawkeye312 10 годин тому

    This is how I learned stacks in college

  • @nnofficial2414
    @nnofficial2414 11 годин тому

    Yes 🙌 Please don’t feel guilty about looking at the solution.

  • @muniswamivikram
    @muniswamivikram 11 годин тому

    Yes I also waiting for machine learning

  • @ayoubab2120
    @ayoubab2120 11 годин тому

    Will you do some machine learning videos again as well :) ?

  • @TR1XT3RZ360
    @TR1XT3RZ360 11 годин тому

    You missed the most important part which is it has to be sorted 😅

  • @PaulSebastianM
    @PaulSebastianM 12 годин тому

    What is considered as DP here!?

  • @Bobby_Org
    @Bobby_Org 12 годин тому

    GOAT ❤

  • @neilgibbons6798
    @neilgibbons6798 13 годин тому

    Why did you make max_distance and prev a list?

  • @mujtabarehman5255
    @mujtabarehman5255 14 годин тому

    Also, if a hash table gets too full (ie passes its load balance), then a new larger table is created which takes O(n) time. But this happens very infrequently. This is similar to how dynamic arrays resize. So insertion is also amortized O(1) time.

  • @Tmplar
    @Tmplar 14 годин тому

    This doesn’t seem O(n) to me, I can imagine the worst case to be when the whole list is a sequence. Then this script would check i numbers for every number in the list. This would give us n(n-1)/2 operations, which is O(n^2). The best case, aka no sequences in the list, would be linear, because you’re only checking once per element.

    • @Tmplar
      @Tmplar 14 годин тому

      Ok, if you pop them out of the set as you check them, then you get O(n). Because then you won’t be running into the same one again. But then you have to check both to the right and the left of the number to make sure you’re always getting the largest sequence.

  • @nithin2782
    @nithin2782 14 годин тому

    Excellent explanation. Thanks!! Very helpful

  • @krishwanthkishore8299
    @krishwanthkishore8299 16 годин тому

    If this is noob level , then i don't know what level i am 💀

  • @supremoluminary
    @supremoluminary 16 годин тому

    Repeat the same question you’ve already done in a different language - even better!

  • @progressiveaccount3270
    @progressiveaccount3270 17 годин тому

    I use Paint, brother. There is an another tip that works for me: If the solution is in the standart library, use it! There are always tricky moments in the question desctiptions or solutions, that u can ignore or miss, so for the first, I literally SOLVE the question, and THEN try to do it WITHOUT standart library functions to be sure, that I really got it. For example: Search Insert Position and single number. - They are solved in a single line of code using STD functions, so firstly I do it. Then I write solution by myself. It makes you good in STD knowledge and you can consentrate on really important parts of a question.

  • @decaalv
    @decaalv 17 годин тому

    I think I am dumb. I did not understand what he did.

  • @srlog_
    @srlog_ 18 годин тому

    I have a serious doubt I can only solve all questions on python language, is that okay.. does interviews allow me to use language of my choice?

  • @moviestownhd9754
    @moviestownhd9754 18 годин тому

    Kabhi kabhi lagta h, ki coding karte karte kahi me bhi iske jaisa na ho jau😢😢

  • @MarioBaeza-gs8yr
    @MarioBaeza-gs8yr 19 годин тому

    it still works if there are more than 2 candidates?

  • @warguy6474
    @warguy6474 19 годин тому

    its probablistically almost always o(1) with proper hashing and load factor calculation, you should cover the equation to derive this

  • @youneverknow7096
    @youneverknow7096 20 годин тому

    yea the comments are are a bum but they arent wrong sometimes lol

  • @bert-janstroop5342
    @bert-janstroop5342 20 годин тому

    abap?

  • @sanyamratreja5457
    @sanyamratreja5457 20 годин тому

    Solved the same question like 3 hours ago lol

  • @russelldsouza7738
    @russelldsouza7738 20 годин тому

    I just finished watching Lec 5 of CS50 course in which they talk about hash tables. And mins later I see this, How TF did yt know ?😰

    • @TinKot791
      @TinKot791 20 годин тому

      Same, I just finished a data structure and algorithm course in udemy. Scary huh?

  • @GregHogg
    @GregHogg 20 годин тому

    Subscribe to the channel to get these in your feed everyday!

  • @gabrielbarrantes6946
    @gabrielbarrantes6946 21 годину тому

    Real life work: first thing to do is checking is there is a library/package that already does it.

  • @jahfarmuhammed3387
    @jahfarmuhammed3387 21 годину тому

    Log(2)base N ??

  • @Om-id1qr
    @Om-id1qr 23 години тому

    Just solved this yesterday and now this video comes in my feed

    • @GregHogg
      @GregHogg 22 години тому

      Awesome job!

  • @benoitavril4806
    @benoitavril4806 23 години тому

    Sorry I might be dumb or not understanding the question but why don't you look at the smallest value of all intervals and the biggest one to create the lower and upper bound of the interval asked?

    • @GregHogg
      @GregHogg 22 години тому

      You need multiple intervals, and yes this is something you would do

  • @Zedament
    @Zedament 23 години тому

    🟤🟢🔵🟣⚪️⚫️

    • @GregHogg
      @GregHogg 22 години тому

      Nice colours

  • @nammi895
    @nammi895 23 години тому

    Those are rookie number in this racket You need to solve atleast 500

    • @GregHogg
      @GregHogg 22 години тому

      Uhm says who lol

    • @nammi895
      @nammi895 19 годин тому

      @@GregHogg says someone who was leetcoding for 4 yrs & got into FAANG 2 yrs ago 😂 Now 300+ is not enough, competition has increased a lot

    • @GregHogg
      @GregHogg 19 годин тому

      @@nammi895 Because you work at FAANG you can adamantly state you need over 500? I know lots of others that would disagree. Also the number of questions doesn't really mean anything

  • @satwiktatikonda764
    @satwiktatikonda764 День тому

    And I have solved 1096

  • @yomajo
    @yomajo День тому

    Big words, no listen

  • @ahmadshbat8363
    @ahmadshbat8363 День тому

    Latterly you are telling me what I need to hear 😂❤

  • @arunamalla1705
    @arunamalla1705 День тому

    What’s a RL agent policy function for the same??

  • @adi2721
    @adi2721 День тому

    Dont see why thats a big deal just look at your code and think lol

    • @GregHogg
      @GregHogg 22 години тому

      It's for those that are unable