Based on my experience as a developer, I suggest you understand the data structures concepts before learning programming languages like Python and Java. Create a flow chart on how to solve the problem. Learn how to write dynamic programming. Understand the concepts of space complexity, time complexity. Keep practicing the problems on your own first. Later compare your solution with better solutions on the internet. Participate in competitions regularly. Keep a note on the leaderboard and improve yourself.
This question is well addressed in this video. Have a look at this video before you start coding.