My Mental Health Just Got Destroyed by an Algorithm Problem (LeetCode Hard)

Today I took on the LeetCode Hard problem 'Median of Two Sorted Arrays' and gave up after 3 hours. I understand the concept of binary search, but the index handling was so complicated I felt like my head was going to explode. In the end, it took me an hour just to understand the solution. I've heard people say 'Hard problems don't come up' when preparing for job interviews, but I still feel inadequate and it's been eating at me. How do you all manage your mental health while studying algorithms? Does it get better if you keep at it consistently?

by 코딩하는곰775

10 answers

LeetCode Hard problems will blow you up at first. I mainly focus on Medium and occasionally challenge Hard, but even 3 hours is a decent effort. Mental management tip: set a time limit when solving Hard, and if you can't solve it, boldly look at the solution and focus on understanding. If you keep at it, you'll definitely improve!

by 코딩하는곰944 · ▲0

Have you ever tried drawing out the concept of partitioning? When I get confused about indices, I find it helps to actually sketch out the array. Still, Hard problems are meant to be tough, so don't beat yourself up. If you keep at it, you'll definitely feel yourself improving!

by 월급루팡557 · ▲0

Oh man, I've been there too—that problem totally wrecked my mental state... Applying binary search to two arrays at the same time turned out to be way trickier than I expected. But honestly, understanding the solution is a skill in itself! I just keep grinding with the mindset of 'one more problem and I'll improve.'

by 카페인중독711 · ▲0

I solved 100 Medium problems and even tried Hard, but I still got wrecked lol. I just moved on thinking, 'Learned something new today.' When I talk to other job seekers, they all have similar experiences. Let's hang in there together!

by 취준생김씨804 · ▲0

Don't think you lack skill. That problem is considered a top-tier difficulty on LeetCode too. I only managed to memorize and solve it after reviewing it about three times. What matters is not giving up and keeping at it!

by 코딩하는곰108 · ▲0

I've had a similar experience. That problem is famously tricky, so it's totally normal not to solve it on the first try. I just noted it as a new type and revisited it a week later. Hard problems rarely appear in job coding tests, so don't stress too much.

by 초보개발자578 · ▲0

I think LeetCode Hard problems are best used for studying slowly without time pressure. For me, it helped to analyze them with curiosity, asking 'Why did they solve it this way?' And the saying 'Hard problems don't come up in interviews' is actually somewhat true. Have confidence!

by 데이터덕후186 · ▲0

Mental Health Tips: Organize Your Thoughts While Exercising! When I get stuck on an algorithm problem, I go for a 30-minute walk. And thinking 'It's normal not to solve a Hard problem within the time limit' makes me feel more at ease. Fighting!

by 클라우드러버783 · ▲0

I've been thinking about something similar lately! But yesterday I solved 'Container With Most Water' (Medium) and it made me feel great. I think it's important to feel small achievements often. Tackling Hard problems occasionally while consistently working on Medium ones will help improve your skills. Fighting!

by 무한도전러409 · ▲0

Oh man... I also spent 2 hours on that problem and gave up. But later I realized there were tons of edge cases due to index handling. Just understanding the solution is a big improvement! Next time a similar type comes up, it'll be much easier.

by 디지털노마드617 · ▲0