Exploring LeetCode's WORST Questions

  Рет қаралды 26,506

Colin Galen

Colin Galen

Күн бұрын

A top competitive programmer from the Codeforces/CodeChef realm (with almost zero prior interview experience) takes on the most annoying questions known to LeetCode to find out... how good is competitive programming, really? Is it enough to take on even the most annoying questions that LeetCode has to offer? Or will I struggle, like a lot of others probably did? Find out in this video experiment.
Resources
Online script: github.com/fatliau/leetcode_M...
My script: pastebin.com/Fdhfxq65
Raw CSV: pastebin.com/eCrBuDgJ
Questions
Q1 (91.7% disliked): leetcode.com/problems/largest...
Q2 (90.8% disliked): leetcode.com/problems/basic-c...
Q3 (90.3% disliked): leetcode.com/problems/longest...
Music
Local Forecast - Slower by Kevin MacLeod
Link: incompetech.filmmusic.io/song...
License: [yt dislikes this link, removed]
Sthlm Sunset by Ehrling
• Ehrling - Sthlm Sunset
(not exactly sure how to credit, the given link is dead)
This Is For You (Prod. by Lukrembo)
Link: • lukrembo - this is for...
Timestamps
0:00:00 Intro
0:00:46 Format
0:01:29 Q1 (91.7% disliked)
0:26:03 Q1 - Recap
0:26:38 Q2 (90.8% disliked)
1:08:52 Q2 - Recap
1:09:43 Q3 (90.3% disliked)
1:11:55 Q3 - Recap
1:12:20 Conclusion

