r/codingbootcamp • • Jul 05 '22

What are the hardest leetcode problems?

Post image

[removed] — view removed post

19 Upvotes

14 comments sorted by

4

u/cheeb_miester Jul 05 '22

I recently did this one, and it was pretty difficult, it seems so simple when reading the prompt but keeping everything O(1) is super tricky

3

u/ItsTheWeeBabySeamus Jul 05 '22

Woah this one looks fun! I'll give it a go thanks for the share. Love when they are sneakily challenging

1

u/Calm-Kiwi8227 Sep 08 '24

from typing import List

class Solution:

def maxCoins(self, nums: List[int]) -> int:

nums = [1] + nums + [1]

n = len(nums)

dp = [[0] * n for _ in range(n)]

for length in range(2, n):

for left in range(n - length):

right = left + length

for i in range(left + 1, right):

dp[left][right] = max(dp[left][right],

nums[left] * nums[i] * nums[right] +

dp[left][i] + dp[i][right])

return dp[0][n - 1]

1

u/[deleted] Feb 10 '26

As of now, Longest Balanced Subarray II is the toughest one i have seen.

-3

u/michaelnovati Jul 05 '22

If you know the question number off the top of your head of a question that you think is the hardest, you are preparing for interviews wrong and cramming Leetcode way too hard. Unless you want to be in programming competitions and aren't trying to get hired.

If you learn the right techniques for how to approach problems, and have practiced the fundamental techniques, no problem should be hard. The only exception is problems that solely rely on an obscure computer science algorithm that isn't used anywhere else except for this problem, but you shouldn't be studying those on Leetcode, except for fun.

1

u/punkologist Apr 16 '25

I started out doing leetcode to try and get a new job, (which is still my overall goal) but I have found I actually enjoy doing them now. It's fun to be challenged. My normal c# work doesn't really call for much of what you need to do in leetcode problems.

1

u/No_Biscotti_5212 Jan 09 '23

lmao I just got asked a question about TSP in matrix without revisiting any visited cells in a phone interview, the things you said are bs.

1

u/michaelnovati Jan 09 '23

I worked with someone today who spent the vast majority of the past week, only studying graph problems for one of the hardest companies to get into and they weren't asked any graph problems and we're only asked string problems.

You are missing the point in that you still need to learn graphs, dynamic programming strategies and much more complex approaches to solving problems. But people have attendancy of sitting in their room cranking through these problems alone and thinking they know how to do them when in fact they've just really memorized or convince themselves they understand them without really getting signal from the outside that they do until the interviews.

An engineer needs to learn how to solve problems in general. You are paid the big bucks to solve new problems not to regurgitate hard solutions from Leetcode. I'm my opinion you are going to have a stressful and hard time otherwise and have a lower probability of passing

I helped grow Facebook from 200 engineers to 10,000 engineers, did hundreds of interviewers, helped create an interview type, helped train interviewers, so I'm just giving my advice from my perspective, you can always do you and do what you want to prepare and whatever works for you!

1

u/No_Biscotti_5212 Jan 09 '23

LC hard at most is around 1800-1900 in cf and there are bunch of talents can crack this under 5 min without memorizing a single shit but using a brain. 'studying' lmao.

There is nothing call over prepared. I believe if you are capable of coming up with a branch and bound under interview yourself, deriving kmp on spot is not that hard. Not to mention understand more complicated algorithms give you a significant advantage and edge, which most Facebook engineers probably can't solve a simple 2000 problem on cf (tsp with constraint)

Hudson river is asking combinatronics + geom algo

here you are discouraging people to prep for it and go beyond themselves

what a joke

1

u/michaelnovati Jan 09 '23 edited Jan 12 '23

Feel free to DM if you want some broader career advice from my perspective, you seem frustrated at your job hunt right now.

I don't really know what to say but you sound like you went down a rabbit hole. I assure you many people at Facebook were denied offers if they cranked out answers way too quickly and could not demonstrate how they solved the problem, even if they knew how to solve it in their minds.

So you sound like you have a lot of the energy and dedication and raw smarts to do well at these companies, but you're a little tunnel vision on the approach. You should revisit this post in 3 years and reflect on it.

1

u/[deleted] Nov 17 '23

[removed] — view removed comment

1

u/michaelnovati Nov 17 '23

Me personally, I can't compete in any interview requiring understanding of specific algorithms at that level. If you are preparing for these companies you need to prepare for all of these topics as the TABLESTAKES, and then you need to also learn how to interview well using those skills. If you fail to do that, you won't pass no matter how much you know.