WHat is the right way to practice?

I want to do many diffrent types of questions, but as the level of questions is increasing and newer algorithm based questions are turning up, I am failing to come up with a solution to problems such as ones based on dp, segment trees etc. In such a case what would be right, reading and learning from editorials or keep brooding over the problem till i get it right?

the right approach will be to learn through practice .
Read the problem , if you get the idea code it , else think about it for a while , if you are still unable to find out the algorithm , read the editorials . now code the solution without seeing others or testers solution , once you got accepted make sure to see the solutions of top coders so that you may know how to make it efficient and in less line of codes .