Пікірлер: 61
@alperkaya8919
@alperkaya8919 Жыл бұрын
I spent 7 hours without giving a break on "Recover a Tree From Preorder Traversal". But I've solved it at the end. My code was over 100 lines, and I even had to force a hashmap to handle duplicate keys. But it was worth it at the end, and it was my first hard question I've solved. So, one hour on a hard question is nothing in my opinion.
@programmer9660
@programmer9660 Жыл бұрын
Colin I love that you’re thinking out loud, keep doing that. Cheers
@wesleyso0
@wesleyso0 Жыл бұрын
Amazing! Thanks for putting in all the hard work into making these videos! I hope I can be as good of an explainer as you are!
@danielgysi5729
@danielgysi5729 Жыл бұрын
Controversial, but I honestly think a lookup table is a totally valid solution to the first problem and I think having an interview question like that is really valuable. Sometimes there just isn't a clever math trick that makes your program 100x faster. In the real world you need to compromise sometimes and saying "We never expect to receive input greater than n so precomputing f(x) for all x
@30svich
@30svich Жыл бұрын
but there is actually a math trick, and he explains in the video someone solved this problem mathematically as it should be. it is not a bad problem, just people did not want to get involved with math.
@user-he4st2ro5h
@user-he4st2ro5h Жыл бұрын
Hey Colin, I had a failed attempt to pass an online assessment for Amazon SDE position, and one of the tasks was leetcode # 2281, which is in top 15 with the least acceptance rate. Could you solve and explain it, please?
@Matthew4770
@Matthew4770 Жыл бұрын
You updated your browser! So proud of you!
@rupok9999
@rupok9999 Жыл бұрын
how about Codeforces Round #815 (Div. 2) today ?
@NobleSavvy
@NobleSavvy Жыл бұрын
Dude Q2 had to feel so good to complete
@rohitpunetha9506
@rohitpunetha9506 Жыл бұрын
Your Background music is very haunting😈 Nice content though.
@bufdud4
@bufdud4 Жыл бұрын
I wonder if your employer would be more impressed to see you solve a difficult problem in less than said minutes versus communicating which would usually take 3x or 5x longer.
@anon3501
@anon3501 Жыл бұрын
Communication is more important. This guy is wasting his time at this point, industry experience is more valuable then solving LC quickly lol
@FinnBender
@FinnBender Жыл бұрын
@@anon3501 I mean he (probably) does this for his and our entertainment... Calling it "wasting time" seems a little harsh.
@anon3501
@anon3501 Жыл бұрын
@@FinnBender true, i was just suggesting to build or work on something with his skills versus solving problems that add no value to the world
@vishnuvs6121
@vishnuvs6121 Жыл бұрын
What you are saying is correct, but he's not doing this for appearing in interviews. People do this stuff for the fun of it too, as a hobby.
@anon3501
@anon3501 Жыл бұрын
@@vishnuvs6121 You shouldn't be taking pride just in things like leet code, its a fun puzzle game but it shouldn't be a major motivator for you. Programmers are solving problems for people or doing something of value for people over what they could be doing
@fiveCSGO
@fiveCSGO Жыл бұрын
how many years have you been programming in total?
@oxi2118
@oxi2118 Жыл бұрын
I learn so much from just watching you code
@michaelmoran9020
@michaelmoran9020 Жыл бұрын
For the 3rd one I do not understand why that trivial solution is the answer. When I read it I thought that for two strings "abcefg" "abcxyz" that the answer would be 3, with the subsequences being efg and xyz?
@muddycalendar3292
@muddycalendar3292 Жыл бұрын
The string itself is a subsequence, so if you have abc and abd, the longest subsequences will be abc and abd, and since the subsequences are different, they can’t be in both
@michaelmoran9020
@michaelmoran9020 Жыл бұрын
@@muddycalendar3292 I'm trying to figure out what implicit condition i was applying to reach my version
@saharshluthra6492
@saharshluthra6492 Жыл бұрын
Hi Colin, For the first problem, the result has to be a palindrome, and apart from n = 1, safe to assume that answer will contain even number of digits. Which means it will be always be divisible by 11. So you can put a condition for one of your numbers to be divisible by 11, only then look for second number possibilities, this will pass leetcodes' time limit. Edit: Just resumed the video and realized this is already covered :)
@MichaelSt
@MichaelSt Жыл бұрын
Why would the answer have an even number of digits?
@saharshluthra6492
@saharshluthra6492 Жыл бұрын
@@MichaelSt You're multiplying 2 n digit numbers, presumably starting off with 8 or 9 as their first digit. so something like (8 * 10^(n - 1) + something smaller) * (8 * 10^(n - 1) + something smaller). So 64 * 100^(n - 1) + something small. This is clearly even number of digits.
@MichaelSt
@MichaelSt Жыл бұрын
@@saharshluthra6492 a lot of assumptions there, like the number starting with 8 or 9, and the something small not "overflowing" into the next digit. I mean you can convince yourself it doesn't happen for 1
@saharshluthra6492
@saharshluthra6492 Жыл бұрын
@@MichaelSt The something small is < 10^(n - 1) and it physically cannot contribute to another digit. 9999 * 9999 has the same number of digits as 4000*4000. The only way to get another digit is 10^4 * 10^4 which is are both n + 1 digit numbers now. Even if you consider a completely random distribution of what you're going to get as a result of multiplication, which it's not, the probability of you not finding a palindrome is astronomically small, and it gets even smaller as n grows. The assumptions don't get weaker, they get even stronger for n > 8. Same goes for starting digits, as n grows, assuming completely random distribution, the chances that you find numbers starting with 999.... become even greater.
@kennethkath6527
@kennethkath6527 Жыл бұрын
Hey Colin, how are you so good at this? Takes me forever to solve even one question
@Supakills101
@Supakills101 Жыл бұрын
practice
@adriancornel864
@adriancornel864 Жыл бұрын
Brains.
@Profit.Genius
@Profit.Genius Жыл бұрын
A lot of practice
@tedchirvasiu
@tedchirvasiu Жыл бұрын
Probably half asian
@saurabh5148
@saurabh5148 Жыл бұрын
Must be pretty good mouse.
@HHJoshHH
@HHJoshHH Жыл бұрын
Cool video man. Only 4 weeks into programming but…this is fun to watch and try to understand. I’m starting in Python but I feel like I should be coding in JS. I’ll be lucky if I ever get smart enough to get a UI/UX job let alone an actual web/app dev job. 😅
@akashkumarsahoosibun8191
@akashkumarsahoosibun8191 Жыл бұрын
I do not know why by seeing your thumbnail I feel so good
@tedchirvasiu
@tedchirvasiu Жыл бұрын
The thumbnail is back
@BODYBUILDERS_AGAINST_FEMINISM
@BODYBUILDERS_AGAINST_FEMINISM Жыл бұрын
Cool videos man
@_sixtyfour
@_sixtyfour Жыл бұрын
For 50k subs, you should speed run eating 50 donuts
@keerthivasan9548
@keerthivasan9548 Жыл бұрын
Bro can you able to make a tutorial on union find operations on matrix
@freyappari
@freyappari 8 ай бұрын
I solved the first one fine,,, class Solution: def largestPalindrome(self, n: int) -> int: if n == 1: return 9 max_num = 10 ** n - 1 min_num = 10 ** (n - 1) for num in range(max_num, min_num - 1, -1): # Construct a palindrome by joining num with its reverse palindrome = int(str(num) + str(num)[::-1]) # Check if this palindrome can be represented as the product of two n-digit integers for i in range(max_num, int(palindrome ** 0.5) - 1, -1): if palindrome % i == 0 and palindrome // i
@cwagnello
@cwagnello Жыл бұрын
91 multiplied by a number with "n" digits of 9 is a palindrome but that doesn't help with the question
@MD-lw4kw
@MD-lw4kw Жыл бұрын
Krita and bloons TD 6🔥
@xyphenius9942
@xyphenius9942 Жыл бұрын
Why do you mostly use C++ ?
@MichaelSt
@MichaelSt Жыл бұрын
Its efficiency is good for competitive programming
@kaitmob3847
@kaitmob3847 Жыл бұрын
Its ironic how he is a competitive programmer but used someone else's code to find the questions
@Jasturtlegang
@Jasturtlegang Жыл бұрын
The real solution to the first largest palindromic product is n = 2 + (987-2); Return n; Ez i don't get why so many dislikes
@gabrielabdul
@gabrielabdul Жыл бұрын
We need more creativity with these thumbnails -- nice vid tho.
@keerthivasan9548
@keerthivasan9548 Жыл бұрын
Leetcode 862
@decafbad5529
@decafbad5529 Жыл бұрын
cute boymoder
@mdyousufgazi4030
@mdyousufgazi4030 Жыл бұрын
💥💥💥💥💥💥
@ciupanezubogdanel
@ciupanezubogdanel Жыл бұрын
3 + years of competitive coding experience, and when this guy is looking for the highest palindrome number from a product...he iterates up from 1 to 1000...instead of down from 1000
@Splish_Splash
@Splish_Splash Жыл бұрын
(high - i) * (high - j) means nothing to you?
@Daman1628
@Daman1628 Жыл бұрын
@@Splish_Splash lol
@bhanupratapsharma6158
@bhanupratapsharma6158 Жыл бұрын
Your voice is not coming
@thetallesthobbithsaka3050
@thetallesthobbithsaka3050 Жыл бұрын
You guys are spending 1 hour on hard questions, i though medium takes that much 👀
Taking On Google's HARDEST Interview Questions
1:25:26
Colin Galen
Рет қаралды 15 М.
A Deep Understanding of Dynamic Programming [Intro / Overview]
29:03
YouTube's Biggest Mistake..
00:34
Stokes Twins
Рет қаралды 76 МЛН
Top Competitive Programmer vs. LeetCode's HARDEST Questions
1:06:25
Colin Galen
Рет қаралды 202 М.
Ranking Every Data Structure & Algorithm
39:13
Colin Galen
Рет қаралды 63 М.
How to Turn Your Ideas Into Code (implementation)
38:16
Colin Galen
Рет қаралды 23 М.
The Feasibility Bias: Why You're Not Happy With Where You Are
14:45
Unlocking Your Intuition: How to Solve Hard Problems Easily
17:34
Colin Galen
Рет қаралды 1,2 МЛН
Top Competitive Programmer vs. FAANG Interview Questions
45:09
Colin Galen
Рет қаралды 357 М.
3-Minute Mental Hack to Take Control of Your Subconscious
11:25
Colin Galen
Рет қаралды 1,2 МЛН
Fundamental Graphs Knowledge - Intro + Basic Algorithms
42:18
Colin Galen
Рет қаралды 25 М.
Code With Me: 24 FAANG Interview Questions
3:39:55
Colin Galen
Рет қаралды 106 М.
Google Coding Interview With A Competitive Programmer
54:17
Clément Mihailescu
Рет қаралды 2,5 МЛН
⌨️ Сколько всего у меня клавиатур? #обзор
0:41
Гранатка — про VR и девайсы
Рет қаралды 214 М.
iPhone green Line Issue #iphone #greenlineissue #greenline #trending
0:10
Rk Electronics Servicing Center
Рет қаралды 4,6 МЛН
Samsung vs Apple Vision Pro🤯
0:31
FilmBytes
Рет қаралды 1,1 МЛН
Apple. 10 Интересных Фактов
24:26
Dameoz
Рет қаралды 114 М.