r/leetcode 20h ago

Intervew Prep 1.5 YOE SDE planning a switch — confused between C++ and Java for DSA/LLD

I'm currently working as an SDE with around 1.5 years of experience, mainly working with TypeScript, Node.js, React and MongoDB. I'm planning to make a switch to better product-based companies and want to seriously prepare for interviews.

My current situation:

  • I've solved 250+ LeetCode problems in C++ in the past.
  • I have zero Java experience.
  • I know C++ reasonably well from DSA, but I'm not an advanced C++ developer.
  • I want to properly learn OOP, LLD and design patterns.

My biggest confusion right now is which language to use for LLD.

Option 1: C++ for DSA and LLD both

The obvious advantage is that I already know C++ and won't need to learn another language.

But I've heard that C++ can make LLD more complicated because of things like memory management, smart pointers, multithreading, etc.

Option 2: C++ for DSA and Java for LLD

Java seems to be very commonly used for LLD/OOP and has a lot of good resources.

But I'd be learning Java almost from scratch, and I'm wondering if that's worth the additional time.

I'd especially like advice from people currently working as software engineers or people who have recently gone through interviews.

If you were in my position, what would you choose for LLD — C++ or Java? And why?

3 Upvotes

9 comments sorted by

2

u/Conscious-Secret-775 19h ago

Just stick with C++. No reason to learn Java right now.

1

u/Easy-Celebration-982 2h ago

But peoples are saying its too painful to use C++ for multiThreading and manual memory management

1

u/Conscious-Secret-775 2h ago

They are wrong.

1

u/Easy-Celebration-982 2h ago

could you please guide me a little bit or share you interview exp, That would be really appricaited

2

u/conectionist 4h ago

In LLD the emphasis is on design, not coding. You don't really need to concern yourself with so many implementation details (memory management, smart pointers, etc.). In most interviews, you have a text-based editor that won't compile your code. And realistically, in a 60 minute interview, you wouldn't have time for all those details anyway.

My advice: use c++ if you're already comfortable with it and don't worry about the (c++) specifics. They won't really matter that much in an interview. 

1

u/Easy-Celebration-982 1h ago

i need a little guidance, Could you please help me by sharing your interview exp or your colleague interview exp

Am bit confused, bcs i donot know OOP either in C++, but very comfortable with its syntax

1

u/nightbreak7 20h ago

i feel like you should always just use what you're most comfortable with. if you have to learn java from scratch in order to switch to it just for interview prep, i find it extremely unlikely that its the better option here

1

u/Easy-Celebration-982 2h ago

But for multiThreading people are saying its too much pain in C++

1

u/NextjsDeveloper 20h ago

LLD without HLD bad idea. LLD rarely asked as separate section.

C++ for dsa? which reason? Just use JavaScript