Exploring LeetCode's WORST Questions

preview_player
Показать описание
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

Questions

Music

Local Forecast - Slower by Kevin MacLeod
License: [yt dislikes this link, removed]

Sthlm Sunset by Ehrling
(not exactly sure how to credit, the given link is dead)

This Is For You (Prod. by Lukrembo)

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
Рекомендации по теме
Комментарии
Автор

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.

alperkaya
Автор

Colin I love that you’re thinking out loud, keep doing that. Cheers

programmer
Автор

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 <= n is the fastest solution" is totally viable. It's not fun, but it's realistic.

danielgysi
Автор

how about Codeforces Round #815 (Div. 2) today ?

rupok
Автор

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.

bufdud
Автор

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?

АлекСневар
Автор

how many years have you been programming in total?

fiveCSGO
Автор

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

saharshluthra
Автор

Hey Colin, how are you so good at this? Takes me forever to solve even one question

kennethkath
Автор

You updated your browser! So proud of you!

Matthew
Автор

Dude Q2 had to feel so good to complete

SavvyForever
Автор

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!

wesleyso
Автор

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?

michaelmoran
Автор

For 50k subs, you should speed run eating 50 donuts

_sixtyfour
Автор

I learn so much from just watching you code

oxi
Автор

Your Background music is very haunting😈
Nice content though.

rohitpunetha
Автор

I do not know why by seeing your thumbnail I feel so good

akashkumarsahoosibun
Автор

Bro can you able to make a tutorial on union find operations on matrix

keerthivasan
Автор

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

Jasturtle
Автор

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 <= max_num:
return palindrome % 1337

freyappari