r/learnprogramming • u/FinancialTrack5007 • 12h ago
What to do !
I know how to write code, but not in the LeetCode style . I also want to do DSA, and my seniors told me to learn a coding language too i know (I already know C, python ). Tell me what all I should do in this situation first .
5
Upvotes
4
u/JohnsTech_dev 12h ago
you dont need another language for dsa, python is fine for leetcode and most interviewers are ok with it. C is painful for it tbh, no hashmap out of the box.
what worked for me was doing problems by topic instead of random ones. like 15 easy array/hashmap problems, then two pointers, then sliding window. if stuck more than 30 min read the solution, close it, and write it again from memory next day
1
u/moonfable42 12h ago
First relearn basic DSA concepts like arrays, strings, recursion, then move to leetcode easy problems in python. Once you get comfortable move to mediums. Do like 1-2 problems a day consistently instead of binge solving. After a month or two start timing yourself like a real interview.
1
u/a3th3rus 12h ago
Try automating some of your simple but repetitive works. If you don't have one, see if your friends have any that you can help with. For example, my wife (a translator) always have the need for extracting text that needs to be translated from a certain format of XML, and I wrote a Ruby script for that, and another for stuffing the translated text back to that XML.
Also, if you play video games, you can write some algorithm for yourself to minmax something. For example, I've written something that finds the optimal fights in Valkyrie Profile to gain as much exp as possible with no member levels up.
1
u/No_Addition_992 4h ago
The LeetCode style is simpler than it looks: you never read input or print output. The function is given the inputs, and you just return the answer, like return [0, 1]. Your normal input()/print() habit is exactly what trips people up at first. Stick with Python for DSA and do one topic at a time.